GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 100.0% 22 / 0 / 22
Functions: 100.0% 1 / 0 / 1
Branches: 96.6% 28 / 0 / 29

src/energyplus/ForwardTranslator/ForwardTranslateSpaceInfiltrationFlowCoefficient.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/SpaceInfiltrationFlowCoefficient.hpp"
10 #include "../../model/SpaceInfiltrationFlowCoefficient_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_FlowCoefficient_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 15 boost::optional<IdfObject> ForwardTranslator::translateSpaceInfiltrationFlowCoefficient(SpaceInfiltrationFlowCoefficient& modelObject) {
34
35
2/2
✓ Branch 1 taken 15 times.
✓ Branch 4 taken 15 times.
15 IdfObject idfObject = createRegisterAndNameIdfObject(openstudio::IddObjectType::ZoneInfiltration_FlowCoefficient, modelObject);
36
1/1
✓ Branch 1 taken 15 times.
15 IdfObject parentIdfObject = getSpaceLoadParent(modelObject, false); // We do not allow spaceType!
37
2/2
✓ Branch 1 taken 15 times.
✓ Branch 4 taken 15 times.
15 idfObject.setString(ZoneInfiltration_FlowCoefficientFields::ZoneorSpaceName, parentIdfObject.nameString());
38
39
1/1
✓ Branch 1 taken 15 times.
15 boost::optional<Schedule> schedule_ = modelObject.schedule();
40
2/2
✓ Branch 1 taken 14 times.
✓ Branch 2 taken 1 time.
15 if (!schedule_) {
41
3/3
✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
✓ Branch 7 taken 14 times.
14 schedule_ = modelObject.model().alwaysOnDiscreteSchedule();
42 }
43
3/4
✓ Branch 1 taken 15 times.
✓ Branch 4 taken 15 times.
✓ Branch 6 taken 15 times.
✗ Branch 7 not taken.
30 if (auto idf_sch_ = translateAndMapModelObject(schedule_.get())) {
44
3/3
✓ Branch 1 taken 15 times.
✓ Branch 4 taken 15 times.
✓ Branch 7 taken 15 times.
15 idfObject.setString(ZoneInfiltration_FlowCoefficientFields::ScheduleName, idf_sch_->nameString());
45 15 }
46
47 // Flow Coefficient: Required Double
48
1/1
✓ Branch 1 taken 15 times.
15 double flowCoefficient = modelObject.flowCoefficient();
49
1/1
✓ Branch 1 taken 15 times.
15 idfObject.setDouble(ZoneInfiltration_FlowCoefficientFields::FlowCoefficient, flowCoefficient);
50
51 // Stack Coefficient: Required Double
52
1/1
✓ Branch 1 taken 15 times.
15 double stackCoefficient = modelObject.stackCoefficient();
53
1/1
✓ Branch 1 taken 15 times.
15 idfObject.setDouble(ZoneInfiltration_FlowCoefficientFields::StackCoefficient, stackCoefficient);
54
55 // Pressure Exponent: Optional Double
56
1/1
✓ Branch 1 taken 15 times.
15 double pressureExponent = modelObject.pressureExponent();
57
1/1
✓ Branch 1 taken 15 times.
15 idfObject.setDouble(ZoneInfiltration_FlowCoefficientFields::PressureExponent, pressureExponent);
58
59 // Wind Coefficient: Required Double
60
1/1
✓ Branch 1 taken 15 times.
15 double windCoefficient = modelObject.windCoefficient();
61
1/1
✓ Branch 1 taken 15 times.
15 idfObject.setDouble(ZoneInfiltration_FlowCoefficientFields::WindCoefficient, windCoefficient);
62
63 // Shelter Factor: Required Double
64
1/1
✓ Branch 1 taken 15 times.
15 double shelterFactor = modelObject.shelterFactor();
65
1/1
✓ Branch 1 taken 15 times.
15 idfObject.setDouble(ZoneInfiltration_FlowCoefficientFields::ShelterFactor, shelterFactor);
66
67
1/1
✓ Branch 1 taken 15 times.
30 return idfObject;
68 15 }
69
70 } // namespace energyplus
71
72 } // namespace openstudio
73