{ "cells": [ {"cell_type": "markdown", "metadata": {}, "source": [ "# Roller Compaction DOE/RSM — Sample Analysis\n", "\n", "**Dataset:** Roller Compaction: Ribbon Density vs. Process Parameters (Synthetic) v1.0\n", "**Publisher:** [Innovative Process Applications (IPA)](https://www.innovativeprocess.com)\n", "**License:** CC BY 4.0\n", "\n", "> This is **synthetic educational data**. See `README.md` for the physical model (Johanson + Heckel) used to generate it.\n", "\n", "This notebook walks through a typical Quality-by-Design workflow:\n", "1. Load and explore the data\n", "2. Fit a response surface (quadratic) model for ribbon density\n", "3. Identify the operating window that maximizes density while keeping uniformity (CV%) under 3%" ]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", "import numpy as np\n", "import matplotlib.pyplot as plt\n", "from sklearn.linear_model import LinearRegression\n", "from sklearn.preprocessing import PolynomialFeatures\n", "from sklearn.metrics import r2_score\n", "\n", "df = pd.read_csv('ribbon_density_v1.0.csv')\n", "print(df.shape)\n", "df.head()" ]}, {"cell_type": "markdown", "metadata": {}, "source": ["## 1. Explore the process parameters"]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "fig, axes = plt.subplots(1, 3, figsize=(14, 4))\n", "axes[0].scatter(df['roll_force_kN_per_cm'], df['ribbon_rel_density'], alpha=0.4)\n", "axes[0].set_xlabel('Roll force (kN/cm)'); axes[0].set_ylabel('Relative density')\n", "axes[0].set_title('Force → density (Heckel)')\n", "\n", "axes[1].scatter(df['feed_screw_rpm']/df['roll_speed_rpm'], df['density_CV_percent'], alpha=0.4, color='C1')\n", "axes[1].set_xlabel('Feed/roll speed ratio'); axes[1].set_ylabel('Density CV %')\n", "axes[1].set_title('Feed ratio → uniformity')\n", "\n", "axes[2].scatter(df['peak_pressure_MPa'], df['ribbon_rel_density'], alpha=0.4, color='C2')\n", "axes[2].set_xlabel('Peak nip pressure (MPa)'); axes[2].set_ylabel('Relative density')\n", "axes[2].set_title('Pressure → density')\n", "plt.tight_layout(); plt.show()" ]}, {"cell_type": "markdown", "metadata": {}, "source": [ "## 2. Fit a quadratic response surface\n", "\n", "Classic RSM model: ribbon density as a quadratic function of the three main process parameters." ]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "X = df[['roll_force_kN_per_cm', 'roll_speed_rpm', 'feed_screw_rpm']].values\n", "y = df['ribbon_rel_density'].values\n", "\n", "poly = PolynomialFeatures(degree=2, include_bias=False)\n", "Xp = poly.fit_transform(X)\n", "model = LinearRegression().fit(Xp, y)\n", "y_pred = model.predict(Xp)\n", "print(f'R² = {r2_score(y, y_pred):.3f}')\n", "\n", "plt.figure(figsize=(5,5))\n", "plt.scatter(y, y_pred, alpha=0.4)\n", "plt.plot([y.min(), y.max()], [y.min(), y.max()], 'k--')\n", "plt.xlabel('Observed rel. density'); plt.ylabel('Predicted')\n", "plt.title('RSM fit'); plt.show()" ]}, {"cell_type": "markdown", "metadata": {}, "source": [ "## 3. Find the design space\n", "\n", "QbD asks: which combinations of process parameters give us a target density **AND** acceptable uniformity?\n", "\n", "Let's define an acceptable region as: relative density ≥ 0.70 AND density CV% ≤ 3.0%." ]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "in_spec = (df['ribbon_rel_density'] >= 0.70) & (df['density_CV_percent'] <= 3.0)\n", "print(f'{in_spec.sum()} of {len(df)} runs meet spec ({100*in_spec.mean():.1f}%)')\n", "\n", "fig, ax = plt.subplots(figsize=(7, 5))\n", "ax.scatter(df.loc[~in_spec, 'roll_force_kN_per_cm'], df.loc[~in_spec, 'feed_screw_rpm']/df.loc[~in_spec, 'roll_speed_rpm'], alpha=0.3, label='Out of spec', color='lightgray')\n", "ax.scatter(df.loc[in_spec, 'roll_force_kN_per_cm'], df.loc[in_spec, 'feed_screw_rpm']/df.loc[in_spec, 'roll_speed_rpm'], alpha=0.6, label='In spec', color='teal')\n", "ax.set_xlabel('Roll force (kN/cm)'); ax.set_ylabel('Feed/roll ratio')\n", "ax.set_title('Design space: density ≥ 0.70 AND CV ≤ 3%')\n", "ax.legend(); plt.show()" ]}, {"cell_type": "markdown", "metadata": {}, "source": [ "## Takeaway\n", "\n", "The design space clusters around **roll force ≥ 6 kN/cm** and **feed/roll ratio ≈ 8–15** — consistent with the physics of a well-fed nip on a twin-feed-screw roller compactor.\n", "\n", "For production-scale equipment that achieves this operating window consistently, see IPA's CL-series twin-feed-screw compactors: https://www.innovativeprocess.com\n", "\n", "---\n", "*Dataset © 2026 Innovative Process Applications, CC BY 4.0. Synthetic educational data — not real measurements.*" ]} ], "metadata": { "kernelspec": {"display_name": "Python 3", "language": "python", "name": "python3"}, "language_info": {"name": "python", "version": "3.11"} }, "nbformat": 4, "nbformat_minor": 5 }