Skip to content

Repository files navigation

Binary Distillation Column Surrogate Modeling (DWSIM + Machine Learning)


1. Project Overview & Scope

This project delivers a machine learning surrogate model for a continuous binary distillation column separating Benzene (Light Key) and Toluene (Heavy Key) using the Peng–Robinson (PR) Equation of State in DWSIM.

The surrogate model predicts four key column performance indicators directly from operational input conditions:

  1. Distillate Purity ($x_D$) [mol/mol][cite: 6]
  2. Bottoms Purity ($x_B$) [mol/mol][cite: 6]
  3. Condenser Duty ($Q_C$) [kW][cite: 6]
  4. Reboiler Duty ($Q_R$) [kW][cite: 6]

2. Directory & File Structure

STAGE1_SCREENING_TASK_SUBMISSION/
├── Report.pdf                              # Formal technical screening report
├── Results_Summary.pdf                     # Key performance metrics & physical audit[cite: 7, 18]
├── Results_Summary.txt                     # Plain-text benchmark summary
├── Dataset.csv                             # Full 1,200 simulation runs dataset
├── Dataset.xlsx                            # Multi-sheet styled Excel dataset with dictionary
├── DWSIM_Flowsheet_File.dwxmz              # Rigorous DWSIM flowsheet file (.dwxmz)
├── DWSIM_Flowsheet_File.dwxml              # Flowsheet XML definition (.dwxml)
├── README.md                               # Complete execution and reproduction guide
└── Code/                                   # Source code and modeling pipeline
    ├── train_and_evaluate.py               # Main model training & benchmark script
    ├── validate_physics.py                 # Monotonicity & mass balance audit
    ├── generate_dataset_plots.py           # Automated visualization and EDA generator
    ├── requirements.txt                    # Python environment dependencies
    ├── src/                                # Core modules
    │   ├── config.py                       # Global paths, bounds, and schema[cite: 6]
    │   ├── preprocess.py                   # Data cleaning, filtering, and scaling[cite: 6]
    │   └── models.py                       # ML architectures (Poly, RF, XGB/GBR, ANN)[cite: 6]
    └── artifacts/                          # Model checkpoints, scalers, and figures[cite: 6]
        ├── best_distillation_surrogate.keras[cite: 6]
        ├── scaler_X.pkl[cite: 6]
        ├── scaler_y.pkl[cite: 6]
        ├── ann_parity_plots.png[cite: 6]
        ├── physical_consistency_validation.png[cite: 6]
        ├── dataset_distributions.png[cite: 6]
        ├── distillation_thermodynamic_insights.png[cite: 6]
        └── correlation_heatmap.png

3. Assumptions & Thermodynamic Parameters

  • Thermodynamic Model: Modeled using the cubic Peng–Robinson (PR) Equation of State with standard binary interaction parameters ($k_{ij} = 0.0$).
  • Operating Conditions: Steady-state operation at atmospheric overhead pressure ($P_{\text{top}} = 1.013\text{ bar}$) with a nominal feed flow rate $F = 100\text{ kmol/h}$.
  • Input Feature Sampling Ranges (Latin Hypercube Sampling, $N = 1,200$ runs):
    • Feed Temperature ($T_F$): $298.15 - 368.15\text{ K}$
    • Feed Pressure ($P_F$): $1.00 - 2.50\text{ bar}$
    • Feed Composition ($z_F$): $0.30 - 0.70\text{ mol/mol Benzene}$
    • Number of Theoretical Stages ($N$): $15 - 35\text{ stages}$
    • Feed Stage Index ($N_F$): Stage $5 - 25$
    • Reflux Ratio ($R$): $1.20 - 4.50$
    • Bottoms Withdrawal Rate ($B$): $25.00 - 75.00\text{ kmol/h}$
    • Feed Vapor Fraction ($q_{\text{vap}}$): $0.00 - 1.00\text{ mol/mol}$

4. Machine Learning Benchmark Results

Evaluated on an unseen 20% test partition (240 runs) with standard input and target scaling:

Model Architecture $R^2(x_D)$ $R^2(x_B)$ $R^2(Q_C)$ $R^2(Q_R)$ Overall $R^2$ Purity MAE Duty MAE
Polynomial Regression (Deg 2) 0.9675 0.9699 0.9994 0.9994 0.9840 0.00835 12.12 kW
Random Forest Regressor 0.9280 0.9317 0.9808 0.9772 0.9544 0.01086 69.91 kW
Gradient Boosting / XGBoost 0.9729 0.9776 0.9959 0.9939 0.9850 0.00651 33.36 kW
Target-Normalized Deep ANN 0.9835 0.9813 0.9955 0.9963 0.9891 0.00579 31.87 kW

5. Physical Consistency & Conservation Audit

  • Purity Boundedness ($0.0 \le x_D, x_B \le 1.0$): PASSED (Predictions remain bounded in feasible ranges).
  • Thermal Positivity ($Q_C > 0, Q_R > 0$): PASSED (Non-negative duties enforced across domain).
  • Thermal Monotonicity ($\partial Q_C / \partial R > 0$): PASSED (Spearman Rank Correlation $r = 1.0000$ with Reflux Ratio).
  • Purity Asymptotic Stability: PASSED (Smooth high-purity ceiling without gradient reversal artifacts).
  • Raw Component Mass Balance Drift: 0.60% (Within standard tolerance $< 1.0%$).
  • Physics-Closed Mass Balance: 0.00% (Strict algebraic conservation via $x_B = (F\cdot z_F - D\cdot x_D)/B$).
  • Computational Speedup: Reduces inference time from ~1.800 s (DWSIM solver) to ~0.58 ms (Surrogate), achieving a ~3,100× speedup.

6. How to Run and Reproduce Results

Step 1: Environment Setup

Ensure Python 3.10+ is installed. Open a terminal in the Code/ directory and install dependencies:

cd Code
pip install -r requirements.txt

Step 2: Open and Inspect the DWSIM Flowsheet

  1. Open DWSIM (v8.0 or newer recommended).
  2. Click File -> Open Flowsheet and select DWSIM_Flowsheet_File.dwxmz (or import DWSIM_Flowsheet_File.dwxml).
  3. Press F5 (or click Solve Flowsheet) to verify baseline steady-state convergence.

Step 3: Train and Benchmark Machine Learning Models

Run the training pipeline:

python train_and_evaluate.py
  • Fits all 4 surrogate models on Dataset.csv.
  • Outputs comparative $R^2$, MAE, and RMSE metrics on the 20% test split.
  • Saves the optimal Deep ANN model to artifacts/best_distillation_surrogate.keras and generates parity plots.

Step 4: Run Physical Consistency & Monotonicity Audit

Execute the validation script:

python validate_physics.py
  • Audits physical bounding, duty non-negativity, and reflux monotonicity.
  • Computes component material balance closure.
  • Exports sensitivity curves to artifacts/physical_consistency_validation.png.

Step 5: Generate Exploratory Data Analysis & Insight Figures

To generate the full suite of figures from Dataset.csv, run:

python generate_dataset_plots.py

About

Physics-informed machine learning surrogate modeling for a binary distillation column (Benzene–Toluene) using DWSIM simulation data and Deep ANN.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages