Class StateSpaceExporter.StateSpaceModel
java.lang.Object
neqsim.process.mpc.StateSpaceExporter.StateSpaceModel
- All Implemented Interfaces:
Serializable
- Enclosing class:
StateSpaceExporter
Represents a discrete-time state-space model.
- Since:
- 3.0
- Version:
- 1.0
- Author:
- Even Solbraa
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionStateSpaceModel(double[][] A, double[][] B, double[][] C, double[][] D, double sampleTime, String[] inputNames, String[] outputNames) Construct a state-space model. -
Method Summary
Modifier and TypeMethodDescriptionprivate double[][]deepCopy(double[][] matrix) double[][]getA()Get the A matrix.double[][]getB()Get the B matrix.double[][]getC()Get the C matrix.double[][]getD()Get the D matrix.doublegetDominantTimeConstant(int outputIndex) Get the dominant time constant for an output.String[]Get the input names.intGet the number of inputs.intGet the number of outputs.intGet the number of states.double[]getOutput(double[] x, double[] u) Calculate output from state.String[]Get the output names.doubleGet the sample time.doublegetSteadyStateGain(int outputIndex, int inputIndex) Get the steady-state gain from input j to output i.matrixToList(double[][] matrix) double[]stepState(double[] x, double[] u) Simulate one step.toMap()Convert to a Map for JSON serialization.toString()
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
A
private final double[][] A -
B
private final double[][] B -
C
private final double[][] C -
D
private final double[][] D -
sampleTime
private final double sampleTime -
inputNames
-
outputNames
-
-
Constructor Details
-
StateSpaceModel
public StateSpaceModel(double[][] A, double[][] B, double[][] C, double[][] D, double sampleTime, String[] inputNames, String[] outputNames) Construct a state-space model.- Parameters:
A- state transition matrixB- input matrixC- output matrixD- feedthrough matrixsampleTime- sample time in secondsinputNames- names of inputs (MVs)outputNames- names of outputs (CVs)
-
-
Method Details
-
deepCopy
private double[][] deepCopy(double[][] matrix) -
getA
public double[][] getA()Get the A matrix.- Returns:
- copy of state transition matrix
-
getB
public double[][] getB()Get the B matrix.- Returns:
- copy of input matrix
-
getC
public double[][] getC()Get the C matrix.- Returns:
- copy of output matrix
-
getD
public double[][] getD()Get the D matrix.- Returns:
- copy of feedthrough matrix
-
getSampleTime
public double getSampleTime()Get the sample time.- Returns:
- sample time in seconds
-
getInputNames
-
getOutputNames
-
getNumStates
public int getNumStates()Get the number of states.- Returns:
- number of states
-
getNumInputs
public int getNumInputs()Get the number of inputs.- Returns:
- number of inputs
-
getNumOutputs
public int getNumOutputs()Get the number of outputs.- Returns:
- number of outputs
-
getSteadyStateGain
public double getSteadyStateGain(int outputIndex, int inputIndex) Get the steady-state gain from input j to output i.For a stable system, the DC gain is: G = C * (I - A)^-1 * B + D
- Parameters:
outputIndex- the output indexinputIndex- the input index- Returns:
- the steady-state gain
-
getDominantTimeConstant
public double getDominantTimeConstant(int outputIndex) Get the dominant time constant for an output.- Parameters:
outputIndex- the output index- Returns:
- the time constant in seconds
-
stepState
public double[] stepState(double[] x, double[] u) Simulate one step.- Parameters:
x- current stateu- input- Returns:
- next state
-
getOutput
public double[] getOutput(double[] x, double[] u) Calculate output from state.- Parameters:
x- current stateu- input- Returns:
- output
-
toMap
-
matrixToList
-
toString
-