Skip to content

Commit 669d276

Browse files
committed
improvements
1 parent 9a9886f commit 669d276

File tree

9 files changed

+1830
-271
lines changed

9 files changed

+1830
-271
lines changed

.github/skills/neqsim-unisim-reader/SKILL.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,55 @@ that was specifically fitted with both OMEGAA and BICs together.
326326
NeqSim's E300 recognized name map — they will be treated as TBP pseudo-fractions
327327
with estimated density.
328328

329+
### E300 Fluid Export (DEFAULT — Recommended Route)
330+
331+
**The E300 export route is the default and preferred method for transferring
332+
fluid definitions from UniSim to NeqSim.** It preserves all critical properties
333+
(Tc, Pc, acentric factor, MW, BIPs, volume shifts, parachors) for both standard
334+
and hypothetical/pseudo components — including C7+ fractions that cannot be
335+
accurately recreated by component name mapping alone.
336+
337+
When `UniSimReader.read()` is called with `export_e300=True` (the default),
338+
it extracts critical properties from each component in each fluid package via COM,
339+
then writes an E300 file per fluid package to the output directory.
340+
341+
**COM properties extracted per component:**
342+
- `component.CriticalTemperature` → Tc (K)
343+
- `component.CriticalPressure` → Pc (kPa → bara, divide by 100)
344+
- `component.AcentricFactor` → omega
345+
- `component.MolecularWeight` → MW (g/mol)
346+
- `component.NormalBoilingPoint` → Tboil (K)
347+
- `component.CriticalVolume` → Vcrit (m³/kgmol)
348+
349+
**BIPs extracted via:** `FluidPackage.PropertyPackage.GetBIP(i, j)` or
350+
`PropertyPackage.BinaryInteractionParameters` (matrix fallback).
351+
352+
**E300 file format keywords:**
353+
`METRIC`, `NCOMPS`, `EOS`, `PRCORR`, `RTEMP`, `STCOND`, `CNAMES`, `TCRIT`,
354+
`PCRIT`, `ACF`, `MW`, `TBOIL`, `VCRIT`, `SSHIFT`, `PARACHOR`, `ZI`, `BIC`
355+
356+
**NeqSim loading:** Use `EclipseFluidReadWrite.read(e300Path)` in Java, or
357+
via Python: `jneqsim.thermo.util.readwrite.EclipseFluidReadWrite.read(path)`.
358+
359+
**Automatic integration:** When `build_and_run()` detects an E300 file in the
360+
fluid section, it loads the fluid via `EclipseFluidReadWrite.read()` and passes
361+
it to `ProcessSystem.fromJsonAndRun(json, fluid)`, bypassing component name
362+
mapping entirely.
363+
364+
```python
365+
# Example: Full E300 workflow
366+
reader = UniSimReader()
367+
model = reader.read(r'C:\path\to\model.usc') # auto-exports E300 files
368+
369+
# E300 files now available:
370+
for fp in model.fluid_packages:
371+
print(f" {fp.name}: {fp.e300_file_path}")
372+
373+
# Convert to NeqSim and run — E300 fluid used automatically
374+
converter = UniSimToNeqSim(model)
375+
result = converter.build_and_run()
376+
```
377+
329378
---
330379

331380
## 2. Operation Type Mapping

