A Python-based interactive simulator for the McCabe-Thiele method for binary distillation.
This simulator calculates and visualizes theoretical stages required for a binary distillation column using the McCabe-Thiele graphical method. Read more about the method Here
The simulator uses a constant relative volatility model to calculate the vapor-liquid equilibrium relationship and constructs the rectifying operating line, feed q-line, and stripping operating line.
The simulator allows users to be able to change the main operating and design parameters and be able to visualize the resulting McCabe-Thiele diagram.
This project was developed by Rofhiwa Percy Netshilongwe, a Chemical Engineering student at Vaal University of Technology. The purpose was to learn new technologies like Python, NumPy, Matplotlib, Streamlit and git. The insipiration for this project came from the question "What can i build using things i learned from the classroom that makes life a bit easier?"
- Binary vapor-liquid equilibrium calculation
- Constant relative volatility model
- Rectifying operating line
- Stripping operating line
- Feed q-line
- Minimum reflux ratio calculation
- Operating-line intersection calculation
- McCabe-Thiele stage stepping
- Theoretical stage count
- Feed-stage identification
- Interactive Streamlit interface
- Input validation and error handling
The equilibrium relationship is calculated using:
where:
- (x) = liquid-phase mole fraction
- (y^*) = equilibrium vapor-phase mole fraction
- (\alpha) = relative volatility
The rectifying operating line is:
where:
- (R) = reflux ratio
- (x_D) = distillate composition
For feeds where (q \neq 1), the q-line is:
For a saturated-liquid feed ((q=1)), the q-line is vertical at:
The stripping operating line is constructed using the bottoms composition and the intersection between the rectifying operating line and q-line.
Install the required packages:
pip install -r requirements.txtRun the Streamlit application:
streamlit run app.pyThe application will open in a web browser.
The simulation engine can be tested with:
python test_simulation.pyThe test checks that a normal simulation runs successfully, that the equilibrium curve has the expected endpoints, and that an invalid reflux ratio is rejected.
The simulator requires:
| Parameter | Description |
|---|---|
| Relative volatility (α) | Relative volatility of the more volatile component |
| Distillate composition (xD) | Desired mole fraction in the distillate |
| Bottoms composition (xB) | Desired mole fraction in the bottoms |
| Feed composition (zF) | Mole fraction of the more volatile component in the feed |
| Reflux ratio (R) | Operating reflux ratio |
| Feed condition (q) | Thermal condition of the feed |
The current model assumes:
- Binary mixture
- Constant relative volatility
- Equilibrium stages
- Constant molar overflow
- Steady-state operation
- Idealized McCabe-Thiele assumptions
The simulator is intended for educational and engineering project purposes not detailed industrial column design.
- Python
- NumPy
- Matplotlib
- Streamlit
- Pytest
Made by Rofhiwa Percy Netshilongwe.
View my other Projects
-
Lamm, M. H., & Jarboe, L. (2022). Chemical Engineering Separations: A Handbook for Students — Distillation. Iowa State University Digital Press / Engineering LibreTexts. Engineering LibreTexts — Distillation
-
Woolf, B. (2020). ODE and Excel Model of a Simple Distillation Column. Engineering LibreTexts. Engineering LibreTexts — Distillation Column Model
-
Coleman, S. (2019). Distillation Science — Putting It All Together. Engineering LibreTexts. Engineering LibreTexts — Putting It All Together