Class SeparatorGymEnv

java.lang.Object
neqsim.process.ml.GymEnvironment
neqsim.process.ml.examples.SeparatorGymEnv
All Implemented Interfaces:
Serializable

public class SeparatorGymEnv extends GymEnvironment
Gymnasium-compatible separator control environment.

This environment wraps a NeqSim separator model with a Gym-compatible API that works directly with Python RL frameworks via JPype/Py4J.

State Space (8-dimensional, continuous):

  • [0] liquid_level - Liquid level fraction [0, 1]
  • [1] pressure - Normalized pressure [0, 1]
  • [2] temperature - Normalized temperature [0, 1]
  • [3] feed_flow - Normalized feed flow [0, 1]
  • [4] gas_density - Normalized gas density
  • [5] liquid_density - Normalized liquid density
  • [6] level_error - Setpoint tracking error [-1, 1]
  • [7] valve_position - Current valve position [0, 1]

Action Space (1-dimensional, continuous):

  • [0] valve_delta - Valve position change [-0.1, 0.1]

Reward:

  • Negative squared level error: -10 * (level - setpoint)²
  • Action penalty: -0.1 * action²
  • Survival bonus: +1.0 per step
  • Constraint penalty: -100 for hard constraint violation

Python Usage:


from jpype import JClass
import numpy as np

SeparatorGymEnv = JClass('neqsim.process.ml.examples.SeparatorGymEnv')
env = SeparatorGymEnv()
env.setMaxEpisodeSteps(500)

obs, info = env.reset().observation, env.reset().info
done = False
while not done:
    action = policy.predict(np.array(obs))
    result = env.step([float(action[0])])
    obs, reward = result.observation, result.reward
    done = result.terminated or result.truncated

Version:
1.0
Author:
ESOL
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • process

      private ProcessSystem process
    • feed

      private Stream feed
    • separator

      private Separator separator
    • liquidValve

      private ThrottlingValve liquidValve
    • liquidLevel

      private double liquidLevel
    • valvePosition

      private double valvePosition
    • levelSetpoint

      private double levelSetpoint
    • maxPressure

      private double maxPressure
    • minTemp

      private double minTemp
    • maxTemp

      private double maxTemp
    • maxFeedFlow

      private double maxFeedFlow
  • Constructor Details

    • SeparatorGymEnv

      public SeparatorGymEnv()
      Create separator gym environment with default parameters.
  • Method Details

    • initializeSpaces

      private void initializeSpaces()
    • initializeProcess

      private void initializeProcess()
    • resetInternal

      protected double[] resetInternal(Map<String,Object> options)
      Description copied from class: GymEnvironment
      Internal reset implementation. Override in subclass.
      Specified by:
      resetInternal in class GymEnvironment
      Parameters:
      options - reset options
      Returns:
      initial observation
    • stepInternal

      protected GymEnvironment.StepResult stepInternal(double[] action)
      Description copied from class: GymEnvironment
      Internal step implementation. Override in subclass.
      Specified by:
      stepInternal in class GymEnvironment
      Parameters:
      action - clipped action
      Returns:
      step result
    • getObservation

      private double[] getObservation()
    • getLiquidOutflowRate

      private double getLiquidOutflowRate()
    • setLevelSetpoint

      public void setLevelSetpoint(double setpoint)
      Set level setpoint.
      Parameters:
      setpoint - target level [0-1]
    • getLevelSetpoint

      public double getLevelSetpoint()
      Get level setpoint.
      Returns:
      current setpoint
    • getLiquidLevel

      public double getLiquidLevel()
      Get current liquid level.
      Returns:
      level [0-1]
    • getValvePosition

      public double getValvePosition()
      Get current valve position.
      Returns:
      position [0-1]
    • getProcess

      public ProcessSystem getProcess()
      Get the underlying process system.
      Returns:
      process
    • getObservationNames

      public String[] getObservationNames()
      Get observation feature names.
      Returns:
      feature names
    • getActionNames

      public String[] getActionNames()
      Get action names.
      Returns:
      action names