Aspen Plus & HYSYS Chemical Process (.in, .inp, .bkp)
@modelscript/aspen (languages/aspen) provides zero-regex parsing, vapor-liquid equilibrium (VLE) flash computation, distillation column MESH equations, DAE lowering, and Modelica 3.x projection for Aspen Plus and Aspen HYSYS chemical flowsheet input decks.
Supported Extensions & Standards
| Extension | Format | Description |
|---|---|---|
.in / .inp | Aspen Plus Input File | Keyword-sectioned chemical process flowsheet, unit operations, stream thermodynamics |
.bkp | Aspen Backup Deck | Serialized ASCII Aspen model topology and stream definitions |
Key Capabilities
1. Rachford-Rice Vapor-Liquid Equilibrium (VLE) Flash Solver
- Solves isothermal (
- ) and adiabatic ( - ) flash equilibrium via the Rachford-Rice equation: where is the vapor fraction, is the feed mole fraction, and is the equilibrium ratio: - Uses modified Antoine vapor pressure equations:
- Implements subcooled liquid (
) and superheated vapor ( ) state identification with monotonic Newton-Raphson bracket solving.
2. Unit Operations & Distillation Columns
- Mixers & Splitters: Rigorous material balance (
) and energy conservation ( ). - Heaters & Coolers: Specified duty (
) or target outlet temperature/vapor fraction. - Flash Separators: Multi-component 2-phase and 3-phase phase separation vessels.
- RadFrac Equilibrium Distillation Columns: Rigorous stage-by-stage MESH equations (Material balance, Equilibrium, Summation, Heat/enthalpy balance).
3. Direct Linear-Memory DAE Lowering
- Compiles flowsheet topology, stream molar balances, and component enthalpies directly into
@modelscript/runtime'sDAEBuilderstruct-of-arrays linear memory arena without intermediary AST allocations. - Emits continuous DAE systems with algebraic stream constraints for joint dynamic simulation with pipeline networks (
@modelscript/lps) and multiphase transient pipelines (@modelscript/olga).
4. Bidirectional Modelica 3.x Projection
- Translates unit operations into standardized
Modelica.Fluidor OpenIPSL thermal-fluid models with acausal fluid ports (m_flow,p,h,Xi).
Pre-Flight Diagnostics
The Aspen analyzer inspects flowsheet connectivity, phase equilibria, and thermodynamic consistency:
15 rules12 error3 warning Run with msx aspen lint
| Code | Rule | Severity | Message |
|---|---|---|---|
M8101 | unconnected-stream-port | error | Stream '<streamName>' connected to block '<blockName>' inlet has no producing source block outlet. |
M8102 | tear-stream-unconverged | error | Circular flowsheet loop detected involving block '<blockName>' without designated tear stream. |
M8103 | invalid-eos-parameter | error | Component '<compName>' lacks critical properties for property method '<propertyMethod>'. |
M8104 | negative-component-fraction | error | Stream '<streamName>' specifies negative component molar fraction for '<compName>' (<val>). |
M8105 | column-reboiler-heat-deficit | warning | Column '<blockName>' duty results in non-positive reboiler boil-up. |
M8106 | duplicate-block-id | error | Duplicate block ID '<blockId>' declared in flowsheet. |
M8107 | duplicate-component-id | error | Duplicate component ID '<compId>' declared in COMPONENTS. |
M8108 | fractions-sum-invalid | warning | Component mole fractions in stream '<streamName>' sum to <value>, expected 1.0. |
M8109 | feed-stage-out-of-range | error | Column '<blockName>' feed stage <stage> is out of bounds (1..<nStages>). |
M8110 | product-stage-out-of-range | error | Column '<blockName>' product stage <stage> is out of bounds (1..<nStages>). |
M8111 | missing-flowsheet-entry | warning | Block '<blockName>' has parameter declarations but is not connected in FLOWSHEET. |
M8112 | stream-temperature-negative | error | Stream '<streamName>' specifies non-physical absolute temperature <temp> K. |
M8113 | stream-pressure-negative | error | Stream '<streamName>' specifies non-positive pressure <pres> bar. |
M8114 | radfrac-stages-too-few | error | RadFrac column '<blockName>' has fewer than 2 stages (<nStages>). |
M8115 | reflux-ratio-negative | error | Column '<blockName>' reflux ratio (<rr>) must be non-negative. |
Generated from languages/aspen/src/errors.ts. All languages →
CLI Usage
bash
# Inspect flowsheet components, blocks, and stream properties
msx aspen inspect MethanolWaterPlant.inp
# Run pre-flight semantic diagnostics
msx aspen lint MethanolWaterPlant.inp
# Solve isothermal flash VLE for a feed stream
msx aspen solve-flash MethanolWaterPlant.inp --stream FEED
# Lower flowsheet to ModelScript linear DAE arena
msx aspen to-dae MethanolWaterPlant.inp
# Project into Modelica 3.x acausal fluid stream model
msx aspen to-modelica MethanolWaterPlant.inp -o MethanolPlant.mo
