MCPcopy Create free account
hub / github.com/NatLabRockies/OpenStudio / addTemperatureEnthalpy

Method addTemperatureEnthalpy

src/model/MaterialPropertyPhaseChange.cpp:128–152  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

126 }
127
128 bool MaterialPropertyPhaseChange_Impl::addTemperatureEnthalpy(const TemperatureEnthalpy& temperatureEnthalpy) {
129 bool result;
130
131 unsigned int num = numberofTemperatureEnthalpys();
132 // Max number of temperature-enthalpys is 16
133 if (num >= 16) {
134 LOG(Warn, briefDescription() << " already has 16 temperature-enthalpys which is the limit");
135 result = false;
136 } else {
137 // Push an extensible group
138 auto eg = getObject<ModelObject>().pushExtensibleGroup().cast<WorkspaceExtensibleGroup>();
139 bool temperature = eg.setDouble(OS_MaterialProperty_PhaseChangeExtensibleFields::Temperature, temperatureEnthalpy.temperature());
140 bool enthalpy = eg.setDouble(OS_MaterialProperty_PhaseChangeExtensibleFields::Enthalpy, temperatureEnthalpy.enthalpy());
141 if (temperature && enthalpy) {
142 result = true;
143 } else {
144 // Something went wrong
145 // So erase the new extensible group
146 getObject<ModelObject>().eraseExtensibleGroup(eg.groupIndex());
147 result = false;
148 }
149 result = true;
150 }
151 return result;
152 }
153
154 bool MaterialPropertyPhaseChange_Impl::addTemperatureEnthalpy(double temperature, double enthalpy) {
155 // Make a temperature-enthalpy, and then call the above function

Callers 1

TEST_FFunction · 0.80

Calls 6

pushExtensibleGroupMethod · 0.80
eraseExtensibleGroupMethod · 0.80
groupIndexMethod · 0.80
setDoubleMethod · 0.45
temperatureMethod · 0.45
enthalpyMethod · 0.45

Tested by 1

TEST_FFunction · 0.64