Class StepResponseGenerator

java.lang.Object
neqsim.process.mpc.StepResponseGenerator
All Implemented Interfaces:
Serializable

public class StepResponseGenerator extends Object implements Serializable
Generates step response models by running NeqSim simulations.

The StepResponseGenerator automates the process of system identification by performing step tests on a ProcessSystem. For each MV-CV pair, it:

  1. Records the baseline CV value
  2. Applies a step change to the MV
  3. Runs simulations and records CV response over time
  4. Fits transfer function models (FOPDT)

The resulting step response data can be used to:

  • Configure the existing ModelPredictiveController
  • Export to external MPC packages
  • Validate process linearity

Example usage:


StepResponseGenerator generator = new StepResponseGenerator(processSystem);

// Add MVs and CVs
generator.addMV(
    new ManipulatedVariable("Valve", valve, "opening").setBounds(0.0, 1.0).setInitialValue(0.5));
generator.addCV(new ControlledVariable("Pressure", separator, "pressure", "bara"));

// Configure step test
generator.setStepSize(0.10); // 10% step
generator.setSettlingTime(60, "min"); // Wait 60 min for steady state
generator.setSampleInterval(1, "min"); // Sample every minute

// Run step tests
StepResponseMatrix responses = generator.generateAllResponses();

// Access individual response
StepResponse pressureToValve = responses.get("Pressure", "Valve");
double gain = pressureToValve.getGain();
double tau = pressureToValve.getTimeConstant();

Since:
3.0
Version:
1.0
Author:
Even Solbraa
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • processSystem

      private final transient ProcessSystem processSystem
      The process system to test.
    • manipulatedVariables

      private final List<ManipulatedVariable> manipulatedVariables
      List of manipulated variables.
    • controlledVariables

      private final List<ControlledVariable> controlledVariables
      List of controlled variables.
    • stepSizeFraction

      private double stepSizeFraction
      Step size as fraction of MV range.
    • settlingTimeSeconds

      private double settlingTimeSeconds
      Settling time in seconds.
    • sampleIntervalSeconds

      private double sampleIntervalSeconds
      Sample interval in seconds.
    • positiveStep

      private boolean positiveStep
      Whether to use positive step (true) or negative (false).
    • bidirectionalTest

      private boolean bidirectionalTest
      Whether to run both positive and negative steps for averaging.
  • Constructor Details

    • StepResponseGenerator

      public StepResponseGenerator(ProcessSystem processSystem)
      Construct a step response generator for a ProcessSystem.
      Parameters:
      processSystem - the NeqSim process to test
  • Method Details

    • addMV

      Add a manipulated variable for step testing.
      Parameters:
      mv - the manipulated variable
      Returns:
      this generator for method chaining
    • addCV

      Add a controlled variable to monitor.
      Parameters:
      cv - the controlled variable
      Returns:
      this generator for method chaining
    • setStepSize

      public StepResponseGenerator setStepSize(double fraction)
      Set the step size as a fraction of MV range.
      Parameters:
      fraction - step size (0.10 = 10%)
      Returns:
      this generator for method chaining
    • setSettlingTime

      public StepResponseGenerator setSettlingTime(double value, String unit)
      Set the settling time for step tests.
      Parameters:
      value - the settling time value
      unit - the time unit ("s", "min", "hr")
      Returns:
      this generator for method chaining
    • setSampleInterval

      public StepResponseGenerator setSampleInterval(double value, String unit)
      Set the sample interval.
      Parameters:
      value - the sample interval value
      unit - the time unit ("s", "min", "hr")
      Returns:
      this generator for method chaining
    • setPositiveStep

      public StepResponseGenerator setPositiveStep(boolean positive)
      Set whether to use positive step direction.
      Parameters:
      positive - true for positive step, false for negative
      Returns:
      this generator for method chaining
    • setBidirectionalTest

      public StepResponseGenerator setBidirectionalTest(boolean bidirectional)
      Set whether to run bidirectional tests.
      Parameters:
      bidirectional - true to run both positive and negative steps
      Returns:
      this generator for method chaining
    • convertToSeconds

      private double convertToSeconds(double value, String unit)
    • generateAllResponses

      public StepResponseGenerator.StepResponseMatrix generateAllResponses()
      Generate step responses for all MV-CV pairs.
      Returns:
      matrix of step responses
    • runStepTest

      public List<StepResponse> runStepTest(ManipulatedVariable mv)
      Run a step test for a single MV.
      Parameters:
      mv - the manipulated variable to step
      Returns:
      list of step responses for all CVs
    • runSingleStep

      private List<StepResponse> runSingleStep(ManipulatedVariable mv, double baseValue, double stepSize)
      Run a single step test.
      Parameters:
      mv - the MV to step
      baseValue - the baseline MV value
      stepSize - the step magnitude (can be negative)
      Returns:
      list of step responses for all CVs
    • calculateStepSize

      private double calculateStepSize(ManipulatedVariable mv, double currentValue)
      Calculate the step size for an MV.
      Parameters:
      mv - the manipulated variable
      currentValue - current MV value
      Returns:
      the step magnitude
    • averageResponses

      private StepResponse averageResponses(StepResponse pos, StepResponse neg)
      Average two step responses (for bidirectional testing).
      Parameters:
      pos - positive step response
      neg - negative step response
      Returns:
      averaged response
    • clear

      public StepResponseGenerator clear()
      Clear all variable definitions.
      Returns:
      this generator for method chaining
    • getSettlingTimeSeconds

      public double getSettlingTimeSeconds()
      Get the configured settling time.
      Returns:
      settling time in seconds
    • getSampleIntervalSeconds

      public double getSampleIntervalSeconds()
      Get the configured sample interval.
      Returns:
      sample interval in seconds
    • getStepSizeFraction

      public double getStepSizeFraction()
      Get the configured step size fraction.
      Returns:
      step size as fraction