Class ManipulatedVariable
java.lang.Object
neqsim.process.mpc.MPCVariable
neqsim.process.mpc.ManipulatedVariable
- All Implemented Interfaces:
Serializable
Represents a manipulated variable (MV) in an MPC formulation.
A manipulated variable is a process input that the MPC controller can adjust to achieve control objectives. Common examples include valve openings, heater duties, compressor speeds, and flow rate setpoints.
Features:
- Absolute bounds (min/max physical limits)
- Rate limits (maximum change per time step)
- Preferred operating point for economic optimization
- Cost weighting for multi-objective optimization
Example usage:
// Valve opening as MV
ManipulatedVariable valveMV =
new ManipulatedVariable("InletValve", valve, "opening").setBounds(0.0, 1.0) // Physical
// limits
.setRateLimit(-0.1, 0.1) // Max 10% change per step
.setPreferredValue(0.7) // Preferred operating point
.setCost(0.0); // No direct cost
// Heater duty as MV with energy cost
ManipulatedVariable heaterMV = new ManipulatedVariable("Heater", heater, "duty", "kW")
.setBounds(0.0, 5000.0).setRateLimit(-500.0, 500.0).setCost(0.05); // $/kWh energy cost
- Since:
- 3.0
- Version:
- 1.0
- Author:
- Even Solbraa
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class MPCVariable
MPCVariable.MPCVariableType -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate doubleCost coefficient for using this MV ($/unit or energy cost).private doubleInitial value before optimization.private doubleMaximum allowed change per time step (rate constraint).private doubleMinimum allowed change per time step (rate constraint).private doubleWeight on control moves (penalizes rapid changes).private doublePreferred operating value for economic optimization.private doubleWeight on deviation from preferred value.private static final longFields inherited from class MPCVariable
currentValue, description, equipment, maxValue, minValue, name, propertyName, unit -
Constructor Summary
ConstructorsConstructorDescriptionManipulatedVariable(String name) Construct a manipulated variable with a name.ManipulatedVariable(String name, ProcessEquipmentInterface equipment, String propertyName) Construct a manipulated variable bound to equipment.ManipulatedVariable(String name, ProcessEquipmentInterface equipment, String propertyName, String unit) Construct a manipulated variable bound to equipment with unit. -
Method Summary
Modifier and TypeMethodDescriptiondoubleCalculate the cost of the current MV value.doublegetCost()Get the cost coefficient for this MV.doubleGet the initial value.doubleGet the maximum rate of change per time step.doubleGet the minimum rate of change per time step.doubleGet the move weight.doubleGet the preferred operating value.doubleGet the weight on deviation from preferred value.getType()Get the type of this MPC variable.booleanisFeasible(double proposedValue) Check if a proposed value satisfies all constraints.doubleRead the current value from the bound equipment.setBounds(double min, double max) Set bounds for this variable.setCost(double cost) Set the cost coefficient for using this MV.setEquipment(ProcessEquipmentInterface equipment) Set the bound equipment.setInitialValue(double value) Set the initial value.setMoveWeight(double weight) Set the move weight for penalizing rapid changes.setPreferredValue(double value) Set the preferred operating value.setPreferredWeight(double weight) Set the weight on deviation from preferred value.setPropertyName(String propertyName) Set the property name to read/write.setRateLimit(double minDelta, double maxDelta) Set rate limits for this MV.Set the unit for this variable.voidwriteValue(double value) Write a new value to the bound equipment.Methods inherited from class MPCVariable
getCurrentValue, getDescription, getEquipment, getMaxValue, getMinValue, getName, getPropertyName, getUnit, setCurrentValue, setDescription, toString
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
minRateOfChange
private double minRateOfChangeMinimum allowed change per time step (rate constraint). -
maxRateOfChange
private double maxRateOfChangeMaximum allowed change per time step (rate constraint). -
preferredValue
private double preferredValuePreferred operating value for economic optimization. -
cost
private double costCost coefficient for using this MV ($/unit or energy cost). -
moveWeight
private double moveWeightWeight on control moves (penalizes rapid changes). -
preferredWeight
private double preferredWeightWeight on deviation from preferred value. -
initialValue
private double initialValueInitial value before optimization.
-
-
Constructor Details
-
ManipulatedVariable
Construct a manipulated variable with a name.- Parameters:
name- unique identifier for this MV
-
ManipulatedVariable
Construct a manipulated variable bound to equipment.- Parameters:
name- unique identifier for this MVequipment- the process equipment to controlpropertyName- the property to manipulate
-
ManipulatedVariable
public ManipulatedVariable(String name, ProcessEquipmentInterface equipment, String propertyName, String unit) Construct a manipulated variable bound to equipment with unit.- Parameters:
name- unique identifier for this MVequipment- the process equipment to controlpropertyName- the property to manipulateunit- the unit for the property value
-
-
Method Details
-
getType
Description copied from class:MPCVariableGet the type of this MPC variable.- Specified by:
getTypein classMPCVariable- Returns:
- the variable type (MV, CV, or DV)
-
getMinRateOfChange
public double getMinRateOfChange()Get the minimum rate of change per time step.- Returns:
- minimum delta (typically negative)
-
getMaxRateOfChange
public double getMaxRateOfChange()Get the maximum rate of change per time step.- Returns:
- maximum delta (typically positive)
-
setRateLimit
Set rate limits for this MV.- Parameters:
minDelta- minimum change per time step (negative for decrease)maxDelta- maximum change per time step (positive for increase)- Returns:
- this variable for method chaining
-
getPreferredValue
public double getPreferredValue()Get the preferred operating value.- Returns:
- the preferred value for economic optimization
-
setPreferredValue
Set the preferred operating value.The MPC will try to keep the MV near this value when there is slack in the control objectives. This is useful for economic optimization (e.g., minimize energy use by preferring lower heater duty).
- Parameters:
value- the preferred operating point- Returns:
- this variable for method chaining
-
getCost
public double getCost()Get the cost coefficient for this MV.- Returns:
- the cost per unit
-
setCost
Set the cost coefficient for using this MV.This is used for economic MPC where the objective includes minimizing operational costs. Examples: energy cost for heater duty, compression cost for compressor power.
- Parameters:
cost- cost per unit (e.g., $/kWh)- Returns:
- this variable for method chaining
-
getMoveWeight
public double getMoveWeight()Get the move weight.- Returns:
- the weight on control moves
-
setMoveWeight
Set the move weight for penalizing rapid changes.- Parameters:
weight- the weight on move penalty (non-negative)- Returns:
- this variable for method chaining
-
getPreferredWeight
public double getPreferredWeight()Get the weight on deviation from preferred value.- Returns:
- the preferred value weight
-
setPreferredWeight
Set the weight on deviation from preferred value.- Parameters:
weight- the weight (non-negative)- Returns:
- this variable for method chaining
-
getInitialValue
public double getInitialValue()Get the initial value.- Returns:
- the initial value before optimization
-
setInitialValue
Set the initial value.- Parameters:
value- the starting value- Returns:
- this variable for method chaining
-
setBounds
Description copied from class:MPCVariableSet bounds for this variable.- Overrides:
setBoundsin classMPCVariable- Parameters:
min- minimum allowed valuemax- maximum allowed value- Returns:
- this variable for method chaining
-
setEquipment
Description copied from class:MPCVariableSet the bound equipment.- Overrides:
setEquipmentin classMPCVariable- Parameters:
equipment- the process equipment to bind to- Returns:
- this variable for method chaining
-
setPropertyName
Description copied from class:MPCVariableSet the property name to read/write.- Overrides:
setPropertyNamein classMPCVariable- Parameters:
propertyName- the property name- Returns:
- this variable for method chaining
-
setUnit
Description copied from class:MPCVariableSet the unit for this variable.- Overrides:
setUnitin classMPCVariable- Parameters:
unit- the unit string- Returns:
- this variable for method chaining
-
readValue
public double readValue()Description copied from class:MPCVariableRead the current value from the bound equipment.This method uses reflection or equipment-specific accessors to read the property value. The implementation varies by variable type and property.
- Specified by:
readValuein classMPCVariable- Returns:
- the current value read from equipment
-
writeValue
public void writeValue(double value) Write a new value to the bound equipment.- Parameters:
value- the new value to write
-
calculateCost
public double calculateCost()Calculate the cost of the current MV value.- Returns:
- the cost contribution
-
isFeasible
public boolean isFeasible(double proposedValue) Check if a proposed value satisfies all constraints.- Parameters:
proposedValue- the value to check- Returns:
- true if the value is feasible
-