Skip to main content

Schema-driven Python simulator for the modified Tennessee Eastman Process.

Project description


title: TEP Studio emoji: 🏭 colorFrom: blue colorTo: indigo sdk: docker app_port: 7860 pinned: false short_description: Interactive Tennessee Eastman Process simulation studio (Dash + Plotly)

TEP Studio

This repository contains a schema-driven Python implementation of the modified Tennessee Eastman Process in temexd_mod. Simulation code lives in src/tep_studio/simulation/; src/tep_studio/__init__.py re-exports the public API.

The Python package keeps the original temexd_mod.c equations as the numerical source of truth by compiling a native CFFI extension, then exposes process-aware Python contracts for:

  • process-core use through TennesseeEastmanProcess
  • Gymnasium RL/control interaction through GymTEPEnv
  • causal trajectory datasets through TrajectoryDataset
  • deterministic rollout and finite-difference optimization through OptimizationAdapter
  • closed-loop decentralized control through ClosedLoopSimulation and RickerMultiLoopController
  • an interactive Dash + Plotly interface for runs, step tests, and dataset generation (tep_studio.ui)

Quickstart

pip install tep-studio            # add [ui] for the web Simulation Studio
import tep_studio as tep
tep.quickstart()                                  # short closed-loop smoke run

import gymnasium                                   # a registered RL environment
env = gymnasium.make("TennesseeEastman-v0", horizon=24.0)

from tep_studio import ClosedLoopSimulation     # the stabilized closed loop
result = ClosedLoopSimulation(horizon=24.0).run()

Or from the terminal: tep run --horizon 24 --idv idv_01@1.0, tep list disturbances, tep ui. See the Cookbook for task recipes.

Build

Once published to PyPI, pip install tep-studio pulls a prebuilt wheel for Linux, macOS, and Windows — no C compiler required. The instructions below are for building from a source checkout, which compiles the native extension locally.

The build requires setuptools>=68 (declared in pyproject.toml). The recommended path is an editable install, which uses build isolation to provision the correct build dependencies automatically:

python3 -m pip install -e .

If your environment blocks build isolation (for example, an offline machine), first ensure the build tools are current, then install without isolation:

python3 -m pip install -U "setuptools>=68" wheel cffi
python3 -m pip install -e . --no-build-isolation

To build the native extension in place instead of installing, the same setuptools>=68 requirement applies (older setuptools mis-places the compiled artifact under the src/ layout):

python3 -m pip install -U "setuptools>=68"
python3 setup.py build_ext --inplace

The compiled _tep_native extension is platform-specific and is not tracked in version control. After moving the repository to a new machine or operating system, rebuild it with one of the commands above before importing the package.

Smoke Test

PYTHONPATH=src python3 src/tep_studio/simulation/examples/r12_open_loop.py
PYTHONPATH=src python3 -m pytest -q

The R12 open-loop example should terminate near 1.07 h with a high reactor pressure shutdown.

Validation

PYTHONPATH=src python3 -m tep_studio.simulation.validation run --suite local
PYTHONPATH=src python3 -m tep_studio.simulation.validation run --suite steady_state
PYTHONPATH=src python3 -m tep_studio.simulation.validation run --suite mat_states
PYTHONPATH=src python3 -m tep_studio.simulation.validation run --suite all --solvers RK23 RK45
PYTHONPATH=src python3 -m tep_studio.simulation.validation figures
PYTHONPATH=src python3 -m tep_studio.simulation.validation report

Validation artifacts are written under src/tep_studio/simulation/validation_outputs/. The steady-state suite exports the Ricker (1995) Table 2/3 references, compares the simulator base case against the reported Downs and Vogel steady state, and marks optimized modes 1-6 as reference-only unless their electronic 50-state vectors are supplied. The MAT-state suite evaluates the bundled Simulink CSTATE vectors for Mode 1, Mode 3, and Skogestad Mode 1 and writes paper-ready comparison tables and figures. Add --download-external to cache public reference metadata and files where available.

Closed-Loop Control

The base-case plant is open-loop unstable and trips on high reactor pressure within a few hours. The tep_studio.control package adds the Ricker (1996) decentralized multiloop PI strategy, which stabilizes the plant for the full horizon:

PYTHONPATH=src python3 src/tep_studio/control/examples/ricker_mode1_closed_loop.py
from tep_studio.control import ClosedLoopSimulation

result = ClosedLoopSimulation(control_interval=0.0005, horizon=48.0).run()
assert result.stabilized  # ran the horizon without a shutdown

The controller is separate from the simulator core and consumes only published measurements (no plant-state leakage). It reproduces the loop pairings and gains from Ricker's runnable MultiLoop_mode1.mdl, initializes bumplessly from the Mode-1 state, and emits a reproducible experiment record. See docs/control.md for the loop structure, overrides, disturbance rejection, and configuration flags.

Interface (Simulation Studio)

