GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 100.0% 46 / 0 / 46
Functions: 100.0% 1 / 0 / 1
Branches: 98.1% 51 / 0 / 52

src/energyplus/ForwardTranslator/ForwardTranslateCurveQuadLinear.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
9 #include "../../model/CurveQuadLinear.hpp"
10
11 #include <utilities/idd/Curve_QuadLinear_FieldEnums.hxx>
12 // #include "../../utilities/idd/IddEnums.hpp"
13 #include <utilities/idd/IddEnums.hxx>
14
15 using namespace openstudio::model;
16
17 namespace openstudio {
18
19 namespace energyplus {
20
21 31 boost::optional<IdfObject> ForwardTranslator::translateCurveQuadLinear(model::CurveQuadLinear& modelObject) {
22 31 boost::optional<WorkspaceObject> result;
23
24 // Instantiate an IdfObject of the class to store the values,
25
2/2
✓ Branch 1 taken 31 times.
✓ Branch 4 taken 31 times.
31 IdfObject idfObject = createRegisterAndNameIdfObject(openstudio::IddObjectType::Curve_QuadLinear, modelObject);
26 // If it doesn't have a name, or if you aren't sure you are going to want to return it
27 // IdfObject idfObject( openstudio::IddObjectType::Curve_QuadLinear );
28 // m_idfObjects.push_back(idfObject);
29
30 // TODO: Note JM 2018-10-17
31 // You are responsible for implementing any additional logic based on choice fields, etc.
32 // The ForwardTranslator generator script is meant to facilitate your work, not get you 100% of the way
33
34 // TODO: If you keep createRegisterAndNameIdfObject above, you don't need this.
35 // But in some cases, you'll want to handle failure without pushing to the map
36 // Name
37
2/3
✓ Branch 1 taken 31 times.
✓ Branch 3 taken 31 times.
✗ Branch 4 not taken.
62 if (boost::optional<std::string> moName = modelObject.name()) {
38
2/2
✓ Branch 1 taken 31 times.
✓ Branch 4 taken 31 times.
31 idfObject.setName(*moName);
39 31 }
40
41 // Coefficient1 Constant: Required Double
42
1/1
✓ Branch 1 taken 31 times.
31 double coefficient1Constant = modelObject.coefficient1Constant();
43
1/1
✓ Branch 1 taken 31 times.
31 idfObject.setDouble(Curve_QuadLinearFields::Coefficient1Constant, coefficient1Constant);
44
45 // Coefficient2 w: Required Double
46
1/1
✓ Branch 1 taken 31 times.
31 double coefficient2w = modelObject.coefficient2w();
47
1/1
✓ Branch 1 taken 31 times.
31 idfObject.setDouble(Curve_QuadLinearFields::Coefficient2w, coefficient2w);
48
49 // Coefficient3 x: Required Double
50
1/1
✓ Branch 1 taken 31 times.
31 double coefficient3x = modelObject.coefficient3x();
51
1/1
✓ Branch 1 taken 31 times.
31 idfObject.setDouble(Curve_QuadLinearFields::Coefficient3x, coefficient3x);
52
53 // Coefficient4 y: Required Double
54
1/1
✓ Branch 1 taken 31 times.
31 double coefficient4y = modelObject.coefficient4y();
55
1/1
✓ Branch 1 taken 31 times.
31 idfObject.setDouble(Curve_QuadLinearFields::Coefficient4y, coefficient4y);
56
57 // Coefficient5 z: Required Double
58
1/1
✓ Branch 1 taken 31 times.
31 double coefficient5z = modelObject.coefficient5z();
59
1/1
✓ Branch 1 taken 31 times.
31 idfObject.setDouble(Curve_QuadLinearFields::Coefficient5z, coefficient5z);
60
61 // Minimum Value of w: Required Double
62
1/1
✓ Branch 1 taken 31 times.
31 double minimumValueofw = modelObject.minimumValueofw();
63
1/1
✓ Branch 1 taken 31 times.
31 idfObject.setDouble(Curve_QuadLinearFields::MinimumValueofw, minimumValueofw);
64
65 // Maximum Value of w: Required Double
66
1/1
✓ Branch 1 taken 31 times.
31 double maximumValueofw = modelObject.maximumValueofw();
67
1/1
✓ Branch 1 taken 31 times.
31 idfObject.setDouble(Curve_QuadLinearFields::MaximumValueofw, maximumValueofw);
68
69 // Minimum Value of x: Required Double
70
1/1
✓ Branch 1 taken 31 times.
31 double minimumValueofx = modelObject.minimumValueofx();
71
1/1
✓ Branch 1 taken 31 times.
31 idfObject.setDouble(Curve_QuadLinearFields::MinimumValueofx, minimumValueofx);
72
73 // Maximum Value of x: Required Double
74
1/1
✓ Branch 1 taken 31 times.
31 double maximumValueofx = modelObject.maximumValueofx();
75
1/1
✓ Branch 1 taken 31 times.
31 idfObject.setDouble(Curve_QuadLinearFields::MaximumValueofx, maximumValueofx);
76
77 // Minimum Value of y: Required Double
78
1/1
✓ Branch 1 taken 31 times.
31 double minimumValueofy = modelObject.minimumValueofy();
79
1/1
✓ Branch 1 taken 31 times.
31 idfObject.setDouble(Curve_QuadLinearFields::MinimumValueofy, minimumValueofy);
80
81 // Maximum Value of y: Required Double
82
1/1
✓ Branch 1 taken 31 times.
31 double maximumValueofy = modelObject.maximumValueofy();
83
1/1
✓ Branch 1 taken 31 times.
31 idfObject.setDouble(Curve_QuadLinearFields::MaximumValueofy, maximumValueofy);
84
85 // Minimum Value of z: Required Double
86
1/1
✓ Branch 1 taken 31 times.
31 double minimumValueofz = modelObject.minimumValueofz();
87
1/1
✓ Branch 1 taken 31 times.
31 idfObject.setDouble(Curve_QuadLinearFields::MinimumValueofz, minimumValueofz);
88
89 // Maximum Value of z: Required Double
90
1/1
✓ Branch 1 taken 31 times.
31 double maximumValueofz = modelObject.maximumValueofz();
91
1/1
✓ Branch 1 taken 31 times.
31 idfObject.setDouble(Curve_QuadLinearFields::MaximumValueofz, maximumValueofz);
92
93 // Minimum Curve Output: boost::optional<double>
94
3/3
✓ Branch 1 taken 31 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 30 times.
62 if (boost::optional<double> _minimumCurveOutput = modelObject.minimumCurveOutput()) {
95
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setDouble(Curve_QuadLinearFields::MinimumCurveOutput, _minimumCurveOutput.get());
96 }
97
98 // Maximum Curve Output: boost::optional<double>
99
3/3
✓ Branch 1 taken 31 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 30 times.
62 if (boost::optional<double> _maximumCurveOutput = modelObject.maximumCurveOutput()) {
100
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setDouble(Curve_QuadLinearFields::MaximumCurveOutput, _maximumCurveOutput.get());
101 }
102
103 // Input Unit Type for w: Optional String
104
1/1
✓ Branch 1 taken 31 times.
31 std::string inputUnitTypeforw = modelObject.inputUnitTypeforw();
105
1/1
✓ Branch 1 taken 31 times.
31 idfObject.setString(Curve_QuadLinearFields::InputUnitTypeforw, inputUnitTypeforw);
106
107 // Input Unit Type for x: Optional String
108
1/1
✓ Branch 1 taken 31 times.
31 std::string inputUnitTypeforx = modelObject.inputUnitTypeforx();
109
1/1
✓ Branch 1 taken 31 times.
31 idfObject.setString(Curve_QuadLinearFields::InputUnitTypeforx, inputUnitTypeforx);
110
111 // Input Unit Type for y: Optional String
112
1/1
✓ Branch 1 taken 31 times.
31 std::string inputUnitTypefory = modelObject.inputUnitTypefory();
113
1/1
✓ Branch 1 taken 31 times.
31 idfObject.setString(Curve_QuadLinearFields::InputUnitTypefory, inputUnitTypefory);
114
115 // Input Unit Type for z: Optional String
116
1/1
✓ Branch 1 taken 31 times.
31 std::string inputUnitTypeforz = modelObject.inputUnitTypeforz();
117
1/1
✓ Branch 1 taken 31 times.
31 idfObject.setString(Curve_QuadLinearFields::InputUnitTypeforz, inputUnitTypeforz);
118
119
1/1
✓ Branch 1 taken 31 times.
62 return idfObject;
120 31 } // End of translate function
121
122 } // end namespace energyplus
123 } // end namespace openstudio
124