GCC Code Coverage Report


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

src/energyplus/ForwardTranslator/ForwardTranslateEnergyManagementSystemTrendVariable.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
8 #include "../../model/Model.hpp"
9 #include "../../model/OutputVariable.hpp"
10 #include "../../model/OutputVariable_Impl.hpp"
11 #include "../../model/OutputMeter.hpp"
12 #include "../../model/OutputMeter_Impl.hpp"
13 #include "../../model/Schedule.hpp"
14 #include "../../model/Schedule_Impl.hpp"
15 #include "../../model/EnergyManagementSystemTrendVariable.hpp"
16 #include "../../model/EnergyManagementSystemTrendVariable_Impl.hpp"
17
18 #include <utilities/idd/EnergyManagementSystem_TrendVariable_FieldEnums.hxx>
19 #include "../../utilities/idd/IddEnums.hpp"
20 #include <utilities/idd/IddEnums.hxx>
21
22 using namespace openstudio::model;
23
24 using namespace std;
25
26 namespace openstudio {
27
28 namespace energyplus {
29
30 6 boost::optional<IdfObject> ForwardTranslator::translateEnergyManagementSystemTrendVariable(EnergyManagementSystemTrendVariable& modelObject) {
31 6 boost::optional<int> i;
32 6 boost::optional<std::string> s;
33
34
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 IdfObject idfObject(openstudio::IddObjectType::EnergyManagementSystem_TrendVariable);
35
1/1
✓ Branch 1 taken 6 times.
6 m_idfObjects.push_back(idfObject);
36 //Name
37
1/1
✓ Branch 1 taken 6 times.
6 s = modelObject.name();
38
1/2
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
6 if (s) {
39
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 idfObject.setName(*s);
40 }
41
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 s = modelObject.emsVariableName();
42
1/2
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
6 if (s) {
43
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 idfObject.setString(EnergyManagementSystem_TrendVariableFields::EMSVariableName, s.get());
44 }
45
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 i = modelObject.numberOfTimestepsToBeLogged();
46
1/2
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
6 if (i.is_initialized()) {
47
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 idfObject.setInt(EnergyManagementSystem_TrendVariableFields::NumberofTimestepstobeLogged, i.get());
48 }
49
50
1/1
✓ Branch 1 taken 6 times.
12 return idfObject;
51 6 }
52
53 } // namespace energyplus
54
55 } // namespace openstudio
56