GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 0.0% 0 / 0 / 111
Functions: 0.0% 0 / 0 / 1
Branches: 0.0% 0 / 0 / 177

src/energyplus/ReverseTranslator/ReverseTranslateZoneHVACIdealLoadsAirSystem.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
8 #include "../../model/Schedule.hpp"
9 #include "../../model/Schedule_Impl.hpp"
10 #include "../../model/Node.hpp"
11 #include "../../model/Node_Impl.hpp"
12 #include "../../model/ZoneHVACIdealLoadsAirSystem.hpp"
13 #include "../../model/ZoneHVACIdealLoadsAirSystem_Impl.hpp"
14 #include "../../model/ThermalZone.hpp"
15 #include "../../model/ThermalZone_Impl.hpp"
16
17 #include <utilities/idd/ZoneHVAC_IdealLoadsAirSystem_FieldEnums.hxx>
18 #include <utilities/idd/OS_ZoneHVAC_IdealLoadsAirSystem_FieldEnums.hxx>
19 #include "../../utilities/idd/IddEnums.hpp"
20 #include <utilities/idd/IddEnums.hxx>
21
22 using namespace openstudio::model;
23
24 namespace openstudio {
25
26 namespace energyplus {
27
28 ✗ OptionalModelObject ReverseTranslator::translateZoneHVACIdealLoadsAirSystem(const WorkspaceObject& workspaceObject) {
29 ✗ if (workspaceObject.iddObject().type() != IddObjectType::ZoneHVAC_IdealLoadsAirSystem) {
30 ✗ LOG(Error, "WorkspaceObject is not IddObjectType: ZoneHVAC:IdealLoadsAirSystem");
31 ✗ return boost::none;
32 }
33
34 ✗ ZoneHVACIdealLoadsAirSystem zoneHVACIdealLoadsAirSystem(m_model);
35
36 // name
37 ✗ boost::optional<std::string> s = workspaceObject.name();
38 ✗ if (s) {
39 ✗ zoneHVACIdealLoadsAirSystem.setName(*s);
40 }
41
42 // availability schedule
43 ✗ OptionalWorkspaceObject target = workspaceObject.getTarget(ZoneHVAC_IdealLoadsAirSystemFields::AvailabilityScheduleName);
44 ✗ if (target) {
45 ✗ OptionalModelObject availabilitySchedule = translateAndMapWorkspaceObject(*target);
46 ✗ if (availabilitySchedule) {
47 ✗ zoneHVACIdealLoadsAirSystem.setPointer(OS_ZoneHVAC_IdealLoadsAirSystemFields::AvailabilityScheduleName, availabilitySchedule->handle());
48 }
49 ✗ }
50
51 // skip inlet and outlet node names - that should be done by the zone HVAC object translator
52
53 // maximum heating supply air temperature
54 ✗ OptionalDouble d = workspaceObject.getDouble(ZoneHVAC_IdealLoadsAirSystemFields::MaximumHeatingSupplyAirTemperature);
55 ✗ if (d) {
56 ✗ zoneHVACIdealLoadsAirSystem.setMaximumHeatingSupplyAirTemperature(*d);
57 }
58
59 // minimum cooling supply air temperature
60 ✗ d = workspaceObject.getDouble(ZoneHVAC_IdealLoadsAirSystemFields::MinimumCoolingSupplyAirTemperature);
61 ✗ if (d) {
62 ✗ zoneHVACIdealLoadsAirSystem.setMinimumCoolingSupplyAirTemperature(*d);
63 }
64
65 // maximum heating supply air humidity ratio
66 ✗ d = workspaceObject.getDouble(ZoneHVAC_IdealLoadsAirSystemFields::MaximumHeatingSupplyAirHumidityRatio);
67 ✗ if (d) {
68 ✗ zoneHVACIdealLoadsAirSystem.setMaximumHeatingSupplyAirHumidityRatio(*d);
69 }
70
71 // minimum cooling supply air humidity ratio
72 ✗ d = workspaceObject.getDouble(ZoneHVAC_IdealLoadsAirSystemFields::MinimumCoolingSupplyAirHumidityRatio);
73 ✗ if (d) {
74 ✗ zoneHVACIdealLoadsAirSystem.setMinimumCoolingSupplyAirHumidityRatio(*d);
75 }
76
77 // heating limit
78 ✗ s = workspaceObject.getString(ZoneHVAC_IdealLoadsAirSystemFields::HeatingLimit);
79 ✗ if (s) {
80 ✗ zoneHVACIdealLoadsAirSystem.setHeatingLimit(*s);
81 }
82
83 // maximum heating air flow rate
84 ✗ d = workspaceObject.getDouble(ZoneHVAC_IdealLoadsAirSystemFields::MaximumHeatingAirFlowRate);
85 ✗ if (d) {
86 ✗ zoneHVACIdealLoadsAirSystem.setMaximumHeatingAirFlowRate(*d);
87 }
88
89 // maximum sensible heating capacity
90 ✗ d = workspaceObject.getDouble(ZoneHVAC_IdealLoadsAirSystemFields::MaximumSensibleHeatingCapacity);
91 ✗ if (d) {
92 ✗ zoneHVACIdealLoadsAirSystem.setMaximumSensibleHeatingCapacity(*d);
93 }
94
95 // cooling limit
96 ✗ s = workspaceObject.getString(ZoneHVAC_IdealLoadsAirSystemFields::CoolingLimit);
97 ✗ if (s) {
98 ✗ zoneHVACIdealLoadsAirSystem.setCoolingLimit(*s);
99 }
100
101 // maximum cooling airflow rate
102 ✗ d = workspaceObject.getDouble(ZoneHVAC_IdealLoadsAirSystemFields::MaximumCoolingAirFlowRate);
103 ✗ if (d) {
104 ✗ zoneHVACIdealLoadsAirSystem.setMaximumCoolingAirFlowRate(*d);
105 }
106
107 // maximum total cooling capacity
108 ✗ d = workspaceObject.getDouble(ZoneHVAC_IdealLoadsAirSystemFields::MaximumTotalCoolingCapacity);
109 ✗ if (d) {
110 ✗ zoneHVACIdealLoadsAirSystem.setMaximumTotalCoolingCapacity(*d);
111 }
112
113 // heating availability schedule
114 ✗ target = workspaceObject.getTarget(ZoneHVAC_IdealLoadsAirSystemFields::HeatingAvailabilityScheduleName);
115 ✗ if (target) {
116 ✗ OptionalModelObject heatingAvailabilitySchedule = translateAndMapWorkspaceObject(*target);
117 ✗ if (heatingAvailabilitySchedule) {
118 ✗ zoneHVACIdealLoadsAirSystem.setPointer(OS_ZoneHVAC_IdealLoadsAirSystemFields::HeatingAvailabilityScheduleName,
119 ✗ heatingAvailabilitySchedule->handle());
120 }
121 ✗ }
122
123 // cooling availability schedule
124 ✗ target = workspaceObject.getTarget(ZoneHVAC_IdealLoadsAirSystemFields::CoolingAvailabilityScheduleName);
125 ✗ if (target) {
126 ✗ OptionalModelObject coolingAvailabilitySchedule = translateAndMapWorkspaceObject(*target);
127 ✗ if (coolingAvailabilitySchedule) {
128 ✗ zoneHVACIdealLoadsAirSystem.setPointer(OS_ZoneHVAC_IdealLoadsAirSystemFields::CoolingAvailabilityScheduleName,
129 ✗ coolingAvailabilitySchedule->handle());
130 }
131 ✗ }
132
133 // dehumidification control type
134 ✗ s = workspaceObject.getString(ZoneHVAC_IdealLoadsAirSystemFields::DehumidificationControlType);
135 ✗ if (s) {
136 ✗ zoneHVACIdealLoadsAirSystem.setDehumidificationControlType(*s);
137 }
138
139 // cooling sensible heat ratio
140 ✗ d = workspaceObject.getDouble(ZoneHVAC_IdealLoadsAirSystemFields::CoolingSensibleHeatRatio);
141 ✗ if (d) {
142 ✗ zoneHVACIdealLoadsAirSystem.setCoolingSensibleHeatRatio(*d);
143 }
144
145 // humidification control type
146 ✗ s = workspaceObject.getString(ZoneHVAC_IdealLoadsAirSystemFields::HumidificationControlType);
147 ✗ if (s) {
148 ✗ zoneHVACIdealLoadsAirSystem.setHumidificationControlType(*s);
149 }
150
151 // design specification outdoor air object name
152 ✗ target = workspaceObject.getTarget(ZoneHVAC_IdealLoadsAirSystemFields::DesignSpecificationOutdoorAirObjectName);
153 ✗ if (target) {
154 ✗ OptionalModelObject designSpecificationOutdoorAir = translateAndMapWorkspaceObject(*target);
155 ✗ if (designSpecificationOutdoorAir) {
156 ✗ zoneHVACIdealLoadsAirSystem.setPointer(OS_ZoneHVAC_IdealLoadsAirSystemFields::DesignSpecificationOutdoorAirObjectName,
157 ✗ designSpecificationOutdoorAir->handle());
158 }
159 ✗ }
160
161 // demand controlled ventilation type
162 ✗ s = workspaceObject.getString(ZoneHVAC_IdealLoadsAirSystemFields::DemandControlledVentilationType);
163 ✗ if (s) {
164 ✗ zoneHVACIdealLoadsAirSystem.setDemandControlledVentilationType(*s);
165 }
166
167 // outdoor air economizer type
168 ✗ s = workspaceObject.getString(ZoneHVAC_IdealLoadsAirSystemFields::OutdoorAirEconomizerType);
169 ✗ if (s) {
170 ✗ zoneHVACIdealLoadsAirSystem.setOutdoorAirEconomizerType(*s);
171 }
172
173 // heat recovery type
174 ✗ s = workspaceObject.getString(ZoneHVAC_IdealLoadsAirSystemFields::HeatRecoveryType);
175 ✗ if (s) {
176 ✗ zoneHVACIdealLoadsAirSystem.setHeatRecoveryType(*s);
177 }
178
179 // sensible heat recovery effectiveness
180 ✗ d = workspaceObject.getDouble(ZoneHVAC_IdealLoadsAirSystemFields::SensibleHeatRecoveryEffectiveness);
181 ✗ if (d) {
182 ✗ zoneHVACIdealLoadsAirSystem.setSensibleHeatRecoveryEffectiveness(*d);
183 }
184
185 // latent heat recovery effectiveness
186 ✗ d = workspaceObject.getDouble(ZoneHVAC_IdealLoadsAirSystemFields::LatentHeatRecoveryEffectiveness);
187 ✗ if (d) {
188 ✗ zoneHVACIdealLoadsAirSystem.setLatentHeatRecoveryEffectiveness(*d);
189 }
190
191 // heating fuel efficiency schedule name
192 ✗ target = workspaceObject.getTarget(ZoneHVAC_IdealLoadsAirSystemFields::HeatingFuelEfficiencyScheduleName);
193 ✗ if (target) {
194 ✗ OptionalModelObject heatingFuelEfficiencySchedule = translateAndMapWorkspaceObject(*target);
195 ✗ if (heatingFuelEfficiencySchedule) {
196 ✗ zoneHVACIdealLoadsAirSystem.setPointer(OS_ZoneHVAC_IdealLoadsAirSystemFields::HeatingFuelEfficiencyScheduleName,
197 ✗ heatingFuelEfficiencySchedule->handle());
198 }
199 ✗ }
200
201 // heating fuel type
202 ✗ s = workspaceObject.getString(ZoneHVAC_IdealLoadsAirSystemFields::HeatingFuelType);
203 ✗ if (s) {
204 ✗ zoneHVACIdealLoadsAirSystem.setHeatingFuelType(*s);
205 }
206
207 // cooling fuel efficiency schedule name
208 ✗ target = workspaceObject.getTarget(ZoneHVAC_IdealLoadsAirSystemFields::CoolingFuelEfficiencyScheduleName);
209 ✗ if (target) {
210 ✗ OptionalModelObject coolingFuelEfficiencySchedule = translateAndMapWorkspaceObject(*target);
211 ✗ if (coolingFuelEfficiencySchedule) {
212 ✗ zoneHVACIdealLoadsAirSystem.setPointer(OS_ZoneHVAC_IdealLoadsAirSystemFields::CoolingFuelEfficiencyScheduleName,
213 ✗ coolingFuelEfficiencySchedule->handle());
214 }
215 ✗ }
216
217 // cooling fuel type
218 ✗ s = workspaceObject.getString(ZoneHVAC_IdealLoadsAirSystemFields::CoolingFuelType);
219 ✗ if (s) {
220 ✗ zoneHVACIdealLoadsAirSystem.setCoolingFuelType(*s);
221 }
222
223 ✗ return zoneHVACIdealLoadsAirSystem;
224 ✗ }
225
226 } // namespace energyplus
227
228 } // namespace openstudio
229