Class DisturbanceVariable
java.lang.Object
neqsim.process.mpc.MPCVariable
neqsim.process.mpc.DisturbanceVariable
- All Implemented Interfaces:
Serializable
Represents a disturbance variable (DV) in an MPC formulation.
A disturbance variable is a measured process input that affects the controlled variables but cannot be manipulated by the controller. DVs are used for feedforward control - the MPC uses knowledge of disturbances to proactively adjust manipulated variables before the disturbance affects the outputs.
Common examples include:
- Feed flow rate
- Feed composition
- Ambient temperature
- Upstream pressure
Example usage:
// Feed flow as disturbance
DisturbanceVariable feedFlowDV =
new DisturbanceVariable("FeedFlow", feedStream, "flowRate", "kg/hr");
// Ambient temperature as disturbance
DisturbanceVariable ambientDV =
new DisturbanceVariable("Ambient").setUnit("C").setCurrentValue(25.0); // Manual update from
// external source
- 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 double[]Sensitivity of CVs to this disturbance (for feedforward).private booleanWhether this is a measured or estimated disturbance.private doublePredicted future value (if available).private doubleTime horizon for prediction (if available).private doublePrevious value for calculating rate of change.private static final longFields inherited from class MPCVariable
currentValue, description, equipment, maxValue, minValue, name, propertyName, unit -
Constructor Summary
ConstructorsConstructorDescriptionDisturbanceVariable(String name) Construct a disturbance variable with a name.DisturbanceVariable(String name, ProcessEquipmentInterface equipment, String propertyName) Construct a disturbance variable bound to equipment.DisturbanceVariable(String name, ProcessEquipmentInterface equipment, String propertyName, String unit) Construct a disturbance variable bound to equipment with unit. -
Method Summary
Modifier and TypeMethodDescriptiondouble[]Get the sensitivity of CVs to this disturbance.doublegetExpectedCvChange(int cvIndex) Calculate the expected change in a CV due to this disturbance change.doublegetExpectedCvChangeFromPrediction(int cvIndex) Calculate the expected change in a CV due to predicted disturbance.doubleGet the predicted future value.doubleGet the prediction time horizon.doubleGet the previous value.doubleGet the rate of change.getType()Get the type of this MPC variable.booleanCheck if this is a measured disturbance.doubleRead the current value from the bound equipment.setBounds(double min, double max) Set bounds for this variable.voidsetCurrentValue(double value) Set the current value (used for caching/tracking).setCvSensitivity(double... sensitivity) Set the sensitivity of CVs to this disturbance.setEquipment(ProcessEquipmentInterface equipment) Set the bound equipment.setMeasured(boolean measured) Set whether this disturbance is measured or estimated.setPrediction(double value, double horizon) Set the predicted future value for feedforward control.setPropertyName(String propertyName) Set the property name to read/write.Set the unit for this variable.update(double value) Update the disturbance value from an external source.Methods inherited from class MPCVariable
getCurrentValue, getDescription, getEquipment, getMaxValue, getMinValue, getName, getPropertyName, getUnit, setDescription, toString
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
previousValue
private double previousValuePrevious value for calculating rate of change. -
predictedValue
private double predictedValuePredicted future value (if available). -
predictionHorizon
private double predictionHorizonTime horizon for prediction (if available). -
measured
private boolean measuredWhether this is a measured or estimated disturbance. -
cvSensitivity
private double[] cvSensitivitySensitivity of CVs to this disturbance (for feedforward).
-
-
Constructor Details
-
DisturbanceVariable
Construct a disturbance variable with a name.- Parameters:
name- unique identifier for this DV
-
DisturbanceVariable
Construct a disturbance variable bound to equipment.- Parameters:
name- unique identifier for this DVequipment- the process equipment to monitorpropertyName- the property to read
-
DisturbanceVariable
public DisturbanceVariable(String name, ProcessEquipmentInterface equipment, String propertyName, String unit) Construct a disturbance variable bound to equipment with unit.- Parameters:
name- unique identifier for this DVequipment- the process equipment to monitorpropertyName- the property to readunit- 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)
-
getPreviousValue
public double getPreviousValue()Get the previous value.- Returns:
- the previous measurement
-
getRateOfChange
public double getRateOfChange()Get the rate of change.- Returns:
- change from previous to current value
-
getPredictedValue
public double getPredictedValue()Get the predicted future value.- Returns:
- the predicted value (if available)
-
setPrediction
Set the predicted future value for feedforward control.- Parameters:
value- the predicted valuehorizon- the time horizon for the prediction- Returns:
- this variable for method chaining
-
getPredictionHorizon
public double getPredictionHorizon()Get the prediction time horizon.- Returns:
- the horizon in time units
-
isMeasured
public boolean isMeasured()Check if this is a measured disturbance.- Returns:
- true if measured, false if estimated
-
setMeasured
Set whether this disturbance is measured or estimated.- Parameters:
measured- true for measured, false for estimated- Returns:
- this variable for method chaining
-
getCvSensitivity
public double[] getCvSensitivity()Get the sensitivity of CVs to this disturbance.- Returns:
- array of sensitivities (∂CV/∂DV)
-
setCvSensitivity
Set the sensitivity of CVs to this disturbance.Used by the MPC for feedforward compensation. Entry i is ∂CV[i]/∂DV.
- Parameters:
sensitivity- array of sensitivities- 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
-
setCurrentValue
public void setCurrentValue(double value) Description copied from class:MPCVariableSet the current value (used for caching/tracking).- Overrides:
setCurrentValuein classMPCVariable- Parameters:
value- the current value
-
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
-
update
Update the disturbance value from an external source.Used when the disturbance is not directly readable from NeqSim equipment (e.g., ambient conditions from external sensors).
- Parameters:
value- the new value- Returns:
- this variable for method chaining
-
getExpectedCvChange
public double getExpectedCvChange(int cvIndex) Calculate the expected change in a CV due to this disturbance change.- Parameters:
cvIndex- the index of the CV- Returns:
- the expected CV change
-
getExpectedCvChangeFromPrediction
public double getExpectedCvChangeFromPrediction(int cvIndex) Calculate the expected change in a CV due to predicted disturbance.- Parameters:
cvIndex- the index of the CV- Returns:
- the expected CV change from predicted disturbance
-