Class ManipulatedVariable

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

public class ManipulatedVariable extends MPCVariable
Represents a manipulated variable (MV) in an MPC formulation.

A manipulated variable is a process input that the MPC controller can adjust to achieve control objectives. Common examples include valve openings, heater duties, compressor speeds, and flow rate setpoints.

Features:

  • Absolute bounds (min/max physical limits)
  • Rate limits (maximum change per time step)
  • Preferred operating point for economic optimization
  • Cost weighting for multi-objective optimization

Example usage:


// Valve opening as MV
ManipulatedVariable valveMV =
    new ManipulatedVariable("InletValve", valve, "opening").setBounds(0.0, 1.0) // Physical
                                                                                // limits
        .setRateLimit(-0.1, 0.1) // Max 10% change per step
        .setPreferredValue(0.7) // Preferred operating point
        .setCost(0.0); // No direct cost

// Heater duty as MV with energy cost
ManipulatedVariable heaterMV = new ManipulatedVariable("Heater", heater, "duty", "kW")
    .setBounds(0.0, 5000.0).setRateLimit(-500.0, 500.0).setCost(0.05); // $/kWh energy cost

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

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • minRateOfChange

      private double minRateOfChange
      Minimum allowed change per time step (rate constraint).
    • maxRateOfChange

      private double maxRateOfChange
      Maximum allowed change per time step (rate constraint).
    • preferredValue

      private double preferredValue
      Preferred operating value for economic optimization.
    • cost

      private double cost
      Cost coefficient for using this MV ($/unit or energy cost).
    • moveWeight

      private double moveWeight
      Weight on control moves (penalizes rapid changes).
    • preferredWeight

      private double preferredWeight
      Weight on deviation from preferred value.
    • initialValue

      private double initialValue
      Initial value before optimization.
  • Constructor Details

    • ManipulatedVariable

      public ManipulatedVariable(String name)
      Construct a manipulated variable with a name.
      Parameters:
      name - unique identifier for this MV
    • ManipulatedVariable

      public ManipulatedVariable(String name, ProcessEquipmentInterface equipment, String propertyName)
      Construct a manipulated variable bound to equipment.
      Parameters:
      name - unique identifier for this MV
      equipment - the process equipment to control
      propertyName - the property to manipulate
    • ManipulatedVariable

      public ManipulatedVariable(String name, ProcessEquipmentInterface equipment, String propertyName, String unit)
      Construct a manipulated variable bound to equipment with unit.
      Parameters:
      name - unique identifier for this MV
      equipment - the process equipment to control
      propertyName - the property to manipulate
      unit - the unit for the property value
  • Method Details

    • getType

      public MPCVariable.MPCVariableType getType()
      Description copied from class: MPCVariable
      Get the type of this MPC variable.
      Specified by:
      getType in class MPCVariable
      Returns:
      the variable type (MV, CV, or DV)
    • getMinRateOfChange

      public double getMinRateOfChange()
      Get the minimum rate of change per time step.
      Returns:
      minimum delta (typically negative)
    • getMaxRateOfChange

      public double getMaxRateOfChange()
      Get the maximum rate of change per time step.
      Returns:
      maximum delta (typically positive)
    • setRateLimit

      public ManipulatedVariable setRateLimit(double minDelta, double maxDelta)
      Set rate limits for this MV.
      Parameters:
      minDelta - minimum change per time step (negative for decrease)
      maxDelta - maximum change per time step (positive for increase)
      Returns:
      this variable for method chaining
    • getPreferredValue

      public double getPreferredValue()
      Get the preferred operating value.
      Returns:
      the preferred value for economic optimization
    • setPreferredValue

      public ManipulatedVariable setPreferredValue(double value)
      Set the preferred operating value.

      The MPC will try to keep the MV near this value when there is slack in the control objectives. This is useful for economic optimization (e.g., minimize energy use by preferring lower heater duty).

      Parameters:
      value - the preferred operating point
      Returns:
      this variable for method chaining
    • getCost

      public double getCost()
      Get the cost coefficient for this MV.
      Returns:
      the cost per unit
    • setCost

      public ManipulatedVariable setCost(double cost)
      Set the cost coefficient for using this MV.

      This is used for economic MPC where the objective includes minimizing operational costs. Examples: energy cost for heater duty, compression cost for compressor power.

      Parameters:
      cost - cost per unit (e.g., $/kWh)
      Returns:
      this variable for method chaining
    • getMoveWeight

      public double getMoveWeight()
      Get the move weight.
      Returns:
      the weight on control moves
    • setMoveWeight

      public ManipulatedVariable setMoveWeight(double weight)
      Set the move weight for penalizing rapid changes.
      Parameters:
      weight - the weight on move penalty (non-negative)
      Returns:
      this variable for method chaining
    • getPreferredWeight

      public double getPreferredWeight()
      Get the weight on deviation from preferred value.
      Returns:
      the preferred value weight
    • setPreferredWeight

      public ManipulatedVariable setPreferredWeight(double weight)
      Set the weight on deviation from preferred value.
      Parameters:
      weight - the weight (non-negative)
      Returns:
      this variable for method chaining
    • getInitialValue

      public double getInitialValue()
      Get the initial value.
      Returns:
      the initial value before optimization
    • setInitialValue

      public ManipulatedVariable setInitialValue(double value)
      Set the initial value.
      Parameters:
      value - the starting value
      Returns:
      this variable for method chaining
    • setBounds

      public ManipulatedVariable setBounds(double min, double max)
      Description copied from class: MPCVariable
      Set bounds for this variable.
      Overrides:
      setBounds in class MPCVariable
      Parameters:
      min - minimum allowed value
      max - maximum allowed value
      Returns:
      this variable for method chaining
    • setEquipment

      public ManipulatedVariable setEquipment(ProcessEquipmentInterface equipment)
      Description copied from class: MPCVariable
      Set the bound equipment.
      Overrides:
      setEquipment in class MPCVariable
      Parameters:
      equipment - the process equipment to bind to
      Returns:
      this variable for method chaining
    • setPropertyName

      public ManipulatedVariable setPropertyName(String propertyName)
      Description copied from class: MPCVariable
      Set the property name to read/write.
      Overrides:
      setPropertyName in class MPCVariable
      Parameters:
      propertyName - the property name
      Returns:
      this variable for method chaining
    • setUnit

      public ManipulatedVariable setUnit(String unit)
      Description copied from class: MPCVariable
      Set the unit for this variable.
      Overrides:
      setUnit in class MPCVariable
      Parameters:
      unit - the unit string
      Returns:
      this variable for method chaining
    • readValue

      public double readValue()
      Description copied from class: MPCVariable
      Read the current value from the bound equipment.

      This method uses reflection or equipment-specific accessors to read the property value. The implementation varies by variable type and property.

      Specified by:
      readValue in class MPCVariable
      Returns:
      the current value read from equipment
    • writeValue

      public void writeValue(double value)
      Write a new value to the bound equipment.
      Parameters:
      value - the new value to write
    • calculateCost

      public double calculateCost()
      Calculate the cost of the current MV value.
      Returns:
      the cost contribution
    • isFeasible

      public boolean isFeasible(double proposedValue)
      Check if a proposed value satisfies all constraints.
      Parameters:
      proposedValue - the value to check
      Returns:
      true if the value is feasible