AGENTS.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,7 @@ ImpurityMonitor = jpype.JClass("neqsim.process.measurementdevice.ImpurityMonitor
693693
| `src/main/java/neqsim/process/processmodel/` | ProcessSystem, ProcessConnection, ProcessElementInterface, JsonProcessBuilder, SimulationResult |
694694
| `src/main/java/neqsim/process/automation/` | ProcessAutomation (string-addressable variable API), AutomationDiagnostics (fuzzy matching, auto-correction, physical validation, learning), SimulationVariable (INPUT/OUTPUT descriptor) |
695695
| `src/main/java/neqsim/process/processmodel/lifecycle/` | ProcessSystemState, ProcessModelState — JSON lifecycle snapshots, version comparison, compressed transfer |
696-
| `devtools/unisim_reader.py` | UniSim COM reader → NeqSim Python/notebook/EOT/JSON (UniSimReader, UniSimToNeqSim, UniSimComparator). 45+ op types, port-specific forward refs, auto-recycle wiring. Verified with TUTOR1.usc (11/13 streams match). |
696+
| `devtools/unisim_reader.py` | UniSim COM reader → NeqSim Python/notebook/EOT/JSON (UniSimReader, UniSimToNeqSim, UniSimComparator). 45+ op types, port-specific forward refs, auto-recycle wiring. **Default E300 fluid export**: `read(export_e300=True)` extracts Tc, Pc, omega, MW, BIPs from COM and writes E300 files for all fluid packages. `build_and_run()` auto-loads E300 fluids via `EclipseFluidReadWrite.read()` and `ProcessSystem.fromJsonAndRun(json, fluid)`. Verified with TUTOR1.usc (11/13 streams match). |
697697
| `devtools/test_unisim_outputs.py` | 14 tests for all UniSim converter output modes (no COM needed — synthetic models) |
698698
| `examples/notebooks/tutor1_gas_processing.ipynb` | End-to-end UniSim→NeqSim verification: TUTOR1 gas processing (7 comp, PR EOS, 13 ops). Reference for conversion workflows. |
699699
| `src/main/java/neqsim/process/mechanicaldesign/subsea/` | Well & SURF design, cost estimation |
@@ -749,7 +749,7 @@ Skills are reusable knowledge packages loaded automatically by agents:
749749
| `neqsim-subsea-and-wells` | Subsea systems, well design, SURF cost, tieback analysis |
750750
| `neqsim-production-optimization` | Decline curves, bottleneck analysis, gas lift, network optimization |
751751
| `neqsim-process-extraction` | Extract process data from text/tables/PFDs into NeqSim JSON builder format |
752-
| `neqsim-unisim-reader` | UniSim COM reader — component/EOS/operation mapping, topology reconstruction, forward refs, verification. Includes TUTOR1 verified reference case, DistillationColumn solver limitations for NGL-rich feeds, HeatExchanger UA tuning notes, separator 2-phase/3-phase auto-detection (flashtank with WaterProduct promoted to ThreePhaseSeparator), orientation detection (vertical → GasScrubber, horizontal → Separator), and entrainment extraction (liquid carryover, gas carry-under, water-in-oil, oil-in-water). |
752+
| `neqsim-unisim-reader` | UniSim COM reader — component/EOS/operation mapping, topology reconstruction, forward refs, verification. **Default E300 fluid export** for lossless transfer of critical properties (Tc, Pc, omega, MW, BIPs) including hypothetical/pseudo components. Includes TUTOR1 verified reference case, DistillationColumn solver limitations for NGL-rich feeds, HeatExchanger UA tuning notes, separator 2-phase/3-phase auto-detection (flashtank with WaterProduct promoted to ThreePhaseSeparator), orientation detection (vertical → GasScrubber, horizontal → Separator), and entrainment extraction (liquid carryover, gas carry-under, water-in-oil, oil-in-water). |
753753
| `neqsim-eos-regression` | EOS parameter regression — kij tuning, PVT matching (CME, CVD), C7+ characterization, scipy optimization |
754754
| `neqsim-reaction-engineering` | Reactor patterns — GibbsReactor, PlugFlowReactor, StirredTankReactor, KineticReaction, CatalystBed |
755755
| `neqsim-dynamic-simulation` | Dynamic simulation — runTransient, PID controllers, transmitters, tuning, depressurization |

CHANGELOG_AGENT_NOTES.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,55 @@
99
1010
---
1111

12+
## 2026-07-08 — UniSim Reader: Default E300 Fluid Export
13+
14+
### E300 is Now the Default Fluid Transfer Route
15+
16+
When importing fluids from UniSim to NeqSim, the **E300 file route is now the
17+
default**. `UniSimReader.read(export_e300=True)` (the default) extracts critical
18+
properties (Tc, Pc, acentric factor, MW, BIPs, volume shifts) from each component
19+
via COM and writes an E300 file per fluid package.
20+
21+
This preserves all thermodynamic characterization — including hypothetical/pseudo
22+
components like C7+ fractions — that component name mapping alone cannot capture.
23+
24+
### New Java Overloads
25+
26+
```java
27+
// Build and run with a pre-built fluid (e.g., from E300 file)
28+
ProcessSystem.fromJsonAndRun(String json, SystemInterface fluid)
29+
JsonProcessBuilder.buildAndRun(String json, SystemInterface fluid)
30+
```
31+
32+
### Python Usage (Automatic)
33+
34+
```python
35+
reader = UniSimReader()
36+
model = reader.read(r'C:\path\to\model.usc') # auto-exports E300 files
37+
for fp in model.fluid_packages:
38+
print(f" {fp.name}: {fp.e300_file_path}")
39+
40+
converter = UniSimToNeqSim(model)
41+
result = converter.build_and_run() # auto-loads E300 fluid
42+
```
43+
44+
### Python Usage (Manual E300 Loading)
45+
46+
```python
47+
from neqsim import jneqsim
48+
EclipseFluidReadWrite = jneqsim.thermo.util.readwrite.EclipseFluidReadWrite
49+
fluid = EclipseFluidReadWrite.read(r'C:\path\to\model_FluidPkg.e300')
50+
```
51+
52+
### Affected Files
53+
- `devtools/unisim_reader.py``UniSimComponent` (critical properties), `UniSimFluidPackage` (`write_e300()`, `has_critical_properties`), `_extract_fluid_packages()` (COM property extraction), `_extract_bips()` (new), `read()` (`export_e300` parameter), `_build_fluid_section()` (E300 path in fluid dict), `build_and_run()` (E300 auto-loading)
54+
- `src/main/java/neqsim/process/processmodel/JsonProcessBuilder.java``buildAndRun(String, SystemInterface)`, `buildFromJsonObject(JsonObject, SystemInterface)`
55+
- `src/main/java/neqsim/process/processmodel/ProcessSystem.java``fromJsonAndRun(String, SystemInterface)`
56+
- `.github/skills/neqsim-unisim-reader/SKILL.md` — E300 section added
57+
- `AGENTS.md` — Updated descriptions
58+
59+
---
60+
1261
## 2026-07-08 — UniSim Reader: Orientation Detection (GasScrubber)
1362
<<<<<<< HEAD
1463

0 commit comments

Comments
 (0)