src/energyplus/ForwardTranslator/ForwardTranslateControllerOutdoorAir.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/AirLoopHVACOutdoorAirSystem.hpp" | ||
| 8 | #include "../../model/ControllerOutdoorAir.hpp" | ||
| 9 | #include "../../model/ControllerMechanicalVentilation.hpp" | ||
| 10 | #include "../../model/Node.hpp" | ||
| 11 | #include "../../model/Schedule.hpp" | ||
| 12 | #include "../../model/ThermalZone.hpp" | ||
| 13 | #include "../../model/Curve.hpp" | ||
| 14 | #include "../../model/ZoneControlHumidistat.hpp" | ||
| 15 | #include <utilities/idd/Controller_OutdoorAir_FieldEnums.hxx> | ||
| 16 | #include <utilities/idd/IddEnums.hxx> | ||
| 17 | |||
| 18 | using namespace openstudio::model; | ||
| 19 | |||
| 20 | using namespace std; | ||
| 21 | |||
| 22 | namespace openstudio { | ||
| 23 | |||
| 24 | namespace energyplus { | ||
| 25 | |||
| 26 | 53 | boost::optional<IdfObject> ForwardTranslator::translateControllerOutdoorAir(ControllerOutdoorAir& modelObject) { | |
| 27 | 53 | OptionalString s; | |
| 28 | 53 | OptionalDouble d; | |
| 29 | |||
| 30 | // Create a new IddObjectType::AirLoopHVAC_OutdoorAirSystem | ||
| 31 |
2/2✓ Branch 1 taken 53 times.
✓ Branch 4 taken 53 times.
|
53 | IdfObject idfObject(IddObjectType::Controller_OutdoorAir); |
| 32 | |||
| 33 |
1/1✓ Branch 1 taken 53 times.
|
53 | m_idfObjects.push_back(idfObject); |
| 34 | |||
| 35 | /////////////////////////////////////////////////////////////////////////// | ||
| 36 | // Field: Name //////////////////////////////////////////////////////////// | ||
| 37 |
1/1✓ Branch 1 taken 53 times.
|
53 | s = modelObject.name(); |
| 38 |
1/2✓ Branch 0 taken 53 times.
✗ Branch 1 not taken.
|
53 | if (s) { |
| 39 |
2/2✓ Branch 1 taken 53 times.
✓ Branch 4 taken 53 times.
|
53 | idfObject.setString(openstudio::Controller_OutdoorAirFields::Name, *s); |
| 40 | } | ||
| 41 | /////////////////////////////////////////////////////////////////////////// | ||
| 42 | // Field: Relief Air Outlet Node Name ///////////////////////////////////// | ||
| 43 |
5/5✓ Branch 1 taken 53 times.
✓ Branch 4 taken 53 times.
✓ Branch 7 taken 53 times.
✓ Branch 10 taken 53 times.
✓ Branch 13 taken 53 times.
|
53 | s = modelObject.airLoopHVACOutdoorAirSystem()->reliefAirModelObject()->name(); |
| 44 |
1/2✓ Branch 0 taken 53 times.
✗ Branch 1 not taken.
|
53 | if (s) { |
| 45 |
2/2✓ Branch 1 taken 53 times.
✓ Branch 4 taken 53 times.
|
53 | idfObject.setString(openstudio::Controller_OutdoorAirFields::ReliefAirOutletNodeName, *s); |
| 46 | } | ||
| 47 | |||
| 48 | /////////////////////////////////////////////////////////////////////////// | ||
| 49 | // Field: Return Air Outlet Node Name ///////////////////////////////////// | ||
| 50 |
5/5✓ Branch 1 taken 53 times.
✓ Branch 4 taken 53 times.
✓ Branch 7 taken 53 times.
✓ Branch 10 taken 53 times.
✓ Branch 13 taken 53 times.
|
53 | s = modelObject.airLoopHVACOutdoorAirSystem()->returnAirModelObject()->name(); |
| 51 |
1/2✓ Branch 0 taken 53 times.
✗ Branch 1 not taken.
|
53 | if (s) { |
| 52 |
2/2✓ Branch 1 taken 53 times.
✓ Branch 4 taken 53 times.
|
53 | idfObject.setString(openstudio::Controller_OutdoorAirFields::ReturnAirNodeName, *s); |
| 53 | } | ||
| 54 | |||
| 55 | /////////////////////////////////////////////////////////////////////////// | ||
| 56 | // Field: Mixed Air Outlet Node Name ////////////////////////////////////// | ||
| 57 |
5/5✓ Branch 1 taken 53 times.
✓ Branch 4 taken 53 times.
✓ Branch 7 taken 53 times.
✓ Branch 10 taken 53 times.
✓ Branch 13 taken 53 times.
|
53 | s = modelObject.airLoopHVACOutdoorAirSystem()->mixedAirModelObject()->name(); |
| 58 |
1/2✓ Branch 0 taken 53 times.
✗ Branch 1 not taken.
|
53 | if (s) { |
| 59 |
2/2✓ Branch 1 taken 53 times.
✓ Branch 4 taken 53 times.
|
53 | idfObject.setString(openstudio::Controller_OutdoorAirFields::MixedAirNodeName, *s); |
| 60 | } | ||
| 61 | |||
| 62 | /////////////////////////////////////////////////////////////////////////// | ||
| 63 | // Field: Actuator Node Name ////////////////////////////////////////////// | ||
| 64 |
5/5✓ Branch 1 taken 53 times.
✓ Branch 4 taken 53 times.
✓ Branch 7 taken 53 times.
✓ Branch 10 taken 53 times.
✓ Branch 13 taken 53 times.
|
53 | s = modelObject.airLoopHVACOutdoorAirSystem()->outboardOANode()->name(); |
| 65 |
1/2✓ Branch 0 taken 53 times.
✗ Branch 1 not taken.
|
53 | if (s) { |
| 66 |
2/2✓ Branch 1 taken 53 times.
✓ Branch 4 taken 53 times.
|
53 | idfObject.setString(openstudio::Controller_OutdoorAirFields::ActuatorNodeName, *s); |
| 67 | } | ||
| 68 | |||
| 69 | /////////////////////////////////////////////////////////////////////////// | ||
| 70 | // Field: Minimum Outdoor Air Flow Rate /////////////////////////////////// | ||
| 71 |
5/13✓ Branch 1 taken 53 times.
✓ Branch 4 taken 53 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 53 times.
✗ Branch 9 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 53 times.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✓ Branch 17 taken 53 times.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
|
53 | if (modelObject.controllerMechanicalVentilation().demandControlledVentilation() && modelObject.isMinimumOutdoorAirFlowRateAutosized()) { |
| 72 | ✗ | idfObject.setDouble(openstudio::Controller_OutdoorAirFields::MinimumOutdoorAirFlowRate, 0.0); | |
| 73 | } else { | ||
| 74 |
1/1✓ Branch 1 taken 53 times.
|
53 | d = modelObject.minimumOutdoorAirFlowRate(); |
| 75 |
2/2✓ Branch 0 taken 43 times.
✓ Branch 1 taken 10 times.
|
53 | if (d) { |
| 76 |
2/2✓ Branch 1 taken 43 times.
✓ Branch 4 taken 43 times.
|
43 | idfObject.setDouble(openstudio::Controller_OutdoorAirFields::MinimumOutdoorAirFlowRate, *d); |
| 77 | } else { | ||
| 78 |
2/2✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
|
20 | idfObject.setString(openstudio::Controller_OutdoorAirFields::MinimumOutdoorAirFlowRate, "Autosize"); |
| 79 | } | ||
| 80 | } | ||
| 81 | |||
| 82 | /////////////////////////////////////////////////////////////////////////// | ||
| 83 | // Field: Maximum Outdoor Air Flow Rate /////////////////////////////////// | ||
| 84 |
1/1✓ Branch 1 taken 53 times.
|
53 | d = modelObject.maximumOutdoorAirFlowRate(); |
| 85 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 53 times.
|
53 | if (d) { |
| 86 | ✗ | idfObject.setDouble(openstudio::Controller_OutdoorAirFields::MaximumOutdoorAirFlowRate, *d); | |
| 87 | } else { | ||
| 88 |
2/2✓ Branch 1 taken 53 times.
✓ Branch 4 taken 53 times.
|
106 | idfObject.setString(openstudio::Controller_OutdoorAirFields::MaximumOutdoorAirFlowRate, "Autosize"); |
| 89 | } | ||
| 90 | |||
| 91 | /////////////////////////////////////////////////////////////////////////// | ||
| 92 | // Field: Economizer Control Type ///////////////////////////////////////// | ||
| 93 |
2/2✓ Branch 1 taken 53 times.
✓ Branch 4 taken 53 times.
|
53 | idfObject.setString(openstudio::Controller_OutdoorAirFields::EconomizerControlType, modelObject.getEconomizerControlType()); |
| 94 | |||
| 95 | /////////////////////////////////////////////////////////////////////////// | ||
| 96 | // Field: Economizer Control Action Type ////////////////////////////////// | ||
| 97 |
2/2✓ Branch 1 taken 53 times.
✓ Branch 4 taken 53 times.
|
53 | idfObject.setString(openstudio::Controller_OutdoorAirFields::EconomizerControlActionType, modelObject.getEconomizerControlActionType()); |
| 98 | |||
| 99 | /////////////////////////////////////////////////////////////////////////// | ||
| 100 | // Field: Economizer Maximum Limit DryBulb Temperature //////////////////// | ||
| 101 |
1/1✓ Branch 1 taken 53 times.
|
53 | d = modelObject.getEconomizerMaximumLimitDryBulbTemperature(); |
| 102 |
1/2✓ Branch 0 taken 53 times.
✗ Branch 1 not taken.
|
53 | if (d) { |
| 103 |
2/2✓ Branch 1 taken 53 times.
✓ Branch 4 taken 53 times.
|
53 | idfObject.setDouble(openstudio::Controller_OutdoorAirFields::EconomizerMaximumLimitDryBulbTemperature, d.get()); |
| 104 | } else { | ||
| 105 | ✗ | idfObject.setString(openstudio::Controller_OutdoorAirFields::EconomizerMaximumLimitDryBulbTemperature, ""); | |
| 106 | } | ||
| 107 | |||
| 108 | /////////////////////////////////////////////////////////////////////////// | ||
| 109 | // Field: Economizer Maximum Limit Enthalpy /////////////////////////////// | ||
| 110 |
1/1✓ Branch 1 taken 53 times.
|
53 | d = modelObject.getEconomizerMaximumLimitEnthalpy(); |
| 111 |
1/2✓ Branch 0 taken 53 times.
✗ Branch 1 not taken.
|
53 | if (d) { |
| 112 |
2/2✓ Branch 1 taken 53 times.
✓ Branch 4 taken 53 times.
|
53 | idfObject.setDouble(openstudio::Controller_OutdoorAirFields::EconomizerMaximumLimitEnthalpy, d.get()); |
| 113 | } else { | ||
| 114 | ✗ | idfObject.setString(openstudio::Controller_OutdoorAirFields::EconomizerMaximumLimitEnthalpy, ""); | |
| 115 | } | ||
| 116 | |||
| 117 | /////////////////////////////////////////////////////////////////////////// | ||
| 118 | // Field: Economizer Maximum Limit Dewpoint Temperature /////////////////// | ||
| 119 |
1/1✓ Branch 1 taken 53 times.
|
53 | d = modelObject.getEconomizerMaximumLimitDewpointTemperature(); |
| 120 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 53 times.
|
53 | if (d) { |
| 121 | ✗ | idfObject.setDouble(openstudio::Controller_OutdoorAirFields::EconomizerMaximumLimitDewpointTemperature, d.get()); | |
| 122 | } else { | ||
| 123 |
2/2✓ Branch 1 taken 53 times.
✓ Branch 4 taken 53 times.
|
106 | idfObject.setString(openstudio::Controller_OutdoorAirFields::EconomizerMaximumLimitDewpointTemperature, ""); |
| 124 | } | ||
| 125 | |||
| 126 | /////////////////////////////////////////////////////////////////////////// | ||
| 127 | // Field: Electronic Enthalpy Limit Curve Name //////////////////////////// | ||
| 128 |
2/3✓ Branch 1 taken 53 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 53 times.
|
106 | if (boost::optional<model::Curve> curve = modelObject.electronicEnthalpyLimitCurve()) { |
| 129 | ✗ | if (boost::optional<IdfObject> _curve = translateAndMapModelObject(curve.get())) { | |
| 130 | ✗ | idfObject.setString(Controller_OutdoorAirFields::ElectronicEnthalpyLimitCurveName, _curve->name().get()); | |
| 131 | ✗ | } | |
| 132 | 53 | } | |
| 133 | |||
| 134 | /////////////////////////////////////////////////////////////////////////// | ||
| 135 | // Field: Economizer Minimum Limit DryBulb Temperature //////////////////// | ||
| 136 |
1/1✓ Branch 1 taken 53 times.
|
53 | d = modelObject.getEconomizerMinimumLimitDryBulbTemperature(); |
| 137 |
1/2✓ Branch 0 taken 53 times.
✗ Branch 1 not taken.
|
53 | if (d) { |
| 138 |
2/2✓ Branch 1 taken 53 times.
✓ Branch 4 taken 53 times.
|
53 | idfObject.setDouble(openstudio::Controller_OutdoorAirFields::EconomizerMinimumLimitDryBulbTemperature, d.get()); |
| 139 | } else { | ||
| 140 | ✗ | idfObject.setString(openstudio::Controller_OutdoorAirFields::EconomizerMinimumLimitDryBulbTemperature, ""); | |
| 141 | } | ||
| 142 | |||
| 143 | /////////////////////////////////////////////////////////////////////////// | ||
| 144 | // Field: Lockout Type //////////////////////////////////////////////////// | ||
| 145 |
2/2✓ Branch 1 taken 53 times.
✓ Branch 4 taken 53 times.
|
53 | idfObject.setString(openstudio::Controller_OutdoorAirFields::LockoutType, modelObject.getLockoutType()); |
| 146 | |||
| 147 | /////////////////////////////////////////////////////////////////////////// | ||
| 148 | // Field: Minimum Limit Type ////////////////////////////////////////////// | ||
| 149 |
2/2✓ Branch 1 taken 53 times.
✓ Branch 4 taken 53 times.
|
53 | idfObject.setString(openstudio::Controller_OutdoorAirFields::MinimumLimitType, modelObject.getMinimumLimitType()); |
| 150 | |||
| 151 | // HighHumidityControl | ||
| 152 | 53 | boost::optional<bool> ob; | |
| 153 |
1/1✓ Branch 1 taken 53 times.
|
53 | ob = modelObject.getHighHumidityControl(); |
| 154 |
1/2✓ Branch 0 taken 53 times.
✗ Branch 1 not taken.
|
53 | if (ob) { |
| 155 |
2/3✓ Branch 1 taken 53 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 53 times.
|
53 | if (*ob) { |
| 156 | ✗ | idfObject.setString(openstudio::Controller_OutdoorAirFields::HighHumidityControl, "Yes"); | |
| 157 | } else { | ||
| 158 |
2/2✓ Branch 1 taken 53 times.
✓ Branch 4 taken 53 times.
|
106 | idfObject.setString(openstudio::Controller_OutdoorAirFields::HighHumidityControl, "No"); |
| 159 | } | ||
| 160 | } | ||
| 161 | |||
| 162 | // HumidistatControlZoneName | ||
| 163 |
2/3✓ Branch 1 taken 53 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 53 times.
|
106 | if (auto zone_ = modelObject.humidistatControlZone()) { |
| 164 | ✗ | if (boost::optional<ZoneControlHumidistat> humidistat = zone_->zoneControlHumidistat()) { | |
| 165 | ✗ | idfObject.setString(openstudio::Controller_OutdoorAirFields::HumidistatControlZoneName, zone_->nameString()); | |
| 166 | } else { | ||
| 167 | ✗ | LOG(Warn, modelObject.briefDescription() << " has a humidistat control zone " << zone_->nameString() | |
| 168 | << " without a zone control humidistat; humidistat control zone field will not be translated"); | ||
| 169 | ✗ | idfObject.setString(openstudio::Controller_OutdoorAirFields::HighHumidityControl, "No"); | |
| 170 | ✗ | } | |
| 171 | 53 | } | |
| 172 | |||
| 173 | // HighHumidityOutdoorAirFlowRatio | ||
| 174 |
2/2✓ Branch 1 taken 53 times.
✓ Branch 4 taken 53 times.
|
53 | d = modelObject.getHighHumidityOutdoorAirFlowRatio(); |
| 175 |
1/2✓ Branch 0 taken 53 times.
✗ Branch 1 not taken.
|
53 | if (d) { |
| 176 |
2/2✓ Branch 1 taken 53 times.
✓ Branch 4 taken 53 times.
|
53 | idfObject.setDouble(openstudio::Controller_OutdoorAirFields::HighHumidityOutdoorAirFlowRatio, *d); |
| 177 | } | ||
| 178 | |||
| 179 | // ControlHighIndoorHumidityBasedonOutdoorHumidityRatio | ||
| 180 |
2/3✓ Branch 1 taken 53 times.
✓ Branch 3 taken 53 times.
✗ Branch 4 not taken.
|
53 | if (modelObject.getControlHighIndoorHumidityBasedOnOutdoorHumidityRatio()) { |
| 181 |
2/2✓ Branch 1 taken 53 times.
✓ Branch 4 taken 53 times.
|
106 | idfObject.setString(openstudio::Controller_OutdoorAirFields::ControlHighIndoorHumidityBasedonOutdoorHumidityRatio, "Yes"); |
| 182 | } else { | ||
| 183 | ✗ | idfObject.setString(openstudio::Controller_OutdoorAirFields::ControlHighIndoorHumidityBasedonOutdoorHumidityRatio, "No"); | |
| 184 | } | ||
| 185 | |||
| 186 | // HeatRecoveryBypassControlType | ||
| 187 |
1/1✓ Branch 1 taken 53 times.
|
53 | s = modelObject.getHeatRecoveryBypassControlType(); |
| 188 |
1/2✓ Branch 0 taken 53 times.
✗ Branch 1 not taken.
|
53 | if (s) { |
| 189 |
2/2✓ Branch 1 taken 53 times.
✓ Branch 4 taken 53 times.
|
53 | idfObject.setString(openstudio::Controller_OutdoorAirFields::HeatRecoveryBypassControlType, *s); |
| 190 | } | ||
| 191 | |||
| 192 | // EconomizerOperationStaging | ||
| 193 |
2/2✓ Branch 1 taken 53 times.
✓ Branch 4 taken 53 times.
|
53 | idfObject.setString(openstudio::Controller_OutdoorAirFields::EconomizerOperationStaging, modelObject.economizerOperationStaging()); |
| 194 | |||
| 195 | // Controller Mechanical Ventilation | ||
| 196 |
1/1✓ Branch 1 taken 53 times.
|
53 | model::ControllerMechanicalVentilation controllerMechanicalVentilation = modelObject.controllerMechanicalVentilation(); |
| 197 | |||
| 198 |
1/1✓ Branch 1 taken 53 times.
|
53 | boost::optional<IdfObject> controllerMechanicalVentilationIdf = translateAndMapModelObject(controllerMechanicalVentilation); |
| 199 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 35 times.
|
53 | if (controllerMechanicalVentilationIdf) { |
| 200 | 18 | idfObject.setString(openstudio::Controller_OutdoorAirFields::MechanicalVentilationControllerName, | |
| 201 |
4/4✓ Branch 1 taken 18 times.
✓ Branch 4 taken 18 times.
✓ Branch 7 taken 18 times.
✓ Branch 10 taken 18 times.
|
18 | controllerMechanicalVentilationIdf->name().get()); |
| 202 | } | ||
| 203 | |||
| 204 | // MinimumOutdoorAirSchedule | ||
| 205 | |||
| 206 |
2/3✓ Branch 1 taken 53 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 53 times.
|
106 | if (boost::optional<Schedule> s = modelObject.minimumOutdoorAirSchedule()) { |
| 207 | ✗ | if (boost::optional<IdfObject> _s = translateAndMapModelObject(s.get())) { | |
| 208 | ✗ | idfObject.setString(openstudio::Controller_OutdoorAirFields::MinimumOutdoorAirScheduleName, _s->name().get()); | |
| 209 | ✗ | } | |
| 210 | 53 | } | |
| 211 | |||
| 212 | // MinimumFractionofOutdoorAirSchedule | ||
| 213 | |||
| 214 |
2/3✓ Branch 1 taken 53 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 53 times.
|
106 | if (boost::optional<Schedule> s = modelObject.minimumFractionofOutdoorAirSchedule()) { |
| 215 | ✗ | if (boost::optional<IdfObject> _s = translateAndMapModelObject(s.get())) { | |
| 216 | ✗ | idfObject.setString(openstudio::Controller_OutdoorAirFields::MinimumFractionofOutdoorAirScheduleName, _s->name().get()); | |
| 217 | ✗ | } | |
| 218 | 53 | } | |
| 219 | |||
| 220 | // MaximumFractionofOutdoorAirSchedule | ||
| 221 | |||
| 222 |
2/3✓ Branch 1 taken 53 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 53 times.
|
106 | if (boost::optional<Schedule> s = modelObject.maximumFractionofOutdoorAirSchedule()) { |
| 223 | ✗ | if (boost::optional<IdfObject> _s = translateAndMapModelObject(s.get())) { | |
| 224 | ✗ | idfObject.setString(openstudio::Controller_OutdoorAirFields::MaximumFractionofOutdoorAirScheduleName, _s->name().get()); | |
| 225 | ✗ | } | |
| 226 | 53 | } | |
| 227 | |||
| 228 | // TimeofDayEconomizerControlSchedule | ||
| 229 | |||
| 230 |
2/3✓ Branch 1 taken 53 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 53 times.
|
106 | if (boost::optional<Schedule> s = modelObject.timeofDayEconomizerControlSchedule()) { |
| 231 | ✗ | if (boost::optional<IdfObject> _s = translateAndMapModelObject(s.get())) { | |
| 232 | ✗ | idfObject.setString(openstudio::Controller_OutdoorAirFields::TimeofDayEconomizerControlScheduleName, _s->name().get()); | |
| 233 | ✗ | } | |
| 234 | 53 | } | |
| 235 | |||
| 236 |
1/1✓ Branch 1 taken 53 times.
|
106 | return boost::optional<IdfObject>(idfObject); |
| 237 | 53 | } | |
| 238 | |||
| 239 | } // namespace energyplus | ||
| 240 | |||
| 241 | } // namespace openstudio | ||
| 242 |