| 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); |