Coverage for backend/django/flowsheetInternals/unitops/config/objects/header_config.py: 100%
4 statements
« prev ^ index » next coverage.py v7.10.7, created at 2026-06-23 21:51 +0000
« prev ^ index » next coverage.py v7.10.7, created at 2026-06-23 21:51 +0000
1from common.config_types import *
2from common.config_utils import *
3from ..spec_helpers import *
6header_config: ObjectType = ObjectType(
7 displayType="Header",
8 displayName="Header",
9 ports={
10 "condensate_outlet": PortType(
11 many=False, # Always exactly 1, cannot increase
12 displayName="Condensate",
13 type=ConType.Outlet,
14 default=1,
15 streamName="Condensate S",
16 streamOffset=3,
17 ),
18 "vent": PortType(
19 many=False,
20 displayName="Vent Outlet",
21 type=ConType.Outlet,
22 default=1, # default number of outlets
23 streamName="Vent S",
24 streamOffset=3,
25 ),
26 "inlet": PortType(
27 many=True,
28 displayName="Inlet",
29 type=ConType.Inlet,
30 default=1, # default number of inlets
31 minimum=1, # minimum number of inlets
32 streamName="S",
33 streamOffset=3,
35 ),
36 "outlet": PortType(
37 many=True,
38 displayName="Outlet",
39 type=ConType.Outlet,
40 default=2, # default number of outlets
41 minimum=1, # minimum number of outlets
42 streamName="S",
43 streamOffset=3,
44 ),
45 },
46 propertyPackagePorts={
47 "": ["inlet", "outlet", "vent", "condensate_outlet"]
48 },
49 graphicObject={
50 "width": 25,
51 "height": 800,
52 "autoHeight": True
53 },
54 indexSets=["splitter_fraction"],
55 properties=PropertiesType({
56 "split_flow": PropertyType(
57 displayName="Flow",
58 type="numeric",
59 unitType="molarflow",
60 indexSets=["splitter_fraction"],
61 ),
62 "splitter.vent.flow_mol": PropertyType(
63 displayName="Vent Flow",
64 type="numeric",
65 unitType="molarflow",
66 ),
67 "heat_duty_inverted": PropertyType(
68 displayName="Heat Loss",
69 type="numeric",
70 unitType="heatflow",
71 value=0,
72 ),
73 "deltaP_inverted": PropertyType(
74 displayName="Pressure Drop",
75 type="numeric",
76 unitType="pressure",
77 value=0,
78 ),
79 # Read-only properties
80 "total_flow_mass": PropertyType(
81 displayName="Mass Flow",
82 type="numeric",
83 unitType="massflow",
84 ),
85 "total_flow_mol": PropertyType(
86 displayName="Molar Flow",
87 type="numeric",
88 unitType="molarflow",
89 ),
90 "balance_flow_mol": PropertyType(
91 displayName="Balance Flow",
92 type="numeric",
93 unitType="molarflow",
94 ),
95 "temperature": PropertyType(
96 displayName="Temperature",
97 type="numeric",
98 unitType="temperature",
99 ),
100 "degree_of_superheat": PropertyType(
101 displayName="Degree of Superheat",
102 type="numeric",
103 unitType="deltaTemperature",
104 ),
105 "pressure": PropertyType(
106 displayName="Pressure",
107 type="numeric",
108 unitType="pressure",
109 ),
110 "vapor_frac": PropertyType(
111 displayName="Vapor Fraction",
112 type="numeric",
113 unitType="ratio",
114 ),
115 "enth_mass": PropertyType(
116 displayName="Mass Specific Enthalpy",
117 type="numeric",
118 unitType="massEnthalpy",
119 ),
120 "enth_mol": PropertyType(
121 displayName="Molar Specific Enthalpy",
122 type="numeric",
123 unitType="molarEnthalpy",
124 ),
125 }),
126 splitter_fraction_name="Outlet",
127 propertySetGroups={
128 "default": {
129 "type": "stateVars",
130 "displayName": "Properties",
131 "stateVars": ("split_flow", "heat_duty_inverted", "deltaP_inverted"),
132 }
133 },
134 keyProperties=[
135 "pressure",
136 "temperature",
137 "degree_of_superheat",
138 "enth_mass",
139 "vapor_frac",
140 ],
141 idaes_adapter=UnitModelAdapter(
142 args=ArgAdapter({
143 "property_package": PropertyPackageAdapter(),
144 "num_inlets": PortCountAdapter("inlet"),
145 "num_outlets": PortCountAdapter("outlet"),
146 }),
147 ports=SchemaPortListAdapter([
148 PortGroupMapping(
149 port_key="inlet",
150 output_key_template="mixer.inlet_{index}",
151 is_inlet=True,
152 connected_only=True,
153 sort_by_index=True,
154 ),
155 PortGroupMapping(
156 port_key="outlet",
157 output_key_template="splitter.outlet_{index}",
158 is_inlet=False,
159 connected_only=True,
160 sort_by_index=True,
161 ),
162 FixedPortMapping(
163 port_key="vent",
164 output_key="splitter.vent",
165 is_inlet=False,
166 optional=True,
167 connected_only=True,
168 ),
169 FixedPortMapping(
170 port_key="condensate_outlet",
171 output_key="phase_separator.condensate_outlet",
172 is_inlet=False,
173 optional=True,
174 connected_only=True,
175 ),
176 ])
177 ),
178)