GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 54.6% 261 / 0 / 478
Functions: 87.5% 14 / 0 / 16
Branches: 66.3% 408 / 0 / 615

src/energyplus/ForwardTranslator/ForwardTranslatePlantEquipmentOperationSchemes.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 "ForwardTranslatePlantEquipmentOperationSchemes.hpp"
8
9 #include "../../model/Model.hpp"
10 #include "../../model/PlantLoop.hpp"
11 #include "../../model/PlantLoop_Impl.hpp"
12 #include "../../model/Node.hpp"
13 #include "../../model/Node_Impl.hpp"
14 #include "../../model/BoilerHotWater.hpp"
15 #include "../../model/BoilerHotWater_Impl.hpp"
16
17 #include "../../model/CentralHeatPumpSystem.hpp"
18 #include "../../model/CentralHeatPumpSystem_Impl.hpp"
19 #include "../../model/CentralHeatPumpSystemModule.hpp"
20 #include "../../model/ChillerHeaterPerformanceElectricEIR.hpp"
21
22 #include "../../model/ChillerElectricASHRAE205.hpp"
23 #include "../../model/ChillerElectricASHRAE205_Impl.hpp"
24 #include "../../model/ChillerElectricEIR.hpp"
25 #include "../../model/ChillerElectricEIR_Impl.hpp"
26 #include "../../model/ChillerElectricReformulatedEIR.hpp"
27 #include "../../model/ChillerElectricReformulatedEIR_Impl.hpp"
28 #include "../../model/ChillerAbsorptionIndirect.hpp"
29 #include "../../model/ChillerAbsorptionIndirect_Impl.hpp"
30 #include "../../model/ChillerAbsorption.hpp"
31 #include "../../model/ChillerAbsorption_Impl.hpp"
32 #include "../../model/CoolingTowerSingleSpeed.hpp"
33 #include "../../model/CoolingTowerSingleSpeed_Impl.hpp"
34 #include "../../model/CoolingTowerVariableSpeed.hpp"
35 #include "../../model/CoolingTowerVariableSpeed_Impl.hpp"
36 #include "../../model/CoolingTowerTwoSpeed.hpp"
37 #include "../../model/CoolingTowerTwoSpeed_Impl.hpp"
38 #include "../../model/GeneratorFuelCellExhaustGasToWaterHeatExchanger.hpp"
39 #include "../../model/GeneratorFuelCellExhaustGasToWaterHeatExchanger_Impl.hpp"
40 #include "../../model/GroundHeatExchangerVertical.hpp"
41 #include "../../model/GroundHeatExchangerVertical_Impl.hpp"
42 #include "../../model/GroundHeatExchangerHorizontalTrench.hpp"
43 #include "../../model/GroundHeatExchangerHorizontalTrench_Impl.hpp"
44 #include "../../model/HeatExchangerFluidToFluid.hpp"
45 #include "../../model/HeatExchangerFluidToFluid_Impl.hpp"
46 #include "../../model/PlantEquipmentOperationCoolingLoad.hpp"
47 #include "../../model/PlantEquipmentOperationCoolingLoad_Impl.hpp"
48 #include "../../model/PlantEquipmentOperationHeatingLoad.hpp"
49 #include "../../model/PlantEquipmentOperationHeatingLoad_Impl.hpp"
50 #include "../../model/PlantEquipmentOperationScheme.hpp"
51 #include "../../model/PlantEquipmentOperationScheme_Impl.hpp"
52 #include "../../model/EvaporativeFluidCoolerSingleSpeed.hpp"
53 #include "../../model/EvaporativeFluidCoolerSingleSpeed_Impl.hpp"
54 #include "../../model/EvaporativeFluidCoolerTwoSpeed.hpp"
55 #include "../../model/EvaporativeFluidCoolerTwoSpeed_Impl.hpp"
56 #include "../../model/FluidCoolerSingleSpeed.hpp"
57 #include "../../model/FluidCoolerSingleSpeed_Impl.hpp"
58 #include "../../model/FluidCoolerTwoSpeed.hpp"
59 #include "../../model/FluidCoolerTwoSpeed_Impl.hpp"
60 #include "../../model/SetpointManager.hpp"
61 #include "../../model/SetpointManager_Impl.hpp"
62 #include "../../model/Schedule.hpp"
63 #include "../../model/Schedule_Impl.hpp"
64 #include "../../model/ThermalStorageChilledWaterStratified.hpp"
65 #include "../../model/ThermalStorageChilledWaterStratified_Impl.hpp"
66 #include "../../model/WaterHeaterMixed.hpp"
67 #include "../../model/WaterHeaterMixed_Impl.hpp"
68 #include "../../model/WaterHeaterStratified.hpp"
69 #include "../../model/WaterHeaterStratified_Impl.hpp"
70 #include "../../model/ZoneHVACComponent.hpp"
71 #include "../../model/ZoneHVACComponent_Impl.hpp"
72 #include "../../model/SolarCollectorIntegralCollectorStorage.hpp"
73 #include "../../model/SolarCollectorIntegralCollectorStorage_Impl.hpp"
74 #include "../../model/SolarCollectorFlatPlateWater.hpp"
75 #include "../../model/SolarCollectorFlatPlateWater_Impl.hpp"
76 #include "../../model/SolarCollectorFlatPlatePhotovoltaicThermal.hpp"
77 #include "../../model/SolarCollectorFlatPlatePhotovoltaicThermal_Impl.hpp"
78 #include "../../model/PlantComponentTemperatureSource.hpp"
79 #include "../../model/PlantComponentTemperatureSource_Impl.hpp"
80 #include "../../model/PlantComponentUserDefined.hpp"
81 #include "../../model/PlantComponentUserDefined_Impl.hpp"
82 #include "../../model/HeatPumpAirToWaterCooling.hpp"
83 #include "../../model/HeatPumpAirToWaterCooling_Impl.hpp"
84 #include "../../model/HeatPumpAirToWaterHeating.hpp"
85 #include "../../model/HeatPumpAirToWaterHeating_Impl.hpp"
86 #include "../../model/HeatPumpAirToWaterFuelFiredHeating.hpp"
87 #include "../../model/HeatPumpAirToWaterFuelFiredHeating_Impl.hpp"
88 #include "../../model/HeatPumpAirToWaterFuelFiredCooling.hpp"
89 #include "../../model/HeatPumpAirToWaterFuelFiredCooling_Impl.hpp"
90 #include "../../model/HeatPumpWaterToWaterEquationFitHeating.hpp"
91 #include "../../model/HeatPumpWaterToWaterEquationFitHeating_Impl.hpp"
92 #include "../../model/HeatPumpWaterToWaterEquationFitCooling.hpp"
93 #include "../../model/HeatPumpWaterToWaterEquationFitCooling_Impl.hpp"
94 #include "../../model/HeatPumpPlantLoopEIRHeating.hpp"
95 #include "../../model/HeatPumpPlantLoopEIRHeating_Impl.hpp"
96 #include "../../model/HeatPumpPlantLoopEIRCooling.hpp"
97 #include "../../model/HeatPumpPlantLoopEIRCooling_Impl.hpp"
98 #include "../../model/CoilCoolingWater.hpp"
99 #include "../../model/CoilCoolingWater_Impl.hpp"
100 #include "../../model/CoilSystemCoolingWater.hpp"
101 #include "../../model/CoilSystemCoolingWater_Impl.hpp"
102 #include "../../utilities/idf/IdfExtensibleGroup.hpp"
103 #include "../../utilities/idf/Workspace.hpp"
104 #include "../../utilities/idf/WorkspaceObjectOrder.hpp"
105 #include "../../utilities/core/Logger.hpp"
106 #include "../../utilities/core/Assert.hpp"
107 #include <utilities/idd/IddEnums.hxx>
108 #include <utilities/idd/PlantEquipmentOperationSchemes_FieldEnums.hxx>
109 #include <utilities/idd/PlantEquipmentOperation_HeatingLoad_FieldEnums.hxx>
110 #include <utilities/idd/PlantEquipmentOperation_CoolingLoad_FieldEnums.hxx>
111 #include <utilities/idd/PlantEquipmentOperation_ComponentSetpoint_FieldEnums.hxx>
112 #include <utilities/idd/PlantEquipmentOperation_Uncontrolled_FieldEnums.hxx>
113 #include <utilities/idd/PlantEquipmentList_FieldEnums.hxx>
114
115 // Special case
116 #include "../../model/GeneratorMicroTurbineHeatRecovery.hpp"
117 #include "../../model/GeneratorMicroTurbineHeatRecovery_Impl.hpp"
118 #include "../../model/GeneratorMicroTurbine.hpp"
119 #include "../../model/GeneratorMicroTurbine_Impl.hpp"
120 #include "../../utilities/data/DataEnums.hpp"
121 #include "../../utilities/core/DeprecatedHelpers.hpp"
122
123 using namespace openstudio::model;
124 using namespace openstudio::energyplus;
125
126 using namespace std;
127
128 namespace openstudio {
129
130 namespace energyplus {
131
132 602 bool _isSetpointComponent(const PlantLoop& plantLoop, const ModelObject& comp) {
133
1/1
✓ Branch 1 taken 602 times.
602 auto supplyOutletNode = plantLoop.supplyOutletNode();
134
1/1
✓ Branch 1 taken 602 times.
602 auto hvacComp = comp.optionalCast<HVACComponent>();
135
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 602 times.
✗ Branch 4 not taken.
602 OS_ASSERT(hvacComp);
136
137
5/5
✓ Branch 1 taken 602 times.
✓ Branch 4 taken 602 times.
✓ Branch 7 taken 602 times.
✓ Branch 10 taken 602 times.
✓ Branch 13 taken 602 times.
1204 auto nodes = subsetCastVector<Node>(plantLoop.supplyComponents(hvacComp.get(), supplyOutletNode));
138
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 602 times.
✗ Branch 4 not taken.
602 OS_ASSERT(!nodes.empty());
139
1/1
✓ Branch 2 taken 602 times.
602 auto componentOutletNode = nodes.front();
140
141
3/3
✓ Branch 1 taken 602 times.
✓ Branch 3 taken 364 times.
✓ Branch 4 taken 238 times.
602 if (componentOutletNode != supplyOutletNode) {
142
1/1
✓ Branch 1 taken 364 times.
364 auto _setpointManagers = componentOutletNode.setpointManagers();
143
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 362 times.
364 if (!_setpointManagers.empty()) {
144 2 return true;
145 }
146 364 }
147
148 600 return false;
149 602 }
150
151 49 openstudio::energyplus::ComponentType convertOSEnumToEnum(openstudio::ComponentType compType) {
152
3/3
✓ Branch 1 taken 49 times.
✓ Branch 4 taken 20 times.
✓ Branch 5 taken 29 times.
49 if (compType == openstudio::ComponentType::Cooling) {
153 20 return openstudio::energyplus::ComponentType::COOLING;
154
3/3
✓ Branch 1 taken 29 times.
✓ Branch 4 taken 16 times.
✓ Branch 5 taken 13 times.
29 } else if (compType == openstudio::ComponentType::Heating) {
155 16 return openstudio::energyplus::ComponentType::HEATING;
156
3/3
✓ Branch 1 taken 13 times.
✓ Branch 4 taken 7 times.
✓ Branch 5 taken 6 times.
13 } else if (compType == openstudio::ComponentType::Both) {
157 7 return openstudio::energyplus::ComponentType::BOTH;
158 }
159
160 6 return openstudio::energyplus::ComponentType::NONE;
161 }
162
163 ✗ openstudio::energyplus::ComponentType plantLoopType(const PlantLoop& plantLoop) {
164 ✗ auto logChannel = [] { return "openstudio::energyplus::plantLoopType"; };
165 ✗ DEPRECATED_AT_MSG(3, 6, 0, "Use Loop::componentType instead");
166 ✗ return convertOSEnumToEnum(plantLoop.componentType());
167 }
168
169 49 openstudio::energyplus::ComponentType componentType(const openstudio::model::HVACComponent& component) {
170 49 auto logChannel = [] { return "openstudio::energyplus::componentType"; };
171
5/5
✓ Branch 1 taken 49 times.
✓ Branch 4 taken 49 times.
✓ Branch 8 taken 49 times.
✓ Branch 11 taken 49 times.
✓ Branch 14 taken 49 times.
294 DEPRECATED_AT_MSG(3, 6, 0, "Use HVACComponent::componentType instead");
172
2/2
✓ Branch 1 taken 49 times.
✓ Branch 4 taken 49 times.
98 return convertOSEnumToEnum(component.componentType());
173 }
174
175 1 boost::optional<Node> inletNode(const PlantLoop& plantLoop, const HVACComponent& component) {
176
4/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
2 auto comps = plantLoop.supplyComponents(plantLoop.supplyInletNode(), component);
177
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 1 time.
✗ Branch 4 not taken.
1 OS_ASSERT(comps.size() >= 2u);
178
1/1
✓ Branch 4 taken 1 time.
2 return (comps.end() - 2u)->optionalCast<Node>();
179 1 }
180
181 1 boost::optional<Node> outletNode(const PlantLoop& plantLoop, const HVACComponent& component) {
182
4/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
2 auto comps = plantLoop.supplyComponents(component, plantLoop.supplyOutletNode());
183
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 1 time.
✗ Branch 4 not taken.
1 OS_ASSERT(comps.size() >= 2u);
184
1/1
✓ Branch 2 taken 1 time.
2 return comps[1].optionalCast<Node>();
185 1 }
186
187 1 boost::optional<double> flowrate(const HVACComponent& component) {
188 1 boost::optional<double> result;
189
4/43
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✓ Branch 25 taken 1 time.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
✗ Branch 32 not taken.
✗ Branch 33 not taken.
✗ Branch 34 not taken.
✗ Branch 35 not taken.
✗ Branch 36 not taken.
✗ Branch 37 not taken.
✗ Branch 38 not taken.
✗ Branch 39 not taken.
✗ Branch 40 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
✗ Branch 48 not taken.
✗ Branch 49 not taken.
1 switch (component.iddObject().type().value()) {
190 ✗ case openstudio::IddObjectType::OS_Generator_FuelCell_ExhaustGasToWaterHeatExchanger: {
191 ✗ auto hr = component.cast<GeneratorFuelCellExhaustGasToWaterHeatExchanger>();
192 ✗ result = hr.heatRecoveryWaterMaximumFlowRate();
193 ✗ break;
194 ✗ }
195 ✗ case openstudio::IddObjectType::OS_Generator_MicroTurbine_HeatRecovery: {
196 ✗ auto mchpHR = component.cast<GeneratorMicroTurbineHeatRecovery>();
197 ✗ result = mchpHR.maximumHeatRecoveryWaterFlowRate();
198 ✗ break;
199 ✗ }
200 ✗ case openstudio::IddObjectType::OS_Boiler_HotWater: {
201 ✗ auto boiler = component.cast<BoilerHotWater>();
202 ✗ result = boiler.designWaterFlowRate();
203 ✗ break;
204 ✗ }
205 ✗ case openstudio::IddObjectType::OS_WaterHeater_Mixed: {
206 ✗ auto waterHeater = component.cast<WaterHeaterMixed>();
207 ✗ result = waterHeater.useSideDesignFlowRate();
208 ✗ break;
209 ✗ }
210 ✗ case openstudio::IddObjectType::OS_WaterHeater_Stratified: {
211 ✗ auto waterHeater = component.cast<WaterHeaterStratified>();
212 ✗ result = waterHeater.useSideDesignFlowRate();
213 ✗ break;
214 ✗ }
215 ✗ case openstudio::IddObjectType::OS_DistrictCooling: {
216 ✗ break;
217 }
218 ✗ case openstudio::IddObjectType::OS_DistrictHeating_Water: {
219 ✗ break;
220 }
221 ✗ case openstudio::IddObjectType::OS_DistrictHeating_Steam: {
222 ✗ break;
223 }
224 ✗ case openstudio::IddObjectType::OS_CentralHeatPumpSystem: {
225 // TODO: JM define behavior needed here...
226 // Probably check if all modules have a ChillerHeaterPerformanceComponent
227 // that has a flow rate hardsized, and multiple by the number of performance comp
228 // Better to add a method to centralheatpumpsystem, for eg "totalDesignFlowRate"
229 // Problem is that you need to know which loop is requesting this since there are two supply loops with
230 // "Design XXX Water Flow Rate" (XXX= Chilled Water, or Hot Water)
231 ✗ break;
232 }
233
234 ✗ case openstudio::IddObjectType::OS_Chiller_Electric_ASHRAE205: {
235 ✗ auto chiller = component.cast<ChillerElectricASHRAE205>();
236 ✗ result = chiller.chilledWaterMaximumRequestedFlowRate();
237 ✗ break;
238 ✗ }
239 ✗ case openstudio::IddObjectType::OS_Chiller_Electric_EIR: {
240 ✗ auto chiller = component.cast<ChillerElectricEIR>();
241 ✗ result = chiller.referenceChilledWaterFlowRate();
242 ✗ break;
243 ✗ }
244 ✗ case openstudio::IddObjectType::OS_Chiller_Electric_ReformulatedEIR: {
245 ✗ auto chiller = component.cast<ChillerElectricReformulatedEIR>();
246 ✗ result = chiller.referenceChilledWaterFlowRate();
247 ✗ break;
248 ✗ }
249 ✗ case openstudio::IddObjectType::OS_Chiller_Absorption_Indirect: {
250 ✗ auto chiller = component.cast<ChillerAbsorptionIndirect>();
251 ✗ result = chiller.designChilledWaterFlowRate();
252 ✗ break;
253 ✗ }
254 ✗ case openstudio::IddObjectType::OS_Chiller_Absorption: {
255 ✗ auto chiller = component.cast<ChillerAbsorption>();
256 ✗ result = chiller.designChilledWaterFlowRate();
257 ✗ break;
258 ✗ }
259 ✗ case openstudio::IddObjectType::OS_ThermalStorage_ChilledWater_Stratified: {
260 ✗ auto ts = component.cast<ThermalStorageChilledWaterStratified>();
261 ✗ result = ts.useSideDesignFlowRate();
262 ✗ break;
263 ✗ }
264 1 case openstudio::IddObjectType::OS_ThermalStorage_Ice_Detailed: {
265 1 break;
266 }
267 ✗ case openstudio::IddObjectType::OS_CoolingTower_SingleSpeed: {
268 ✗ auto tower = component.cast<CoolingTowerSingleSpeed>();
269 ✗ result = tower.designWaterFlowRate();
270 ✗ break;
271 ✗ }
272 ✗ case openstudio::IddObjectType::OS_CoolingTower_VariableSpeed: {
273 ✗ auto tower = component.cast<CoolingTowerVariableSpeed>();
274 ✗ result = tower.designWaterFlowRate();
275 ✗ break;
276 ✗ }
277 ✗ case openstudio::IddObjectType::OS_CoolingTower_TwoSpeed: {
278 ✗ auto tower = component.cast<CoolingTowerTwoSpeed>();
279 ✗ result = tower.designWaterFlowRate();
280 ✗ break;
281 ✗ }
282 ✗ case openstudio::IddObjectType::OS_EvaporativeFluidCooler_SingleSpeed: {
283 ✗ auto mo = component.cast<EvaporativeFluidCoolerSingleSpeed>();
284 ✗ result = mo.designWaterFlowRate();
285 ✗ break;
286 ✗ }
287 ✗ case openstudio::IddObjectType::OS_EvaporativeFluidCooler_TwoSpeed: {
288 ✗ auto mo = component.cast<EvaporativeFluidCoolerTwoSpeed>();
289 ✗ result = mo.designWaterFlowRate();
290 ✗ break;
291 ✗ }
292 ✗ case openstudio::IddObjectType::OS_FluidCooler_SingleSpeed: {
293 ✗ auto mo = component.cast<FluidCoolerSingleSpeed>();
294 ✗ result = mo.designWaterFlowRate();
295 ✗ break;
296 ✗ }
297 ✗ case openstudio::IddObjectType::OS_FluidCooler_TwoSpeed: {
298 ✗ auto mo = component.cast<FluidCoolerTwoSpeed>();
299 ✗ result = mo.designWaterFlowRate();
300 ✗ break;
301 ✗ }
302 ✗ case openstudio::IddObjectType::OS_GroundHeatExchanger_Vertical: {
303 ✗ auto hx = component.cast<GroundHeatExchangerVertical>();
304 ✗ result = hx.designFlowRate();
305 ✗ break;
306 ✗ }
307 ✗ case openstudio::IddObjectType::OS_GroundHeatExchanger_HorizontalTrench: {
308 ✗ auto hx = component.cast<GroundHeatExchangerHorizontalTrench>();
309 ✗ result = hx.designFlowRate();
310 ✗ break;
311 ✗ }
312 ✗ case openstudio::IddObjectType::OS_HeatExchanger_FluidToFluid: {
313 ✗ auto hx = component.cast<HeatExchangerFluidToFluid>();
314 ✗ result = hx.loopSupplySideDesignFlowRate();
315 ✗ break;
316 ✗ }
317 ✗ case openstudio::IddObjectType::OS_SolarCollector_FlatPlate_PhotovoltaicThermal: {
318 ✗ auto mo = component.cast<SolarCollectorFlatPlatePhotovoltaicThermal>();
319 ✗ result = mo.designFlowRate();
320 ✗ break;
321 ✗ }
322 ✗ case openstudio::IddObjectType::OS_SolarCollector_FlatPlate_Water: {
323 ✗ auto mo = component.cast<SolarCollectorFlatPlateWater>();
324 ✗ result = mo.maximumFlowRate();
325 ✗ break;
326 ✗ }
327 ✗ case openstudio::IddObjectType::OS_SolarCollector_IntegralCollectorStorage: {
328 ✗ auto mo = component.cast<SolarCollectorIntegralCollectorStorage>();
329 ✗ result = mo.maximumFlowRate();
330 ✗ break;
331 ✗ }
332 ✗ case openstudio::IddObjectType::OS_PlantComponent_TemperatureSource: {
333 ✗ auto mo = component.cast<PlantComponentTemperatureSource>();
334 ✗ result = mo.designVolumeFlowRate();
335 ✗ break;
336 ✗ }
337 ✗ case openstudio::IddObjectType::OS_PlantComponent_UserDefined: {
338 ✗ auto mo = component.cast<PlantComponentUserDefined>();
339 //TODO use Design Volume Flow Rate Actuator for PlantLoop 1
340 //result = mo.designVolumeFlowRateActuator().get();
341 ✗ break;
342 ✗ }
343 ✗ case openstudio::IddObjectType::OS_HeatPump_WaterToWater_EquationFit_Cooling: {
344 ✗ auto mo = component.cast<HeatPumpWaterToWaterEquationFitCooling>();
345 ✗ result = mo.ratedLoadSideFlowRate();
346 ✗ break;
347 ✗ }
348 ✗ case openstudio::IddObjectType::OS_HeatPump_WaterToWater_EquationFit_Heating: {
349 ✗ auto mo = component.cast<HeatPumpWaterToWaterEquationFitHeating>();
350 ✗ result = mo.ratedLoadSideFlowRate();
351 ✗ break;
352 ✗ }
353 ✗ case openstudio::IddObjectType::OS_HeatPump_PlantLoop_EIR_Cooling: {
354 ✗ auto mo = component.cast<HeatPumpPlantLoopEIRCooling>();
355 ✗ result = mo.loadSideReferenceFlowRate();
356 ✗ break;
357 ✗ }
358 ✗ case openstudio::IddObjectType::OS_HeatPump_PlantLoop_EIR_Heating: {
359 ✗ auto mo = component.cast<HeatPumpPlantLoopEIRHeating>();
360 ✗ result = mo.loadSideReferenceFlowRate();
361 ✗ break;
362 ✗ }
363 ✗ case openstudio::IddObjectType::OS_HeatPump_AirToWater_Cooling: {
364 ✗ auto mo = component.cast<HeatPumpAirToWaterCooling>();
365 ✗ result = mo.ratedWaterFlowRate();
366 ✗ break;
367 ✗ }
368 ✗ case openstudio::IddObjectType::OS_HeatPump_AirToWater_Heating: {
369 ✗ auto mo = component.cast<HeatPumpAirToWaterHeating>();
370 ✗ result = mo.ratedWaterFlowRate();
371 ✗ break;
372 ✗ }
373 ✗ case openstudio::IddObjectType::OS_HeatPump_AirToWater_FuelFired_Heating: {
374 ✗ auto mo = component.cast<HeatPumpAirToWaterFuelFiredHeating>();
375 ✗ result = mo.designFlowRate();
376 ✗ break;
377 ✗ }
378 ✗ case openstudio::IddObjectType::OS_HeatPump_AirToWater_FuelFired_Cooling: {
379 ✗ auto mo = component.cast<HeatPumpAirToWaterFuelFiredCooling>();
380 ✗ result = mo.designFlowRate();
381 ✗ break;
382 ✗ }
383 ✗ default: {
384 ✗ break;
385 }
386 }
387
388 1 return result;
389 }
390
391 // Some plant components air in a containingHVACComponent() and it is that
392 // container which needs to go on the plant operation scheme. Here is a filter to
393 // figure that out.
394 101 HVACComponent operationSchemeComponent(const HVACComponent& component) {
395 101 boost::optional<HVACComponent> result;
396
397
8/8
✓ Branch 1 taken 101 times.
✓ Branch 4 taken 101 times.
✓ Branch 7 taken 101 times.
✓ Branch 10 taken 28 times.
✓ Branch 11 taken 9 times.
✓ Branch 12 taken 2 times.
✓ Branch 13 taken 3 times.
✓ Branch 14 taken 59 times.
101 switch (component.iddObject().type().value()) {
398 28 case openstudio::IddObjectType::OS_WaterHeater_Mixed: {
399
1/1
✓ Branch 1 taken 28 times.
28 auto waterHeater = component.cast<WaterHeaterMixed>();
400
2/3
✓ Branch 1 taken 28 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 28 times.
56 if (auto hpwh = waterHeater.containingZoneHVACComponent()) {
401 ✗ result = hpwh;
402 28 }
403 28 break;
404 28 }
405 9 case openstudio::IddObjectType::OS_WaterHeater_Stratified: {
406
1/1
✓ Branch 1 taken 9 times.
9 auto waterHeater = component.cast<WaterHeaterStratified>();
407
3/3
✓ Branch 1 taken 9 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 7 times.
18 if (auto hpwh = waterHeater.containingZoneHVACComponent()) {
408
1/1
✓ Branch 1 taken 2 times.
2 result = hpwh;
409 9 }
410 9 break;
411 9 }
412 2 case openstudio::IddObjectType::OS_HeatPump_AirToWater_Cooling: {
413
1/1
✓ Branch 1 taken 2 times.
2 auto awhp = component.cast<HeatPumpAirToWaterCooling>();
414
1/1
✓ Branch 1 taken 2 times.
2 result = awhp.containingHVACComponent();
415 2 break;
416 2 }
417 3 case openstudio::IddObjectType::OS_HeatPump_AirToWater_Heating: {
418
1/1
✓ Branch 1 taken 3 times.
3 auto awhp = component.cast<HeatPumpAirToWaterHeating>();
419
1/1
✓ Branch 1 taken 3 times.
3 result = awhp.containingHVACComponent();
420 3 break;
421 3 }
422 59 default: {
423 59 break;
424 }
425 }
426
427
2/2
✓ Branch 0 taken 7 times.
✓ Branch 1 taken 94 times.
101 if (result) {
428
2/2
✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
7 return result.get();
429 }
430
431
1/1
✓ Branch 1 taken 94 times.
94 return component;
432 101 }
433
434 238 std::vector<HVACComponent> setpointComponents(const PlantLoop& plantLoop) {
435 238 std::vector<HVACComponent> result;
436
437
6/6
✓ Branch 1 taken 238 times.
✓ Branch 4 taken 238 times.
✓ Branch 7 taken 238 times.
✓ Branch 10 taken 238 times.
✓ Branch 19 taken 1446 times.
✓ Branch 20 taken 238 times.
2160 for (const auto& comp : subsetCastVector<HVACComponent>(plantLoop.supplyComponents())) {
438
3/3
✓ Branch 1 taken 1446 times.
✓ Branch 5 taken 596 times.
✓ Branch 6 taken 850 times.
1446 if (!comp.optionalCast<Node>()) {
439
3/3
✓ Branch 1 taken 596 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 595 times.
596 if (_isSetpointComponent(plantLoop, comp)) {
440
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 result.push_back(operationSchemeComponent(comp));
441 }
442 }
443 238 }
444
445 238 return result;
446 ✗ }
447
448 238 std::vector<HVACComponent> coolingComponents(const PlantLoop& plantLoop) {
449 238 std::vector<HVACComponent> result;
450
451
6/6
✓ Branch 1 taken 238 times.
✓ Branch 4 taken 238 times.
✓ Branch 7 taken 238 times.
✓ Branch 10 taken 238 times.
✓ Branch 19 taken 1446 times.
✓ Branch 20 taken 238 times.
2160 for (const auto& comp : subsetCastVector<HVACComponent>(plantLoop.supplyComponents())) {
452 // Special case for CentralHeatPumpSystem. If plantLoop = central_hp.coolingLoop, we add it
453
5/5
✓ Branch 1 taken 1446 times.
✓ Branch 4 taken 1446 times.
✓ Branch 7 taken 1446 times.
✓ Branch 10 taken 6 times.
✓ Branch 11 taken 1440 times.
1446 if (comp.iddObject().type().value() == openstudio::IddObjectType::OS_CentralHeatPumpSystem) {
454
1/1
✓ Branch 1 taken 6 times.
6 auto central_hp = comp.cast<CentralHeatPumpSystem>();
455
2/3
✓ Branch 1 taken 6 times.
✓ Branch 5 taken 6 times.
✗ Branch 6 not taken.
6 if (central_hp.coolingPlantLoop().is_initialized()) {
456
7/7
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
✓ Branch 10 taken 6 times.
✓ Branch 13 taken 6 times.
✓ Branch 16 taken 3 times.
✓ Branch 17 taken 3 times.
6 if (plantLoop.handle() == central_hp.coolingPlantLoop()->handle()) {
457
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
3 result.push_back(operationSchemeComponent(comp));
458 }
459 }
460
461 // Regular case
462
4/4
✓ Branch 2 taken 1440 times.
✓ Branch 5 taken 1440 times.
✓ Branch 8 taken 20 times.
✓ Branch 9 taken 1420 times.
1446 } else if (comp.componentType() == openstudio::ComponentType::Cooling) {
463
2/2
✓ Branch 1 taken 20 times.
✓ Branch 4 taken 20 times.
20 result.push_back(operationSchemeComponent(comp));
464 }
465 238 }
466
467 238 return result;
468 ✗ }
469
470 238 std::vector<HVACComponent> heatingComponents(const PlantLoop& plantLoop) {
471 238 std::vector<HVACComponent> result;
472
473
6/6
✓ Branch 1 taken 238 times.
✓ Branch 4 taken 238 times.
✓ Branch 7 taken 238 times.
✓ Branch 10 taken 238 times.
✓ Branch 19 taken 1446 times.
✓ Branch 20 taken 238 times.
2160 for (const auto& comp : subsetCastVector<HVACComponent>(plantLoop.supplyComponents())) {
474 // Special case for CentralHeatPumpSystem. If plantLoop = central_hp.heatingPlantLoop, we add it
475
5/5
✓ Branch 1 taken 1446 times.
✓ Branch 4 taken 1446 times.
✓ Branch 7 taken 1446 times.
✓ Branch 10 taken 6 times.
✓ Branch 11 taken 1440 times.
1446 if (comp.iddObject().type().value() == openstudio::IddObjectType::OS_CentralHeatPumpSystem) {
476
1/1
✓ Branch 1 taken 6 times.
6 auto central_hp = comp.cast<CentralHeatPumpSystem>();
477
2/3
✓ Branch 1 taken 6 times.
✓ Branch 5 taken 6 times.
✗ Branch 6 not taken.
6 if (central_hp.heatingPlantLoop().is_initialized()) {
478
7/7
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
✓ Branch 10 taken 6 times.
✓ Branch 13 taken 6 times.
✓ Branch 16 taken 3 times.
✓ Branch 17 taken 3 times.
6 if (plantLoop.handle() == central_hp.heatingPlantLoop()->handle()) {
479
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
3 result.push_back(operationSchemeComponent(comp));
480 }
481 }
482
483 // Regular case
484
4/4
✓ Branch 2 taken 1440 times.
✓ Branch 5 taken 1440 times.
✓ Branch 8 taken 65 times.
✓ Branch 9 taken 1375 times.
1446 } else if (comp.componentType() == openstudio::ComponentType::Heating) {
485
2/2
✓ Branch 1 taken 65 times.
✓ Branch 4 taken 65 times.
65 result.push_back(operationSchemeComponent(comp));
486 }
487 238 }
488
489 238 return result;
490 ✗ }
491
492 238 std::vector<HVACComponent> uncontrolledComponents(const PlantLoop& plantLoop) {
493 238 std::vector<HVACComponent> result;
494
495
6/6
✓ Branch 1 taken 238 times.
✓ Branch 4 taken 238 times.
✓ Branch 7 taken 238 times.
✓ Branch 10 taken 238 times.
✓ Branch 19 taken 1446 times.
✓ Branch 20 taken 238 times.
2160 for (const auto& comp : subsetCastVector<HVACComponent>(plantLoop.supplyComponents())) {
496
9/9
✓ Branch 1 taken 1446 times.
✓ Branch 4 taken 1446 times.
✓ Branch 7 taken 6 times.
✓ Branch 8 taken 1440 times.
✓ Branch 10 taken 6 times.
✓ Branch 12 taken 5 times.
✓ Branch 13 taken 1 time.
✓ Branch 14 taken 5 times.
✓ Branch 15 taken 1441 times.
1446 if ((comp.componentType() == openstudio::ComponentType::Both) && !(_isSetpointComponent(plantLoop, comp))) {
497
2/2
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
5 result.push_back(operationSchemeComponent(comp));
498 }
499 238 }
500
501 // Special case for CoilSystemCoolingWater (Wrap Around Water Coil Heat Recovery Mode)
502
6/6
✓ Branch 1 taken 238 times.
✓ Branch 4 taken 238 times.
✓ Branch 7 taken 238 times.
✓ Branch 10 taken 238 times.
✓ Branch 19 taken 1369 times.
✓ Branch 20 taken 238 times.
2083 for (const auto& comp : subsetCastVector<HVACComponent>(plantLoop.demandComponents())) {
503
5/5
✓ Branch 1 taken 1369 times.
✓ Branch 4 taken 1369 times.
✓ Branch 7 taken 1369 times.
✓ Branch 10 taken 13 times.
✓ Branch 11 taken 1356 times.
1369 if (comp.iddObject().type().value() == openstudio::IddObjectType::OS_Coil_Cooling_Water) {
504
1/1
✓ Branch 1 taken 13 times.
13 auto coil = comp.cast<CoilCoolingWater>();
505
3/3
✓ Branch 1 taken 13 times.
✓ Branch 3 taken 9 times.
✓ Branch 4 taken 4 times.
26 if (auto containingHVACComponent = coil.containingHVACComponent()) {
506
4/4
✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
✓ Branch 6 taken 4 times.
✓ Branch 7 taken 5 times.
18 if (auto coilSystemCoolingWater = containingHVACComponent->optionalCast<CoilSystemCoolingWater>()) {
507
3/3
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
4 result.push_back(operationSchemeComponent(*coilSystemCoolingWater));
508 9 }
509 13 }
510 13 }
511 238 }
512
513 238 return result;
514 ✗ }
515
516 240 boost::optional<IdfObject> ForwardTranslator::translatePlantEquipmentOperationSchemes(PlantLoop& plantLoop) {
517
2/2
✓ Branch 1 taken 240 times.
✓ Branch 4 taken 240 times.
240 IdfObject operationSchemes(IddObjectType::PlantEquipmentOperationSchemes);
518
1/1
✓ Branch 1 taken 240 times.
240 m_idfObjects.push_back(operationSchemes);
519
520
3/3
✓ Branch 1 taken 240 times.
✓ Branch 4 taken 240 times.
✓ Branch 7 taken 240 times.
240 operationSchemes.setName(plantLoop.nameString() + " Operation Schemes");
521
522
2/2
✓ Branch 1 taken 240 times.
✓ Branch 4 taken 240 times.
240 auto alwaysOnSchedule = plantLoop.model().alwaysOnDiscreteSchedule();
523
1/1
✓ Branch 1 taken 240 times.
240 auto _alwaysOn = translateAndMapModelObject(alwaysOnSchedule);
524
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 240 times.
✗ Branch 4 not taken.
240 OS_ASSERT(_alwaysOn);
525
526 // Lambda does what the name suggests, create setpoint operation schemes.
527 // This is for any component that has a setpoint manager on its outlet node
528 238 auto createSetpointOperationScheme = [&](PlantLoop& plantLoop) {
529
1/1
✓ Branch 1 taken 238 times.
238 auto t_setpointComponents = setpointComponents(plantLoop);
530
2/2
✓ Branch 1 taken 1 time.
✓ Branch 2 taken 237 times.
238 if (!t_setpointComponents.empty()) {
531
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 IdfObject setpointOperation(IddObjectType::PlantEquipmentOperation_ComponentSetpoint);
532
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 setpointOperation.setName(plantLoop.nameString() + " Setpoint Operation Scheme");
533
1/1
✓ Branch 1 taken 1 time.
1 m_idfObjects.push_back(setpointOperation);
534
1/1
✓ Branch 1 taken 1 time.
1 setpointOperation.clearExtensibleGroups();
535
536
1/1
✓ Branch 1 taken 1 time.
1 IdfExtensibleGroup eg = operationSchemes.pushExtensibleGroup();
537
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 eg.setString(PlantEquipmentOperationSchemesExtensibleFields::ControlSchemeObjectType, setpointOperation.iddObject().name());
538
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 eg.setString(PlantEquipmentOperationSchemesExtensibleFields::ControlSchemeName, setpointOperation.nameString());
539
2/3
✓ Branch 1 taken 1 time.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 time.
2 if (const auto& schedule = plantLoop.componentSetpointOperationSchemeSchedule()) {
540 ✗ eg.setString(PlantEquipmentOperationSchemesExtensibleFields::ControlSchemeScheduleName, schedule->nameString());
541 } else {
542
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 eg.setString(PlantEquipmentOperationSchemesExtensibleFields::ControlSchemeScheduleName, _alwaysOn->nameString());
543 1 }
544
545
2/2
✓ Branch 5 taken 1 time.
✓ Branch 6 taken 1 time.
2 for (auto& setpointComponent : t_setpointComponents) {
546 // TODO: @kbenne, Find the right way to deal with this
547 // For now, "dirty" (?) fix for Generator:MicroTurbine
548
549 1 boost::optional<IdfObject> _idfObject;
550
551
2/3
✓ Branch 1 taken 1 time.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 time.
2 if (boost::optional<GeneratorMicroTurbineHeatRecovery> mchpHR = setpointComponent.optionalCast<GeneratorMicroTurbineHeatRecovery>()) {
552 ✗ GeneratorMicroTurbine mchp = mchpHR->generatorMicroTurbine();
553 ✗ _idfObject = translateAndMapModelObject(mchp);
554 ✗ } else {
555
1/1
✓ Branch 1 taken 1 time.
1 _idfObject = translateAndMapModelObject(setpointComponent);
556 1 }
557
558
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 1 time.
✗ Branch 4 not taken.
1 OS_ASSERT(_idfObject);
559
560
1/1
✓ Branch 1 taken 1 time.
1 IdfExtensibleGroup eg = setpointOperation.pushExtensibleGroup();
561
4/4
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
1 eg.setString(PlantEquipmentOperation_ComponentSetpointExtensibleFields::EquipmentObjectType, _idfObject->iddObject().name());
562
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 eg.setString(PlantEquipmentOperation_ComponentSetpointExtensibleFields::EquipmentName, _idfObject->nameString());
563
2/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✗ Branch 5 not taken.
2 if (const auto& t_inletNode = inletNode(plantLoop, setpointComponent)) {
564
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 eg.setString(PlantEquipmentOperation_ComponentSetpointExtensibleFields::DemandCalculationNodeName, t_inletNode->nameString());
565 1 }
566
2/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✗ Branch 5 not taken.
2 if (const auto& t_outletNode = outletNode(plantLoop, setpointComponent)) {
567
3/3
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
1 eg.setString(PlantEquipmentOperation_ComponentSetpointExtensibleFields::SetpointNodeName, t_outletNode->nameString());
568 1 }
569
2/3
✓ Branch 1 taken 1 time.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 time.
2 if (auto value = flowrate(setpointComponent)) {
570 ✗ eg.setDouble(PlantEquipmentOperation_ComponentSetpointExtensibleFields::ComponentFlowRate, value.get());
571 } else {
572
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 eg.setString(PlantEquipmentOperation_ComponentSetpointExtensibleFields::ComponentFlowRate, "Autosize");
573 }
574
1/1
✓ Branch 1 taken 1 time.
1 auto t_componentType = setpointComponent.componentType();
575
2/3
✓ Branch 1 taken 1 time.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 time.
1 if (t_componentType == openstudio::ComponentType::Heating) {
576 ✗ eg.setString(PlantEquipmentOperation_ComponentSetpointExtensibleFields::OperationType, "Heating");
577
2/3
✓ Branch 1 taken 1 time.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 time.
1 } else if (t_componentType == openstudio::ComponentType::Cooling) {
578 ✗ eg.setString(PlantEquipmentOperation_ComponentSetpointExtensibleFields::OperationType, "Cooling");
579 } else {
580
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
2 eg.setString(PlantEquipmentOperation_ComponentSetpointExtensibleFields::OperationType, "Dual");
581 }
582 1 }
583 1 }
584 238 };
585
586 240 bool applyDefault = true;
587
588 // If any operation schemes are defined in the model then don't apply default operation schemes
589
590
2/3
✓ Branch 1 taken 240 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 240 times.
480 if (auto coolingLoadScheme = plantLoop.plantEquipmentOperationCoolingLoad()) {
591 ✗ auto _scheme = translateAndMapModelObject(coolingLoadScheme.get());
592 ✗ OS_ASSERT(_scheme);
593 ✗ auto eg = operationSchemes.pushExtensibleGroup();
594 ✗ eg.setString(PlantEquipmentOperationSchemesExtensibleFields::ControlSchemeObjectType, _scheme->iddObject().name());
595 ✗ eg.setString(PlantEquipmentOperationSchemesExtensibleFields::ControlSchemeName, _scheme->nameString());
596 ✗ if (const auto& schedule = plantLoop.plantEquipmentOperationCoolingLoadSchedule()) {
597 ✗ eg.setString(PlantEquipmentOperationSchemesExtensibleFields::ControlSchemeScheduleName, schedule->nameString());
598 } else {
599 ✗ eg.setString(PlantEquipmentOperationSchemesExtensibleFields::ControlSchemeScheduleName, _alwaysOn->nameString());
600 ✗ }
601
602 ✗ applyDefault = false;
603 240 }
604
605
3/3
✓ Branch 1 taken 240 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 238 times.
480 if (auto heatingLoadScheme = plantLoop.plantEquipmentOperationHeatingLoad()) {
606
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 auto _scheme = translateAndMapModelObject(heatingLoadScheme.get());
607
1/3
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 4 not taken.
2 OS_ASSERT(_scheme);
608
1/1
✓ Branch 1 taken 2 times.
2 auto eg = operationSchemes.pushExtensibleGroup();
609
4/4
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
2 eg.setString(PlantEquipmentOperationSchemesExtensibleFields::ControlSchemeObjectType, _scheme->iddObject().name());
610
3/3
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
2 eg.setString(PlantEquipmentOperationSchemesExtensibleFields::ControlSchemeName, _scheme->nameString());
611
2/3
✓ Branch 1 taken 2 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
4 if (const auto& schedule = plantLoop.plantEquipmentOperationHeatingLoadSchedule()) {
612 ✗ eg.setString(PlantEquipmentOperationSchemesExtensibleFields::ControlSchemeScheduleName, schedule->nameString());
613 } else {
614
3/3
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
2 eg.setString(PlantEquipmentOperationSchemesExtensibleFields::ControlSchemeScheduleName, _alwaysOn->nameString());
615 2 }
616
617 2 applyDefault = false;
618 242 }
619
620
2/3
✓ Branch 1 taken 240 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 240 times.
480 if (auto primaryScheme = plantLoop.primaryPlantEquipmentOperationScheme()) {
621 ✗ auto _scheme = translateAndMapModelObject(primaryScheme.get());
622 ✗ OS_ASSERT(_scheme);
623 ✗ auto eg = operationSchemes.pushExtensibleGroup();
624 ✗ eg.setString(PlantEquipmentOperationSchemesExtensibleFields::ControlSchemeObjectType, _scheme->iddObject().name());
625 ✗ eg.setString(PlantEquipmentOperationSchemesExtensibleFields::ControlSchemeName, _scheme->nameString());
626 ✗ if (const auto& schedule = plantLoop.primaryPlantEquipmentOperationSchemeSchedule()) {
627 ✗ eg.setString(PlantEquipmentOperationSchemesExtensibleFields::ControlSchemeScheduleName, schedule->nameString());
628 } else {
629 ✗ eg.setString(PlantEquipmentOperationSchemesExtensibleFields::ControlSchemeScheduleName, _alwaysOn->nameString());
630 ✗ }
631
632 ✗ createSetpointOperationScheme(plantLoop);
633 ✗ applyDefault = false;
634 240 }
635
636
2/2
✓ Branch 0 taken 238 times.
✓ Branch 1 taken 2 times.
240 if (applyDefault) {
637 // If we get here then there must not be any operation schemes defined in the model
638 // and we should go ahead and create default schemes.
639
1/1
✓ Branch 1 taken 238 times.
238 auto t_heatingComponents = heatingComponents(plantLoop);
640
2/2
✓ Branch 1 taken 60 times.
✓ Branch 2 taken 178 times.
238 if (!t_heatingComponents.empty()) {
641
2/2
✓ Branch 1 taken 60 times.
✓ Branch 4 taken 60 times.
60 IdfObject heatingOperation(IddObjectType::PlantEquipmentOperation_HeatingLoad);
642
3/3
✓ Branch 1 taken 60 times.
✓ Branch 4 taken 60 times.
✓ Branch 7 taken 60 times.
60 heatingOperation.setName(plantLoop.nameString() + " Heating Operation Scheme");
643
1/1
✓ Branch 1 taken 60 times.
60 m_idfObjects.push_back(heatingOperation);
644
1/1
✓ Branch 1 taken 60 times.
60 heatingOperation.clearExtensibleGroups();
645
646
2/2
✓ Branch 1 taken 60 times.
✓ Branch 4 taken 60 times.
60 IdfObject plantEquipmentList(IddObjectType::PlantEquipmentList);
647
3/3
✓ Branch 1 taken 60 times.
✓ Branch 4 taken 60 times.
✓ Branch 7 taken 60 times.
60 plantEquipmentList.setName(plantLoop.nameString() + " Heating Equipment List");
648
1/1
✓ Branch 1 taken 60 times.
60 plantEquipmentList.clearExtensibleGroups();
649
1/1
✓ Branch 1 taken 60 times.
60 m_idfObjects.push_back(plantEquipmentList);
650
651
1/1
✓ Branch 1 taken 60 times.
60 IdfExtensibleGroup eg = heatingOperation.pushExtensibleGroup();
652
1/1
✓ Branch 1 taken 60 times.
60 eg.setDouble(PlantEquipmentOperation_HeatingLoadExtensibleFields::LoadRangeLowerLimit, 0.0);
653
1/1
✓ Branch 1 taken 60 times.
60 eg.setDouble(PlantEquipmentOperation_HeatingLoadExtensibleFields::LoadRangeUpperLimit, 1E9);
654
2/2
✓ Branch 1 taken 60 times.
✓ Branch 4 taken 60 times.
60 eg.setString(PlantEquipmentOperation_HeatingLoadExtensibleFields::RangeEquipmentListName, plantEquipmentList.nameString());
655
656
1/1
✓ Branch 1 taken 60 times.
60 eg = operationSchemes.pushExtensibleGroup();
657
3/3
✓ Branch 1 taken 60 times.
✓ Branch 4 taken 60 times.
✓ Branch 7 taken 60 times.
60 eg.setString(PlantEquipmentOperationSchemesExtensibleFields::ControlSchemeObjectType, heatingOperation.iddObject().name());
658
2/2
✓ Branch 1 taken 60 times.
✓ Branch 4 taken 60 times.
60 eg.setString(PlantEquipmentOperationSchemesExtensibleFields::ControlSchemeName, heatingOperation.nameString());
659
3/3
✓ Branch 1 taken 60 times.
✓ Branch 4 taken 60 times.
✓ Branch 7 taken 60 times.
60 eg.setString(PlantEquipmentOperationSchemesExtensibleFields::ControlSchemeScheduleName, _alwaysOn->nameString());
660
661
2/2
✓ Branch 5 taken 68 times.
✓ Branch 6 taken 60 times.
128 for (auto& heatingComponent : t_heatingComponents) {
662
3/3
✓ Branch 1 taken 68 times.
✓ Branch 3 taken 67 times.
✓ Branch 4 taken 1 time.
136 if (auto idfObject_ = translateAndMapModelObject(heatingComponent)) {
663
1/1
✓ Branch 1 taken 67 times.
67 IdfExtensibleGroup eg = plantEquipmentList.pushExtensibleGroup();
664
4/4
✓ Branch 1 taken 67 times.
✓ Branch 4 taken 67 times.
✓ Branch 7 taken 67 times.
✓ Branch 10 taken 67 times.
67 eg.setString(PlantEquipmentListExtensibleFields::EquipmentObjectType, idfObject_->iddObject().name());
665
3/3
✓ Branch 1 taken 67 times.
✓ Branch 4 taken 67 times.
✓ Branch 7 taken 67 times.
67 eg.setString(PlantEquipmentListExtensibleFields::EquipmentName, idfObject_->nameString());
666 135 }
667 }
668 60 }
669
670
1/1
✓ Branch 1 taken 238 times.
238 auto t_coolingComponents = coolingComponents(plantLoop);
671
2/2
✓ Branch 1 taken 23 times.
✓ Branch 2 taken 215 times.
238 if (!t_coolingComponents.empty()) {
672
2/2
✓ Branch 1 taken 23 times.
✓ Branch 4 taken 23 times.
23 IdfObject coolingOperation(IddObjectType::PlantEquipmentOperation_CoolingLoad);
673
3/3
✓ Branch 1 taken 23 times.
✓ Branch 4 taken 23 times.
✓ Branch 7 taken 23 times.
23 coolingOperation.setName(plantLoop.nameString() + " Cooling Operation Scheme");
674
1/1
✓ Branch 1 taken 23 times.
23 m_idfObjects.push_back(coolingOperation);
675
1/1
✓ Branch 1 taken 23 times.
23 coolingOperation.clearExtensibleGroups();
676
677
2/2
✓ Branch 1 taken 23 times.
✓ Branch 4 taken 23 times.
23 IdfObject plantEquipmentList(IddObjectType::PlantEquipmentList);
678
3/3
✓ Branch 1 taken 23 times.
✓ Branch 4 taken 23 times.
✓ Branch 7 taken 23 times.
23 plantEquipmentList.setName(plantLoop.nameString() + " Cooling Equipment List");
679
1/1
✓ Branch 1 taken 23 times.
23 plantEquipmentList.clearExtensibleGroups();
680
1/1
✓ Branch 1 taken 23 times.
23 m_idfObjects.push_back(plantEquipmentList);
681
682
1/1
✓ Branch 1 taken 23 times.
23 IdfExtensibleGroup eg = coolingOperation.pushExtensibleGroup();
683
1/1
✓ Branch 1 taken 23 times.
23 eg.setDouble(PlantEquipmentOperation_CoolingLoadExtensibleFields::LoadRangeLowerLimit, 0.0);
684
1/1
✓ Branch 1 taken 23 times.
23 eg.setDouble(PlantEquipmentOperation_CoolingLoadExtensibleFields::LoadRangeUpperLimit, 1E9);
685
2/2
✓ Branch 1 taken 23 times.
✓ Branch 4 taken 23 times.
23 eg.setString(PlantEquipmentOperation_CoolingLoadExtensibleFields::RangeEquipmentListName, plantEquipmentList.nameString());
686
687
1/1
✓ Branch 1 taken 23 times.
23 eg = operationSchemes.pushExtensibleGroup();
688
3/3
✓ Branch 1 taken 23 times.
✓ Branch 4 taken 23 times.
✓ Branch 7 taken 23 times.
23 eg.setString(PlantEquipmentOperationSchemesExtensibleFields::ControlSchemeObjectType, coolingOperation.iddObject().name());
689
2/2
✓ Branch 1 taken 23 times.
✓ Branch 4 taken 23 times.
23 eg.setString(PlantEquipmentOperationSchemesExtensibleFields::ControlSchemeName, coolingOperation.nameString());
690
3/3
✓ Branch 1 taken 23 times.
✓ Branch 4 taken 23 times.
✓ Branch 7 taken 23 times.
23 eg.setString(PlantEquipmentOperationSchemesExtensibleFields::ControlSchemeScheduleName, _alwaysOn->nameString());
691
692
2/2
✓ Branch 5 taken 23 times.
✓ Branch 6 taken 23 times.
46 for (auto& coolingComponent : t_coolingComponents) {
693
3/3
✓ Branch 1 taken 23 times.
✓ Branch 3 taken 22 times.
✓ Branch 4 taken 1 time.
46 if (auto idfObject_ = translateAndMapModelObject(coolingComponent)) {
694
1/1
✓ Branch 1 taken 22 times.
22 IdfExtensibleGroup eg = plantEquipmentList.pushExtensibleGroup();
695
4/4
✓ Branch 1 taken 22 times.
✓ Branch 4 taken 22 times.
✓ Branch 7 taken 22 times.
✓ Branch 10 taken 22 times.
22 eg.setString(PlantEquipmentListExtensibleFields::EquipmentObjectType, idfObject_->iddObject().name());
696
3/3
✓ Branch 1 taken 22 times.
✓ Branch 4 taken 22 times.
✓ Branch 7 taken 22 times.
22 eg.setString(PlantEquipmentListExtensibleFields::EquipmentName, idfObject_->nameString());
697 45 }
698 }
699 23 }
700
701
1/1
✓ Branch 1 taken 238 times.
238 auto t_uncontrolledComponents = uncontrolledComponents(plantLoop);
702
2/2
✓ Branch 1 taken 8 times.
✓ Branch 2 taken 230 times.
238 if (!t_uncontrolledComponents.empty()) {
703
704
2/2
✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
8 IdfObject uncontrolledOperation(IddObjectType::PlantEquipmentOperation_Uncontrolled);
705
3/3
✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
✓ Branch 7 taken 8 times.
8 uncontrolledOperation.setName(plantLoop.nameString() + " Uncontrolled Operation Scheme");
706
1/1
✓ Branch 1 taken 8 times.
8 m_idfObjects.push_back(uncontrolledOperation);
707
1/1
✓ Branch 1 taken 8 times.
8 uncontrolledOperation.clearExtensibleGroups();
708
709
2/2
✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
8 IdfObject plantEquipmentList(IddObjectType::PlantEquipmentList);
710
3/3
✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
✓ Branch 7 taken 8 times.
8 plantEquipmentList.setName(plantLoop.nameString() + " Uncontrolled Equipment List");
711
1/1
✓ Branch 1 taken 8 times.
8 plantEquipmentList.clearExtensibleGroups();
712
1/1
✓ Branch 1 taken 8 times.
8 m_idfObjects.push_back(plantEquipmentList);
713
714
2/2
✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
8 uncontrolledOperation.setString(PlantEquipmentOperation_UncontrolledFields::EquipmentListName, plantEquipmentList.nameString());
715
716
1/1
✓ Branch 1 taken 8 times.
8 auto eg = operationSchemes.pushExtensibleGroup();
717
3/3
✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
✓ Branch 7 taken 8 times.
8 eg.setString(PlantEquipmentOperationSchemesExtensibleFields::ControlSchemeObjectType, uncontrolledOperation.iddObject().name());
718
2/2
✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
8 eg.setString(PlantEquipmentOperationSchemesExtensibleFields::ControlSchemeName, uncontrolledOperation.nameString());
719
3/3
✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
✓ Branch 7 taken 8 times.
8 eg.setString(PlantEquipmentOperationSchemesExtensibleFields::ControlSchemeScheduleName, _alwaysOn->nameString());
720
721
2/2
✓ Branch 5 taken 9 times.
✓ Branch 6 taken 8 times.
17 for (auto& uncontrolledComponent : t_uncontrolledComponents) {
722
3/3
✓ Branch 1 taken 9 times.
✓ Branch 4 taken 5 times.
✓ Branch 5 taken 4 times.
18 if (uncontrolledComponent.optionalCast<CoilSystemCoolingWater>()) {
723 // no-op
724
2/3
✓ Branch 1 taken 5 times.
✓ Branch 3 taken 5 times.
✗ Branch 4 not taken.
10 } else if (auto idfObject_ = translateAndMapModelObject(uncontrolledComponent)) {
725
1/1
✓ Branch 1 taken 5 times.
5 IdfExtensibleGroup eg = plantEquipmentList.pushExtensibleGroup();
726
4/4
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
5 eg.setString(PlantEquipmentListExtensibleFields::EquipmentObjectType, idfObject_->iddObject().name());
727
3/3
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
5 eg.setString(PlantEquipmentListExtensibleFields::EquipmentName, idfObject_->nameString());
728 10 }
729 }
730 8 }
731
732
1/1
✓ Branch 1 taken 238 times.
238 createSetpointOperationScheme(plantLoop);
733 238 }
734
735
1/1
✓ Branch 1 taken 240 times.
480 return operationSchemes;
736 240 }
737
738 } // namespace energyplus
739
740 } // namespace openstudio
741