Skip to main content


Reinforcement learning environments for process control

Quick start ⚡

Setup a CSTR environment with a setpoint change

import pcgym

# Simulation variables
nsteps = 100
T = 25

# Setpoint
SP = {'Ca': [0.85 for i in range(int(nsteps/2))] + [0.9 for i in range(int(nsteps/2))]} 

# Action and observation Space
action_space = {'low': np.array([295]), 'high': np.array([302])}
observation_space = {'low': np.array([0.7,300,0.8]),'high': np.array([1,350,0.9])}

# Construct the environment parameter dictionary
env_params = {
    'N': nsteps, # Number of time steps
    'tsim':T, # Simulation Time
    'SP' :SP, 
    'o_space' : observation_space, 
    'a_space' : action_space, 
    'x0': np.array([0.8, 330, 0.8]), # Initial conditions [Ca, T, Ca_SP]
    'model': 'cstr_ode', # Select the model
}

# Create environment
env = pcgym.make_env(env_params)

# Reset the environment
obs, state = env.reset()

# Sample a random action
action = env.action_space.sample()

# Perform a step in the environment
obs, rew, done, term, info = env.step(action)

Documentation

You can read the full documentation here!

Installation ⏳

The latest pc-gym version can be installed from PyPI:

pip install pcgym

Examples

Example notebooks with training walkthroughs, implementing constraints, disturbances and the policy evaluation tool can be found here.

Implemented Process Control Environments 🎛️

Environment Reference Source Documentation
CSTR Hedengren, 2022 Source
First Order Sytem N/A Source
Multistage Extraction Column Ingham et al, 2007 (pg 471) Source
Nonsmooth Control Lim,1969 Source

Paper 📚

The associated pre-print paper can be found here. If you use our software in your work please cite the following:

@article{bloor2024pcgymbenchmarkenvironmentsprocess,
      title={PC-Gym: Benchmark Environments For Process Control Problems}, 
      author={Maximilian Bloor and José Torraca and Ilya Orson Sandoval and Akhil Ahmed and Martha White and Mehmet Mercangöz and Calvin Tsay and Ehecatl Antonio Del Rio Chanona and Max Mowbray},
      year={2024},
      eprint={2410.22093},
      archivePrefix={arXiv},
      primaryClass={eess.SY},
      url={https://arxiv.org/abs/2410.22093}, 
}

Other Great Gyms 🔍

Metadata

Release files for pcgym 0.1.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pcgym 0.1.8
File Size Uploaded Provenance Actions
pcgym-0.1.8.tar.gz 29.4 kB Without provenance Details for pcgym-0.1.8.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pcgym 0.1.8
File Interpreter ABI Platform Actions
pcgym-0.1.8-py3-none-any.whl Python 3 none any Details for pcgym-0.1.8-py3-none-any.whl

Total release size: 58.3 kB

Release files / pcgym-0.1.8.tar.gz

Download URL pcgym-0.1.8.tar.gz
Size 29.4 kB
Tags Source
SHA-256 checksum
How to use checksums
12dc57a5324bf1b92964abc1663259e032ad5ca4cc71d5c1a1d680998e5460f4
BLAKE2b-256 checksum
How to use checksums
06e248be12a2805afaafbd90abbece99cbaf09f360be34ca254d5f18e529e038
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.7

Release files / pcgym-0.1.8-py3-none-any.whl

Download URL pcgym-0.1.8-py3-none-any.whl
Size 28.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3eb3c1c9beb979d7cceee04ac1466a6c2c6f2a4fc3e96909e683c1fe56d5e557
BLAKE2b-256 checksum
How to use checksums
5d56178a417cc09e9cdc8a71f02c2b1620e331157cd4f6f34e868834a8bf5872
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.7

Security for pcgym 0.1.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page