GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 79.7% 47 / 0 / 59
Functions: 100.0% 1 / 0 / 1
Branches: 63.8% 81 / 0 / 127

src/energyplus/ForwardTranslator/ForwardTranslateCoilHeatingWater.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/Schedule.hpp"
9 #include "../../model/Schedule_Impl.hpp"
10 #include "../../model/Node.hpp"
11 #include "../../model/Node_Impl.hpp"
12 #include "../../model/CoilHeatingWater.hpp"
13 #include "../../model/CoilHeatingWater_Impl.hpp"
14 #include "../../utilities/core/Logger.hpp"
15 #include "../../utilities/core/Assert.hpp"
16 #include <utilities/idd/Coil_Heating_Water_FieldEnums.hxx>
17 #include "../../utilities/idd/IddEnums.hpp"
18 #include <utilities/idd/IddEnums.hxx>
19 #include <utilities/idd/IddFactory.hxx>
20
21 using namespace openstudio::model;
22
23 using namespace std;
24
25 namespace openstudio {
26
27 namespace energyplus {
28
29 11 boost::optional<IdfObject> ForwardTranslator::translateCoilHeatingWater(CoilHeatingWater& modelObject) {
30 11 boost::optional<std::string> s;
31 11 boost::optional<double> value;
32
33
2/2
✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
11 IdfObject idfObject(IddObjectType::Coil_Heating_Water);
34
35
1/1
✓ Branch 1 taken 11 times.
11 m_idfObjects.push_back(idfObject);
36
37
1/1
✓ Branch 1 taken 11 times.
11 s = modelObject.name();
38
1/2
✓ Branch 0 taken 11 times.
✗ Branch 1 not taken.
11 if (s) {
39
2/2
✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
11 idfObject.setName(*s);
40 }
41
42
1/1
✓ Branch 1 taken 11 times.
11 Schedule sched = modelObject.availableSchedule();
43
1/1
✓ Branch 1 taken 11 times.
11 boost::optional<IdfObject> _sched = translateAndMapModelObject(sched);
44
1/2
✓ Branch 0 taken 11 times.
✗ Branch 1 not taken.
11 if (_sched) {
45
4/4
✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
✓ Branch 7 taken 11 times.
✓ Branch 10 taken 11 times.
11 idfObject.setString(Coil_Heating_WaterFields::AvailabilityScheduleName, _sched->name().get());
46 }
47
48 // UFactorTimesAreaValue
49
50
2/3
✓ Branch 1 taken 11 times.
✓ Branch 3 taken 11 times.
✗ Branch 4 not taken.
11 if (modelObject.isUFactorTimesAreaValueAutosized()) {
51
2/2
✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
22 idfObject.setString(Coil_Heating_WaterFields::UFactorTimesAreaValue, "Autosize");
52 ✗ } else if ((value = modelObject.uFactorTimesAreaValue())) {
53 ✗ idfObject.setDouble(Coil_Heating_WaterFields::UFactorTimesAreaValue, value.get());
54 }
55
56 // MaximumWaterFlowRate
57
58
2/3
✓ Branch 1 taken 11 times.
✓ Branch 3 taken 11 times.
✗ Branch 4 not taken.
11 if (modelObject.isMaximumWaterFlowRateAutosized()) {
59
2/2
✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
22 idfObject.setString(Coil_Heating_WaterFields::MaximumWaterFlowRate, "Autosize");
60 ✗ } else if ((value = modelObject.maximumWaterFlowRate())) {
61 ✗ idfObject.setDouble(Coil_Heating_WaterFields::MaximumWaterFlowRate, value.get());
62 }
63
64 // WaterInletNodeName
65
66
3/3
✓ Branch 1 taken 11 times.
✓ Branch 3 taken 6 times.
✓ Branch 4 taken 5 times.
22 if (boost::optional<ModelObject> mo = modelObject.waterInletModelObject()) {
67
3/4
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 6 taken 6 times.
✗ Branch 7 not taken.
12 if (boost::optional<Node> node = mo->optionalCast<Node>()) {
68
4/4
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
✓ Branch 10 taken 6 times.
6 idfObject.setString(Coil_Heating_WaterFields::WaterInletNodeName, node->name().get());
69 6 }
70 11 }
71
72 // WaterOutletNodeName
73
74
3/3
✓ Branch 1 taken 11 times.
✓ Branch 3 taken 6 times.
✓ Branch 4 taken 5 times.
22 if (boost::optional<ModelObject> mo = modelObject.waterOutletModelObject()) {
75
3/4
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 6 taken 6 times.
✗ Branch 7 not taken.
12 if (boost::optional<Node> node = mo->optionalCast<Node>()) {
76
4/4
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
✓ Branch 10 taken 6 times.
6 idfObject.setString(Coil_Heating_WaterFields::WaterOutletNodeName, node->name().get());
77 6 }
78 11 }
79
80 // AirInletNodeName
81
82
2/3
✓ Branch 1 taken 11 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 11 times.
22 if (boost::optional<ModelObject> mo = modelObject.airInletModelObject()) {
83 ✗ if (boost::optional<Node> node = mo->optionalCast<Node>()) {
84 ✗ idfObject.setString(Coil_Heating_WaterFields::AirInletNodeName, node->name().get());
85 ✗ }
86 11 }
87
88 // AirOutletNodeName
89
90
2/3
✓ Branch 1 taken 11 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 11 times.
22 if (boost::optional<ModelObject> mo = modelObject.airOutletModelObject()) {
91 ✗ if (boost::optional<Node> node = mo->optionalCast<Node>()) {
92 ✗ idfObject.setString(Coil_Heating_WaterFields::AirOutletNodeName, node->name().get());
93 ✗ }
94 11 }
95
96 // PerformanceInputMethod
97
98
2/2
✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
11 s = modelObject.performanceInputMethod();
99
1/2
✓ Branch 0 taken 11 times.
✗ Branch 1 not taken.
11 if (s) {
100
2/2
✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
11 idfObject.setString(Coil_Heating_WaterFields::PerformanceInputMethod, s.get());
101 }
102
103 // RatedCapacity
104
105
2/3
✓ Branch 1 taken 11 times.
✓ Branch 3 taken 11 times.
✗ Branch 4 not taken.
11 if (modelObject.isRatedCapacityAutosized()) {
106
2/2
✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
22 idfObject.setString(Coil_Heating_WaterFields::RatedCapacity, "Autosize");
107 ✗ } else if ((value = modelObject.ratedCapacity())) {
108 ✗ idfObject.setDouble(Coil_Heating_WaterFields::RatedCapacity, value.get());
109 }
110
111 // RatedInletWaterTemperature
112
113
3/4
✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
✓ Branch 7 taken 11 times.
✗ Branch 8 not taken.
22 if ((value = modelObject.ratedInletWaterTemperature())) {
114
2/2
✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
11 idfObject.setDouble(Coil_Heating_WaterFields::RatedInletWaterTemperature, value.get());
115 }
116
117 // RatedInletAirTemperature
118
119
3/4
✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
✓ Branch 7 taken 11 times.
✗ Branch 8 not taken.
22 if ((value = modelObject.ratedInletAirTemperature())) {
120
2/2
✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
11 idfObject.setDouble(Coil_Heating_WaterFields::RatedInletAirTemperature, value.get());
121 }
122
123 // RatedOutletWaterTemperature
124
125
3/4
✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
✓ Branch 7 taken 11 times.
✗ Branch 8 not taken.
22 if ((value = modelObject.ratedOutletWaterTemperature())) {
126
2/2
✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
11 idfObject.setDouble(Coil_Heating_WaterFields::RatedOutletWaterTemperature, value.get());
127 }
128
129 // RatedOutletAirTemperature
130
131
3/4
✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
✓ Branch 7 taken 11 times.
✗ Branch 8 not taken.
22 if ((value = modelObject.ratedOutletAirTemperature())) {
132
2/2
✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
11 idfObject.setDouble(Coil_Heating_WaterFields::RatedOutletAirTemperature, value.get());
133 }
134
135 // RatedRatioforAirandWaterConvection
136
137
3/4
✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
✓ Branch 7 taken 11 times.
✗ Branch 8 not taken.
22 if ((value = modelObject.ratedRatioForAirAndWaterConvection())) {
138
2/2
✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
11 idfObject.setDouble(Coil_Heating_WaterFields::RatedRatioforAirandWaterConvection, value.get());
139 }
140
141
1/1
✓ Branch 1 taken 11 times.
22 return boost::optional<IdfObject>(idfObject);
142 11 }
143
144 //((Name)(Name))
145 //((AvailabilityScheduleName)(Availability Schedule Name))
146
147 } // namespace energyplus
148
149 } // namespace openstudio
150