MFCBlend
Vendor-neutral gas-feed planning for catalytic reactors using the cylinders and mass-flow controllers (MFCs) that are actually available in the laboratory.
Why
A target such as 5 mol% CO2 and 20 mol% H2 is not enough to set a reactor feed when the laboratory owns premixed cylinders and MFCs with minimum, maximum, and turndown limits. MFCBlend records those constraints, solves the general linear mixing balance, and refuses to label an infeasible target as an exact plan.
MFCBlend is decision support, not instrument control, a reactor simulator, or a flammability/process-safety certification tool.
Install
Until the first PyPI release, install the public repository source:
python -m venv .venv
source .venv/bin/activate
python -m pip install "git+https://github.com/hdkim99/MFCBlend.git"
After a PyPI release is published, python -m pip install mfcblend is the
equivalent package install.
The headless core and CLI do not import Tkinter, Qt, or a Matplotlib GUI backend. For the desktop workflow and optional result figure support:
python -m pip install "mfcblend[gui]"
python -m mfcblend.gui
For a local checkout, use python -m pip install . or python -m pip install ".[gui]".
30-second inverse example
examples/co2_hydrogen_system.json defines:
- 10% CO2 / N2, 50% H2 / N2, and pure N2 cylinders;
- each connected MFC's off/operating ranges and optional turndown;
sccmreferenced to 273.15 K and 101325 Pa absolute.
mfcblend inverse \
examples/co2_hydrogen_system.json \
examples/target_5co2_20h2.json \
--output plan.json
The exact material-balance result is 100 sccm from the CO2 premix, 80 sccm from the H2 premix, and 20 sccm N2, totaling 200 sccm. The output retains the target, achieved composition, reference conditions, residuals, assumptions, and status.
Forward calculation uses the same core:
mfcblend forward \
examples/co2_hydrogen_system.json \
examples/setpoints_5co2_20h2.json \
--output checked-feed.csv
Scientific basis
For cylinder j, species i, and setpoint q_j, MFCBlend uses the steady
ideal-mixing balance
component flow_i = sum_j(y_ij q_j)
mixture fraction_i = component flow_i / sum_j(q_j)
Inverse mode solves this generalized linear system subject to nonnegative MFC
flows and the stated limits. An MFC may be off, or it must be between its
effective minimum and maximum. When a turndown ratio is supplied, the effective
minimum is max(stated minimum, full scale / turndown). Active MFC subsets are
enumerated (currently up to 16 MFCs) and each bounded linear least-squares problem
is solved with SciPy. Approximate results are opt-in and explicitly labelled.
Equivalent volumetric flow is converted to molar flow only with its explicit
reference conditions and the ideal-gas relationship n_dot = P_ref Q_ref / (R T_ref). NIST warns that sccm can use different reference temperatures. MFCBlend
therefore has no hidden default in configuration files.
Authoritative sources and equation-to-code links are in
docs/scientific-basis.md.
Python API
from mfcblend import inverse_mix
from mfcblend.io import load_system
system = load_system("examples/co2_hydrogen_system.json")
result = inverse_mix(system, {"CO2": 0.05, "H2": 0.20}, 200.0)
assert result.status.value == "exact"
Importing mfcblend, mfcblend.core, or mfcblend.cli does not initialize a
GUI or Matplotlib backend.
Validation
- unique hand calculation for the documented three-cylinder inverse problem;
- pure- and premixed-cylinder forward composition closure;
- exact overdetermined solve and deliberately infeasible target;
- MFC off/minimum/maximum/turndown boundaries;
- NIST-compatible
sccmmolar-flow regression at 0 °C and 1 atm; - standard-condition conversion preserving ideal-gas molar flow;
- CLI/API/GUI equality and JSON/CSV export wiring;
- clean-wheel, headless CLI, Xvfb GUI lifecycle, and native macOS GUI smoke jobs.
A suitably licensed, machine-readable public catalytic-reactor feed dataset has not yet been adopted. Real-data validation is therefore pending, not claimed.
Supported scope and limitations
Implemented:
- arbitrary cylinder/species matrices on a molar-fraction basis;
- forward and inverse modes;
- exact, approximate, and infeasible status separation;
- off-or-operating MFC ranges and turndown;
- explicit
sccm,slm, ornml/minreference temperature/pressure; - ideal-gas molar flow, ideal partial pressure, reactant ratios, and GHSV API;
- JSON inputs and JSON/CSV result export.
Explicitly unsupported in 0.1.0:
- instrument communication or automatic setpoint application;
- non-ideal-gas corrections, calibration-gas correction factors, uncertainty, dynamics, pressure drops, and full reactor simulation;
- water saturators or condensable-feed phase equilibrium;
- WHSV without an explicit mass-flow model;
- flammability, explosion limits, gas compatibility, and safety certification.
An exact result means only that the stated ideal material-balance target can be
met within the supplied numerical tolerances and limits. It does not establish
that the physical setup is safe, calibrated, stable, or accurately mixed.
Platforms and GUI
- Python 3.10–3.14;
- macOS 13+ is the stated target for Python.org/Homebrew CPython on Apple Silicon and Intel; combinations not exercised by CI are not claimed as verified;
- Tkinter/ttk is the only GUI framework; PyQt and PySide are not dependencies;
- CLI/headless operation works without GUI extras;
- plotting sets
Agginside the plotting entry point; Tk uses its native Tk event loop and never selects a Qt backend.
See docs/macos.md for verified combinations and diagnostic
commands.
Development and citation
See CONTRIBUTING.md, SECURITY.md, and CITATION.cff. Version 0.1.0 is an alpha release; 1.0.0 requires external user experience and broader real-data validation.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mfcblend-0.1.0.tar.gz.
File metadata
- Download URL: mfcblend-0.1.0.tar.gz
- Upload date:
- Size: 84.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fe105d089392c838b589be893bd4ce426d5f569b282651552b76035977bfb346
|
|
| MD5 |
20c757b1aa2627ee2172147a30a3d294
|
|
| BLAKE2b-256 |
c3ea25a1bf63db2c7df6da7899bd8d83d324dcac932ffff9d2a8c5a1e1e83535
|
Provenance
The following attestation bundles were made for mfcblend-0.1.0.tar.gz:
Publisher:
release.yml on hdkim99/MFCBlend
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mfcblend-0.1.0.tar.gz -
Subject digest:
fe105d089392c838b589be893bd4ce426d5f569b282651552b76035977bfb346 - Sigstore transparency entry: 2571325428
- Sigstore integration time:
-
Permalink:
hdkim99/MFCBlend@6c1728e040e55014d367302a3bf5bdfbafd84a8f -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/hdkim99
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@6c1728e040e55014d367302a3bf5bdfbafd84a8f -
Trigger Event:
release
-
Statement type:
File details
Details for the file mfcblend-0.1.0-py3-none-any.whl.
File metadata
- Download URL: mfcblend-0.1.0-py3-none-any.whl
- Upload date:
- Size: 24.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d290f978f9e87ca0a50424583524e362ef63af72170d0f602d1a6e7e86ce63b0
|
|
| MD5 |
b9a610c7a3d3f009d4a2b1d1c8d8bbb0
|
|
| BLAKE2b-256 |
56e8262b2a80968958b3e60704ae32646c4fa996d77c972f206f82aab04b6bf7
|
Provenance
The following attestation bundles were made for mfcblend-0.1.0-py3-none-any.whl:
Publisher:
release.yml on hdkim99/MFCBlend
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mfcblend-0.1.0-py3-none-any.whl -
Subject digest:
d290f978f9e87ca0a50424583524e362ef63af72170d0f602d1a6e7e86ce63b0 - Sigstore transparency entry: 2571325462
- Sigstore integration time:
-
Permalink:
hdkim99/MFCBlend@6c1728e040e55014d367302a3bf5bdfbafd84a8f -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/hdkim99
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@6c1728e040e55014d367302a3bf5bdfbafd84a8f -
Trigger Event:
release
-
Statement type: