GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 65.2% 60 / 0 / 92
Functions: 100.0% 1 / 0 / 1
Branches: 39.2% 98 / 0 / 250

src/energyplus/ReverseTranslator/ReverseTranslateCurveQuintLinear.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/CurveQuintLinear.hpp"
9
10 #include <utilities/idd/Curve_QuintLinear_FieldEnums.hxx>
11 #include <utilities/idd/IddEnums.hxx>
12
13 using namespace openstudio::model;
14
15 namespace openstudio {
16
17 namespace energyplus {
18
19 2 boost::optional<ModelObject> ReverseTranslator::translateCurveQuintLinear(const WorkspaceObject& workspaceObject) {
20 2 boost::optional<ModelObject> result;
21
22 // Instantiate an object of the class to store the values,
23 // but we don't return it until we know it's ok
24 // TODO: check constructor, it might need other objects
25
1/1
✓ Branch 1 taken 2 times.
2 openstudio::model::CurveQuintLinear modelObject(m_model);
26
27 // TODO: Note JM 2018-10-17
28 // You are responsible for implementing any additional logic based on choice fields, etc.
29 // The ReverseTranslator generator script is meant to facilitate your work, not get you 100% of the way
30
31 // Name
32
2/3
✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
4 if (boost::optional<std::string> _name = workspaceObject.name()) {
33
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 modelObject.setName(_name.get());
34 2 }
35
36 // Coefficient1 Constant: Required Double
37
2/3
✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
4 if (boost::optional<double> _coefficient1Constant = workspaceObject.getDouble(Curve_QuintLinearFields::Coefficient1Constant)) {
38
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 modelObject.setCoefficient1Constant(_coefficient1Constant.get());
39 } else {
40 ✗ LOG(Error, "For " << workspaceObject.briefDescription() << ", cannot find required property 'Coefficient1 Constant'");
41 ✗ return result;
42 }
43
44 // Coefficient2 v: Required Double
45
2/3
✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
4 if (boost::optional<double> _coefficient2v = workspaceObject.getDouble(Curve_QuintLinearFields::Coefficient2v)) {
46
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 modelObject.setCoefficient2v(_coefficient2v.get());
47 } else {
48 ✗ LOG(Error, "For " << workspaceObject.briefDescription() << ", cannot find required property 'Coefficient2 v'");
49 ✗ return result;
50 }
51
52 // Coefficient3 w: Required Double
53
2/3
✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
4 if (boost::optional<double> _coefficient3w = workspaceObject.getDouble(Curve_QuintLinearFields::Coefficient3w)) {
54
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 modelObject.setCoefficient3w(_coefficient3w.get());
55 } else {
56 ✗ LOG(Error, "For " << workspaceObject.briefDescription() << ", cannot find required property 'Coefficient3 w'");
57 ✗ return result;
58 }
59
60 // Coefficient4 x: Required Double
61
2/3
✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
4 if (boost::optional<double> _coefficient4x = workspaceObject.getDouble(Curve_QuintLinearFields::Coefficient4x)) {
62
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 modelObject.setCoefficient4x(_coefficient4x.get());
63 } else {
64 ✗ LOG(Error, "For " << workspaceObject.briefDescription() << ", cannot find required property 'Coefficient4 x'");
65 ✗ return result;
66 }
67
68 // Coefficient5 y: Required Double
69
2/3
✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
4 if (boost::optional<double> _coefficient5y = workspaceObject.getDouble(Curve_QuintLinearFields::Coefficient5y)) {
70
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 modelObject.setCoefficient5y(_coefficient5y.get());
71 } else {
72 ✗ LOG(Error, "For " << workspaceObject.briefDescription() << ", cannot find required property 'Coefficient5 y'");
73 ✗ return result;
74 }
75
76 // Coefficient6 z: Required Double
77
2/3
✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
4 if (boost::optional<double> _coefficient6z = workspaceObject.getDouble(Curve_QuintLinearFields::Coefficient6z)) {
78
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 modelObject.setCoefficient6z(_coefficient6z.get());
79 } else {
80 ✗ LOG(Error, "For " << workspaceObject.briefDescription() << ", cannot find required property 'Coefficient6 z'");
81 ✗ return result;
82 }
83
84 // Minimum Value of v: Required Double
85
2/3
✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
4 if (boost::optional<double> _minimumValueofv = workspaceObject.getDouble(Curve_QuintLinearFields::MinimumValueofv)) {
86
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 modelObject.setMinimumValueofv(_minimumValueofv.get());
87 } else {
88 ✗ LOG(Error, "For " << workspaceObject.briefDescription() << ", cannot find required property 'Minimum Value of v'");
89 ✗ return result;
90 }
91
92 // Maximum Value of v: Required Double
93
2/3
✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
4 if (boost::optional<double> _maximumValueofv = workspaceObject.getDouble(Curve_QuintLinearFields::MaximumValueofv)) {
94
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 modelObject.setMaximumValueofv(_maximumValueofv.get());
95 } else {
96 ✗ LOG(Error, "For " << workspaceObject.briefDescription() << ", cannot find required property 'Maximum Value of v'");
97 ✗ return result;
98 }
99
100 // Minimum Value of w: Required Double
101
2/3
✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
4 if (boost::optional<double> _minimumValueofw = workspaceObject.getDouble(Curve_QuintLinearFields::MinimumValueofw)) {
102
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 modelObject.setMinimumValueofw(_minimumValueofw.get());
103 } else {
104 ✗ LOG(Error, "For " << workspaceObject.briefDescription() << ", cannot find required property 'Minimum Value of w'");
105 ✗ return result;
106 }
107
108 // Maximum Value of w: Required Double
109
2/3
✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
4 if (boost::optional<double> _maximumValueofw = workspaceObject.getDouble(Curve_QuintLinearFields::MaximumValueofw)) {
110
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 modelObject.setMaximumValueofw(_maximumValueofw.get());
111 } else {
112 ✗ LOG(Error, "For " << workspaceObject.briefDescription() << ", cannot find required property 'Maximum Value of w'");
113 ✗ return result;
114 }
115
116 // Minimum Value of x: Required Double
117
2/3
✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
4 if (boost::optional<double> _minimumValueofx = workspaceObject.getDouble(Curve_QuintLinearFields::MinimumValueofx)) {
118
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 modelObject.setMinimumValueofx(_minimumValueofx.get());
119 } else {
120 ✗ LOG(Error, "For " << workspaceObject.briefDescription() << ", cannot find required property 'Minimum Value of x'");
121 ✗ return result;
122 }
123
124 // Maximum Value of x: Required Double
125
2/3
✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
4 if (boost::optional<double> _maximumValueofx = workspaceObject.getDouble(Curve_QuintLinearFields::MaximumValueofx)) {
126
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 modelObject.setMaximumValueofx(_maximumValueofx.get());
127 } else {
128 ✗ LOG(Error, "For " << workspaceObject.briefDescription() << ", cannot find required property 'Maximum Value of x'");
129 ✗ return result;
130 }
131
132 // Minimum Value of y: Required Double
133
2/3
✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
4 if (boost::optional<double> _minimumValueofy = workspaceObject.getDouble(Curve_QuintLinearFields::MinimumValueofy)) {
134
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 modelObject.setMinimumValueofy(_minimumValueofy.get());
135 } else {
136 ✗ LOG(Error, "For " << workspaceObject.briefDescription() << ", cannot find required property 'Minimum Value of y'");
137 ✗ return result;
138 }
139
140 // Maximum Value of y: Required Double
141
2/3
✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
4 if (boost::optional<double> _maximumValueofy = workspaceObject.getDouble(Curve_QuintLinearFields::MaximumValueofy)) {
142
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 modelObject.setMaximumValueofy(_maximumValueofy.get());
143 } else {
144 ✗ LOG(Error, "For " << workspaceObject.briefDescription() << ", cannot find required property 'Maximum Value of y'");
145 ✗ return result;
146 }
147
148 // Minimum Value of z: Required Double
149
2/3
✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
4 if (boost::optional<double> _minimumValueofz = workspaceObject.getDouble(Curve_QuintLinearFields::MinimumValueofz)) {
150
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 modelObject.setMinimumValueofz(_minimumValueofz.get());
151 } else {
152 ✗ LOG(Error, "For " << workspaceObject.briefDescription() << ", cannot find required property 'Minimum Value of z'");
153 ✗ return result;
154 }
155
156 // Maximum Value of z: Required Double
157
2/3
✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
4 if (boost::optional<double> _maximumValueofz = workspaceObject.getDouble(Curve_QuintLinearFields::MaximumValueofz)) {
158
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 modelObject.setMaximumValueofz(_maximumValueofz.get());
159 } else {
160 ✗ LOG(Error, "For " << workspaceObject.briefDescription() << ", cannot find required property 'Maximum Value of z'");
161 ✗ return result;
162 }
163
164 // Minimum Curve Output: Optional Double
165
2/3
✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
4 if (boost::optional<double> _minimumCurveOutput = workspaceObject.getDouble(Curve_QuintLinearFields::MinimumCurveOutput)) {
166
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 modelObject.setMinimumCurveOutput(_minimumCurveOutput.get());
167 }
168
169 // Maximum Curve Output: Optional Double
170
2/3
✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
4 if (boost::optional<double> _maximumCurveOutput = workspaceObject.getDouble(Curve_QuintLinearFields::MaximumCurveOutput)) {
171
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 modelObject.setMaximumCurveOutput(_maximumCurveOutput.get());
172 }
173
174 // Input Unit Type for v: Optional String
175
2/3
✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
4 if (boost::optional<std::string> _inputUnitTypeforv = workspaceObject.getString(Curve_QuintLinearFields::InputUnitTypeforv)) {
176
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 modelObject.setInputUnitTypeforv(_inputUnitTypeforv.get());
177 2 }
178
179 // Input Unit Type for w: Optional String
180
2/3
✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
4 if (boost::optional<std::string> _inputUnitTypeforw = workspaceObject.getString(Curve_QuintLinearFields::InputUnitTypeforw)) {
181
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 modelObject.setInputUnitTypeforw(_inputUnitTypeforw.get());
182 2 }
183
184 // Input Unit Type for x: Optional String
185
2/3
✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
4 if (boost::optional<std::string> _inputUnitTypeforx = workspaceObject.getString(Curve_QuintLinearFields::InputUnitTypeforx)) {
186
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 modelObject.setInputUnitTypeforx(_inputUnitTypeforx.get());
187 2 }
188
189 // Input Unit Type for y: Optional String
190
2/3
✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
4 if (boost::optional<std::string> _inputUnitTypefory = workspaceObject.getString(Curve_QuintLinearFields::InputUnitTypefory)) {
191
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 modelObject.setInputUnitTypefory(_inputUnitTypefory.get());
192 2 }
193
194 // Input Unit Type for z: Optional String
195
2/3
✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
4 if (boost::optional<std::string> _inputUnitTypeforz = workspaceObject.getString(Curve_QuintLinearFields::InputUnitTypeforz)) {
196
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 modelObject.setInputUnitTypeforz(_inputUnitTypeforz.get());
197 2 }
198
199
1/1
✓ Branch 1 taken 2 times.
2 result = modelObject;
200 2 return result;
201 2 } // End of translate function
202
203 } // end namespace energyplus
204 } // end namespace openstudio
205