Coverage for backend/django/flowsheetInternals/unitops/config/objects/heat_exchanger_1d_config.py: 100%

4 statements  

« 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 * 

4 

5heat_exchanger_1d_config: ObjectType = ObjectType( 

6 displayType="Heat Exchanger (1D)", 

7 displayName="Heat Exchanger (1D)", 

8 

9 # Use IDAES port names so the adapter can bind directly 

10 ports={ 

11 "hot_side_inlet": PortType( 

12 displayName="Hot Inlet", 

13 type="inlet", 

14 streamOffset=1, 

15 streamName="HS", 

16 ), 

17 "hot_side_outlet": PortType( 

18 displayName="Hot Outlet", 

19 type="outlet", 

20 streamOffset=1, 

21 streamName="HS", 

22 ), 

23 "cold_side_inlet": PortType( 

24 displayName="Cold Inlet", 

25 type="inlet", 

26 streamOffset=1, 

27 streamName="CS", 

28 ), 

29 "cold_side_outlet": PortType( 

30 displayName="Cold Outlet", 

31 type="outlet", 

32 streamOffset=1, 

33 streamName="CS", 

34 ), 

35 }, 

36 

37 # Tell the factory which ports share a property package 

38 propertyPackagePorts={ 

39 "Hot Side": ["hot_side_inlet", "hot_side_outlet"], 

40 "Cold Side": ["cold_side_inlet", "cold_side_outlet"], 

41 }, 

42 

43 graphicObject=unitop_graphic(), 

44 

45 # Declare we have discretized (1D) properties keyed by this axis 

46 indexSets=["discretization"], 

47 

48 properties=PropertiesType({ 

49 # Scalar specs/outputs 

50 "overall_heat_transfer_coefficient": PropertyType( 

51 displayName="Heat Transfer Coefficient (U)", 

52 type="numeric", 

53 unitType="heat_transf_coeff", 

54 ), 

55 "area": PropertyType( 

56 displayName="Heat Exchange Area", 

57 type="numeric", 

58 unitType="area", 

59 hasTimeIndex=False, 

60 ), 

61 "length": PropertyType( 

62 displayName="Length", 

63 type="numeric", 

64 unitType="distance", 

65 hasTimeIndex=False, 

66 ), 

67 "flow_type": PropertyType( 

68 displayName="Flow Pattern", 

69 type="dropdown", 

70 unitType="dimensionless", 

71 options={ 

72 "countercurrent": "Counter-current", 

73 "cocurrent": "Co-current", 

74 }, 

75 value="countercurrent", # Default value 

76 hasTimeIndex=False, 

77 ), 

78 "transformation_method": PropertyType( 

79 displayName="Discretization Method", 

80 type="dropdown", 

81 unitType="dimensionless", 

82 options={ 

83 "dae.finite_difference": "Finite Difference", 

84 "dae.collocation": "Collocation", 

85 }, 

86 value="dae.collocation", 

87 hasTimeIndex=False, 

88 ), 

89 "transformation_scheme": PropertyType( 

90 displayName="Discretization Scheme", 

91 type="dropdown", 

92 unitType="dimensionless", 

93 options={ 

94 "BACKWARD": "Backward", 

95 "FORWARD": "Forward", 

96 "LAGRANGE-RADAU": "Lagrange-Radau", 

97 }, 

98 value="LAGRANGE-RADAU", 

99 hasTimeIndex=False, 

100 ), 

101 "finite_elements": PropertyType( 

102 displayName="Number of Finite Elements", 

103 type="numeric_arg", 

104 unitType="dimensionless", 

105 value=20, # IDAES default 

106 hasTimeIndex=False, 

107 ), 

108 "collocation_points": PropertyType( 

109 displayName="Collocation Points", 

110 type="numeric_arg", 

111 unitType="dimensionless", 

112 value=3, # IDAES default 

113 hasTimeIndex=False, 

114 ), 

115 # "hot_side.deltaP_inverted": { 

116 # "displayName": "Pressure Drop (Hot Side)", 

117 # "type": "numeric", 

118 # "unitType": "pressure", 

119 # "value": 0.0, 

120 # }, 

121 # "cold_side.deltaP_inverted": { 

122 # "displayName": "Pressure Drop (Cold Side)", 

123 # "type": "numeric", 

124 # "unitType": "pressure", 

125 # "value": 0.0, 

126 # }, 

127 

128 # 1D profiles (arrays) along the discretization axis; read-only display 

129 "hot_side.temperature_profile": PropertyType( 

130 displayName="Hot Temperature Profile", 

131 type="numeric", 

132 unitType="temperature", 

133 indexSets=["discretization"], 

134 readOnly=True, 

135 ), 

136 "cold_side.temperature_profile": PropertyType( 

137 displayName="Cold Temperature Profile", 

138 type="numeric", 

139 unitType="temperature", 

140 indexSets=["discretization"], 

141 readOnly=True, 

142 ), 

143 }), 

144 propertySetGroups={ 

145 "default": { 

146 "type": "stateVars", 

147 "displayName": "Properties", 

148 "stateVars": ("flow_type", "transformation_method", "transformation_scheme", "finite_elements", "collocation_points", "overall_heat_transfer_coefficient", "area", "length"), 

149 }, 

150 "profiles": { 

151 "type": "stateVars", 

152 "displayName": "Profiles", 

153 "stateVars": ("hot_side.temperature_profile", "cold_side.temperature_profile"), 

154 }, 

155 }, 

156 

157 keyProperties=[ 

158 "overall_heat_transfer_coefficient", 

159 "area", 

160 "length", 

161 ], 

162 idaes_adapter=UnitModelAdapter( 

163 args=ArgAdapter({ 

164 "hot_side": DictArgAdapter({ 

165 "property_package": PropertyPackageAdapter("Hot Side"), 

166 "transformation_method": EnumAdapter("transformation_method"), 

167 "transformation_scheme": EnumAdapter("transformation_scheme"), 

168 "has_pressure_change": ConstantArg(False), 

169 }), 

170 "cold_side": DictArgAdapter({ 

171 "property_package": PropertyPackageAdapter("Cold Side"), 

172 "transformation_method": EnumAdapter("transformation_method"), 

173 "transformation_scheme": EnumAdapter("transformation_scheme"), 

174 "has_pressure_change": ConstantArg(False), 

175 }), 

176 "finite_elements": EnumAdapter("finite_elements"), 

177 "collocation_points": EnumAdapter("collocation_points"), 

178 "flow_type": EnumAdapter("flow_type"), 

179 }), 

180 ports=PortListAdapter({ 

181 # Map platform ports to IDAES attributes for 1D HX 

182 "hot_side_inlet": PortAdapter("hot_side_inlet", inlet=True), 

183 "hot_side_outlet": PortAdapter("hot_side_outlet"), 

184 "cold_side_inlet": PortAdapter("cold_side_inlet", inlet=True), 

185 "cold_side_outlet": PortAdapter("cold_side_outlet"), 

186 }), 

187 ), 

188)