Class IndustrialMPCExporter

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

public class IndustrialMPCExporter extends Object implements Serializable
Exports MPC models and configurations in formats compatible with industrial control systems.

This class provides export capabilities for integrating NeqSim-generated models with external MPC platforms commonly used in process industries. It supports multiple standard formats including:

  • Step response coefficients (DMC-style) for dynamic matrix controllers
  • Transfer function parameters (FOPDT, SOPDT) for model-based controllers
  • Variable configuration with OPC-style naming conventions
  • Gain matrices and time constants for linear MPC

The exports include complete variable definitions with engineering units, limits, tuning parameters, and model data in formats that can be directly imported into industrial MPC configuration tools.

Example usage:


// Configure and identify model
ProcessLinkedMPC mpc = new ProcessLinkedMPC("separator_control", process);
mpc.addMV("valve", "opening", 0.0, 100.0);
mpc.addCV("separator", "pressure", 30.0);
mpc.identifyModel(60.0);

// Export for industrial MPC
IndustrialMPCExporter exporter = new IndustrialMPCExporter(mpc);
exporter.exportStepResponseModel("model_step_response.json");
exporter.exportVariableConfiguration("variables.json");
exporter.exportGainMatrix("gains.csv");

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

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • controller

      private final ProcessLinkedMPC controller
      The MPC controller to export.
    • stepResponseGenerator

      private StepResponseGenerator stepResponseGenerator
      Step response generator for detailed model export.
    • numStepCoefficients

      private int numStepCoefficients
      Number of step response coefficients to export.
    • defaultTimeConstant

      private double defaultTimeConstant
      Default time constant for FOPDT models (seconds).
    • defaultDeadTime

      private double defaultDeadTime
      Default dead time for FOPDT models (seconds).
    • applicationName

      private String applicationName
      Application name for exported files.
    • tagPrefix

      private String tagPrefix
      Tag prefix for variable naming.
  • Constructor Details

    • IndustrialMPCExporter

      public IndustrialMPCExporter(ProcessLinkedMPC controller)
      Construct an exporter for a ProcessLinkedMPC.
      Parameters:
      controller - the MPC controller to export
  • Method Details

    • setNumStepCoefficients

      public IndustrialMPCExporter setNumStepCoefficients(int numCoefficients)
      Set the number of step response coefficients to export.
      Parameters:
      numCoefficients - number of coefficients (typically 30-120)
      Returns:
      this exporter for method chaining
    • setDefaultTimeConstant

      public IndustrialMPCExporter setDefaultTimeConstant(double timeConstant)
      Set the default time constant for FOPDT models.
      Parameters:
      timeConstant - time constant in seconds
      Returns:
      this exporter for method chaining
    • setTagPrefix

      public IndustrialMPCExporter setTagPrefix(String prefix)
      Set the tag prefix for variable naming.

      This prefix is prepended to all variable names in exports, useful for matching plant tag naming conventions.

      Parameters:
      prefix - the tag prefix (e.g., "UNIT1.")
      Returns:
      this exporter for method chaining
    • setApplicationName

      public IndustrialMPCExporter setApplicationName(String name)
      Set the application name for exported files.
      Parameters:
      name - the application name
      Returns:
      this exporter for method chaining
    • exportStepResponseModel

      public void exportStepResponseModel(String filename) throws IOException
      Export the complete MPC model in step response coefficient format.

      This format is commonly used by Dynamic Matrix Control (DMC) style controllers. Each MV-CV pair is represented by a vector of step response coefficients that describe the dynamic response.

      Parameters:
      filename - the output filename
      Throws:
      IOException - if writing fails
    • exportVariableConfiguration

      public void exportVariableConfiguration(String filename) throws IOException
      Export variable configuration in a format suitable for industrial control systems.

      The output includes all MVs, CVs, and DVs with their limits, setpoints, engineering units, and tuning parameters in a standardized format.

      Parameters:
      filename - the output filename
      Throws:
      IOException - if writing fails
    • exportGainMatrix

      public void exportGainMatrix(String filename) throws IOException
      Export the gain matrix in CSV format.

      The matrix shows the steady-state gain from each MV to each CV. Row headers are CV names, column headers are MV names.

      Parameters:
      filename - the output filename
      Throws:
      IOException - if writing fails
    • exportTransferFunctions

      public void exportTransferFunctions(String filename) throws IOException
      Export transfer function parameters in CSV format.

      Each row contains the FOPDT (First Order Plus Dead Time) parameters for one MV-CV pair: gain, time constant, and dead time.

      Parameters:
      filename - the output filename
      Throws:
      IOException - if writing fails
    • exportComprehensiveConfiguration

      public void exportComprehensiveConfiguration(String filename) throws IOException
      Export the complete model configuration as a single comprehensive JSON file.

      This format includes all information needed to configure an external MPC controller: variable definitions, model parameters, tuning weights, and constraints.

      Parameters:
      filename - the output filename
      Throws:
      IOException - if writing fails
    • createDataExchange

      public ControllerDataExchange createDataExchange()
      Get a real-time data exchange object for online integration.
      Returns:
      a new ControllerDataExchange instance
    • createMVConfig

      private Map<String,Object> createMVConfig(ManipulatedVariable mv, int index)
    • createCVConfig

      private Map<String,Object> createCVConfig(ControlledVariable cv, int index)
    • createDVConfig

      private Map<String,Object> createDVConfig(DisturbanceVariable dv, int index)
    • generateStepCoefficients

      private double[] generateStepCoefficients(double gain, double tau, double sampleTime)
      Generate step response coefficients for a first-order system.
      Parameters:
      gain - steady-state gain
      tau - time constant (seconds)
      sampleTime - sample time (seconds)
      Returns:
      array of step response coefficients
    • exportStepResponseCSV

      public void exportStepResponseCSV(String filename) throws IOException
      Export step response coefficients in tabular CSV format.

      This format is designed for easy import into industrial MPC systems. Each row contains the step response coefficient for one time step, with columns for each MV-CV pair.

      Parameters:
      filename - the output filename
      Throws:
      IOException - if writing fails
    • exportObjectStructure

      public void exportObjectStructure(String filename) throws IOException
      Export model object structure as a hierarchical configuration.

      This format mirrors the object structure used by industrial control system cores for configuration storage and data logging. It provides a complete description of the controller that can be serialized/deserialized.

      Parameters:
      filename - the output filename
      Throws:
      IOException - if writing fails
    • createSoftSensorExporter

      public SoftSensorExporter createSoftSensorExporter()
      Create a soft-sensor exporter for the process system used by this controller.
      Returns:
      a new SoftSensorExporter