Class NonlinearPredictor
java.lang.Object
neqsim.process.mpc.NonlinearPredictor
- All Implemented Interfaces:
Serializable
Performs multi-step ahead prediction using full NeqSim nonlinear simulation.
The NonlinearPredictor uses the actual NeqSim ProcessSystem to predict future CV trajectories given a sequence of MV moves. Unlike linear prediction which uses gain matrices, this approach captures all nonlinear process behavior.
Use cases:
- Validate linear MPC predictions
- Nonlinear MPC with full simulation in the loop
- What-if scenario analysis
- Operator training simulators
Example usage:
NonlinearPredictor predictor = new NonlinearPredictor(processSystem);
// Configure prediction
predictor.addMV(new ManipulatedVariable("Valve", valve, "opening"));
predictor.addCV(new ControlledVariable("Pressure", separator, "pressure", "bara"));
predictor.setPredictionHorizon(20);
predictor.setSampleTime(60.0); // 60 seconds
// Define MV trajectory
MVTrajectory trajectory = new MVTrajectory();
trajectory.addMove("Valve", 0.52);
trajectory.addMove("Valve", 0.54);
trajectory.addMove("Valve", 0.55);
// Run prediction
PredictionResult result = predictor.predict(trajectory);
// Access results
double[] futurePressure = result.getTrajectory("Pressure");
- Since:
- 3.0
- Version:
- 1.0
- Author:
- Even Solbraa
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classRepresents a trajectory of MV values over time.static classResult of a prediction containing CV and MV trajectories. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanWhether to clone the process for each prediction (safer but slower).private final List<ControlledVariable> List of controlled variables.private final List<ManipulatedVariable> List of manipulated variables.private intPrediction horizon (number of steps).private final ProcessSystemThe process system to use for prediction.private doubleSample time in seconds.private static final long -
Constructor Summary
ConstructorsConstructorDescriptionNonlinearPredictor(ProcessSystem processSystem) Construct a nonlinear predictor for a ProcessSystem. -
Method Summary
Modifier and TypeMethodDescriptionAdd a controlled variable.Add a manipulated variable.clear()Clear all variable definitions.intGet the prediction horizon.doubleGet the sample time.predict(NonlinearPredictor.MVTrajectory trajectory) Predict CV trajectories given an MV trajectory.predictConstant(double... mvValues) Predict CV trajectories given constant MV values.setCloneProcess(boolean clone) Set whether to clone the process for each prediction.setPredictionHorizon(int horizon) Set the prediction horizon.setSampleTime(double seconds) Set the sample time.
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
processSystem
The process system to use for prediction. -
manipulatedVariables
List of manipulated variables. -
controlledVariables
List of controlled variables. -
predictionHorizon
private int predictionHorizonPrediction horizon (number of steps). -
sampleTimeSeconds
private double sampleTimeSecondsSample time in seconds. -
cloneProcess
private boolean cloneProcessWhether to clone the process for each prediction (safer but slower).
-
-
Constructor Details
-
NonlinearPredictor
Construct a nonlinear predictor for a ProcessSystem.- Parameters:
processSystem- the NeqSim process to use for prediction
-
-
Method Details
-
addMV
Add a manipulated variable.- Parameters:
mv- the manipulated variable- Returns:
- this predictor for method chaining
-
addCV
Add a controlled variable.- Parameters:
cv- the controlled variable- Returns:
- this predictor for method chaining
-
setPredictionHorizon
Set the prediction horizon.- Parameters:
horizon- number of prediction steps- Returns:
- this predictor for method chaining
-
setSampleTime
Set the sample time.- Parameters:
seconds- sample time in seconds- Returns:
- this predictor for method chaining
-
setCloneProcess
Set whether to clone the process for each prediction.- Parameters:
clone- true to clone (safer), false to modify in-place (faster)- Returns:
- this predictor for method chaining
-
getPredictionHorizon
public int getPredictionHorizon()Get the prediction horizon.- Returns:
- number of prediction steps
-
getSampleTimeSeconds
public double getSampleTimeSeconds()Get the sample time.- Returns:
- sample time in seconds
-
predict
Predict CV trajectories given an MV trajectory.- Parameters:
trajectory- the MV trajectory to apply- Returns:
- prediction result with CV trajectories
-
predictConstant
Predict CV trajectories given constant MV values.- Parameters:
mvValues- constant MV values (one per MV)- Returns:
- prediction result
-
clear
Clear all variable definitions.- Returns:
- this predictor for method chaining
-