Coverage for backend/django/flowsheetInternals/unitops/config/objects/heater_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 

5heater_config: ObjectType = ObjectType( 

6 displayType="Heater", 

7 displayName="Heater", 

8 

9 ports=default_ports(), 

10 propertyPackagePorts=default_property_package_ports(), 

11 graphicObject=unitop_graphic(), 

12 properties=PropertiesType({ 

13 "heat_duty": PropertyType( 

14 displayName="Heat Added", 

15 type="numeric", 

16 unitType="heatflow" 

17 ), 

18 "deltaP_inverted": PropertyType( 

19 displayName="Pressure Drop", 

20 type="numeric", 

21 value=0, 

22 unitType="pressure" 

23 ), 

24 "control_volume.material_holdup": PropertyType( 

25 displayName="Material Holdup", 

26 propertySetGroup="dynamics", 

27 type="numeric", 

28 unitType="molar", 

29 indexSets=["phase","compound"], 

30 ), 

31 "control_volume.energy_holdup": PropertyType( 

32 displayName="Energy Holdup", 

33 propertySetGroup="dynamics", 

34 type="numeric", 

35 unitType="energy", 

36 indexSets=["phase"], # https://idaes-pse.readthedocs.io/en/2.4.0/reference_guides/core/control_volume_0d.html#add-total-enthalpy-balances 

37 ), 

38 "control_volume.volume": PropertyType( 

39 displayName="Volume", 

40 propertySetGroup="dynamics", 

41 type="numeric", 

42 unitType="volume", 

43 value=1, 

44 ), 

45 "control_volume.material_accumulation": PropertyType( 

46 displayName="Material Accumulation", 

47 propertySetGroup="dynamics", 

48 type="numeric", 

49 value=0, 

50 unitType="molarflow", 

51 indexSets=["phase","compound"], 

52 ), 

53 "control_volume.energy_accumulation": PropertyType( 

54 displayName="Energy Accumulation", 

55 propertySetGroup="dynamics", 

56 type="numeric", 

57 value=0, 

58 unitType="heatflow", 

59 indexSets=["phase"], 

60 ), 

61 "control_volume.phase_fraction": PropertyType( 

62 displayName="Phase Fraction", 

63 propertySetGroup="dynamics", 

64 type="numeric", 

65 unitType="dimensionless", 

66 indexSets=["phase"], 

67 sumToOne=True, 

68 ), 

69 "dynamics": PropertyType( 

70 displayName="Enable Dynamics", 

71 propertySetGroup="dynamics", 

72 type="checkbox", 

73 unitType="dimensionless", 

74 value=False, 

75 ), 

76 "initial_material_accumulation": PropertyType( 

77 displayName="Initial Material Accumulation", 

78 propertySetGroup="dynamics", 

79 type="numeric", 

80 value=0, 

81 unitType="molarflow", 

82 indexSets=["phase","compound"], 

83 hasTimeIndex=False, 

84 ), 

85 "initial_energy_accumulation": PropertyType( 

86 displayName="Initial Energy Accumulation", 

87 propertySetGroup="dynamics", 

88 type="numeric", 

89 value=0, 

90 unitType="heatflow", 

91 indexSets=["phase"], 

92 hasTimeIndex=False, 

93 ), 

94 "initial_material_holdup": PropertyType( 

95 displayName="Initial Material Holdup", 

96 propertySetGroup="dynamics", 

97 type="numeric", 

98 unitType="molar", 

99 indexSets=["phase","compound"], 

100 hasTimeIndex=False, 

101 ), 

102 "initial_energy_holdup": PropertyType( 

103 displayName="Initial Energy Holdup", 

104 propertySetGroup="dynamics", 

105 type="numeric", 

106 unitType="energy", 

107 indexSets=["phase"], # https://idaes-pse.readthedocs.io/en/2.4.0/reference_guides/core/control_volume_0d.html#add-total-enthalpy-balances 

108 hasTimeIndex=False, 

109 ), 

110 }), 

111 indexSets=["phase","compound"], 

112 propertySetGroups={ 

113 "default": { 

114 "type": "stateVars", 

115 "displayName": "Properties", 

116 "stateVars": ("heat_duty", "deltaP_inverted"), 

117 }, 

118 "dynamics": { 

119 "type": "stateVars", 

120 "displayName": "Dynamics", 

121 "toggle": "dynamics", # if holdup is true, then display these properties 

122 "stateVars": ("dynamics","initial_material_accumulation", "initial_energy_accumulation", "control_volume.phase_fraction") 

123 } 

124 }, 

125 keyProperties=[ 

126 "heat_duty" 

127 ], 

128 idaes_adapter=UnitModelAdapter( 

129 args=ArgAdapter({ 

130 "property_package": PropertyPackageAdapter(), 

131 "has_pressure_change": ConstantArg(True), 

132 "dynamic": DynamicAdapter(), 

133 "has_holdup": DynamicAdapter(), # these are both set to true at the same time. 

134 }), 

135 ports=PortListAdapter({ 

136 "inlet": PortAdapter("inlet", inlet=True), 

137 "outlet": PortAdapter("outlet") 

138 }) 

139 ), 

140)