GCC Code Coverage Report


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

src/energyplus/ForwardTranslator/ForwardTranslateSpaceInfiltrationDesignFlowRate.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/SpaceInfiltrationDesignFlowRate.hpp"
10 #include "../../model/SpaceInfiltrationDesignFlowRate_Impl.hpp"
11 #include "../../model/Space.hpp"
12 #include "../../model/Space_Impl.hpp"
13 #include "../../model/ThermalZone.hpp"
14 #include "../../model/ThermalZone_Impl.hpp"
15 #include "../../model/SpaceType.hpp"
16 #include "../../model/SpaceType_Impl.hpp"
17 #include "../../model/Schedule.hpp"
18 #include "../../model/Schedule_Impl.hpp"
19
20 #include <utilities/idd/ZoneInfiltration_DesignFlowRate_FieldEnums.hxx>
21 #include "../../utilities/idd/IddEnums.hpp"
22 #include <utilities/idd/IddEnums.hxx>
23 #include <utilities/idd/IddFactory.hxx>
24
25 using namespace openstudio::model;
26
27 using namespace std;
28
29 namespace openstudio {
30
31 namespace energyplus {
32
33 70 boost::optional<IdfObject> ForwardTranslator::translateSpaceInfiltrationDesignFlowRate(SpaceInfiltrationDesignFlowRate& modelObject) {
34
35
2/2
✓ Branch 1 taken 70 times.
✓ Branch 4 taken 70 times.
70 IdfObject idfObject = createRegisterAndNameIdfObject(openstudio::IddObjectType::ZoneInfiltration_DesignFlowRate, modelObject);
36
1/1
✓ Branch 1 taken 70 times.
70 IdfObject parentIdfObject = getSpaceLoadParent(modelObject, true); // We **do** allow spaceType!
37
2/2
✓ Branch 1 taken 70 times.
✓ Branch 4 taken 70 times.
70 idfObject.setString(ZoneInfiltration_DesignFlowRateFields::ZoneorZoneListorSpaceorSpaceListName, parentIdfObject.nameString());
38
39
1/1
✓ Branch 1 taken 70 times.
70 boost::optional<Schedule> schedule = modelObject.schedule();
40
2/2
✓ Branch 0 taken 58 times.
✓ Branch 1 taken 12 times.
70 if (schedule) {
41
3/3
✓ Branch 1 taken 58 times.
✓ Branch 4 taken 58 times.
✓ Branch 7 taken 58 times.
58 idfObject.setString(ZoneInfiltration_DesignFlowRateFields::ScheduleName, schedule->nameString());
42 }
43
44
1/1
✓ Branch 1 taken 70 times.
70 std::string designFlowRateCalculationMethod = modelObject.designFlowRateCalculationMethod();
45
4/4
✓ Branch 1 taken 70 times.
✓ Branch 4 taken 70 times.
✓ Branch 7 taken 7 times.
✓ Branch 8 taken 63 times.
140 if (istringEqual("Flow/Space", designFlowRateCalculationMethod)) {
46
1/1
✓ Branch 1 taken 7 times.
7 designFlowRateCalculationMethod = "Flow/Zone";
47 }
48
1/1
✓ Branch 1 taken 70 times.
70 idfObject.setString(ZoneInfiltration_DesignFlowRateFields::DesignFlowRateCalculationMethod, designFlowRateCalculationMethod);
49
50
1/1
✓ Branch 1 taken 70 times.
70 OptionalDouble d = modelObject.designFlowRate();
51
2/2
✓ Branch 0 taken 7 times.
✓ Branch 1 taken 63 times.
70 if (d) {
52
2/2
✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
7 idfObject.setDouble(ZoneInfiltration_DesignFlowRateFields::DesignFlowRate, *d);
53 }
54
55
1/1
✓ Branch 1 taken 70 times.
70 d = modelObject.flowperSpaceFloorArea();
56
2/2
✓ Branch 0 taken 1 time.
✓ Branch 1 taken 69 times.
70 if (d) {
57
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setDouble(ZoneInfiltration_DesignFlowRateFields::FlowRateperFloorArea, *d);
58 }
59
60
1/1
✓ Branch 1 taken 70 times.
70 d = modelObject.flowperExteriorSurfaceArea();
61
2/2
✓ Branch 0 taken 56 times.
✓ Branch 1 taken 14 times.
70 if (d) {
62
2/2
✓ Branch 1 taken 56 times.
✓ Branch 4 taken 56 times.
56 idfObject.setDouble(ZoneInfiltration_DesignFlowRateFields::FlowRateperExteriorSurfaceArea, *d);
63 }
64
65
1/1
✓ Branch 1 taken 70 times.
70 d = modelObject.flowperExteriorWallArea();
66
2/2
✓ Branch 0 taken 1 time.
✓ Branch 1 taken 69 times.
70 if (d) {
67
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setDouble(ZoneInfiltration_DesignFlowRateFields::FlowRateperExteriorSurfaceArea, *d);
68 }
69
70
1/1
✓ Branch 1 taken 70 times.
70 d = modelObject.airChangesperHour();
71
2/2
✓ Branch 0 taken 5 times.
✓ Branch 1 taken 65 times.
70 if (d) {
72
2/2
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
5 idfObject.setDouble(ZoneInfiltration_DesignFlowRateFields::AirChangesperHour, *d);
73 }
74
75
3/3
✓ Branch 1 taken 70 times.
✓ Branch 3 taken 17 times.
✓ Branch 4 taken 53 times.
70 if (!modelObject.isConstantTermCoefficientDefaulted()) {
76
2/2
✓ Branch 1 taken 17 times.
✓ Branch 4 taken 17 times.
17 idfObject.setDouble(ZoneInfiltration_DesignFlowRateFields::ConstantTermCoefficient, modelObject.constantTermCoefficient());
77 }
78
79
3/3
✓ Branch 1 taken 70 times.
✓ Branch 3 taken 7 times.
✓ Branch 4 taken 63 times.
70 if (!modelObject.isTemperatureTermCoefficientDefaulted()) {
80
2/2
✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
7 idfObject.setDouble(ZoneInfiltration_DesignFlowRateFields::TemperatureTermCoefficient, modelObject.temperatureTermCoefficient());
81 }
82
83
3/3
✓ Branch 1 taken 70 times.
✓ Branch 3 taken 7 times.
✓ Branch 4 taken 63 times.
70 if (!modelObject.isVelocityTermCoefficientDefaulted()) {
84
2/2
✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
7 idfObject.setDouble(ZoneInfiltration_DesignFlowRateFields::VelocityTermCoefficient, modelObject.velocityTermCoefficient());
85 }
86
87
3/3
✓ Branch 1 taken 70 times.
✓ Branch 3 taken 7 times.
✓ Branch 4 taken 63 times.
70 if (!modelObject.isVelocitySquaredTermCoefficientDefaulted()) {
88
2/2
✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
7 idfObject.setDouble(ZoneInfiltration_DesignFlowRateFields::VelocitySquaredTermCoefficient, modelObject.velocitySquaredTermCoefficient());
89 }
90
91
2/2
✓ Branch 1 taken 70 times.
✓ Branch 4 taken 70 times.
70 idfObject.setString(ZoneInfiltration_DesignFlowRateFields::DensityBasis, modelObject.densityBasis());
92
93
1/1
✓ Branch 1 taken 70 times.
140 return idfObject;
94 70 }
95
96 } // namespace energyplus
97
98 } // namespace openstudio
99