Class StateSpaceExporter.StateSpaceModel

java.lang.Object
neqsim.process.mpc.StateSpaceExporter.StateSpaceModel
All Implemented Interfaces:
Serializable
Enclosing class:
StateSpaceExporter

public static class StateSpaceExporter.StateSpaceModel extends Object implements Serializable
Represents a discrete-time state-space model.
Since:
3.0
Version:
1.0
Author:
Even Solbraa
See Also:
  • 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

      private final String[] inputNames
    • outputNames

      private final String[] 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 matrix
      B - input matrix
      C - output matrix
      D - feedthrough matrix
      sampleTime - sample time in seconds
      inputNames - 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

      public String[] getInputNames()
      Get the input names.
      Returns:
      copy of input names
    • getOutputNames

      public String[] getOutputNames()
      Get the output names.
      Returns:
      copy of output names
    • 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 index
      inputIndex - 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 state
      u - input
      Returns:
      next state
    • getOutput

      public double[] getOutput(double[] x, double[] u)
      Calculate output from state.
      Parameters:
      x - current state
      u - input
      Returns:
      output
    • toMap

      public Map<String,Object> toMap()
      Convert to a Map for JSON serialization.
      Returns:
      map representation
    • matrixToList

      private List<List<Double>> matrixToList(double[][] matrix)
    • toString

      public String toString()
      Overrides:
      toString in class Object