processforge 0.4.1__tar.gz → 0.5.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {processforge-0.4.1/src/processforge.egg-info → processforge-0.5.0}/PKG-INFO +1 -1
- processforge-0.5.0/flowsheets/custom/crimson/simple_water_system.json +163 -0
- {processforge-0.4.1 → processforge-0.5.0}/pyproject.toml +1 -1
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/__init__.py +1 -1
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/cli/common.py +3 -3
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/cli/runs.py +40 -13
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/flowsheet.py +27 -14
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/providers/__init__.py +20 -0
- processforge-0.5.0/src/processforge/providers/_sim_strategy.py +70 -0
- processforge-0.5.0/src/processforge/providers/base_simulation_provider.py +92 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/providers/cantera_provider.py +2 -1
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/providers/container_client.py +2 -1
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/providers/coolprop_provider.py +4 -3
- processforge-0.5.0/src/processforge/providers/errors.py +453 -0
- processforge-0.5.0/src/processforge/providers/festim/__init__.py +16 -0
- processforge-0.5.0/src/processforge/providers/festim/build_helpers.py +349 -0
- processforge-0.5.0/src/processforge/providers/festim/provider.py +171 -0
- processforge-0.5.0/src/processforge/providers/festim/result_extraction.py +106 -0
- processforge-0.5.0/src/processforge/providers/festim/strategies.py +93 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/providers/manager.py +45 -35
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/providers/modelica_provider.py +2 -1
- processforge-0.5.0/src/processforge/providers/openmc/__init__.py +16 -0
- processforge-0.5.0/src/processforge/providers/openmc/build_helpers.py +163 -0
- processforge-0.5.0/src/processforge/providers/openmc/provider.py +327 -0
- processforge-0.5.0/src/processforge/providers/openmc/result_extraction.py +194 -0
- processforge-0.5.0/src/processforge/providers/openmc/strategies.py +217 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/providers/registry.py +83 -61
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/result.py +33 -9
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/schemas/festim/festim_model.py +1 -1
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/types.py +1 -1
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/utils/validate_flowsheet.py +3 -3
- {processforge-0.4.1 → processforge-0.5.0/src/processforge.egg-info}/PKG-INFO +1 -1
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge.egg-info/SOURCES.txt +13 -2
- {processforge-0.4.1 → processforge-0.5.0}/tests/test_cli.py +9 -2
- {processforge-0.4.1 → processforge-0.5.0}/tests/test_coupling.py +1 -1
- {processforge-0.4.1 → processforge-0.5.0}/tests/test_festim_provider.py +35 -39
- {processforge-0.4.1 → processforge-0.5.0}/tests/test_init.py +6 -6
- {processforge-0.4.1 → processforge-0.5.0}/tests/test_openmc_provider.py +1 -1
- processforge-0.5.0/tests/test_provider_errors.py +216 -0
- {processforge-0.4.1 → processforge-0.5.0}/tests/test_providers.py +30 -3
- processforge-0.5.0/tests/test_result_zarr.py +158 -0
- {processforge-0.4.1 → processforge-0.5.0}/tests/test_runs_command.py +85 -14
- processforge-0.4.1/src/processforge/providers/errors.py +0 -276
- processforge-0.4.1/src/processforge/providers/festim_provider.py +0 -917
- processforge-0.4.1/src/processforge/providers/openmc_provider.py +0 -1066
- processforge-0.4.1/tests/test_provider_errors.py +0 -104
- processforge-0.4.1/tests/test_result_zarr.py +0 -73
- {processforge-0.4.1 → processforge-0.5.0}/LICENSE +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/MANIFEST.in +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/README.md +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/flowsheets/closed-loop-chain.json +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/flowsheets/coupled/msre_coupled.json +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/flowsheets/custom/crimson/MUWS_HB.json +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/flowsheets/custom/simple_hyrdaulic_scheme.json +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/flowsheets/festim/hydrogen_transport_1d.json +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/flowsheets/festim/tds_tungsten.json +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/flowsheets/hydraulic-chain.json +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/flowsheets/openmc/msre_eigenvalue.json +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/setup.cfg +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/__main__.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/_schema.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/analysis/__init__.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/analysis/dof.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/api/__init__.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/api/serve.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/cli/__init__.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/cli/apply.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/cli/diagram.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/cli/display.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/cli/export_fmu.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/cli/export_modelica.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/cli/init.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/cli/persist.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/cli/plan.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/cli/run.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/cli/validate.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/compose.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/coupling.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/eo/__init__.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/eo/backends/__init__.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/eo/backends/base.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/eo/backends/casadi_backend.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/eo/backends/pyomo_backend.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/eo/backends/scipy_backend.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/eo/flowsheet.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/eo/jacobian.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/eo/mixin.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/eo/solver.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/eo/stream_var.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/eo/units/__init__.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/eo/units/flash_eo.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/eo/units/heater_eo.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/eo/units/pipes_eo.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/eo/units/pump_eo.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/eo/units/strainer_eo.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/eo/units/valve_eo.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/fmu/__init__.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/fmu/_fmi_vars.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/fmu/builder.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/fmu/interface.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/fmu/slave_template.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/lock.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/modelica/__init__.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/modelica/mo_writer.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/modelica/omc_runner.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/modelica/transpiler.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/modelica/unit_equations.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/output_collector.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/pathsim/__init__.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/pathsim/adapter.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/pcl/__init__.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/pcl/compiler.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/pcl/namespace.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/persistence/__init__.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/persistence/archive.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/persistence/artifact_store.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/provenance.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/providers/base.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/providers/base_jacobian_mixin.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/providers/cantera_jacobian.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/providers/jacobian_contributor.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/providers/modelica_jacobian.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/providers/reference_state_registry.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/quantity.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/result_schema.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/schemas/__init__.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/schemas/flowsheet_schema.json +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/schemas/openmc/openmc_model.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/simulate.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/solver.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/state.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/thermo.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/units/__init__.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/units/base.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/units/cstr.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/units/flash.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/units/heater.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/units/pfr.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/units/pipes.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/units/pump.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/units/registry.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/units/solver_unit.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/units/strainer.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/units/tank.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/units/valve.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/utils/__init__.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/utils/flowsheet_diagram.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/utils/mermaid_diagram.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/utils/s3_upload.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/utils/topology.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/utils/unit_consistency.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge/utils/validation.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge.egg-info/dependency_links.txt +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge.egg-info/entry_points.txt +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge.egg-info/requires.txt +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/src/processforge.egg-info/top_level.txt +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/tests/test_container_client.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/tests/test_display.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/tests/test_festim_schema.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/tests/test_fmu_solverunit.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/tests/test_pathsim_adapter.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/tests/test_persist.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/tests/test_s3_upload.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/tests/test_state.py +0 -0
- {processforge-0.4.1 → processforge-0.5.0}/tests/test_types.py +0 -0
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
{
|
|
2
|
+
"metadata": {
|
|
3
|
+
"name": "Make-up Water System",
|
|
4
|
+
"description": "A simple water system with a tank, pump, and valves.",
|
|
5
|
+
"version": "2.0"
|
|
6
|
+
},
|
|
7
|
+
"providers": {
|
|
8
|
+
"coolprop": {
|
|
9
|
+
"type": "coolprop"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"materials": {
|
|
13
|
+
"Water": {
|
|
14
|
+
"id": 1
|
|
15
|
+
},
|
|
16
|
+
"Steel": {
|
|
17
|
+
"id": 2
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"streams": {
|
|
21
|
+
"feed": {
|
|
22
|
+
"T": 313.00,
|
|
23
|
+
"P": 101325,
|
|
24
|
+
"flowrate": 1,
|
|
25
|
+
"z": {
|
|
26
|
+
"Water": 1.0
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"units": {
|
|
31
|
+
"tank_1": {
|
|
32
|
+
"type": "Tank",
|
|
33
|
+
"in": [
|
|
34
|
+
"feed"
|
|
35
|
+
],
|
|
36
|
+
"out": [
|
|
37
|
+
"tank_1_to_pipe1",
|
|
38
|
+
"tank_1_to_pipe2"
|
|
39
|
+
],
|
|
40
|
+
"outlet_flow": 1.0,
|
|
41
|
+
"initial_n": {
|
|
42
|
+
"Water": 1.0
|
|
43
|
+
},
|
|
44
|
+
"initial_T": 298.15,
|
|
45
|
+
"P": 101325,
|
|
46
|
+
"material": 1
|
|
47
|
+
},
|
|
48
|
+
"pipe_1": {
|
|
49
|
+
"type": "Pipes",
|
|
50
|
+
"in": "tank_1_to_pipe1",
|
|
51
|
+
"out": "after_pipe_1",
|
|
52
|
+
"delta_p": 1000.0,
|
|
53
|
+
"diameter": 0.05,
|
|
54
|
+
"material": 2
|
|
55
|
+
},
|
|
56
|
+
"low_pressure_pump": {
|
|
57
|
+
"type": "Pump",
|
|
58
|
+
"in": "after_pipe_1",
|
|
59
|
+
"out": "after_low_pressure_pump",
|
|
60
|
+
"q_flowrate": 4,
|
|
61
|
+
"head": 57,
|
|
62
|
+
"efficiency": 36,
|
|
63
|
+
"power": 1.3,
|
|
64
|
+
"cap": 2.5,
|
|
65
|
+
"motor_rating": 370,
|
|
66
|
+
"material": 2,
|
|
67
|
+
"delta_p": 1000.0
|
|
68
|
+
},
|
|
69
|
+
"pipe_2": {
|
|
70
|
+
"type": "Pipes",
|
|
71
|
+
"in": "tank_1_to_pipe2",
|
|
72
|
+
"out": "after_pipe_2",
|
|
73
|
+
"delta_p": 1000.0,
|
|
74
|
+
"diameter": 0.05,
|
|
75
|
+
"material": 2
|
|
76
|
+
},
|
|
77
|
+
"pipe_3": {
|
|
78
|
+
"type": "Pipes",
|
|
79
|
+
"in": "after_low_pressure_pump",
|
|
80
|
+
"out": "after_pipe_3",
|
|
81
|
+
"delta_p": 1000.0,
|
|
82
|
+
"diameter": 0.05,
|
|
83
|
+
"material": 2
|
|
84
|
+
},
|
|
85
|
+
"drain_valve_1": {
|
|
86
|
+
"type": "Valve",
|
|
87
|
+
"in": "after_pipe_2",
|
|
88
|
+
"out": "after_drain_valve_1",
|
|
89
|
+
"material": 2,
|
|
90
|
+
"valve_type": "drain",
|
|
91
|
+
"p_start_open": 2059396.5,
|
|
92
|
+
"p_full_open": 2451662.5,
|
|
93
|
+
"flow_min": 2.7778e-05,
|
|
94
|
+
"flow_max": 0.0013889
|
|
95
|
+
},
|
|
96
|
+
"make_up_valve_1": {
|
|
97
|
+
"type": "Valve",
|
|
98
|
+
"in": "after_pipe_3",
|
|
99
|
+
"out": "after_make_up_valve_1",
|
|
100
|
+
"material": 2,
|
|
101
|
+
"valve_type": "makeup",
|
|
102
|
+
"p_start_open": 1863273.5,
|
|
103
|
+
"p_full_open": 1470997.5,
|
|
104
|
+
"flow_min": 5.5556e-05,
|
|
105
|
+
"flow_max": 0.0016667
|
|
106
|
+
},
|
|
107
|
+
"pipe_4": {
|
|
108
|
+
"type": "Pipes",
|
|
109
|
+
"in": "after_make_up_valve_1",
|
|
110
|
+
"out": "after_pipe_4",
|
|
111
|
+
"delta_p": 1000.0,
|
|
112
|
+
"diameter": 0.05,
|
|
113
|
+
"material": 2
|
|
114
|
+
},
|
|
115
|
+
"pipe_5": {
|
|
116
|
+
"type": "Pipes",
|
|
117
|
+
"in": "after_drain_valve_1",
|
|
118
|
+
"out": "after_pipe_5",
|
|
119
|
+
"delta_p": 1000.0,
|
|
120
|
+
"diameter": 0.05,
|
|
121
|
+
"material": 2
|
|
122
|
+
},
|
|
123
|
+
"tank_2": {
|
|
124
|
+
"type": "Tank",
|
|
125
|
+
"in": [
|
|
126
|
+
"after_pipe_4",
|
|
127
|
+
"after_pipe_5"
|
|
128
|
+
],
|
|
129
|
+
"out": "after_tank_2",
|
|
130
|
+
"outlet_flow": 1.0,
|
|
131
|
+
"initial_n": {
|
|
132
|
+
"Water": 1.0
|
|
133
|
+
},
|
|
134
|
+
"initial_T": 298.15,
|
|
135
|
+
"P": 1961330,
|
|
136
|
+
"material": 1
|
|
137
|
+
},
|
|
138
|
+
"pipe_6": {
|
|
139
|
+
"type": "Pipes",
|
|
140
|
+
"in": "after_tank_2",
|
|
141
|
+
"out": "after_pipe_6",
|
|
142
|
+
"delta_p": 1000.0,
|
|
143
|
+
"diameter": 0.05,
|
|
144
|
+
"material": 2
|
|
145
|
+
},
|
|
146
|
+
"manual_drain_valve": {
|
|
147
|
+
"type": "Valve",
|
|
148
|
+
"in": "after_pipe_6",
|
|
149
|
+
"out": "after_manual_drain_valve",
|
|
150
|
+
"opening": 50,
|
|
151
|
+
"q_flowrate": 50,
|
|
152
|
+
"material": 2,
|
|
153
|
+
"pressure_ratio": 0.5
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
"simulation": {
|
|
157
|
+
"mode": "dynamic",
|
|
158
|
+
"t0": 0.0,
|
|
159
|
+
"tf": 20.0,
|
|
160
|
+
"dt": 1.0,
|
|
161
|
+
"backend": "scipy"
|
|
162
|
+
}
|
|
163
|
+
}
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "processforge"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.5.0"
|
|
8
8
|
description = "A Python-based process simulation framework for chemical engineering applications."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = "BSD-3-Clause"
|
|
@@ -252,13 +252,13 @@ def _check_pip_provider(
|
|
|
252
252
|
"""Verify a pip-installable provider's module is importable."""
|
|
253
253
|
from ..providers.registry import _PROVIDER_CATALOG
|
|
254
254
|
|
|
255
|
-
catalog = _PROVIDER_CATALOG.get(ptype
|
|
256
|
-
module = catalog.
|
|
255
|
+
catalog = _PROVIDER_CATALOG.get(ptype)
|
|
256
|
+
module = catalog.module if catalog else ""
|
|
257
257
|
try:
|
|
258
258
|
importlib.util.find_spec(module)
|
|
259
259
|
logger.info(f" [OK] {name} [{ptype}] (pip — importable)")
|
|
260
260
|
except (ModuleNotFoundError, ValueError):
|
|
261
|
-
dep = catalog.
|
|
261
|
+
dep = catalog.optional_dep if catalog else None
|
|
262
262
|
hint = f"pip install 'processforge[{dep}]'" if dep else "built-in"
|
|
263
263
|
msg = (
|
|
264
264
|
f" [WARN] {name} [{ptype}] — not installed. "
|
|
@@ -11,7 +11,16 @@ from loguru import logger
|
|
|
11
11
|
|
|
12
12
|
from .common import flowsheet_basename, output_root
|
|
13
13
|
from ..persistence.archive import ProcessStateArchive
|
|
14
|
-
from ..result import
|
|
14
|
+
from ..result import (
|
|
15
|
+
_fmt_scientific,
|
|
16
|
+
_one_line_summary,
|
|
17
|
+
_scalar_from_sequence,
|
|
18
|
+
summarize_zarr_store,
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
# Fixed column widths for the compact single-run stream table.
|
|
22
|
+
STREAM_COL_WIDTH = 28
|
|
23
|
+
VAR_COL_WIDTH = 10
|
|
15
24
|
|
|
16
25
|
|
|
17
26
|
def _humanize_timestamp(ts: str) -> str:
|
|
@@ -42,8 +51,8 @@ def _artifact_status(artifact: dict) -> str:
|
|
|
42
51
|
return "missing"
|
|
43
52
|
|
|
44
53
|
|
|
45
|
-
def
|
|
46
|
-
"""Format a
|
|
54
|
+
def _format_run_compact(manifest, summary: dict) -> str:
|
|
55
|
+
"""Format a compact, human-readable result summary for a single run."""
|
|
47
56
|
lines = [
|
|
48
57
|
f"Run: {manifest.run_id}",
|
|
49
58
|
f"Timestamp: {manifest.timestamp}",
|
|
@@ -61,17 +70,25 @@ def _format_run_details(manifest, summary: dict) -> str:
|
|
|
61
70
|
status = eo.get("status", "")
|
|
62
71
|
lines.append(f"{name} ({engine} / {sim_type}) [{status}]")
|
|
63
72
|
for fname, fdata in eo.get("fields", {}).items():
|
|
64
|
-
val = _fmt_scientific(fdata.get("value"))
|
|
73
|
+
val = _fmt_scientific(_scalar_from_sequence(fdata.get("value")))
|
|
65
74
|
unit = fdata.get("unit", "")
|
|
66
75
|
std = fdata.get("std_dev")
|
|
67
76
|
if std is not None:
|
|
68
|
-
lines.append(
|
|
77
|
+
lines.append(
|
|
78
|
+
f" {fname}: {val} ± {_fmt_scientific(std)} {unit}".strip()
|
|
79
|
+
)
|
|
69
80
|
else:
|
|
70
81
|
lines.append(f" {fname}: {val} {unit}".strip())
|
|
71
82
|
if eo.get("attrs") and not eo.get("fields"):
|
|
72
83
|
for k, v in eo["attrs"].items():
|
|
73
|
-
if not k.startswith("_") and k not in (
|
|
74
|
-
|
|
84
|
+
if not k.startswith("_") and k not in (
|
|
85
|
+
"engine",
|
|
86
|
+
"sim_type",
|
|
87
|
+
"status",
|
|
88
|
+
):
|
|
89
|
+
lines.append(
|
|
90
|
+
f" {k}: {_fmt_scientific(_scalar_from_sequence(v))}"
|
|
91
|
+
)
|
|
75
92
|
lines.append("")
|
|
76
93
|
else:
|
|
77
94
|
lines.append(" (no solver/engine outputs)")
|
|
@@ -79,25 +96,33 @@ def _format_run_details(manifest, summary: dict) -> str:
|
|
|
79
96
|
|
|
80
97
|
streams = summary.get("streams", {})
|
|
81
98
|
if streams:
|
|
82
|
-
lines.append("Streams:")
|
|
99
|
+
lines.append("Streams (final timestep):")
|
|
83
100
|
all_vars: set[str] = set()
|
|
84
101
|
for sdata in streams.values():
|
|
85
102
|
all_vars.update(sdata.get("variables", []))
|
|
86
103
|
all_vars = sorted(all_vars)
|
|
87
104
|
|
|
88
|
-
header_parts = ["stream".ljust(
|
|
105
|
+
header_parts = ["stream".ljust(STREAM_COL_WIDTH)] + [
|
|
106
|
+
v.rjust(VAR_COL_WIDTH) for v in all_vars
|
|
107
|
+
]
|
|
89
108
|
lines.append(" " + " ".join(header_parts))
|
|
90
109
|
lines.append(" " + "-" * len(" ".join(header_parts)))
|
|
91
110
|
for sname in sorted(streams):
|
|
92
111
|
sdata = streams[sname]
|
|
93
112
|
fields = sdata.get("fields", {})
|
|
94
|
-
|
|
113
|
+
display_name = sname[:STREAM_COL_WIDTH]
|
|
114
|
+
row = [display_name.ljust(STREAM_COL_WIDTH)]
|
|
95
115
|
for var in all_vars:
|
|
96
116
|
fdata = fields.get(var, {})
|
|
97
117
|
val = fdata.get("value")
|
|
98
|
-
row.append(
|
|
118
|
+
row.append(
|
|
119
|
+
_fmt_scientific(_scalar_from_sequence(val)).rjust(VAR_COL_WIDTH)
|
|
120
|
+
)
|
|
99
121
|
lines.append(" " + " ".join(row))
|
|
100
122
|
lines.append("")
|
|
123
|
+
else:
|
|
124
|
+
lines.append("Streams: none")
|
|
125
|
+
lines.append("")
|
|
101
126
|
|
|
102
127
|
artifacts = summary.get("artifacts", [])
|
|
103
128
|
if artifacts:
|
|
@@ -106,7 +131,9 @@ def _format_run_details(manifest, summary: dict) -> str:
|
|
|
106
131
|
name = art.get("name", "unknown")
|
|
107
132
|
kind = art.get("kind", "")
|
|
108
133
|
status = _artifact_status(art)
|
|
109
|
-
loc =
|
|
134
|
+
loc = (
|
|
135
|
+
art.get("local_path") or (art.get("remote_uris") or ["no location"])[0]
|
|
136
|
+
)
|
|
110
137
|
lines.append(f" [{kind}] {name}: {status} ({loc})")
|
|
111
138
|
else:
|
|
112
139
|
lines.append("Artifacts: none")
|
|
@@ -170,7 +197,7 @@ def runs(
|
|
|
170
197
|
manifest = archive.load_run(resolved_id)
|
|
171
198
|
summary = summarize_zarr_store(zarr_path)
|
|
172
199
|
summary["_zarr_path"] = zarr_path
|
|
173
|
-
typer.echo(
|
|
200
|
+
typer.echo(_format_run_compact(manifest, summary))
|
|
174
201
|
return
|
|
175
202
|
|
|
176
203
|
# List all runs with a one-line summary.
|
|
@@ -835,6 +835,27 @@ class Flowsheet:
|
|
|
835
835
|
) from exc
|
|
836
836
|
return stream_ts
|
|
837
837
|
|
|
838
|
+
@staticmethod
|
|
839
|
+
def _store_dynamic_outlet(results: dict, cfg: dict, sol) -> None:
|
|
840
|
+
"""Store a unit's dynamic solution into the result streams.
|
|
841
|
+
|
|
842
|
+
Handles the three outlet conventions supported by the framework:
|
|
843
|
+
* ``out`` is a string -> single outlet stream.
|
|
844
|
+
* ``out`` is a list of strings -> broadcast the same solution to each.
|
|
845
|
+
* ``retentate_out`` / ``permeate_out`` -> split the solution by key.
|
|
846
|
+
"""
|
|
847
|
+
if "out" in cfg:
|
|
848
|
+
out_val = cfg["out"]
|
|
849
|
+
if isinstance(out_val, list):
|
|
850
|
+
for stream_name in out_val:
|
|
851
|
+
results[stream_name] = sol
|
|
852
|
+
else:
|
|
853
|
+
results[out_val] = sol
|
|
854
|
+
else:
|
|
855
|
+
for out_key in ["retentate_out", "permeate_out"]:
|
|
856
|
+
if out_key in cfg and out_key in sol:
|
|
857
|
+
results[cfg[out_key]] = sol[out_key]
|
|
858
|
+
|
|
838
859
|
def _run_dynamic_sequential(self, solver, processing_order, results, t_eval, num_steps, start_time, end_time):
|
|
839
860
|
"""Standard sequential dynamic simulation for non-recycle flowsheets."""
|
|
840
861
|
# Process units in topological order
|
|
@@ -842,7 +863,6 @@ class Flowsheet:
|
|
|
842
863
|
unit = self.units[unit_name]
|
|
843
864
|
cfg = self.config["units"][unit_name]
|
|
844
865
|
inlet_name = cfg["in"]
|
|
845
|
-
outlets = self._get_unit_outlets(unit_name)
|
|
846
866
|
if isinstance(inlet_name, list):
|
|
847
867
|
inlet_stream_ts = self._merge_inlet_timeseries(inlet_name, results, num_steps, t_eval)
|
|
848
868
|
else:
|
|
@@ -853,23 +873,13 @@ class Flowsheet:
|
|
|
853
873
|
sol = unit.run_dynamic(
|
|
854
874
|
inlet_stream_ts, (start_time, end_time), t_eval, solver
|
|
855
875
|
)
|
|
856
|
-
|
|
857
|
-
results[outlets[0]] = sol
|
|
858
|
-
else:
|
|
859
|
-
for out_key, stream_name in zip(["retentate_out", "permeate_out"], outlets):
|
|
860
|
-
if out_key in sol:
|
|
861
|
-
results[stream_name] = sol[out_key]
|
|
876
|
+
self._store_dynamic_outlet(results, cfg, sol)
|
|
862
877
|
else:
|
|
863
878
|
logger.debug(f"Processing static unit {unit_name} dynamically")
|
|
864
879
|
sol = self._process_static_unit(
|
|
865
880
|
unit, inlet_stream_ts, t_eval, num_steps
|
|
866
881
|
)
|
|
867
|
-
|
|
868
|
-
results[outlets[0]] = sol
|
|
869
|
-
else:
|
|
870
|
-
for out_key, stream_name in zip(["retentate_out", "permeate_out"], outlets):
|
|
871
|
-
if out_key in sol:
|
|
872
|
-
results[stream_name] = sol[out_key]
|
|
882
|
+
self._store_dynamic_outlet(results, cfg, sol)
|
|
873
883
|
|
|
874
884
|
self.results = results
|
|
875
885
|
logger.info("Dynamic simulation completed")
|
|
@@ -981,7 +991,10 @@ class Flowsheet:
|
|
|
981
991
|
|
|
982
992
|
# Store results for this timestep
|
|
983
993
|
if "out" in cfg:
|
|
984
|
-
|
|
994
|
+
out_val = cfg["out"]
|
|
995
|
+
targets = out_val if isinstance(out_val, list) else [out_val]
|
|
996
|
+
for stream_name in targets:
|
|
997
|
+
self._store_snapshot_in_timeseries(results, stream_name, outlet_snapshot, step, components)
|
|
985
998
|
else:
|
|
986
999
|
for out_key in ["retentate_out", "permeate_out"]:
|
|
987
1000
|
if out_key in cfg and out_key in outlet_snapshot:
|
|
@@ -23,6 +23,16 @@ back to the built-in CoolProp provider — existing flowsheets are unaffected.
|
|
|
23
23
|
from .base import AbstractProvider
|
|
24
24
|
from .base_jacobian_mixin import BaseJacobianMixin
|
|
25
25
|
from .coolprop_provider import CoolPropProvider
|
|
26
|
+
from .errors import (
|
|
27
|
+
ProviderCleanupError,
|
|
28
|
+
ProviderConfigError,
|
|
29
|
+
ProviderError,
|
|
30
|
+
ProviderInitError,
|
|
31
|
+
ProviderNotAvailableError,
|
|
32
|
+
ProviderRunError,
|
|
33
|
+
ProviderRuntimeError,
|
|
34
|
+
ProviderValidationError,
|
|
35
|
+
)
|
|
26
36
|
from .jacobian_contributor import JacobianContributor, ReferenceState
|
|
27
37
|
from .reference_state_registry import ReferenceStateRegistry
|
|
28
38
|
from .registry import get_provider_class, list_providers, register_provider
|
|
@@ -38,4 +48,14 @@ __all__ = [
|
|
|
38
48
|
"ReferenceState",
|
|
39
49
|
"BaseJacobianMixin",
|
|
40
50
|
"ReferenceStateRegistry",
|
|
51
|
+
# Provider error taxonomy
|
|
52
|
+
"ProviderError",
|
|
53
|
+
"ProviderInitError",
|
|
54
|
+
"ProviderNotAvailableError",
|
|
55
|
+
"ProviderRuntimeError",
|
|
56
|
+
"ProviderCleanupError",
|
|
57
|
+
"ProviderValidationError",
|
|
58
|
+
"ProviderConfigError",
|
|
59
|
+
"ProviderRunError",
|
|
41
60
|
]
|
|
61
|
+
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"""Shared simulation-type strategy registry for engine providers.
|
|
2
|
+
|
|
3
|
+
Engine providers such as OpenMC and FESTIM support multiple ``sim_type`` values.
|
|
4
|
+
Each simulation type is implemented as a strategy class that builds the
|
|
5
|
+
engine-specific model for that type. This module provides the shared
|
|
6
|
+
infrastructure so new engines can reuse the same registration pattern.
|
|
7
|
+
|
|
8
|
+
Example::
|
|
9
|
+
|
|
10
|
+
from processforge.providers._sim_strategy import SimStrategy, register_sim_type
|
|
11
|
+
|
|
12
|
+
class MyEngineStrategy(SimStrategy):
|
|
13
|
+
config_model = MyGeometryConfig
|
|
14
|
+
|
|
15
|
+
def build(self, engine_module, solver_cfg, geometry_cfg, materials_map):
|
|
16
|
+
...
|
|
17
|
+
return built_model
|
|
18
|
+
|
|
19
|
+
register_sim_type("my_engine", "my_sim", MyEngineStrategy)
|
|
20
|
+
"""
|
|
21
|
+
from __future__ import annotations
|
|
22
|
+
|
|
23
|
+
from abc import ABC, abstractmethod
|
|
24
|
+
from typing import Any
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class SimStrategy(ABC):
|
|
28
|
+
"""Base class for an engine-specific simulation type.
|
|
29
|
+
|
|
30
|
+
Subclasses declare ``config_model`` — the Pydantic model validating the
|
|
31
|
+
per-strategy ``geometry_config`` block of the flowsheet — and implement
|
|
32
|
+
``build`` to construct the engine model.
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
#: Pydantic model validating the unit's ``geometry_config`` block. ``None``
|
|
36
|
+
#: means the strategy takes no geometry config.
|
|
37
|
+
config_model: type | None = None
|
|
38
|
+
|
|
39
|
+
@abstractmethod
|
|
40
|
+
def build(self, **kwargs: Any) -> Any:
|
|
41
|
+
"""Construct the engine model and return engine-specific objects."""
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
# Engine name -> sim_type name -> strategy class
|
|
45
|
+
_SIM_TYPE_REGISTRIES: dict[str, dict[str, type]] = {}
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def register_sim_type(engine: str, name: str, strategy_cls: type) -> None:
|
|
49
|
+
"""Register a simulation type for a given engine.
|
|
50
|
+
|
|
51
|
+
Args:
|
|
52
|
+
engine: Engine/provider name (e.g. ``"openmc"``, ``"festim"``).
|
|
53
|
+
name: The ``sim_type`` string used in the flowsheet JSON.
|
|
54
|
+
strategy_cls: A subclass of :class:`SimStrategy`.
|
|
55
|
+
"""
|
|
56
|
+
_SIM_TYPE_REGISTRIES.setdefault(engine, {})[name] = strategy_cls
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def get_registered_sim_types(engine: str) -> dict[str, type]:
|
|
60
|
+
"""Return a copy of the sim_type → strategy mapping for *engine*.
|
|
61
|
+
|
|
62
|
+
Returns:
|
|
63
|
+
A dict mapping ``sim_type`` strings to strategy classes.
|
|
64
|
+
"""
|
|
65
|
+
return dict(_SIM_TYPE_REGISTRIES.get(engine, {}))
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def get_strategy(engine: str, sim_type: str) -> type | None:
|
|
69
|
+
"""Return the strategy class for (*engine*, *sim_type*), or ``None``."""
|
|
70
|
+
return _SIM_TYPE_REGISTRIES.get(engine, {}).get(sim_type)
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"""BaseSimulationProvider — shared scaffolding for engine-style providers.
|
|
2
|
+
|
|
3
|
+
Engine providers (OpenMC, FESTIM, and future providers that run standalone
|
|
4
|
+
simulations via ``SolverUnit``) share a common lifecycle:
|
|
5
|
+
|
|
6
|
+
* they do not provide per-stream thermodynamics,
|
|
7
|
+
* they do not intercept ``compute_unit()`` calls,
|
|
8
|
+
* they keep a material registry built from the flowsheet,
|
|
9
|
+
* they resolve a writable run directory with a temp-dir fallback.
|
|
10
|
+
|
|
11
|
+
This base class captures those defaults so concrete providers only implement
|
|
12
|
+
``initialize()`` and ``run_simulation()``.
|
|
13
|
+
"""
|
|
14
|
+
from __future__ import annotations
|
|
15
|
+
|
|
16
|
+
import os
|
|
17
|
+
import pathlib
|
|
18
|
+
import tempfile
|
|
19
|
+
from abc import ABC
|
|
20
|
+
from typing import TYPE_CHECKING, Optional
|
|
21
|
+
|
|
22
|
+
from .base import AbstractProvider
|
|
23
|
+
|
|
24
|
+
if TYPE_CHECKING:
|
|
25
|
+
from processforge.types import FlowsheetConfig, ProviderConfig
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class BaseSimulationProvider(AbstractProvider, ABC):
|
|
29
|
+
"""Base class for providers that run standalone engine simulations.
|
|
30
|
+
|
|
31
|
+
Provides default implementations of ``get_thermo_properties``,
|
|
32
|
+
``compute_unit``, and ``teardown``, plus a helper for resolving a writable
|
|
33
|
+
run directory.
|
|
34
|
+
"""
|
|
35
|
+
|
|
36
|
+
def __init__(self) -> None:
|
|
37
|
+
self._materials: dict = {}
|
|
38
|
+
self._provider_output_dir: str = "outputs"
|
|
39
|
+
self._initialized: bool = False
|
|
40
|
+
|
|
41
|
+
def initialize(
|
|
42
|
+
self,
|
|
43
|
+
provider_config: "ProviderConfig",
|
|
44
|
+
flowsheet_config: "FlowsheetConfig",
|
|
45
|
+
) -> None:
|
|
46
|
+
"""Set up the provider. Must be implemented by subclasses."""
|
|
47
|
+
raise NotImplementedError(
|
|
48
|
+
f"{type(self).__name__} must implement initialize()"
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
def get_thermo_properties(self, stream: dict) -> dict:
|
|
52
|
+
"""Stream thermodynamics are not supported by engine providers."""
|
|
53
|
+
raise NotImplementedError(
|
|
54
|
+
f"{type(self).__name__} does not support stream thermodynamics."
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
def compute_unit(self, unit_type: str, config: dict, inlet: dict):
|
|
58
|
+
"""Engine providers use ``run_simulation()`` via ``SolverUnit``."""
|
|
59
|
+
return None
|
|
60
|
+
|
|
61
|
+
def teardown(self) -> None:
|
|
62
|
+
"""Release provider state."""
|
|
63
|
+
self._initialized = False
|
|
64
|
+
|
|
65
|
+
def _resolve_run_dir(self) -> pathlib.Path:
|
|
66
|
+
"""Create the run output directory, falling back to a temp dir on failure.
|
|
67
|
+
|
|
68
|
+
The configured output dir (often a mounted volume) may not be writable by
|
|
69
|
+
the current user. Fall back to a temp dir so the simulation can still run;
|
|
70
|
+
only the persisted artifacts are lost.
|
|
71
|
+
"""
|
|
72
|
+
run_dir = pathlib.Path(self._provider_output_dir)
|
|
73
|
+
try:
|
|
74
|
+
run_dir.mkdir(parents=True, exist_ok=True)
|
|
75
|
+
except (PermissionError, OSError) as exc:
|
|
76
|
+
run_dir = pathlib.Path(tempfile.mkdtemp(prefix="processforge_"))
|
|
77
|
+
from loguru import logger
|
|
78
|
+
|
|
79
|
+
logger.warning(
|
|
80
|
+
f"{type(self).__name__}: cannot use output dir "
|
|
81
|
+
f"'{self._provider_output_dir}' ({exc}); "
|
|
82
|
+
f"falling back to '{run_dir}'."
|
|
83
|
+
)
|
|
84
|
+
return run_dir
|
|
85
|
+
|
|
86
|
+
def _expand_output_dir(self, output_dir: str) -> str:
|
|
87
|
+
"""Expand env vars and anchor relative paths under the run output root."""
|
|
88
|
+
out_dir = os.path.expandvars(output_dir)
|
|
89
|
+
if not os.path.isabs(out_dir):
|
|
90
|
+
root = os.environ.get("PROCESSFORGE_OUTPUT_DIR", "outputs")
|
|
91
|
+
out_dir = os.path.join(root, out_dir)
|
|
92
|
+
return out_dir
|
|
@@ -7,6 +7,7 @@ from loguru import logger
|
|
|
7
7
|
|
|
8
8
|
from .base import AbstractProvider
|
|
9
9
|
from .cantera_jacobian import CanteraJacobianMixin
|
|
10
|
+
from .errors import ProviderNotAvailableError
|
|
10
11
|
from .registry import register_provider
|
|
11
12
|
|
|
12
13
|
if TYPE_CHECKING:
|
|
@@ -57,7 +58,7 @@ class CanteraProvider(AbstractProvider, CanteraJacobianMixin):
|
|
|
57
58
|
try:
|
|
58
59
|
import cantera as ct
|
|
59
60
|
except ImportError as exc:
|
|
60
|
-
raise
|
|
61
|
+
raise ProviderNotAvailableError(
|
|
61
62
|
"Cantera is not installed. "
|
|
62
63
|
"Install it with: pip install 'processforge[cantera]'"
|
|
63
64
|
) from exc
|
|
@@ -24,6 +24,7 @@ from typing import TYPE_CHECKING, Optional
|
|
|
24
24
|
from loguru import logger
|
|
25
25
|
|
|
26
26
|
from .base import AbstractProvider
|
|
27
|
+
from .errors import ProviderNotAvailableError
|
|
27
28
|
from .registry import get_provider_default_port
|
|
28
29
|
|
|
29
30
|
if TYPE_CHECKING:
|
|
@@ -134,7 +135,7 @@ class ContainerProviderClient(AbstractProvider):
|
|
|
134
135
|
f"status={health.get('status')}"
|
|
135
136
|
)
|
|
136
137
|
except (urllib.error.URLError, OSError, TimeoutError) as exc:
|
|
137
|
-
raise
|
|
138
|
+
raise ProviderNotAvailableError(
|
|
138
139
|
f"Provider '{self._ptype}' service unreachable at {self._url}. "
|
|
139
140
|
f"Ensure the container is running: pf init <flowsheet>"
|
|
140
141
|
) from exc
|
|
@@ -4,6 +4,7 @@ from __future__ import annotations
|
|
|
4
4
|
from typing import TYPE_CHECKING, Optional
|
|
5
5
|
|
|
6
6
|
from .base import AbstractProvider
|
|
7
|
+
from .errors import ProviderNotAvailableError
|
|
7
8
|
|
|
8
9
|
if TYPE_CHECKING:
|
|
9
10
|
from processforge.types import CoolPropProviderConfig, FlowsheetConfig
|
|
@@ -25,11 +26,11 @@ class CoolPropProvider(AbstractProvider):
|
|
|
25
26
|
try:
|
|
26
27
|
import CoolProp.CoolProp as CP
|
|
27
28
|
self.CP = CP
|
|
28
|
-
except ImportError:
|
|
29
|
-
raise
|
|
29
|
+
except ImportError as exc:
|
|
30
|
+
raise ProviderNotAvailableError(
|
|
30
31
|
"CoolProp is not installed. To use the CoolProp thermodynamics provider, "
|
|
31
32
|
"please install it by running `pip install \"processforge[coolprop]\"`"
|
|
32
|
-
)
|
|
33
|
+
) from exc
|
|
33
34
|
|
|
34
35
|
def get_thermo_properties(self, stream: dict) -> dict:
|
|
35
36
|
"""Calculate thermodynamic properties using CoolProp."""
|