Coverage for backend/flowsheetInternals/unitops/config/objects/stream_config.py: 100%
8 statements
« prev ^ index » next coverage.py v7.10.7, created at 2025-11-06 23:27 +0000
« prev ^ index » next coverage.py v7.10.7, created at 2025-11-06 23:27 +0000
1from common.config_types import *
2from common.config_utils import *
5property_combinations = (
6 ("temperature", "pressure"),
7 ("temperature", "vapor_frac"),
8 ("pressure", "vapor_frac"),
9 ("enth_mol", "pressure"),
10 ("enth_mass", "pressure"),
11 ("entr_mol", "temperature"),
12 ("entr_mass", "temperature"),
13 ("total_energy_flow", "pressure"),
14 ("temperature", "enth_mol"),
15 ("temperature", "enth_mass"),
16 ("pressure", "entr_mol"),
17 ("pressure", "entr_mass"),
18)
19# for each combination, add the following flows:
20# molarFlow, massFlow, volumetricFlow
21degrees_of_freedom = []
22for combination in property_combinations:
23 for flow in ["flow_mol", "flow_mass", "flow_vol"]:
24 degrees_of_freedom.append(combination + (flow,))
27stream_config: ObjectType = ObjectType.model_validate({
28 "displayType": "S",
29 "displayName": "Stream",
30 "is_stream": True,
31 "ports": {},
32 # TODO: check if streams have inlets and outlets
33 "graphicObject": stream_graphic(),
34 "indexSets": ["phase","compound"],
35 "properties": {
36 "mole_frac_comp": {
37 "displayName": "Compounds",
38 "propertySetGroup": "composition",
39 "type": "numeric",
40 "unitType": "ratio",
41 "indexSets": ["compound"],
42 },
43 "flow_mass": {
44 "displayName": "Mass Flow",
45 "type": "numeric",
46 "unitType": "massflow",
47 },
48 "flow_mol": {
49 "displayName": "Molar Flow",
50 "type": "numeric",
51 "unitType": "molarflow",
52 },
53 "temperature": {
54 "displayName": "Temperature",
55 "type": "numeric",
56 "unitType": "temperature",
57 },
58 "pressure": {
59 "displayName": "Pressure",
60 "type": "numeric",
61 "unitType": "pressure",
62 },
63 "vapor_frac": {
64 "displayName": "Vapor Fraction",
65 "type": "numeric",
66 "unitType": "ratio",
67 },
68 "enth_mol": {
69 "displayName": "Molar Specific Enthalpy",
70 "type": "numeric",
71 "unitType": "molarEnthalpy",
72 },
73 "enth_mass": {
74 "displayName": "Mass Specific Enthalpy",
75 "type": "numeric",
76 "unitType": "massEnthalpy",
77 },
78 "entr_mol": {
79 "displayName": "Molar Specific Entropy",
80 "type": "numeric",
81 "unitType": "molarEntropy",
82 },
83 "entr_mass": {
84 "displayName": "Mass Specific Entropy",
85 "type": "numeric",
86 "unitType": "massEntropy",
87 },
88 "total_energy_flow": {
89 "displayName": "Total Energy Flow",
90 "type": "numeric",
91 "unitType": "heatflow",
92 },
93 "flow_vol": {
94 "displayName": "Volumetric Flow",
95 "type": "numeric",
96 "unitType": "volumetricFlow",
97 },
98 "mole_frac_phase_comp": {
99 "displayName": "Phases",
100 "type": "numeric",
101 "unitType": "ratio",
102 "indexSets": ["phase","compound"],
103 },
104 },
105 "propertySetGroups": {
106 "composition": {
107 "type": "composition",
108 "displayName": "Composition",
109 "stateVars": ("mole_frac_comp",),
110 },
111 "default": {
112 "type": "stateVars",
113 "displayName": "Properties",
114 "stateVars": ("flow_mol", "temperature", "pressure"),
115 },
116 },
117 "keyProperties": {
118 "mass": [
119 "flow_mass",
120 "temperature",
121 "pressure",
122 "vapor_frac"
123 ],
124 "molar": [
125 "flow_mol",
126 "temperature",
127 "pressure",
128 "vapor_frac"
129 ]
130 }
131})