Skip to content

About

A repo of codes of different areas in chemical engineering

Resources

Stars

0 stars

Watchers

1 watching

Forks

Repository files navigation

ChemEng SimLab

A real-time SCADA application with teaching simulators for chemical engineering labs. Currently ships two modules — a Plug Flow Reactor (PFR) with temperature control, dual-feed streams, and conductivity sensing, and an RTD/CIP tracer experiment (residence-time distribution) — with more planned. Generates realistic synthetic process data when physical equipment is unavailable.

ChemEng SimLab — P&ID Diagram

ChemEng SimLab — Live Graphs


Features

  • Realistic PFR physics — Method of Lines spatial discretization (N = 50 nodes), bimolecular Arrhenius kinetics (saponification of EtAc by NaOH), non-adiabatic wall heat loss
  • Dual feed streams — independent NaOH (A) and EtAc (B) flow and concentration setpoints
  • PID temperature control — hot-water heat exchanger upstream of the PFR, gains tunable at runtime via the P&ID diagram
  • Sensor imperfections — Gaussian noise on TE-101 / TE-102 (σ = 0.3 K), calibration curve on CT-101 conductivity transmitter
  • Real-time P&ID diagram — clickable equipment opens parameter dialogs
  • 2×2 live plots — temperature + setpoint, valve %, feed flows, conductivity with inlet concentrations
  • Alarm system — HIGH/LOW temperature and conversion alarms with hysteresis, unbounded event log
  • Student-facing Table tab — flows in mL/min, one-click CSV / Excel export
  • Password-protected Admin tab — conversion plot and full internal variable table with export
  • Windows one-folder executable — no Python installation required

Quick Start

Run the pre-built executable (Windows)

dist/ChemEng_SimLab/ChemEng_SimLab.exe

Run from source

pip install -e .
python -m scada_app.main

Build the Windows executable

pip install pyinstaller
pyinstaller ChemEng_SimLab.spec
# Output: dist/ChemEng_SimLab/

See docs/shared/build.md for the full build checklist.

macOS and Linux builds must be run on those platforms.


Physical System

The simulated plant is a saponification reactor (NaOH + EtAc → NaAc + EtOH):

Component Specification
Reactor Tube, L = 20.9 m, D = 5 mm, N = 50 spatial nodes (MOL)
Heat exchanger Hot-water shell-and-tube upstream of PFR; UA_max = 100 W/K; T_hw = 60 °C
CT-101 Conductivity transmitter tracking residual NaOH at outlet; σ = A·C + B
TE-101 / TE-102 Inlet / outlet thermocouples; Gaussian noise σ = 0.3 K
Kinetics k₀ = 1.146×10⁴ m³/(mol·s), Eₐ = 46 kJ/mol (literature saponification)
Conversion range ≈ 31 % at 20 °C → 60 % at 40 °C → 72 % at 50 °C

Project Structure

chemical-engineering/
├── scada_app/                ← SCADA application (PyQt6 UI + per-module engines)
│   ├── engine/                ← BaseEngine, PFREngine, RTDEngine, DataStore, *Snapshot
│   ├── scenarios/              ← per-module scenario JSON (pfr/, plants/) + loader
│   ├── ui/                    ← tabs, dialogs, widgets, panels
│   ├── app.py                 ← MainWindow
│   ├── constants.py           ← app-global values (identity, timers, UI)
│   └── main.py                ← entry point
│
├── reactor_simulation/       ← Physics package (reusable, framework-independent),
│                                organized by physical role -- see
│                                docs/shared/CONVENTION.md
│   ├── models/                ← PFRSimulator, PackedBedRTD, analytic reactor types, state
│   ├── kinetics/               ← Reaction, overall_yield_pfr/mfr
│   ├── actuators/              ← HXDynamic, HeatExchanger, Heater, Pump
│   ├── control/                ← PIDController
│   ├── sensors/                ← ConductivitySensor, TemperatureSensor, Thermocouple, Photocolorimeter
│   └── simulation/             ← Experiment, perturbations (batch/script mode)
│
├── examples/                 ← Standalone batch simulation scripts
├── tests/                    ← pytest test suite
├── legacy/                   ← Archived modules (kept for reference)
├── images/                   ← pfr/ and rtd/ diagram assets; _design/ for
│                                unreferenced mockups/sources
└── docs/                     ← Developer documentation

Documentation

Full index: docs/README.md. Highlights:

Document Contents
shared/frontend.md UI architecture (both modules), tabs, dialogs, engine tick sequence, data flow
shared/CONVENTION.md The module convention: how PFR, RTD, and future modules are structured
shared/backend.md reactor_simulation package structure, class reference, design philosophy
modules/pfr/fundamentals.md PFR PDE model, bimolecular kinetics, Method of Lines, numerical integration
modules/rtd/fundamentals.md RTD theory: E(t)/moments, one-parameter models, hidden compartment-network ground truth
shared/quickstart.md Import patterns and common workflows for the script (batch) API
documentacion_es.md Student manual (Spanish): install, run, per-module usage
CHANGELOG.md Version history
examples/README.md Script-mode example descriptions

Citation

If you use this simulator in coursework or research, please cite:

Villegas G., M. (2026). ChemEng SimLab v2.0.1 [Software]. Universidad de Santiago de Chile. Department of Chemical Engineering.


Author

Marco Villegas G. — MSc Chemical Engineering, Professor at USACH

About

A repo of codes of different areas in chemical engineering

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages