src/energyplus/ForwardTranslator/ForwardTranslateAvailabilityManagerNightVentilation.cpp
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /*********************************************************************************************************************** | ||
| 2 | * OpenStudio(R), Copyright (c) Alliance for Energy Innovation, LLC. | ||
| 3 | * See also https://openstudio.net/license | ||
| 4 | ***********************************************************************************************************************/ | ||
| 5 | |||
| 6 | #include "../ForwardTranslator.hpp" | ||
| 7 | #include "../../model/AvailabilityManagerNightVentilation.hpp" | ||
| 8 | #include "../../model/AvailabilityManagerNightVentilation_Impl.hpp" | ||
| 9 | #include "../../model/Node.hpp" | ||
| 10 | #include "../../model/Node_Impl.hpp" | ||
| 11 | #include "../../model/Schedule.hpp" | ||
| 12 | #include "../../model/Schedule_Impl.hpp" | ||
| 13 | #include "../../model/FanConstantVolume.hpp" | ||
| 14 | #include "../../model/FanConstantVolume_Impl.hpp" | ||
| 15 | #include "../../model/FanVariableVolume.hpp" | ||
| 16 | #include "../../model/FanVariableVolume_Impl.hpp" | ||
| 17 | #include "../../model/AirLoopHVAC.hpp" | ||
| 18 | #include "../../model/AirLoopHVAC_Impl.hpp" | ||
| 19 | #include "../../model/ThermalZone.hpp" | ||
| 20 | #include "../../model/ThermalZone_Impl.hpp" | ||
| 21 | #include "../../utilities/core/Assert.hpp" | ||
| 22 | #include "../../utilities/idf/IdfExtensibleGroup.hpp" | ||
| 23 | #include <utilities/idd/AvailabilityManager_NightVentilation_FieldEnums.hxx> | ||
| 24 | #include <utilities/idd/ZoneList_FieldEnums.hxx> | ||
| 25 | #include <utilities/idd/IddEnums.hxx> | ||
| 26 | |||
| 27 | using namespace openstudio::model; | ||
| 28 | using namespace std; | ||
| 29 | |||
| 30 | namespace openstudio { | ||
| 31 | |||
| 32 | namespace energyplus { | ||
| 33 | |||
| 34 | ✗ | boost::optional<IdfObject> ForwardTranslator::translateAvailabilityManagerNightVentilation(AvailabilityManagerNightVentilation& modelObject) { | |
| 35 | ✗ | IdfObject idfObject(IddObjectType::AvailabilityManager_NightVentilation); | |
| 36 | ✗ | m_idfObjects.push_back(idfObject); | |
| 37 | |||
| 38 | ✗ | boost::optional<AirLoopHVAC> airLoopHVAC; | |
| 39 | ✗ | if (auto loop = modelObject.loop()) { | |
| 40 | ✗ | airLoopHVAC = loop->optionalCast<model::AirLoopHVAC>(); | |
| 41 | ✗ | } | |
| 42 | |||
| 43 | // Name | ||
| 44 | ✗ | if (auto s = modelObject.name()) { | |
| 45 | ✗ | idfObject.setName(*s); | |
| 46 | ✗ | } | |
| 47 | |||
| 48 | // ApplicabilityScheduleName | ||
| 49 | { | ||
| 50 | ✗ | auto schedule = modelObject.applicabilitySchedule(); | |
| 51 | ✗ | idfObject.setString(AvailabilityManager_NightVentilationFields::ApplicabilityScheduleName, schedule.name().get()); | |
| 52 | ✗ | } | |
| 53 | |||
| 54 | ✗ | if (airLoopHVAC) { | |
| 55 | // Fan schedules are set to match the availabilitySchedule in the translator | ||
| 56 | ✗ | idfObject.setString(AvailabilityManager_NightVentilationFields::FanScheduleName, airLoopHVAC->availabilitySchedule().name().get()); | |
| 57 | } | ||
| 58 | |||
| 59 | // VentilationTemperatureScheduleName | ||
| 60 | ✗ | if (auto schedule = modelObject.ventilationTemperatureSchedule()) { | |
| 61 | ✗ | idfObject.setString(AvailabilityManager_NightVentilationFields::VentilationTemperatureScheduleName, schedule->name().get()); | |
| 62 | ✗ | } | |
| 63 | |||
| 64 | // VentilationTemperatureDifference | ||
| 65 | { | ||
| 66 | ✗ | auto value = modelObject.ventilationTemperatureDifference(); | |
| 67 | ✗ | idfObject.setDouble(AvailabilityManager_NightVentilationFields::VentilationTemperatureDifference, value); | |
| 68 | } | ||
| 69 | |||
| 70 | // VentilationTemperatureLowLimit | ||
| 71 | { | ||
| 72 | ✗ | auto value = modelObject.ventilationTemperatureLowLimit(); | |
| 73 | ✗ | idfObject.setDouble(AvailabilityManager_NightVentilationFields::VentilationTemperatureLowLimit, value); | |
| 74 | } | ||
| 75 | |||
| 76 | // NightVentingFlowFraction | ||
| 77 | { | ||
| 78 | ✗ | auto value = modelObject.nightVentingFlowFraction(); | |
| 79 | ✗ | idfObject.setDouble(AvailabilityManager_NightVentilationFields::NightVentingFlowFraction, value); | |
| 80 | } | ||
| 81 | |||
| 82 | // ControlZoneName | ||
| 83 | ✗ | if (auto zone = modelObject.controlZone()) { | |
| 84 | ✗ | idfObject.setString(AvailabilityManager_NightVentilationFields::ControlZoneName, zone->name().get()); | |
| 85 | } else { | ||
| 86 | ✗ | if (airLoopHVAC) { | |
| 87 | ✗ | auto zones = airLoopHVAC->thermalZones(); | |
| 88 | ✗ | if (!zones.empty()) { | |
| 89 | ✗ | auto default_zone = zones.front(); | |
| 90 | ✗ | LOG(Info, modelObject.briefDescription() << " is missing Control Zone Name, defaulting to " << default_zone.briefDescription() << "."); | |
| 91 | ✗ | idfObject.setString(AvailabilityManager_NightVentilationFields::ControlZoneName, default_zone.name().get()); | |
| 92 | ✗ | } | |
| 93 | ✗ | } | |
| 94 | ✗ | } | |
| 95 | |||
| 96 | ✗ | return idfObject; | |
| 97 | ✗ | } | |
| 98 | |||
| 99 | } // namespace energyplus | ||
| 100 | } // namespace openstudio | ||
| 101 |