GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 100.0% 13 / 0 / 13
Functions: 100.0% 1 / 0 / 1
Branches: 100.0% 16 / 0 / 16

src/energyplus/ForwardTranslator/ForwardTranslateOutputTableMonthly.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/OutputTableMonthly.hpp"
10
11 #include "../../utilities/idf/IdfExtensibleGroup.hpp"
12
13 #include <utilities/idd/Output_Table_Monthly_FieldEnums.hxx>
14 #include <utilities/idd/IddEnums.hxx>
15
16 using namespace openstudio::model;
17
18 namespace openstudio {
19
20 namespace energyplus {
21
22 27 boost::optional<IdfObject> ForwardTranslator::translateOutputTableMonthly(model::OutputTableMonthly& modelObject) {
23
24
3/3
✓ Branch 1 taken 27 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 26 times.
27 if (modelObject.numberofMonthlyVariableGroups() == 0) {
25 1 return boost::none;
26 }
27
28 // Instantiate an IdfObject of the class to store the values
29
2/2
✓ Branch 1 taken 26 times.
✓ Branch 4 taken 26 times.
26 IdfObject idfObject = createRegisterAndNameIdfObject(openstudio::IddObjectType::Output_Table_Monthly, modelObject);
30
31 // Digits After Decimal: Optional Integer, we set it in ctor
32
1/1
✓ Branch 1 taken 26 times.
26 const int digitsAfterDecimal = modelObject.digitsAfterDecimal();
33
1/1
✓ Branch 1 taken 26 times.
26 idfObject.setInt(Output_Table_MonthlyFields::DigitsAfterDecimal, digitsAfterDecimal);
34
35
3/3
✓ Branch 1 taken 26 times.
✓ Branch 8 taken 220 times.
✓ Branch 9 taken 26 times.
246 for (const auto& group : modelObject.monthlyVariableGroups()) {
36
1/1
✓ Branch 1 taken 220 times.
220 IdfExtensibleGroup eg = idfObject.pushExtensibleGroup();
37
2/2
✓ Branch 1 taken 220 times.
✓ Branch 4 taken 220 times.
220 eg.setString(Output_Table_MonthlyExtensibleFields::VariableorMeterName, group.variableOrMeterName());
38
2/2
✓ Branch 1 taken 220 times.
✓ Branch 4 taken 220 times.
220 eg.setString(Output_Table_MonthlyExtensibleFields::AggregationTypeforVariableorMeter, group.aggregationType());
39 246 }
40
41
1/1
✓ Branch 1 taken 26 times.
26 return idfObject;
42 26 } // End of translate function
43
44 } // end namespace energyplus
45 } // end namespace openstudio
46