GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 89.8% 53 / 0 / 59
Functions: 100.0% 1 / 0 / 1
Branches: 53.4% 86 / 0 / 161

src/energyplus/ForwardTranslator/ForwardTranslateCoilSystemCoolingWater.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/Model.hpp"
8 #include "../../model/CoilSystemCoolingWater.hpp"
9 #include "../../model/CoilSystemCoolingWater_Impl.hpp"
10 #include "../../model/Node.hpp"
11 #include "../../model/Node_Impl.hpp"
12 #include "../../model/Schedule.hpp"
13 #include "../../model/Schedule_Impl.hpp"
14 #include "../../model/CoilCoolingWater.hpp"
15 #include "../../model/CoilCoolingWater_Impl.hpp"
16 #include "../../model/ControllerWaterCoil.hpp"
17 #include "../../model/ControllerWaterCoil_Impl.hpp"
18
19 #include "../../model/AirLoopHVAC.hpp"
20 #include "../../model/FanVariableVolume.hpp"
21 #include "../../model/FanVariableVolume_Impl.hpp"
22 #include "../../model/FanConstantVolume.hpp"
23 #include "../../model/FanConstantVolume_Impl.hpp"
24 #include "../../model/FanOnOff.hpp"
25 #include "../../model/FanOnOff_Impl.hpp"
26 #include "../../model/FanSystemModel.hpp"
27 #include "../../model/FanSystemModel_Impl.hpp"
28 #include "../../model/AirLoopHVACOutdoorAirSystem.hpp"
29 #include "../../model/AirLoopHVACOutdoorAirSystem_Impl.hpp"
30
31 #include <utilities/idd/CoilSystem_Cooling_Water_FieldEnums.hxx>
32 #include <utilities/idd/Coil_Cooling_Water_FieldEnums.hxx>
33 #include <utilities/idd/Controller_WaterCoil_FieldEnums.hxx>
34 #include <utilities/idd/SetpointManager_MixedAir_FieldEnums.hxx>
35 #include <utilities/idd/IddEnums.hxx>
36
37 using namespace openstudio::model;
38
39 namespace openstudio {
40
41 namespace energyplus {
42
43 3 boost::optional<IdfObject> ForwardTranslator::translateCoilSystemCoolingWater(model::CoilSystemCoolingWater& modelObject) {
44
45
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
3 IdfObject idfObject = createRegisterAndNameIdfObject(openstudio::IddObjectType::CoilSystem_Cooling_Water, modelObject);
46
47 3 std::string airInletNodeName;
48 // InletNodeName
49
2/3
✓ Branch 1 taken 3 times.
✓ Branch 3 taken 3 times.
✗ Branch 4 not taken.
6 if (auto mo = modelObject.inletModelObject()) {
50
3/4
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 6 taken 3 times.
✗ Branch 7 not taken.
6 if (auto node = mo->optionalCast<Node>()) {
51
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
3 airInletNodeName = node->nameString();
52 3 }
53 3 }
54
55 3 std::string airOutletNodeName;
56 // OutletNodeName
57
2/3
✓ Branch 1 taken 3 times.
✓ Branch 3 taken 3 times.
✗ Branch 4 not taken.
6 if (auto mo = modelObject.outletModelObject()) {
58
3/4
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 6 taken 3 times.
✗ Branch 7 not taken.
6 if (auto node = mo->optionalCast<Node>()) {
59
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
3 airOutletNodeName = node->nameString();
60 3 }
61 3 }
62
63
1/1
✓ Branch 1 taken 3 times.
3 idfObject.setString(CoilSystem_Cooling_WaterFields::AirInletNodeName, airInletNodeName);
64
1/1
✓ Branch 1 taken 3 times.
3 idfObject.setString(CoilSystem_Cooling_WaterFields::AirOutletNodeName, airOutletNodeName);
65
66 // CoolingCoilObjectType
67 // CoolingCoilName
68 {
69
1/1
✓ Branch 1 taken 3 times.
3 auto coolingCoil = modelObject.coolingCoil();
70
2/3
✓ Branch 1 taken 3 times.
✓ Branch 3 taken 3 times.
✗ Branch 4 not taken.
6 if (auto idf = translateAndMapModelObject(coolingCoil)) {
71
4/4
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✓ Branch 10 taken 3 times.
3 idfObject.setString(CoilSystem_Cooling_WaterFields::CoolingCoilObjectType, idf->iddObject().name());
72
3/3
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
3 idfObject.setString(CoilSystem_Cooling_WaterFields::CoolingCoilName, idf->nameString());
73
6/6
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✓ Branch 10 taken 3 times.
✓ Branch 14 taken 2 times.
✓ Branch 15 taken 1 time.
3 if (idf->iddObject().type() == IddObjectType::Coil_Cooling_Water) {
74
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 idf->setString(Coil_Cooling_WaterFields::AirInletNodeName, airInletNodeName);
75
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 idf->setString(Coil_Cooling_WaterFields::AirOutletNodeName, airOutletNodeName);
76 // Add IddObjectType::Coil_Cooling_Water_DetailedGeometry if implemented
77
5/6
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✗ Branch 14 not taken.
✓ Branch 15 taken 1 time.
1 } else if (idf->iddObject().type() == IddObjectType::CoilSystem_Cooling_Water_HeatExchangerAssisted) {
78 // The logic is built in the translateCoilSystemCoolingWaterHeatExchangerAssisted method
79 // Essentially it's the same as getting the HX (CoilSystem_Cooling_Water_HeatExchangerAssistedFields::HeatExchangerName)
80 // and setting HeatExchanger_AirToAir_SensibleAndLatentFields::SupplyAirInletNodeName & ExhaustAirOutletNodeName
81 } else {
82 // Shouldn't happen, accepts only Coil:Cooling:Water CoilSystem:Cooling:Water:HeatExchangerAssisted (or Coil:Cooling:Water:DetailedGeometry, not wrapped)
83 ✗ LOG_AND_THROW(modelObject.briefDescription()
84 << " appears to have a cooling coil that shouldn't have been accepted: " << coolingCoil.briefDescription());
85 }
86 3 }
87 3 }
88
89 // Availability Schedule Name: Optional Object
90
3/4
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 8 taken 3 times.
✗ Branch 9 not taken.
6 if (boost::optional<Schedule> availabilitySchedule_ = modelObject.availabilitySchedule()) {
91
3/4
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 6 taken 3 times.
✗ Branch 7 not taken.
6 if (boost::optional<IdfObject> wo_ = translateAndMapModelObject(availabilitySchedule_.get())) {
92
3/3
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
3 idfObject.setString(CoilSystem_Cooling_WaterFields::AvailabilityScheduleName, wo_->nameString());
93 3 }
94 3 }
95
96 // Dehumidification Control Type: Optional String
97
1/1
✓ Branch 1 taken 3 times.
3 const std::string dehumidificationControlType = modelObject.dehumidificationControlType();
98
1/1
✓ Branch 1 taken 3 times.
3 idfObject.setString(CoilSystem_Cooling_WaterFields::DehumidificationControlType, dehumidificationControlType);
99
100 // Run on Sensible Load: Optional Boolean
101
2/3
✓ Branch 1 taken 3 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 3 times.
3 if (modelObject.runonSensibleLoad()) {
102 ✗ idfObject.setString(CoilSystem_Cooling_WaterFields::RunonSensibleLoad, "Yes");
103 } else {
104
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
6 idfObject.setString(CoilSystem_Cooling_WaterFields::RunonSensibleLoad, "No");
105 }
106
107 // Run on Latent Load: Optional Boolean
108
2/3
✓ Branch 1 taken 3 times.
✓ Branch 3 taken 3 times.
✗ Branch 4 not taken.
3 if (modelObject.runonLatentLoad()) {
109
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
6 idfObject.setString(CoilSystem_Cooling_WaterFields::RunonLatentLoad, "Yes");
110 } else {
111 ✗ idfObject.setString(CoilSystem_Cooling_WaterFields::RunonLatentLoad, "No");
112 }
113
114 // Minimum Air To Water Temperature Offset: Optional Double
115
1/1
✓ Branch 1 taken 3 times.
3 const double minimumAirToWaterTemperatureOffset = modelObject.minimumAirToWaterTemperatureOffset();
116
1/1
✓ Branch 1 taken 3 times.
3 idfObject.setDouble(CoilSystem_Cooling_WaterFields::MinimumAirToWaterTemperatureOffset, minimumAirToWaterTemperatureOffset);
117
118 // Economizer Lockout: Optional Boolean
119
2/3
✓ Branch 1 taken 3 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 3 times.
3 if (modelObject.economizerLockout()) {
120 ✗ idfObject.setString(CoilSystem_Cooling_WaterFields::EconomizerLockout, "Yes");
121 } else {
122
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
6 idfObject.setString(CoilSystem_Cooling_WaterFields::EconomizerLockout, "No");
123 }
124
125 // Minimum Water Loop Temperature For Heat Recovery: Optional Double
126
1/1
✓ Branch 1 taken 3 times.
3 const double minimumWaterLoopTemperatureForHeatRecovery = modelObject.minimumWaterLoopTemperatureForHeatRecovery();
127
1/1
✓ Branch 1 taken 3 times.
3 idfObject.setDouble(CoilSystem_Cooling_WaterFields::MinimumWaterLoopTemperatureForHeatRecovery, minimumWaterLoopTemperatureForHeatRecovery);
128
129 // Companion Coil Used For Heat Recovery: Optional Object
130
3/3
✓ Branch 1 taken 3 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 1 time.
6 if (boost::optional<HVACComponent> companionCoilUsedForHeatRecovery_ = modelObject.companionCoilUsedForHeatRecovery()) {
131
3/4
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
4 if (auto comp_ = companionCoilUsedForHeatRecovery_->optionalCast<CoilCoolingWater>()) {
132
3/4
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✗ Branch 8 not taken.
4 if (comp_->airInletModelObject()) {
133
3/4
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
4 if (boost::optional<IdfObject> idf_ = translateAndMapModelObject(companionCoilUsedForHeatRecovery_.get())) {
134
3/3
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
2 idfObject.setString(CoilSystem_Cooling_WaterFields::CompanionCoilUsedForHeatRecovery, idf_->nameString());
135 2 }
136 } else {
137 ✗ LOG(Warn, modelObject.briefDescription()
138 << " has a companion coil used for heat recovery that is not connected to an AirLoopHVAC / AirLoopHVACOutdoorAirSystem"
139 << " and will not be translated:" << comp_->briefDescription());
140 }
141 } else {
142 // Shouldn't happen, accepts only Coil:Cooling:Water
143 ✗ LOG_AND_THROW(modelObject.briefDescription() << " appears to have a companion coil used for heat recovery that shouldn't have been accepted: "
144 << companionCoilUsedForHeatRecovery_.get().briefDescription());
145 2 }
146 3 }
147
148
1/1
✓ Branch 1 taken 3 times.
6 return idfObject;
149 3 } // End of translate function
150
151 } // end namespace energyplus
152 } // end namespace openstudio
153