GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 71.9% 41 / 0 / 57
Functions: 100.0% 1 / 0 / 1
Branches: 54.7% 76 / 0 / 139

src/energyplus/ForwardTranslator/ForwardTranslateCoilSystemCoolingDXHeatExchangerAssisted.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/CoilSystemCoolingDXHeatExchangerAssisted.hpp"
8 #include "../../model/CoilSystemCoolingDXHeatExchangerAssisted_Impl.hpp"
9 #include "../../model/Node.hpp"
10 #include "../../model/Node_Impl.hpp"
11 #include "../../model/HeatExchangerAirToAirSensibleAndLatent.hpp"
12 #include "../../model/HeatExchangerAirToAirSensibleAndLatent_Impl.hpp"
13 #include "../../model/CoilCoolingDX.hpp"
14 #include "../../model/CoilCoolingDX_Impl.hpp"
15 #include "../../model/CoilCoolingDXSingleSpeed.hpp"
16 #include "../../model/CoilCoolingDXSingleSpeed_Impl.hpp"
17 #include "../../model/CoilCoolingDXVariableSpeed.hpp"
18 #include "../../model/CoilCoolingDXVariableSpeed_Impl.hpp"
19 #include "../../model/Model.hpp"
20 #include "../../utilities/core/Assert.hpp"
21 #include <utilities/idd/CoilSystem_Cooling_DX_HeatExchangerAssisted_FieldEnums.hxx>
22 #include <utilities/idd/HeatExchanger_AirToAir_SensibleAndLatent_FieldEnums.hxx>
23 #include <utilities/idd/HeatExchanger_Desiccant_BalancedFlow_FieldEnums.hxx>
24 #include <utilities/idd/Coil_Cooling_DX_FieldEnums.hxx>
25 #include <utilities/idd/Coil_Cooling_DX_SingleSpeed_FieldEnums.hxx>
26 #include <utilities/idd/Coil_Cooling_DX_VariableSpeed_FieldEnums.hxx>
27 #include <utilities/idd/IddEnums.hxx>
28
29 using namespace openstudio::model;
30 using namespace std;
31
32 namespace openstudio {
33
34 namespace energyplus {
35
36 boost::optional<IdfObject>
37 5 ForwardTranslator::translateCoilSystemCoolingDXHeatExchangerAssisted(CoilSystemCoolingDXHeatExchangerAssisted& modelObject) {
38
2/2
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
5 IdfObject idfObject(IddObjectType::CoilSystem_Cooling_DX_HeatExchangerAssisted);
39
1/1
✓ Branch 1 taken 5 times.
5 m_idfObjects.push_back(idfObject);
40
41 // Name
42
2/3
✓ Branch 1 taken 5 times.
✓ Branch 3 taken 5 times.
✗ Branch 4 not taken.
10 if (auto s = modelObject.name()) {
43
2/2
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
5 idfObject.setName(*s);
44 5 }
45
46 5 std::string hxSupplyAirInletNodeName;
47 // InletNodeName
48
2/3
✓ Branch 1 taken 5 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 5 times.
10 if (auto mo = modelObject.inletModelObject()) {
49 ✗ if (auto node = mo->optionalCast<Node>()) {
50 ✗ hxSupplyAirInletNodeName = node->name().get();
51 ✗ }
52 5 }
53
54 5 std::string hxExhaustAirOutletNodeName;
55 // OutletNodeName
56
2/3
✓ Branch 1 taken 5 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 5 times.
10 if (auto mo = modelObject.outletModelObject()) {
57 ✗ if (auto node = mo->optionalCast<Node>()) {
58 ✗ hxExhaustAirOutletNodeName = node->name().get();
59 ✗ }
60 5 }
61
62
3/3
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
5 std::string hxSupplyAirOutletNodeName = modelObject.name().get() + " HX Supply Air Outlet - Cooling Inlet Node";
63
3/3
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
5 std::string hxExhaustAirInletNodeName = modelObject.name().get() + " HX Exhaust Air Inlet - Cooling Outlet Node";
64
65 // HeatExchangerObjectType
66 // HeatExchangerName
67 {
68
1/1
✓ Branch 1 taken 5 times.
5 auto hx = modelObject.heatExchanger();
69
2/3
✓ Branch 1 taken 5 times.
✓ Branch 3 taken 5 times.
✗ Branch 4 not taken.
10 if (auto idf = translateAndMapModelObject(hx)) {
70
4/4
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
5 idfObject.setString(CoilSystem_Cooling_DX_HeatExchangerAssistedFields::HeatExchangerObjectType, idf->iddObject().name());
71
4/4
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
5 idfObject.setString(CoilSystem_Cooling_DX_HeatExchangerAssistedFields::HeatExchangerName, idf->name().get());
72
6/6
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
✓ Branch 14 taken 4 times.
✓ Branch 15 taken 1 time.
5 if (idf->iddObject().type() == IddObjectType::HeatExchanger_AirToAir_SensibleAndLatent) {
73
2/2
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
4 idf->setString(HeatExchanger_AirToAir_SensibleAndLatentFields::SupplyAirInletNodeName, hxSupplyAirInletNodeName);
74
2/2
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
4 idf->setString(HeatExchanger_AirToAir_SensibleAndLatentFields::SupplyAirOutletNodeName, hxSupplyAirOutletNodeName);
75
2/2
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
4 idf->setString(HeatExchanger_AirToAir_SensibleAndLatentFields::ExhaustAirOutletNodeName, hxExhaustAirOutletNodeName);
76
2/2
✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
4 idf->setString(HeatExchanger_AirToAir_SensibleAndLatentFields::ExhaustAirInletNodeName, hxExhaustAirInletNodeName);
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 taken 1 time.
✗ Branch 15 not taken.
1 } else if (idf->iddObject().type() == IddObjectType::HeatExchanger_Desiccant_BalancedFlow) {
78
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idf->setString(HeatExchanger_Desiccant_BalancedFlowFields::RegenerationAirInletNodeName, hxSupplyAirInletNodeName);
79
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idf->setString(HeatExchanger_Desiccant_BalancedFlowFields::RegenerationAirOutletNodeName, hxSupplyAirOutletNodeName);
80
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idf->setString(HeatExchanger_Desiccant_BalancedFlowFields::ProcessAirOutletNodeName, hxExhaustAirOutletNodeName);
81
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idf->setString(HeatExchanger_Desiccant_BalancedFlowFields::ProcessAirInletNodeName, hxExhaustAirInletNodeName);
82 } else {
83 // Shouldn't happen
84 ✗ LOG(Fatal, modelObject.briefDescription()
85 << " appears to have a heat exchanger that shouldn't have been accepted: " << hx.briefDescription());
86 ✗ OS_ASSERT(false);
87 }
88 5 }
89 5 }
90
91 // CoolingCoilObjectType
92 // CoolingCoilName
93 {
94
1/1
✓ Branch 1 taken 5 times.
5 auto coolingCoil = modelObject.coolingCoil();
95
2/3
✓ Branch 1 taken 5 times.
✓ Branch 3 taken 5 times.
✗ Branch 4 not taken.
10 if (auto idf = translateAndMapModelObject(coolingCoil)) {
96
4/4
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
5 idfObject.setString(CoilSystem_Cooling_DX_HeatExchangerAssistedFields::CoolingCoilObjectType, idf->iddObject().name());
97
4/4
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
5 idfObject.setString(CoilSystem_Cooling_DX_HeatExchangerAssistedFields::CoolingCoilName, idf->name().get());
98
5/6
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
✓ Branch 14 taken 5 times.
✗ Branch 15 not taken.
5 if (idf->iddObject().type() == IddObjectType::Coil_Cooling_DX_SingleSpeed) {
99
2/2
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
5 idf->setString(Coil_Cooling_DX_SingleSpeedFields::AirInletNodeName, hxSupplyAirOutletNodeName);
100
2/2
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
5 idf->setString(Coil_Cooling_DX_SingleSpeedFields::AirOutletNodeName, hxExhaustAirInletNodeName);
101 ✗ } else if (idf->iddObject().type() == IddObjectType::Coil_Cooling_DX_VariableSpeed) {
102 ✗ idf->setString(Coil_Cooling_DX_VariableSpeedFields::IndoorAirInletNodeName, hxSupplyAirOutletNodeName);
103 ✗ idf->setString(Coil_Cooling_DX_VariableSpeedFields::IndoorAirOutletNodeName, hxExhaustAirInletNodeName);
104 ✗ } else if (idf->iddObject().type() == IddObjectType::Coil_Cooling_DX) {
105 ✗ idf->setString(Coil_Cooling_DXFields::EvaporatorInletNodeName, hxSupplyAirOutletNodeName);
106 ✗ idf->setString(Coil_Cooling_DXFields::EvaporatorOutletNodeName, hxExhaustAirInletNodeName);
107 } else {
108 // Shouldn't happen, accepts only Coil:Cooling:DX or Coil:Cooling:DX:SingleSpeed or Coil:Cooling:DX:VariableSpeed
109 ✗ LOG(Fatal, modelObject.briefDescription()
110 << " appears to have a cooling coil that shouldn't have been accepted: " << coolingCoil.briefDescription());
111 ✗ OS_ASSERT(false);
112 }
113 5 }
114 5 }
115
116
1/1
✓ Branch 1 taken 5 times.
10 return idfObject;
117 5 }
118
119 } // namespace energyplus
120 } // namespace openstudio
121