Class ProcessVariableAccessor
java.lang.Object
neqsim.process.mpc.ProcessVariableAccessor
Accessor for reading and writing process variables by path.
Provides a unified interface for accessing any variable in a NeqSim ProcessSystem using a simple path notation.
Path formats supported:
- Simple: "UnitName.propertyName" (e.g., "Feed.flowRate")
- Nested: "UnitName.subObject.propertyName" (e.g., "Separator.gasOutStream.flowRate")
- Indexed: "UnitName.propertyName[index]" (e.g., "Feed.composition[0]")
- Version:
- 1.0
- Author:
- NeqSim Development Team
-
Field Summary
FieldsModifier and TypeFieldDescriptionDefault units for common properties that require unit parameters.private ProcessSystemThe process system to access. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate Stringcapitalize(String s) Capitalize first letter.private doubleextractNumericValue(Object result, int arrayIndex, String path) Extract numeric value from method result.private MethodfindMethod(Class<?> clazz, String name, Class<?>... paramTypes) Find a method by name and parameter types.private MethodfindMethodNoParams(Class<?> clazz, String name) Find a method with no parameters.private StringgetDefaultUnit(String propertyName) Get default unit for a property name.doubleGet a variable value by path.doubleGet a variable value with unit conversion.private booleanisBoxedEquivalent(Class<?> a, Class<?> b) Check if types are boxed equivalents.booleanisValidPath(String path) Check if a variable path is valid.private booleanmatchesParams(Method method, Class<?>[] paramTypes) Check if method parameters match.private String[]Parse a path into components.private ObjectresolveTarget(String[] parts, int depth) Resolve the target object for a path.voidSet a variable value by path.voidSet a variable value with unit specification.
-
Field Details
-
process
The process system to access. -
DEFAULT_UNITS
-
-
Constructor Details
-
ProcessVariableAccessor
Constructor.- Parameters:
process- the process system to access
-
-
Method Details
-
getValue
Get a variable value by path.- Parameters:
path- variable path (e.g., "Feed.flowRate", "Separator.gasOutStream.temperature")- Returns:
- variable value
-
extractNumericValue
Extract numeric value from method result.- Parameters:
result- the result object from method invocationarrayIndex- the array index if result is an array, -1 otherwisepath- the variable path for error messages- Returns:
- the extracted numeric value
-
getDefaultUnit
-
findMethodNoParams
-
getValue
-
setValue
Set a variable value by path.- Parameters:
path- variable pathvalue- value to set
-
setValue
-
isValidPath
Check if a variable path is valid.- Parameters:
path- variable path- Returns:
- true if path can be resolved
-
parsePath
-
resolveTarget
-
findMethod
Find a method by name and parameter types.- Parameters:
clazz- the class to search for the methodname- the method name to findparamTypes- the parameter types of the method- Returns:
- the Method object if found, null otherwise
-
matchesParams
-
isBoxedEquivalent
-
capitalize
-