GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 82.4% 14 / 0 / 17
Functions: 100.0% 1 / 0 / 1
Branches: 51.7% 15 / 0 / 29

src/energyplus/ReverseTranslator/ReverseTranslateEnergyManagementSystemGlobalVariable.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/EnergyManagementSystemGlobalVariable.hpp"
9 #include "../../model/EnergyManagementSystemGlobalVariable_Impl.hpp"
10
11 #include "../../utilities/idf/WorkspaceExtensibleGroup.hpp"
12
13 #include <utilities/idd/EnergyManagementSystem_GlobalVariable_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 8 OptionalModelObject ReverseTranslator::translateEnergyManagementSystemGlobalVariable(const WorkspaceObject& workspaceObject) {
24
4/5
✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
✓ Branch 7 taken 8 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 8 times.
8 if (workspaceObject.iddObject().type() != IddObjectType::EnergyManagementSystem_GlobalVariable) {
25 ✗ LOG(Error, "WorkspaceObject is not IddObjectType: EnergyManagementSystem_GlobalVariable");
26 ✗ return boost::none;
27 }
28
29
2/3
✓ Branch 1 taken 8 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 8 times.
8 if (workspaceObject.numExtensibleGroups() > 1) {
30 ✗ LOG(Warn, "EnergyManagementSystem GlobalVariable has more than 1 value.");
31 }
32
33 8 OptionalModelObject result;
34
3/3
✓ Branch 1 taken 8 times.
✓ Branch 8 taken 8 times.
✓ Branch 9 taken 8 times.
16 for (const IdfExtensibleGroup& eg : workspaceObject.extensibleGroups()) {
35
1/1
✓ Branch 1 taken 8 times.
8 boost::optional<std::string> value = eg.getString(EnergyManagementSystem_GlobalVariableExtensibleFields::ErlVariableName);
36
1/2
✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
8 if (value) {
37
2/2
✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
8 openstudio::model::EnergyManagementSystemGlobalVariable emsGlobalVariable(m_model, value.get());
38
1/2
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
8 if (!result) {
39
1/1
✓ Branch 1 taken 8 times.
8 result = emsGlobalVariable;
40 }
41 8 }
42 16 }
43
44 8 return result;
45 8 }
46
47 } // namespace energyplus
48
49 } // namespace openstudio
50