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

Method setNightCycleControlType

src/model/AirLoopHVAC.cpp:1308–1345  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1306 }
1307
1308 bool AirLoopHVAC_Impl::setNightCycleControlType(const std::string& controlType) {
1309 auto createNightCycleManager = [&]() {
1310 boost::optional<AvailabilityManagerNightCycle> result;
1311 auto t_model = model();
1312 AvailabilityManagerNightCycle nightCycle(t_model);
1313 if (nightCycle.setControlType(controlType)) {
1314 result = nightCycle;
1315 } else {
1316 nightCycle.remove();
1317 }
1318 return result;
1319 };
1320
1321 // Loop through the current AVMs, if you find an AVM NightCycle, set its controlType
1322 // TODO: @kbenne: Unless the controType is "StayOff" in which case perhaps remove? what do you think?
1323 for (auto& t_availabilityManager : availabilityManagers()) {
1324 if (auto nightCycle = t_availabilityManager.optionalCast<AvailabilityManagerNightCycle>()) {
1325 /*
1326 *if ( openstudio::istringEqual(controlType, "StayOff") ) {
1327 * nightCycle->remove()
1328 * return true
1329 *} else {
1330 * return nightCycle->setControlType(controlType);
1331 *}
1332 */
1333 return nightCycle->setControlType(controlType);
1334 }
1335 }
1336
1337 // Else, add one
1338 if (auto nightCycle = createNightCycleManager()) {
1339 auto result = addAvailabilityManager(nightCycle.get());
1340 OS_ASSERT(result);
1341 return true;
1342 }
1343
1344 return false;
1345 }
1346
1347 // boost::optional<Schedule> AirLoopHVAC_Impl::returnAirBypassFlowTemperatureSetpointSchedule() const
1348 // {

Callers 3

translateAirSystemMethod · 0.80
TEST_FFunction · 0.80
TEST_FFunction · 0.80

Calls 3

setControlTypeMethod · 0.45
removeMethod · 0.45
getMethod · 0.45

Tested by 2

TEST_FFunction · 0.64
TEST_FFunction · 0.64