src/energyplus/ReverseTranslator/ReverseTranslateAirTerminalSingleDuctVAVReheat.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 "../ReverseTranslator.hpp" | ||
| 7 | #include "../../model/AirTerminalSingleDuctVAVReheat.hpp" | ||
| 8 | #include "../../model/AirTerminalSingleDuctVAVReheat_Impl.hpp" | ||
| 9 | #include "../../model/Schedule.hpp" | ||
| 10 | #include "../../model/Schedule_Impl.hpp" | ||
| 11 | #include "../../model/CoilHeatingGas.hpp" | ||
| 12 | #include "../../model/CoilHeatingGas_Impl.hpp" | ||
| 13 | #include <utilities/idd/AirTerminal_SingleDuct_VAV_Reheat_FieldEnums.hxx> | ||
| 14 | #include "../../utilities/idd/IddEnums.hpp" | ||
| 15 | #include <utilities/idd/IddEnums.hxx> | ||
| 16 | |||
| 17 | using namespace openstudio::model; | ||
| 18 | |||
| 19 | namespace openstudio { | ||
| 20 | |||
| 21 | namespace energyplus { | ||
| 22 | |||
| 23 | ✗ | OptionalModelObject ReverseTranslator::translateAirTerminalSingleDuctVAVReheat(const WorkspaceObject& workspaceObject) { | |
| 24 | ✗ | if (workspaceObject.iddObject().type() != IddObjectType::AirTerminal_SingleDuct_VAV_Reheat) { | |
| 25 | ✗ | LOG(Error, "WorkspaceObject is not IddObjectType: AirTerminal_SingleDuct_VAV_Reheat"); | |
| 26 | ✗ | return boost::none; | |
| 27 | } | ||
| 28 | |||
| 29 | ✗ | boost::optional<WorkspaceObject> wo = workspaceObject.getTarget(AirTerminal_SingleDuct_VAV_ReheatFields::AvailabilityScheduleName); | |
| 30 | ✗ | boost::optional<Schedule> schedule; | |
| 31 | ✗ | boost::optional<HVACComponent> coil; | |
| 32 | ✗ | boost::optional<AirTerminalSingleDuctVAVReheat> airTerminal; | |
| 33 | |||
| 34 | ✗ | if (wo) { | |
| 35 | ✗ | boost::optional<ModelObject> mo = translateAndMapWorkspaceObject(wo.get()); | |
| 36 | ✗ | if (mo) { | |
| 37 | ✗ | if (!(schedule = mo->optionalCast<Schedule>())) { | |
| 38 | ✗ | LOG(Error, workspaceObject.briefDescription() << " does not have an associated availability schedule"); | |
| 39 | |||
| 40 | ✗ | return boost::none; | |
| 41 | } | ||
| 42 | } | ||
| 43 | ✗ | } | |
| 44 | |||
| 45 | ✗ | wo = workspaceObject.getTarget(AirTerminal_SingleDuct_VAV_ReheatFields::ReheatCoilName); | |
| 46 | ✗ | if (wo) { | |
| 47 | ✗ | boost::optional<ModelObject> mo = translateAndMapWorkspaceObject(wo.get()); | |
| 48 | ✗ | if (mo) { | |
| 49 | ✗ | if (!coil) { | |
| 50 | ✗ | coil = mo->optionalCast<CoilHeatingGas>(); | |
| 51 | } | ||
| 52 | } | ||
| 53 | ✗ | } | |
| 54 | |||
| 55 | ✗ | if (schedule && coil) { | |
| 56 | ✗ | airTerminal = AirTerminalSingleDuctVAVReheat(m_model, schedule.get(), coil.get()); | |
| 57 | } | ||
| 58 | |||
| 59 | ✗ | if (airTerminal) { | |
| 60 | ✗ | boost::optional<double> value; | |
| 61 | ✗ | boost::optional<std::string> s = workspaceObject.getString(AirTerminal_SingleDuct_VAV_ReheatFields::Name); | |
| 62 | |||
| 63 | ✗ | if (s) { | |
| 64 | ✗ | airTerminal->setName(s.get()); | |
| 65 | } | ||
| 66 | |||
| 67 | // MaximumAirFlowRate | ||
| 68 | ✗ | value = workspaceObject.getDouble(AirTerminal_SingleDuct_VAV_ReheatFields::MaximumAirFlowRate); | |
| 69 | ✗ | s = workspaceObject.getString(AirTerminal_SingleDuct_VAV_ReheatFields::MaximumAirFlowRate); | |
| 70 | ✗ | if (value) { | |
| 71 | ✗ | airTerminal->setMaximumAirFlowRate(value.get()); | |
| 72 | ✗ | } else if (s && istringEqual(s.get(), "Autosize")) { | |
| 73 | ✗ | airTerminal->autosizeMaximumAirFlowRate(); | |
| 74 | ✗ | } else if (s && istringEqual(s.get(), "Autocalculate")) { | |
| 75 | ✗ | airTerminal->autosizeMaximumAirFlowRate(); | |
| 76 | } | ||
| 77 | |||
| 78 | // ZoneMinimumAirFlowInputMethod | ||
| 79 | ✗ | s = workspaceObject.getString(AirTerminal_SingleDuct_VAV_ReheatFields::ZoneMinimumAirFlowInputMethod); | |
| 80 | ✗ | if (s) { | |
| 81 | ✗ | airTerminal->setZoneMinimumAirFlowInputMethod(s.get()); | |
| 82 | } | ||
| 83 | |||
| 84 | // ConstantMinimumAirFlowFraction | ||
| 85 | ✗ | value = workspaceObject.getDouble(AirTerminal_SingleDuct_VAV_ReheatFields::ConstantMinimumAirFlowFraction); | |
| 86 | ✗ | if (value) { | |
| 87 | ✗ | airTerminal->setConstantMinimumAirFlowFraction(value.get()); | |
| 88 | } else { | ||
| 89 | ✗ | s = workspaceObject.getString(AirTerminal_SingleDuct_VAV_ReheatFields::ConstantMinimumAirFlowFraction); | |
| 90 | ✗ | if (s && (istringEqual(s.get(), "Autosize") || istringEqual(s.get(), "Autocalculate"))) { | |
| 91 | ✗ | airTerminal->autosizeMaximumAirFlowRate(); | |
| 92 | } | ||
| 93 | } | ||
| 94 | |||
| 95 | // FixedMinimumAirFlowRate | ||
| 96 | ✗ | value = workspaceObject.getDouble(AirTerminal_SingleDuct_VAV_ReheatFields::FixedMinimumAirFlowRate); | |
| 97 | ✗ | if (value) { | |
| 98 | ✗ | airTerminal->setFixedMinimumAirFlowRate(value.get()); | |
| 99 | } else { | ||
| 100 | ✗ | s = workspaceObject.getString(AirTerminal_SingleDuct_VAV_ReheatFields::FixedMinimumAirFlowRate); | |
| 101 | ✗ | if (s && (istringEqual(s.get(), "Autosize") || istringEqual(s.get(), "Autocalculate"))) { | |
| 102 | ✗ | airTerminal->autosizeFixedMinimumAirFlowRate(); | |
| 103 | } | ||
| 104 | } | ||
| 105 | |||
| 106 | ✗ | boost::optional<WorkspaceObject> _schedule; | |
| 107 | |||
| 108 | // MinimumAirFlowFractionScheduleName | ||
| 109 | ✗ | _schedule = workspaceObject.getTarget(AirTerminal_SingleDuct_VAV_ReheatFields::MinimumAirFlowFractionScheduleName); | |
| 110 | ✗ | if (_schedule) { | |
| 111 | ✗ | boost::optional<ModelObject> mo = translateAndMapWorkspaceObject(_schedule.get()); | |
| 112 | ✗ | if (mo) { | |
| 113 | ✗ | if (boost::optional<Schedule> schedule = mo->optionalCast<Schedule>()) { | |
| 114 | ✗ | airTerminal->setMinimumAirFlowFractionSchedule(schedule.get()); | |
| 115 | ✗ | } | |
| 116 | } | ||
| 117 | ✗ | } | |
| 118 | |||
| 119 | // MaximumHotWaterorSteamFlowRate | ||
| 120 | ✗ | value = workspaceObject.getDouble(AirTerminal_SingleDuct_VAV_ReheatFields::MaximumHotWaterorSteamFlowRate); | |
| 121 | ✗ | s = workspaceObject.getString(AirTerminal_SingleDuct_VAV_ReheatFields::MaximumHotWaterorSteamFlowRate); | |
| 122 | ✗ | if (value) { | |
| 123 | ✗ | airTerminal->setMaximumHotWaterOrSteamFlowRate(value.get()); | |
| 124 | ✗ | } else if (s && istringEqual(s.get(), "Autosize")) { | |
| 125 | ✗ | airTerminal->autosizeMaximumHotWaterOrSteamFlowRate(); | |
| 126 | ✗ | } else if (s && istringEqual(s.get(), "Autocalculate")) { | |
| 127 | ✗ | airTerminal->autosizeMaximumHotWaterOrSteamFlowRate(); | |
| 128 | } | ||
| 129 | |||
| 130 | // MinimumHotWaterorSteamFlowRate | ||
| 131 | ✗ | value = workspaceObject.getDouble(AirTerminal_SingleDuct_VAV_ReheatFields::MinimumHotWaterorSteamFlowRate); | |
| 132 | ✗ | if (value) { | |
| 133 | ✗ | airTerminal->setMinimumHotWaterOrStreamFlowRate(value.get()); | |
| 134 | } | ||
| 135 | |||
| 136 | // ConvergenceTolerance | ||
| 137 | ✗ | value = workspaceObject.getDouble(AirTerminal_SingleDuct_VAV_ReheatFields::ConvergenceTolerance); | |
| 138 | ✗ | if (value) { | |
| 139 | ✗ | airTerminal->setConvergenceTolerance(value.get()); | |
| 140 | } | ||
| 141 | |||
| 142 | // DamperHeatingAction | ||
| 143 | ✗ | s = workspaceObject.getString(AirTerminal_SingleDuct_VAV_ReheatFields::DamperHeatingAction); | |
| 144 | ✗ | if (s) { | |
| 145 | ✗ | airTerminal->setDamperHeatingAction(s.get()); | |
| 146 | } | ||
| 147 | |||
| 148 | // MaximumFlowPerZoneFloorAreaDuringReheat | ||
| 149 | ✗ | value = workspaceObject.getDouble(AirTerminal_SingleDuct_VAV_ReheatFields::MaximumFlowperZoneFloorAreaDuringReheat); | |
| 150 | ✗ | s = workspaceObject.getString(AirTerminal_SingleDuct_VAV_ReheatFields::MaximumFlowperZoneFloorAreaDuringReheat); | |
| 151 | ✗ | if (value) { | |
| 152 | ✗ | airTerminal->setMaximumFlowPerZoneFloorAreaDuringReheat(value.get()); | |
| 153 | ✗ | } else if (s && istringEqual(s.get(), "Autosize")) { | |
| 154 | ✗ | airTerminal->autosizeMaximumFlowPerZoneFloorAreaDuringReheat(); | |
| 155 | ✗ | } else if (s && istringEqual(s.get(), "Autocalculate")) { | |
| 156 | ✗ | airTerminal->autosizeMaximumFlowPerZoneFloorAreaDuringReheat(); | |
| 157 | } | ||
| 158 | |||
| 159 | // MaximumFlowFractionDuringReheat | ||
| 160 | ✗ | value = workspaceObject.getDouble(AirTerminal_SingleDuct_VAV_ReheatFields::MaximumFlowFractionDuringReheat); | |
| 161 | ✗ | s = workspaceObject.getString(AirTerminal_SingleDuct_VAV_ReheatFields::MaximumFlowFractionDuringReheat); | |
| 162 | ✗ | if (value) { | |
| 163 | ✗ | airTerminal->setMaximumFlowFractionDuringReheat(value.get()); | |
| 164 | ✗ | } else if (s && istringEqual(s.get(), "Autosize")) { | |
| 165 | ✗ | airTerminal->autosizeMaximumFlowFractionDuringReheat(); | |
| 166 | ✗ | } else if (s && istringEqual(s.get(), "Autocalculate")) { | |
| 167 | ✗ | airTerminal->autosizeMaximumFlowFractionDuringReheat(); | |
| 168 | } | ||
| 169 | |||
| 170 | // MaximumReheatAirTemperature | ||
| 171 | ✗ | value = workspaceObject.getDouble(AirTerminal_SingleDuct_VAV_ReheatFields::MaximumReheatAirTemperature); | |
| 172 | ✗ | if (value) { | |
| 173 | ✗ | airTerminal->setMaximumReheatAirTemperature(value.get()); | |
| 174 | } | ||
| 175 | |||
| 176 | // MinimumAirFlowTurndownScheduleName | ||
| 177 | ✗ | _schedule = workspaceObject.getTarget(AirTerminal_SingleDuct_VAV_ReheatFields::MinimumAirFlowTurndownScheduleName); | |
| 178 | ✗ | if (_schedule) { | |
| 179 | ✗ | boost::optional<ModelObject> mo = translateAndMapWorkspaceObject(_schedule.get()); | |
| 180 | ✗ | if (mo) { | |
| 181 | ✗ | if (boost::optional<Schedule> schedule = mo->optionalCast<Schedule>()) { | |
| 182 | ✗ | airTerminal->setMinimumAirFlowTurndownSchedule(schedule.get()); | |
| 183 | ✗ | } | |
| 184 | } | ||
| 185 | ✗ | } | |
| 186 | |||
| 187 | ✗ | return airTerminal.get(); | |
| 188 | ✗ | } else { | |
| 189 | ✗ | LOG(Error, "Unknown error translating " << workspaceObject.briefDescription()); | |
| 190 | |||
| 191 | ✗ | return boost::none; | |
| 192 | } | ||
| 193 | ✗ | } | |
| 194 | |||
| 195 | } // namespace energyplus | ||
| 196 | |||
| 197 | } // namespace openstudio | ||
| 198 |