GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 94.4% 17 / 0 / 18
Functions: 100.0% 1 / 0 / 1
Branches: 82.8% 24 / 0 / 29

src/energyplus/ForwardTranslator/ForwardTranslateTableIndependentVariable.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/TableIndependentVariable.hpp"
10
11 #include "../../utilities/idf/IdfExtensibleGroup.hpp"
12
13 #include <utilities/idd/Table_IndependentVariable_FieldEnums.hxx>
14 // #include "../../utilities/idd/IddEnums.hpp"
15 #include <utilities/idd/IddEnums.hxx>
16
17 using namespace openstudio::model;
18
19 namespace openstudio {
20
21 namespace energyplus {
22
23 10 boost::optional<IdfObject> ForwardTranslator::translateTableIndependentVariable(model::TableIndependentVariable& modelObject) {
24 10 boost::optional<IdfObject> result;
25
26 // Instantiate an IdfObject of the class to store the values
27
2/2
✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
10 IdfObject idfObject = createRegisterAndNameIdfObject(openstudio::IddObjectType::Table_IndependentVariable, modelObject);
28
29 // Interpolation Method: String
30
2/2
✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
10 idfObject.setString(Table_IndependentVariableFields::InterpolationMethod, modelObject.interpolationMethod());
31
32 // Extrapolation Method: String
33
2/2
✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
10 idfObject.setString(Table_IndependentVariableFields::ExtrapolationMethod, modelObject.extrapolationMethod());
34
35 // Minimum Value: boost::optional<double>
36
2/3
✓ Branch 1 taken 10 times.
✓ Branch 3 taken 10 times.
✗ Branch 4 not taken.
20 if (boost::optional<double> minimumValue_ = modelObject.minimumValue()) {
37
2/2
✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
10 idfObject.setDouble(Table_IndependentVariableFields::MinimumValue, minimumValue_.get());
38 }
39
40 // Maximum Value: boost::optional<double>
41
2/3
✓ Branch 1 taken 10 times.
✓ Branch 3 taken 10 times.
✗ Branch 4 not taken.
20 if (boost::optional<double> maximumValue_ = modelObject.maximumValue()) {
42
2/2
✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
10 idfObject.setDouble(Table_IndependentVariableFields::MaximumValue, maximumValue_.get());
43 }
44
45 // Normalization Reference Value: boost::optional<double>
46
2/3
✓ Branch 1 taken 10 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 10 times.
20 if (boost::optional<double> normalizationReferenceValue_ = modelObject.normalizationReferenceValue()) {
47 ✗ idfObject.setDouble(Table_IndependentVariableFields::NormalizationReferenceValue, normalizationReferenceValue_.get());
48 }
49
50 // Unit Type: String
51
2/2
✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
10 idfObject.setString(Table_IndependentVariableFields::UnitType, modelObject.unitType());
52
53 // Value
54
3/3
✓ Branch 1 taken 10 times.
✓ Branch 8 taken 44 times.
✓ Branch 9 taken 10 times.
54 for (const double& value : modelObject.values()) {
55
1/1
✓ Branch 1 taken 44 times.
44 IdfExtensibleGroup eg = idfObject.pushExtensibleGroup();
56
1/1
✓ Branch 1 taken 44 times.
44 eg.setDouble(Table_IndependentVariableExtensibleFields::Value, value);
57 54 }
58
59 // External File Name: boost::optional<std::string>
60
61 // External File Column Number: boost::optional<int>
62
63 // External File Starting Row Number: boost::optional<int>
64
65
1/1
✓ Branch 1 taken 10 times.
20 return idfObject;
66 10 } // End of translate function
67
68 } // end namespace energyplus
69 } // end namespace openstudio
70