An interactive Dash + Plotly web interface for running, visualizing, and exporting simulations — open/closed-loop runs, disturbance scenarios, step tests, dataset generation, run comparison, and scenario save/load:

python3 -m pip install -e ".[ui]"
python3 -m tep_studio.ui          # or: tep-ui ; opens http://127.0.0.1:8050

The interface is a thin layer over a Dash-free, importable backend (from tep_studio.ui import run_scenario, ScenarioConfig, build_dataset), so the same runs and exports are scriptable. See docs/ui.md.

Online Documentation

The online documentation source is in docs/ and is configured by mkdocs.yml. It is written as a practical step-by-step guide for new users and is based on the simulator supplement:

python3 -m pip install -e ".[docs]"
python3 -m mkdocs serve
python3 -m mkdocs build --strict

(Append --no-build-isolation to the install command if your environment blocks build isolation, after upgrading the build tools as described under Build.)

The local server defaults to http://127.0.0.1:8000/. Start with docs/getting-started.md, then run the walkthrough in docs/first-simulation.md.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tep_studio-0.1.0.tar.gz (151.5 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

tep_studio-0.1.0-cp313-cp313-win_amd64.whl (164.5 kB view details)

Uploaded CPython 3.13Windows x86-64

tep_studio-0.1.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (208.7 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

tep_studio-0.1.0-cp313-cp313-macosx_11_0_arm64.whl (162.7 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

tep_studio-0.1.0-cp312-cp312-win_amd64.whl (164.5 kB view details)

Uploaded CPython 3.12Windows x86-64

tep_studio-0.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (208.8 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

tep_studio-0.1.0-cp312-cp312-macosx_11_0_arm64.whl (162.7 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

tep_studio-0.1.0-cp311-cp311-win_amd64.whl (164.5 kB view details)

Uploaded CPython 3.11Windows x86-64

tep_studio-0.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (208.3 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

tep_studio-0.1.0-cp311-cp311-macosx_11_0_arm64.whl (162.8 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

tep_studio-0.1.0-cp310-cp310-win_amd64.whl (164.5 kB view details)

Uploaded CPython 3.10Windows x86-64

tep_studio-0.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (208.3 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

tep_studio-0.1.0-cp310-cp310-macosx_11_0_arm64.whl (162.8 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

Details for the file tep_studio-0.1.0.tar.gz.

File metadata

  • Download URL: tep_studio-0.1.0.tar.gz
  • Upload date:
  • Size: 151.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for tep_studio-0.1.0.tar.gz
Algorithm Hash digest
SHA256 cf2448acb1b0eb4ea1637f7891a49e70902b05af2dd887420749e9786bc950af
MD5 9d67f73d0baa81e91a6c7f0098e7e0a1
BLAKE2b-256 257827ca7f6c0a731f4d3ac162c93eda86937db1c5cebd6f5f36e90d417f1f1b

See more details on using hashes here.

Provenance

The following attestation bundles were made for tep_studio-0.1.0.tar.gz:

Publisher: wheels.yml on khalidlabs/tep-studio

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tep_studio-0.1.0-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: tep_studio-0.1.0-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 164.5 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for tep_studio-0.1.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 e10a05c1f6d8e4792b62c9f41afeb8c658f06e07f53353afd839a911c04a39bb
MD5 4c3db4f643f5c1b0a2fec5fb84b06bbb
BLAKE2b-256 6ae83af00458142af07e9f80a98c1dc6f9b053469fd86bb49823adc78c9009dd

See more details on using hashes here.

Provenance

The following attestation bundles were made for tep_studio-0.1.0-cp313-cp313-win_amd64.whl:

Publisher: wheels.yml on khalidlabs/tep-studio

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tep_studio-0.1.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for tep_studio-0.1.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9b77c8bb35748859dd25ef09060035acb0f1b19a4bd438e27974b04a4ab05fb9
MD5 3694feab8f3b13a12891dab6a3863c47
BLAKE2b-256 3af70d6b1cdfd6ba3beecfc71a7a66779b71893e6c5918142d1c7fe2b601b514

See more details on using hashes here.

Provenance

The following attestation bundles were made for tep_studio-0.1.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: wheels.yml on khalidlabs/tep-studio

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tep_studio-0.1.0-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for tep_studio-0.1.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b51fbb0470c70f2ed1d67d3bc3815d924575a4e43f7a46c60420bd6d515adf02
MD5 d23a324cc05d4230f9dfb0c012daca60
BLAKE2b-256 508830e05b62bc055e6946cdc630ce29926c33854552dc66b679094dc879eb01

See more details on using hashes here.

Provenance

The following attestation bundles were made for tep_studio-0.1.0-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: wheels.yml on khalidlabs/tep-studio

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tep_studio-0.1.0-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: tep_studio-0.1.0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 164.5 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for tep_studio-0.1.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 5c14695e7b52453f7bbf479bebc7488956dcce1bfd88ffb0ece70267f665ea88
MD5 f135d111da4c8d4e0da32d31832891c6
BLAKE2b-256 eac3c862e28480988e48d9db0f9c8c51af439fe0168cc21a1e9473e500f9f562

See more details on using hashes here.

Provenance

The following attestation bundles were made for tep_studio-0.1.0-cp312-cp312-win_amd64.whl:

Publisher: wheels.yml on khalidlabs/tep-studio

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tep_studio-0.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for tep_studio-0.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1d68de2186f5f15c5044150132eea45bf92dd341630148e70c49aff629e2a4dd
MD5 d1502e800f72bee157cbc5887a81c918
BLAKE2b-256 367675721888f5c8b28803e552c3757dea5437abbec2c1f9f6402ae53bef9dae

See more details on using hashes here.

Provenance

The following attestation bundles were made for tep_studio-0.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: wheels.yml on khalidlabs/tep-studio

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tep_studio-0.1.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for tep_studio-0.1.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 84d1e5ec1b2090dd6f8dcc96f946dc72abc07119e4868e4ffd0becfa63010442
MD5 e47a832b0e19eeb77a13724a996dce2c
BLAKE2b-256 c7bb8645d1a4c66fdaa7b5dcfc6d9cd44ee9bfc20975ab71bf3bfc55f41b213f

See more details on using hashes here.

Provenance

The following attestation bundles were made for tep_studio-0.1.0-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: wheels.yml on khalidlabs/tep-studio

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tep_studio-0.1.0-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: tep_studio-0.1.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 164.5 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for tep_studio-0.1.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 b42d03ebaf1bb6bafeb4e99af5e69f96e9d1561a7c11e68e4b4d72fae6082a7a
MD5 027ea75a1afb5c43e8bf22ac08285c0e
BLAKE2b-256 e8eac8d9ad32b6460dc9c81f48cd7ad63bc7e28b8b2bd9bed87b89242304fa19

See more details on using hashes here.

Provenance

The following attestation bundles were made for tep_studio-0.1.0-cp311-cp311-win_amd64.whl:

Publisher: wheels.yml on khalidlabs/tep-studio

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tep_studio-0.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for tep_studio-0.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 60433881621ba16c8b1e0c574358e280eaf6e2ace2a4b06f7745a5a36ee74caa
MD5 34164628639193a1140e53e6dc8baade
BLAKE2b-256 7a40d5a7f6f85a476095c6557187bc5598b8fa594053c06910f5aee42c671a84

See more details on using hashes here.

Provenance

The following attestation bundles were made for tep_studio-0.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: wheels.yml on khalidlabs/tep-studio

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tep_studio-0.1.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for tep_studio-0.1.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 75568b74c7e077e14850a5925e74b1a1b90404927e300df3e288ae14e3a4627e
MD5 d8efb15163e1ebe998adedb6c8f58d23
BLAKE2b-256 41dfbd4a6ce211e1e59e38b316395e5ecba838dc52e1807e669f8c2fa12c327d

See more details on using hashes here.

Provenance

The following attestation bundles were made for tep_studio-0.1.0-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: wheels.yml on khalidlabs/tep-studio

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tep_studio-0.1.0-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: tep_studio-0.1.0-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 164.5 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for tep_studio-0.1.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 30086528662036d93f79dcabc2cd83e0ae8c33b9cd150e483a7bd44c05a620cb
MD5 e0cae5d414dc9d87b29739e1303ab31f
BLAKE2b-256 eef36ffbc0f7636c3cd2a37374689190ba22924aabc66a007846327ef81f9c84

See more details on using hashes here.

Provenance

The following attestation bundles were made for tep_studio-0.1.0-cp310-cp310-win_amd64.whl:

Publisher: wheels.yml on khalidlabs/tep-studio

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tep_studio-0.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for tep_studio-0.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 82ef787b57d8308fd0a3c2b0d8bc3659d5083e6e2bc23afe46e09752f5f37886
MD5 532029c8fc3c8e5c28db06eab8bd8ffb
BLAKE2b-256 343513b101a80ca2b4b3517f30829dbf249f3be1497ab841e6aef85f88ea450c

See more details on using hashes here.

Provenance

The following attestation bundles were made for tep_studio-0.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: wheels.yml on khalidlabs/tep-studio

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tep_studio-0.1.0-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for tep_studio-0.1.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 792aeb314c56000dd2944cd8ba34ad96bc64e1be6d2aa13497be4810e387adea
MD5 7896e4287dc8d65b45ae9fcaf919c223
BLAKE2b-256 44a7d2ed0eacee47df9917b96e96c92448d6ced574c9a4afb9da4d3be82b8672

See more details on using hashes here.

Provenance

The following attestation bundles were made for tep_studio-0.1.0-cp310-cp310-macosx_11_0_arm64.whl:

Publisher: wheels.yml on khalidlabs/tep-studio

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page