GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 66.2% 51 / 0 / 77
Functions: 100.0% 1 / 0 / 1
Branches: 39.8% 82 / 0 / 206

src/energyplus/ReverseTranslator/ReverseTranslateCurveQuadLinear.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/CurveQuadLinear.hpp"
9
10 #include <utilities/idd/Curve_QuadLinear_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::translateCurveQuadLinear(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::CurveQuadLinear 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_QuadLinearFields::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 w: Required Double
45
2/3
✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
4 if (boost::optional<double> _coefficient2w = workspaceObject.getDouble(Curve_QuadLinearFields::Coefficient2w)) {
46
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 modelObject.setCoefficient2w(_coefficient2w.get());
47 } else {
48 ✗ LOG(Error, "For " << workspaceObject.briefDescription() << ", cannot find required property 'Coefficient2 w'");
49 ✗ return result;
50 }
51
52 // Coefficient3 x: Required Double
53
2/3
✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
4 if (boost::optional<double> _coefficient3x = workspaceObject.getDouble(Curve_QuadLinearFields::Coefficient3x)) {
54
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 modelObject.setCoefficient3x(_coefficient3x.get());
55 } else {
56 ✗ LOG(Error, "For " << workspaceObject.briefDescription() << ", cannot find required property 'Coefficient3 x'");
57 ✗ return result;
58 }
59
60 // Coefficient4 y: Required Double
61
2/3
✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
4 if (boost::optional<double> _coefficient4y = workspaceObject.getDouble(Curve_QuadLinearFields::Coefficient4y)) {
62
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 modelObject.setCoefficient4y(_coefficient4y.get());
63 } else {
64 ✗ LOG(Error, "For " << workspaceObject.briefDescription() << ", cannot find required property 'Coefficient4 y'");
65 ✗ return result;
66 }
67
68 // Coefficient5 z: Required Double
69
2/3
✓ Branch 1 taken 2 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
4 if (boost::optional<double> _coefficient5z = workspaceObject.getDouble(Curve_QuadLinearFields::Coefficient5z)) {
70
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 modelObject.setCoefficient5z(_coefficient5z.get());
71 } else {
72 ✗ LOG(Error, "For " << workspaceObject.briefDescription() << ", cannot find required property 'Coefficient5 z'");
73 ✗ return result;
74 }
75
76 // Minimum Value of w: Required Double
77
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_QuadLinearFields::MinimumValueofw)) {
78
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 modelObject.setMinimumValueofw(_minimumValueofw.get());
79 } else {
80 ✗ LOG(Error, "For " << workspaceObject.briefDescription() << ", cannot find required property 'Minimum Value of w'");
81 ✗ return result;
82 }
83
84 // Maximum Value of w: Required Double
85
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_QuadLinearFields::MaximumValueofw)) {
86
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 modelObject.setMaximumValueofw(_maximumValueofw.get());
87 } else {
88 ✗ LOG(Error, "For " << workspaceObject.briefDescription() << ", cannot find required property 'Maximum Value of w'");
89 ✗ return result;
90 }
91
92 // Minimum Value of x: Required Double
93
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_QuadLinearFields::MinimumValueofx)) {
94
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 modelObject.setMinimumValueofx(_minimumValueofx.get());
95 } else {
96 ✗ LOG(Error, "For " << workspaceObject.briefDescription() << ", cannot find required property 'Minimum Value of x'");
97 ✗ return result;
98 }
99
100 // Maximum Value of x: Required Double
101
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_QuadLinearFields::MaximumValueofx)) {
102
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 modelObject.setMaximumValueofx(_maximumValueofx.get());
103 } else {
104 ✗ LOG(Error, "For " << workspaceObject.briefDescription() << ", cannot find required property 'Maximum Value of x'");
105 ✗ return result;
106 }
107
108 // Minimum Value of y: Required Double
109
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_QuadLinearFields::MinimumValueofy)) {
110
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 modelObject.setMinimumValueofy(_minimumValueofy.get());
111 } else {
112 ✗ LOG(Error, "For " << workspaceObject.briefDescription() << ", cannot find required property 'Minimum Value of y'");
113 ✗ return result;
114 }
115
116 // Maximum Value of y: Required Double
117
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_QuadLinearFields::MaximumValueofy)) {
118
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 modelObject.setMaximumValueofy(_maximumValueofy.get());
119 } else {
120 ✗ LOG(Error, "For " << workspaceObject.briefDescription() << ", cannot find required property 'Maximum Value of y'");
121 ✗ return result;
122 }
123
124 // Minimum Value of z: Required Double
125
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_QuadLinearFields::MinimumValueofz)) {
126
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 modelObject.setMinimumValueofz(_minimumValueofz.get());
127 } else {
128 ✗ LOG(Error, "For " << workspaceObject.briefDescription() << ", cannot find required property 'Minimum Value of z'");
129 ✗ return result;
130 }
131
132 // Maximum Value of z: Required Double
133
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_QuadLinearFields::MaximumValueofz)) {
134
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 modelObject.setMaximumValueofz(_maximumValueofz.get());
135 } else {
136 ✗ LOG(Error, "For " << workspaceObject.briefDescription() << ", cannot find required property 'Maximum Value of z'");
137 ✗ return result;
138 }
139
140 // Minimum Curve Output: Optional Double
141
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_QuadLinearFields::MinimumCurveOutput)) {
142
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 modelObject.setMinimumCurveOutput(_minimumCurveOutput.get());
143 }
144
145 // Maximum Curve Output: Optional Double
146
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_QuadLinearFields::MaximumCurveOutput)) {
147
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 modelObject.setMaximumCurveOutput(_maximumCurveOutput.get());
148 }
149
150 // Input Unit Type for w: Optional String
151
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_QuadLinearFields::InputUnitTypeforw)) {
152
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 modelObject.setInputUnitTypeforw(_inputUnitTypeforw.get());
153 2 }
154
155 // Input Unit Type for x: Optional String
156
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_QuadLinearFields::InputUnitTypeforx)) {
157
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 modelObject.setInputUnitTypeforx(_inputUnitTypeforx.get());
158 2 }
159
160 // Input Unit Type for y: Optional String
161
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_QuadLinearFields::InputUnitTypefory)) {
162
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 modelObject.setInputUnitTypefory(_inputUnitTypefory.get());
163 2 }
164
165 // Input Unit Type for z: Optional String
166
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_QuadLinearFields::InputUnitTypeforz)) {
167
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 modelObject.setInputUnitTypeforz(_inputUnitTypeforz.get());
168 2 }
169
170
1/1
✓ Branch 1 taken 2 times.
2 result = modelObject;
171 2 return result;
172 2 } // End of translate function
173
174 } // end namespace energyplus
175 } // end namespace openstudio
176