GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 87.5% 14 / 0 / 16
Functions: 100.0% 1 / 0 / 1
Branches: 70.4% 19 / 0 / 27

src/energyplus/ReverseTranslator/ReverseTranslateSizingParameters.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 #include "../../model/SizingParameters.hpp"
8 #include "../../model/SizingParameters_Impl.hpp"
9 #include <utilities/idd/Sizing_Parameters_FieldEnums.hxx>
10 #include "../../utilities/idd/IddEnums.hpp"
11 #include <utilities/idd/IddEnums.hxx>
12
13 using namespace openstudio::model;
14
15 namespace openstudio {
16
17 namespace energyplus {
18
19 34 OptionalModelObject ReverseTranslator::translateSizingParameters(const WorkspaceObject& workspaceObject) {
20
4/5
✓ Branch 1 taken 34 times.
✓ Branch 4 taken 34 times.
✓ Branch 7 taken 34 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 34 times.
34 if (workspaceObject.iddObject().type() != IddObjectType::Sizing_Parameters) {
21 ✗ LOG(Error, "WorkspaceObject is not IddObjectType: Sizing_Parameters");
22 ✗ return boost::none;
23 }
24
25
1/1
✓ Branch 1 taken 34 times.
34 auto mo = m_model.getUniqueModelObject<SizingParameters>();
26
27
1/1
✓ Branch 1 taken 34 times.
34 boost::optional<double> value = workspaceObject.getDouble(Sizing_ParametersFields::HeatingSizingFactor);
28
1/2
✓ Branch 0 taken 34 times.
✗ Branch 1 not taken.
34 if (value) {
29
2/2
✓ Branch 1 taken 34 times.
✓ Branch 4 taken 34 times.
34 mo.setHeatingSizingFactor(value.get());
30 }
31
32
1/1
✓ Branch 1 taken 34 times.
34 value = workspaceObject.getDouble(Sizing_ParametersFields::CoolingSizingFactor);
33
1/2
✓ Branch 0 taken 34 times.
✗ Branch 1 not taken.
34 if (value) {
34
2/2
✓ Branch 1 taken 34 times.
✓ Branch 4 taken 34 times.
34 mo.setCoolingSizingFactor(value.get());
35 }
36
37
1/1
✓ Branch 1 taken 34 times.
34 boost::optional<int> i = workspaceObject.getInt(Sizing_ParametersFields::TimestepsinAveragingWindow);
38
2/2
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 31 times.
34 if (i) {
39
2/2
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
3 mo.setTimestepsinAveragingWindow(i.get());
40 }
41
42
1/1
✓ Branch 1 taken 34 times.
34 return mo;
43 34 }
44
45 } // namespace energyplus
46
47 } // namespace openstudio
48