Class ModelPredictiveController
- All Implemented Interfaces:
Serializable, ControllerDeviceInterface, NamedInterface
The controller supports both single-input operation and multivariable configurations with linear quality constraints. A first-order discrete process model is used internally to predict the future trajectory of the controlled variable across a configurable prediction horizon. The controller minimises a quadratic objective consisting of tracking error, absolute control effort and control movement. The optimal actuation is calculated analytically which keeps the implementation dependency free while still representing a full MPC formulation.
In addition to the control formulation the implementation exposes a receding horizon (moving horizon) estimation routine. The estimator reuses the same first-order model to identify the process gain, time constant and bias from historical measurement and actuation data. This allows automatic tuning of the internal model parameters when operating on real process data without requiring external optimisation packages.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classConfiguration options for the MPC auto-tuning routine.static final classResult produced by the auto-tuning routine.static final classResult from the moving horizon estimation routine.static final classRepresentation of a quality constraint handled by the MPC.Nested classes/interfaces inherited from interface ControllerDeviceInterface
ControllerDeviceInterface.StepResponseTuningMethod -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate UUIDprivate doubleprivate double[]private doubleprivate double[]private booleanprivate booleanprivate doubleprivate double[]private doubleprivate doubleprivate doubleprivate double[]private double[]private doubleprivate doubleprivate static final intprivate double[]private double[]private doubleprivate doubleprivate doubleprivate double[]private booleanprivate intprivate doubleprivate doubleprivate intprivate doubleprivate double[]private intprivate doubleprivate doubleprivate final List<ModelPredictiveController.QualityConstraint> private doubleprivate booleanprivate static final longprivate doubleprivate MeasurementDeviceInterfaceprivate StringFields inherited from class NamedBaseClass
name -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor assigning a generic name.Construct an MPC controller with a specific name. -
Method Summary
Modifier and TypeMethodDescriptionvoidRegister a new quality constraint.autoTune()Automatically identify the internal first-order process model and configure the MPC weights using the most recent moving-horizon estimation history.autoTune(List<Double> measurements, List<Double> controls, List<Double> sampleTimes, ModelPredictiveController.AutoTuneConfiguration configuration) Auto-tune the controller using explicitly supplied measurement and actuation samples.autoTune(ModelPredictiveController.AutoTuneConfiguration configuration) Automatically identify the internal first-order process model and configure the MPC weights using the most recent moving-horizon estimation history.autoTuneFromEstimate(ModelPredictiveController.MovingHorizonEstimate estimate, ModelPredictiveController.AutoTuneConfiguration config) private double[][]buildActiveMatrix(double[][] matrix, int mask) private double[]buildActiveVector(double[] vector, int mask) private doubleclamp(double value) private voidvoidRemove any stored estimation samples.voidClear all registered quality constraints.private doublecomputeOptimalControl(double measurement, double dt, double previousControl) final voidconfigureControls(String... names) Configure the set of manipulated variables handled by the MPC.voidDisable the moving horizon estimation routine.voidenableMovingHorizonEstimation(int windowSize) Enable moving horizon (receding horizon) estimation of the internal first-order process model.private voidensureControlIndex(int index) private voidensureControlLength(int expectedLength) booleanGet the identifier of the last run transient calculation.doublegetControllerSetPoint.Retrieve the ordered list of configured control names.doublegetControlValue(int index) Get the latest control value by index.doublegetControlValue(String controlName) Get the latest control value by name.double[]Copy of the current control vector.doubleRetrieve the configured absolute control weight for diagnostic purposes.doubleRetrieve the last applied control signal.Retrieve the latest moving horizon estimate.doubleRetrieve the last sampled process value.doubleGet the last sampling interval seen by the controller.doubleGet the controller output upper bound.doublegetMeasuredValue.doublegetMeasuredValue(String unit) getMeasuredValue.doubleGet the controller output lower bound.doubleRetrieve the configured move suppression weight for diagnostic purposes.intGet the number of samples kept in the moving horizon estimation window.doubleRetrieve the configured output weight for diagnostic purposes.doublegetPredictedQuality(String name) Get the last predicted quality value produced by the controller for a named constraint.double[]getPredictedTrajectory(int steps, double dt) Predict future measurements using the internal first-order model assuming the most recent control signal is held constant.intGet the configured prediction horizon.doubleGet the current process bias used by the controller's internal model.doubleGet the current process gain used by the controller's internal model.doublegetResponse.doubleGet the current process time constant used by the controller's internal model.getUnit()getUnit.inthashCode()voidingestPlantSample(double measurement, double appliedControl) Convenience overload ofingestPlantSample(double, double, double)when only the measurement and applied control are known.voidingestPlantSample(double measurement, double appliedControl, double dt) Inject a measurement collected directly from a physical plant rather than the built-in transmitter abstraction.booleanisActive()isActive.private booleanisFeasible(double[] candidate, double[][] constraints, double[] bounds) booleanCheck whether moving horizon estimation is currently enabled.booleanisReverseActing.private doubleobjectiveValue(double[][] hessian, double[] gradient, double[] candidate) private voidrecordEstimationSample(double measurement, double appliedControl, double dt) private voidvoidrunTransient(double initResponse, double dt, UUID id) runTransient.voidsetActive(boolean isActive) setActive.voidsetControllerParameters(double Kp, double Ti, double Td) Set PID tuning parameters.voidsetControllerSetPoint(double signal) setControllerSetPoint.voidsetControlLimits(int index, double min, double max) Set lower and upper bounds for a control variable.voidsetControlLimits(String controlName, double min, double max) Convenience overload allowing limits to be set by control name.voidsetControlMoveLimits(int index, double minDelta, double maxDelta) Constrain the permitted change of a control variable relative to the previously applied value.voidsetControlMoveLimits(String controlName, double minDelta, double maxDelta) Convenience overload to configure move limits by control name.voidsetControlWeights(double... weights) Set quadratic weights on the absolute value of each control variable.voidsetEnergyReference(double reference) Deprecated.voidsetEnergyReferenceVector(double... references) Deprecated.UsesetPreferredControlVector(double...)to configure the nominal control point.voidsetInitialControlValues(double... values) Specify the starting values of all manipulated variables.voidsetMoveLimits(double minDelta, double maxDelta) Limit the change of the single-input MPC output relative to the previously applied value.voidsetMoveWeights(double... weights) Set quadratic penalty on control moves for each variable.voidsetOutputLimits(double min, double max) Set minimum and maximum controller output for anti-windup handling.voidsetPredictionHorizon(int horizon) Set the number of future steps used when predicting the controlled variable trajectory.voidsetPreferredControlValue(double reference) Specify the preferred steady-state control level for the single-input MPC mode.voidsetPreferredControlVector(double... references) Define the preferred steady-state operating point for each control variable.voidsetPrimaryControlIndex(int index) Choose which control variable is exposed viagetResponse()to maintain compatibility with theControllerDeviceInterface.voidsetProcessBias(double bias) Set the steady-state bias of the process model.voidsetProcessModel(double gain, double timeConstant) Configure the internal first order process model.voidsetProcessModel(double gain, double timeConstant, double deadTimeSeconds) Configure the internal first order process model including dead time.voidsetReverseActing(boolean reverseActing) setReverseActing.voidsetTransmitter.voidsetUnit.voidsetWeights(double outputWeight, double controlWeight, double moveWeight) Set quadratic weights for output tracking, absolute control effort and control movement.private double[]solveEqualityConstrained(double[] inverseDiagonal, double[] gradient, double[][] constraints, double[] bounds) private double[]solveLinearSystem(double[][] matrix, double[] vector) private double[]solveQuadraticProgram(double[][] hessian, double[] gradient, double[][] constraints, double[] bounds) voidupdateFeedConditions(Map<String, Double> composition, double feedRate) Update the predicted incoming feed composition and flow rate.private voidbooleanupdateQualityMeasurement(String name, double measurement) Update the stored measurement for a named quality constraint.voidupdateQualityMeasurements(Map<String, Double> measurements) Convenience method to update multiple quality-constraint measurements in one call.Methods inherited from class NamedBaseClass
getName, getTagName, setName, setTagNameMethods inherited from class Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ControllerDeviceInterface
addGainSchedulePoint, autoTune, autoTune, autoTuneFromEventLog, autoTuneFromEventLog, autoTuneStepResponse, autoTuneStepResponse, getEventLog, getIntegralAbsoluteError, getSettlingTime, getStepResponseTuningMethod, resetEventLog, resetPerformanceMetrics, runTransient, setControllerSetPoint, setDerivativeFilterTime, setStepResponseTuningMethod
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
MIN_ESTIMATION_SAMPLES
private static final int MIN_ESTIMATION_SAMPLES- See Also:
-
transmitter
-
controllerSetPoint
private double controllerSetPoint -
unit
-
reverseActing
private boolean reverseActing -
isActive
private boolean isActive -
response
private double response -
minResponse
private double minResponse -
maxResponse
private double maxResponse -
minMove
private double minMove -
maxMove
private double maxMove -
processGain
private double processGain -
timeConstant
private double timeConstant -
processBias
private double processBias -
predictionHorizon
private int predictionHorizon -
outputWeight
private double outputWeight -
controlWeight
private double controlWeight -
moveWeight
private double moveWeight -
preferredControlValue
private double preferredControlValue -
calcIdentifier
-
lastSampledValue
private double lastSampledValue -
lastSampleTime
private double lastSampleTime -
lastAppliedControl
private double lastAppliedControl -
controlNames
-
controlVector
private double[] controlVector -
lastControlVector
private double[] lastControlVector -
minControlVector
private double[] minControlVector -
maxControlVector
private double[] maxControlVector -
minControlMoveVector
private double[] minControlMoveVector -
maxControlMoveVector
private double[] maxControlMoveVector -
preferredControlVector
private double[] preferredControlVector -
controlWeightsVector
private double[] controlWeightsVector -
moveWeightsVector
private double[] moveWeightsVector -
private int primaryControlIndex
-
qualityConstraints
-
lastFeedComposition
-
pendingFeedComposition
-
lastFeedRate
private double lastFeedRate -
pendingFeedRate
private double pendingFeedRate -
feedInitialised
private boolean feedInitialised -
predictedQualityValues
-
movingHorizonEstimationEnabled
private boolean movingHorizonEstimationEnabled -
movingHorizonWindow
private int movingHorizonWindow -
estimationMeasurements
-
estimationControls
-
estimationSampleTimes
-
lastMovingHorizonEstimate
-
-
Constructor Details
-
ModelPredictiveController
public ModelPredictiveController()Default constructor assigning a generic name. -
ModelPredictiveController
Construct an MPC controller with a specific name.- Parameters:
name- controller name
-
-
Method Details
-
configureControls
Configure the set of manipulated variables handled by the MPC. Existing quality constraints are cleared because their sensitivity dimensions may no longer match the new set of controls.- Parameters:
names- ordered list of control names (e.g. pressure, temperature)
-
ensureControlLength
private void ensureControlLength(int expectedLength) -
ensureControlIndex
private void ensureControlIndex(int index) -
setInitialControlValues
public void setInitialControlValues(double... values) Specify the starting values of all manipulated variables.- Parameters:
values- control vector in the configured order
-
setPrimaryControlIndex
public void setPrimaryControlIndex(int index) Choose which control variable is exposed viagetResponse()to maintain compatibility with theControllerDeviceInterface.- Parameters:
index- index of the primary control variable
-
setControlLimits
public void setControlLimits(int index, double min, double max) Set lower and upper bounds for a control variable.- Parameters:
index- control indexmin- minimum allowed value (may beDouble.NEGATIVE_INFINITY)max- maximum allowed value (may beDouble.POSITIVE_INFINITY)
-
setControlMoveLimits
public void setControlMoveLimits(int index, double minDelta, double maxDelta) Constrain the permitted change of a control variable relative to the previously applied value. Limits are interpreted asminDelta <= u - u_prev <= maxDelta.- Parameters:
index- control indexminDelta- minimum permitted change (may beDouble.NEGATIVE_INFINITY)maxDelta- maximum permitted change (may beDouble.POSITIVE_INFINITY)
-
setControlMoveLimits
Convenience overload to configure move limits by control name.- Parameters:
controlName- name of the control variableminDelta- minimum permitted changemaxDelta- maximum permitted change
-
setControlLimits
Convenience overload allowing limits to be set by control name.- Parameters:
controlName- name of the control variablemin- minimum allowed valuemax- maximum allowed value
-
setControlWeights
public void setControlWeights(double... weights) Set quadratic weights on the absolute value of each control variable. Values must be non-negative.- Parameters:
weights- absolute control weights
-
setMoveWeights
public void setMoveWeights(double... weights) Set quadratic penalty on control moves for each variable.- Parameters:
weights- move weights
-
setPreferredControlVector
public void setPreferredControlVector(double... references) Define the preferred steady-state operating point for each control variable. This represents the control vector that minimises the absolute control penalty when no tracking error is present.- Parameters:
references- preferred control levels
-
setEnergyReferenceVector
Deprecated.UsesetPreferredControlVector(double...)to configure the nominal control point. This method is retained for backwards compatibility with earlier snapshots of the MPC implementation.- Parameters:
references- preferred control levels for the energy terms
-
getControlNames
-
getControlValue
Get the latest control value by name.- Parameters:
controlName- name of control variable- Returns:
- value of the control variable
-
getControlValue
public double getControlValue(int index) Get the latest control value by index.- Parameters:
index- control index- Returns:
- value of the control variable
-
getControlVector
public double[] getControlVector()Copy of the current control vector.- Returns:
- current control vector
-
addQualityConstraint
Register a new quality constraint. The sensitivity vector must match the number of configured controls.- Parameters:
constraint- quality constraint description
-
clearQualityConstraints
public void clearQualityConstraints()Clear all registered quality constraints. -
updateQualityMeasurement
Update the stored measurement for a named quality constraint. When integrating against a live plant this allows the MPC to use the latest analyser or laboratory sample even if the simulation does not contain a dedicatedMeasurementDeviceInterface. The value is stored in the controller and will be used as the baseline for the next optimisation step.- Parameters:
name- quality constraint identifiermeasurement- measured specification value in the constraint unit- Returns:
trueif the constraint was found and updated
-
updateQualityMeasurements
-
updateFeedConditions
Update the predicted incoming feed composition and flow rate. The values are used as feedforward information in the MPC optimisation.- Parameters:
composition- component molar fractions (will be normalised outside the method)feedRate- molar feed rate
-
getPredictedQuality
Get the last predicted quality value produced by the controller for a named constraint.- Parameters:
name- constraint name- Returns:
- predicted value or
Double.NaNif unavailable
-
enableMovingHorizonEstimation
public void enableMovingHorizonEstimation(int windowSize) Enable moving horizon (receding horizon) estimation of the internal first-order process model. The estimator analyses the most recent samples of measured output and applied control to update the process gain, time constant and bias.- Parameters:
windowSize- number of recent samples to keep in the estimation window (minimum of 5)
-
disableMovingHorizonEstimation
public void disableMovingHorizonEstimation()Disable the moving horizon estimation routine. Existing history and the last estimate are retained so the method can be re-enabled later. -
isMovingHorizonEstimationEnabled
public boolean isMovingHorizonEstimationEnabled()Check whether moving horizon estimation is currently enabled.- Returns:
truewhen the estimator is active
-
getMovingHorizonEstimationWindow
public int getMovingHorizonEstimationWindow()Get the number of samples kept in the moving horizon estimation window.- Returns:
- window length
-
clearMovingHorizonHistory
public void clearMovingHorizonHistory()Remove any stored estimation samples. The last estimate is cleared to make it explicit that a new identification cycle is required before accessing estimation results again. -
getLastMovingHorizonEstimate
Retrieve the latest moving horizon estimate. The result contains the identified model parameters along with a simple mean squared prediction error.nullis returned until the estimator has processed a sufficient number of samples.- Returns:
- most recent estimate or
nullwhen unavailable
-
autoTune
Automatically identify the internal first-order process model and configure the MPC weights using the most recent moving-horizon estimation history. The controller must have collected at least 5 valid samples viaenableMovingHorizonEstimation(int)before invoking auto-tune.- Returns:
- tuning result containing the identified parameters and applied configuration
-
autoTune
public ModelPredictiveController.AutoTuneResult autoTune(ModelPredictiveController.AutoTuneConfiguration configuration) Automatically identify the internal first-order process model and configure the MPC weights using the most recent moving-horizon estimation history.- Parameters:
configuration- optional tuning configuration; ifnullthe default configuration is used- Returns:
- tuning result containing the identified parameters and applied configuration
-
autoTune
public ModelPredictiveController.AutoTuneResult autoTune(List<Double> measurements, List<Double> controls, List<Double> sampleTimes, ModelPredictiveController.AutoTuneConfiguration configuration) Auto-tune the controller using explicitly supplied measurement and actuation samples. This is useful when historical process data has been collected outside of the live controller instance. The provided lists must follow the same structure as the moving-horizon estimator wheremeasurements.size() == controls.size() + 1andsampleTimes.size() == controls.size().- Parameters:
measurements- ordered list of measured process valuescontrols- ordered list of control signals that produced the subsequent measurementssampleTimes- sampling intervals between consecutive measurements (seconds)configuration- optional tuning configuration- Returns:
- tuning result containing the identified parameters and applied configuration
-
autoTuneFromEstimate
private ModelPredictiveController.AutoTuneResult autoTuneFromEstimate(ModelPredictiveController.MovingHorizonEstimate estimate, ModelPredictiveController.AutoTuneConfiguration config) -
setProcessModel
public void setProcessModel(double gain, double timeConstant) Configure the internal first order process model.- Parameters:
gain- steady-state process gain relating control action to the measured variabletimeConstant- dominant time constant of the process model (seconds)
-
setProcessModel
public void setProcessModel(double gain, double timeConstant, double deadTimeSeconds) Configure the internal first order process model including dead time. Dead time is represented as an equivalent time constant increase because the simplified controller does not maintain an explicit delay line.- Parameters:
gain- steady-state process gain relating control action to the measured variabletimeConstant- dominant time constant of the process model (seconds)deadTimeSeconds- estimated dead time (seconds)
-
setProcessBias
public void setProcessBias(double bias) Set the steady-state bias of the process model. The bias corresponds to the measured value when the manipulated variable is zero (for example ambient temperature).- Parameters:
bias- process bias value
-
setWeights
public void setWeights(double outputWeight, double controlWeight, double moveWeight) Set quadratic weights for output tracking, absolute control effort and control movement.- Parameters:
outputWeight- weight on future tracking errorcontrolWeight- weight on absolute control magnitude (e.g. energy/emission usage)moveWeight- weight on control movements between successive time steps
-
setPreferredControlValue
public void setPreferredControlValue(double reference) Specify the preferred steady-state control level for the single-input MPC mode. This value represents the operating point that minimises the absolute control penalty when tracking is not active.- Parameters:
reference- preferred control level
-
setMoveLimits
public void setMoveLimits(double minDelta, double maxDelta) Limit the change of the single-input MPC output relative to the previously applied value.- Parameters:
minDelta- minimum allowed change (may beDouble.NEGATIVE_INFINITY)maxDelta- maximum allowed change (may beDouble.POSITIVE_INFINITY)
-
setEnergyReference
Deprecated.UsesetPreferredControlValue(double)when configuring the MPC economic target. This method is kept for compatibility with earlier code samples.- Parameters:
reference- preferred steady-state control value for the single-input controller
-
setPredictionHorizon
public void setPredictionHorizon(int horizon) Set the number of future steps used when predicting the controlled variable trajectory.- Parameters:
horizon- prediction horizon length
-
getLastSampledValue
public double getLastSampledValue()Retrieve the last sampled process value. Mainly intended for diagnostics and testing.- Returns:
- last measured value
-
getLastAppliedControl
public double getLastAppliedControl()Retrieve the last applied control signal.- Returns:
- last actuation sent to the process
-
getMeasuredValue
public double getMeasuredValue()Description copied from interface:ControllerDeviceInterfacegetMeasuredValue.
- Specified by:
getMeasuredValuein interfaceControllerDeviceInterface- Returns:
- a double
-
getMeasuredValue
Description copied from interface:ControllerDeviceInterfacegetMeasuredValue.
- Specified by:
getMeasuredValuein interfaceControllerDeviceInterface- Parameters:
unit- aStringobject- Returns:
- a double
-
setControllerSetPoint
public void setControllerSetPoint(double signal) Description copied from interface:ControllerDeviceInterfacesetControllerSetPoint.
- Specified by:
setControllerSetPointin interfaceControllerDeviceInterface- Parameters:
signal- a double
-
getControllerSetPoint
public double getControllerSetPoint()Description copied from interface:ControllerDeviceInterfacegetControllerSetPoint.
- Specified by:
getControllerSetPointin interfaceControllerDeviceInterface- Returns:
- current controller set point
-
getUnit
Description copied from interface:ControllerDeviceInterfacegetUnit.
- Specified by:
getUnitin interfaceControllerDeviceInterface- Returns:
- a
Stringobject
-
setUnit
Description copied from interface:ControllerDeviceInterfacesetUnit.
- Specified by:
setUnitin interfaceControllerDeviceInterface- Parameters:
unit- aStringobject
-
setTransmitter
Description copied from interface:ControllerDeviceInterfacesetTransmitter.
- Specified by:
setTransmitterin interfaceControllerDeviceInterface- Parameters:
device- aMeasurementDeviceInterfaceobject
-
ingestPlantSample
public void ingestPlantSample(double measurement, double appliedControl, double dt) Inject a measurement collected directly from a physical plant rather than the built-in transmitter abstraction. This is useful when the MPC is connected to a live facility where instrumentation values arrive asynchronously from the control system. The sample updates the diagnostic state of the controller and provides a fallback measurement if no transmitter is configured.- Parameters:
measurement- latest measured process valueappliedControl- control signal that was active when the sample was takendt- sample interval since the previous measurement
-
ingestPlantSample
public void ingestPlantSample(double measurement, double appliedControl) Convenience overload ofingestPlantSample(double, double, double)when only the measurement and applied control are known.- Parameters:
measurement- measured process valueappliedControl- applied control signal
-
runTransient
Description copied from interface:ControllerDeviceInterfacerunTransient.
Calculates controller output. Sets calc identifier UUID.- Specified by:
runTransientin interfaceControllerDeviceInterface- Parameters:
initResponse- Init value for response calculationdt- Delta time [s]id- Calculation identifier
-
clampControlVector
private void clampControlVector() -
runMultivariable
private void runMultivariable() -
recordEstimationSample
private void recordEstimationSample(double measurement, double appliedControl, double dt) -
updateMovingHorizonEstimate
private void updateMovingHorizonEstimate() -
estimateFromSamples
-
estimateFromHistory
-
solveQuadraticProgram
private double[] solveQuadraticProgram(double[][] hessian, double[] gradient, double[][] constraints, double[] bounds) -
buildActiveMatrix
private double[][] buildActiveMatrix(double[][] matrix, int mask) -
buildActiveVector
private double[] buildActiveVector(double[] vector, int mask) -
solveEqualityConstrained
private double[] solveEqualityConstrained(double[] inverseDiagonal, double[] gradient, double[][] constraints, double[] bounds) -
solveLinearSystem
private double[] solveLinearSystem(double[][] matrix, double[] vector) -
isFeasible
private boolean isFeasible(double[] candidate, double[][] constraints, double[] bounds) -
objectiveValue
private double objectiveValue(double[][] hessian, double[] gradient, double[] candidate) -
computeOptimalControl
private double computeOptimalControl(double measurement, double dt, double previousControl) -
clamp
private double clamp(double value) -
getResponse
public double getResponse()Description copied from interface:ControllerDeviceInterfacegetResponse.
- Specified by:
getResponsein interfaceControllerDeviceInterface- Returns:
- a double
-
isReverseActing
public boolean isReverseActing()Description copied from interface:ControllerDeviceInterfaceisReverseActing.
- Specified by:
isReverseActingin interfaceControllerDeviceInterface- Returns:
- a boolean
-
setReverseActing
public void setReverseActing(boolean reverseActing) Description copied from interface:ControllerDeviceInterfacesetReverseActing.
- Specified by:
setReverseActingin interfaceControllerDeviceInterface- Parameters:
reverseActing- a boolean
-
setControllerParameters
public void setControllerParameters(double Kp, double Ti, double Td) Description copied from interface:ControllerDeviceInterfaceSet PID tuning parameters.
- Specified by:
setControllerParametersin interfaceControllerDeviceInterface- Parameters:
Kp- Proportional gainTi- Integral time in secondsTd- Derivative time in seconds
-
setOutputLimits
public void setOutputLimits(double min, double max) Description copied from interface:ControllerDeviceInterfaceSet minimum and maximum controller output for anti-windup handling.
- Specified by:
setOutputLimitsin interfaceControllerDeviceInterface- Parameters:
min- Minimum controller responsemax- Maximum controller response
-
getPredictedTrajectory
public double[] getPredictedTrajectory(int steps, double dt) Predict future measurements using the internal first-order model assuming the most recent control signal is held constant.- Parameters:
steps- number of steps ahead to predict (must be positive)dt- sampling interval in seconds- Returns:
- predicted measurements for each step into the future
-
setActive
public void setActive(boolean isActive) Description copied from interface:ControllerDeviceInterfacesetActive.
Set if controller is active- Specified by:
setActivein interfaceControllerDeviceInterface- Parameters:
isActive- Set true to make controller active.
-
isActive
public boolean isActive()Description copied from interface:ControllerDeviceInterfaceisActive.
Specifies if controller is active- Specified by:
isActivein interfaceControllerDeviceInterface- Returns:
- a boolean
-
equals
Description copied from interface:ControllerDeviceInterface- Specified by:
equalsin interfaceControllerDeviceInterface- Overrides:
equalsin classObject
-
hashCode
public int hashCode()Description copied from interface:ControllerDeviceInterface- Specified by:
hashCodein interfaceControllerDeviceInterface- Overrides:
hashCodein classObject
-
getCalcIdentifier
Get the identifier of the last run transient calculation.- Returns:
- calculation identifier
-
getMinResponse
public double getMinResponse()Get the controller output lower bound.- Returns:
- minimum response
-
getMaxResponse
public double getMaxResponse()Get the controller output upper bound.- Returns:
- maximum response
-
getPredictionHorizon
public int getPredictionHorizon()Get the configured prediction horizon.- Returns:
- prediction horizon length
-
getLastSampleTime
public double getLastSampleTime()Get the last sampling interval seen by the controller.- Returns:
- sampling time in seconds
-
getOutputWeight
public double getOutputWeight()Retrieve the configured output weight for diagnostic purposes.- Returns:
- output tracking weight
-
getControlWeight
public double getControlWeight()Retrieve the configured absolute control weight for diagnostic purposes.- Returns:
- control usage weight
-
getMoveWeight
public double getMoveWeight()Retrieve the configured move suppression weight for diagnostic purposes.- Returns:
- control move weight
-
getProcessGain
public double getProcessGain()Get the current process gain used by the controller's internal model.- Returns:
- process gain
-
getTimeConstant
public double getTimeConstant()Get the current process time constant used by the controller's internal model.- Returns:
- process time constant in seconds
-
getProcessBias
public double getProcessBias()Get the current process bias used by the controller's internal model.- Returns:
- process bias
-
setPreferredControlValue(double)when configuring the MPC economic target.