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

Method doZoneSizingCalculation

src/model/SimulationControl.cpp:181–212  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

179 }
180
181 bool SimulationControl_Impl::doZoneSizingCalculation() const {
182
183 auto shouldItBeOn = [this]() -> bool {
184 const auto m = model();
185 const auto hasSizingPeriods = !m.getModelObjects<SizingPeriod>().empty();
186 if (!hasSizingPeriods) {
187 return false;
188 }
189
190 const auto zones = m.getConcreteModelObjects<ThermalZone>();
191 const auto hasZoneEquipment = std::any_of(zones.cbegin(), zones.cend(), [](const auto& z) { return !z.equipment().empty(); });
192
193 return hasZoneEquipment;
194 };
195
196 if (!isDoZoneSizingCalculationDefaulted()) {
197 boost::optional<std::string> value = getString(OS_SimulationControlFields::DoZoneSizingCalculation, true);
198 OS_ASSERT(value);
199 const auto result = openstudio::istringEqual(value.get(), "Yes");
200 if (!result && shouldItBeOn()) {
201 LOG(Warn, "You have zonal equipment and design days, it's possible you should enable SimulationControl::DoZoneSizingCalculation");
202 }
203 return result;
204 }
205
206 const auto result = shouldItBeOn();
207 if (result) {
208 LOG(Debug, "You have zonal equipment and design days, and SimulationControl::DoZoneSizingCalculation is defaulted: turning on.");
209 }
210
211 return result;
212 }
213
214 bool SimulationControl_Impl::isDoZoneSizingCalculationDefaulted() const {
215 return isEmpty(OS_SimulationControlFields::DoZoneSizingCalculation);

Callers 3

TEST_FFunction · 0.80
TEST_FFunction · 0.80

Calls 6

istringEqualFunction · 0.85
cbeginMethod · 0.80
cendMethod · 0.80
emptyMethod · 0.45
equipmentMethod · 0.45
getMethod · 0.45

Tested by 2

TEST_FFunction · 0.64
TEST_FFunction · 0.64