GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 68.0% 34 / 0 / 50
Functions: 100.0% 1 / 0 / 1
Branches: 46.1% 65 / 0 / 141

src/energyplus/ReverseTranslator/ReverseTranslateDesignSpecificationOutdoorAir.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/DesignSpecificationOutdoorAir.hpp"
8 #include "../../model/DesignSpecificationOutdoorAir_Impl.hpp"
9 #include "../../model/Schedule.hpp"
10 #include "../../model/Schedule_Impl.hpp"
11 #include <utilities/idd/DesignSpecification_OutdoorAir_FieldEnums.hxx>
12 #include "../../utilities/idd/IddEnums.hpp"
13 #include <utilities/idd/IddEnums.hxx>
14 #include "../../utilities/core/Assert.hpp"
15
16 using namespace openstudio::model;
17
18 namespace openstudio {
19
20 namespace energyplus {
21
22 43 OptionalModelObject ReverseTranslator::translateDesignSpecificationOutdoorAir(const WorkspaceObject& workspaceObject) {
23
4/5
✓ Branch 1 taken 43 times.
✓ Branch 4 taken 43 times.
✓ Branch 7 taken 43 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 43 times.
43 if (workspaceObject.iddObject().type() != IddObjectType::DesignSpecification_OutdoorAir) {
24 ✗ LOG(Error, "WorkspaceObject is not IddObjectType: DesignSpecification:OutdoorAir");
25 ✗ return boost::none;
26 }
27
28
1/1
✓ Branch 1 taken 43 times.
43 OptionalString outdoorAirMethod = workspaceObject.getString(DesignSpecification_OutdoorAirFields::OutdoorAirMethod, true);
29
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 43 times.
43 if (!outdoorAirMethod) {
30 ✗ LOG(Error, "No OutdoorAirMethod specified for DesignSpecification:OutdoorAir named '" << workspaceObject.name().get() << "'");
31 ✗ return boost::none;
32 }
33
34
1/1
✓ Branch 1 taken 43 times.
43 DesignSpecificationOutdoorAir result(m_model);
35
36
1/1
✓ Branch 1 taken 43 times.
43 OptionalString name = workspaceObject.name();
37
1/2
✓ Branch 0 taken 43 times.
✗ Branch 1 not taken.
43 if (name) {
38
2/2
✓ Branch 1 taken 43 times.
✓ Branch 4 taken 43 times.
43 result.setName(*name);
39 }
40
41
2/2
✓ Branch 1 taken 43 times.
✓ Branch 4 taken 43 times.
43 result.setOutdoorAirMethod(*outdoorAirMethod);
42
43
1/1
✓ Branch 1 taken 43 times.
43 boost::optional<double> flowPerPerson = workspaceObject.getDouble(DesignSpecification_OutdoorAirFields::OutdoorAirFlowperPerson);
44
1/1
✓ Branch 1 taken 43 times.
43 boost::optional<double> flowPerArea = workspaceObject.getDouble(DesignSpecification_OutdoorAirFields::OutdoorAirFlowperZoneFloorArea);
45
1/1
✓ Branch 1 taken 43 times.
43 boost::optional<double> flowPerZone = workspaceObject.getDouble(DesignSpecification_OutdoorAirFields::OutdoorAirFlowperZone);
46
1/1
✓ Branch 1 taken 43 times.
43 boost::optional<double> ach = workspaceObject.getDouble(DesignSpecification_OutdoorAirFields::OutdoorAirFlowAirChangesperHour);
47
48
5/5
✓ Branch 1 taken 43 times.
✓ Branch 4 taken 43 times.
✓ Branch 7 taken 43 times.
✓ Branch 10 taken 21 times.
✓ Branch 11 taken 22 times.
86 if (istringEqual(*outdoorAirMethod, "Flow/Person")) {
49
1/2
✓ Branch 0 taken 21 times.
✗ Branch 1 not taken.
21 if (flowPerPerson) {
50
2/2
✓ Branch 1 taken 21 times.
✓ Branch 4 taken 21 times.
21 result.setOutdoorAirFlowperPerson(*flowPerPerson);
51 }
52
4/5
✓ Branch 1 taken 22 times.
✓ Branch 4 taken 22 times.
✓ Branch 7 taken 22 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 22 times.
44 } else if (istringEqual(*outdoorAirMethod, "Flow/Area")) {
53 ✗ if (flowPerArea) {
54 ✗ result.setOutdoorAirFlowperFloorArea(*flowPerArea);
55 }
56
5/5
✓ Branch 1 taken 22 times.
✓ Branch 4 taken 22 times.
✓ Branch 7 taken 22 times.
✓ Branch 10 taken 5 times.
✓ Branch 11 taken 17 times.
44 } else if (istringEqual(*outdoorAirMethod, "Flow/Zone")) {
57
1/2
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
5 if (flowPerZone) {
58
2/2
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
5 result.setOutdoorAirFlowRate(*flowPerZone);
59 }
60
4/5
✓ Branch 1 taken 17 times.
✓ Branch 4 taken 17 times.
✓ Branch 7 taken 17 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 17 times.
34 } else if (istringEqual(*outdoorAirMethod, "AirChanges/Hour")) {
61 ✗ if (ach) {
62 ✗ result.setOutdoorAirFlowRate(*ach);
63 }
64
9/28
✓ Branch 1 taken 17 times.
✓ Branch 4 taken 17 times.
✓ Branch 7 taken 17 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 17 times.
✗ Branch 12 not taken.
✗ Branch 15 not taken.
✗ Branch 18 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✓ Branch 23 taken 17 times.
✗ Branch 25 not taken.
✓ Branch 26 taken 17 times.
✓ Branch 27 taken 17 times.
✗ Branch 28 not taken.
✓ Branch 30 taken 17 times.
✗ Branch 31 not taken.
✓ Branch 32 taken 17 times.
✗ Branch 33 not taken.
✗ Branch 34 not taken.
✗ Branch 35 not taken.
✗ Branch 37 not taken.
✗ Branch 38 not taken.
✗ Branch 39 not taken.
✗ Branch 40 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
51 } else if (istringEqual(*outdoorAirMethod, "Sum") || istringEqual(*outdoorAirMethod, "Maximum")) {
65
66
1/2
✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
17 if (flowPerPerson) {
67
2/2
✓ Branch 1 taken 17 times.
✓ Branch 4 taken 17 times.
17 result.setOutdoorAirFlowperPerson(*flowPerPerson);
68 }
69
1/2
✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
17 if (flowPerArea) {
70
2/2
✓ Branch 1 taken 17 times.
✓ Branch 4 taken 17 times.
17 result.setOutdoorAirFlowperFloorArea(*flowPerArea);
71 }
72
1/2
✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
17 if (flowPerZone) {
73
2/2
✓ Branch 1 taken 17 times.
✓ Branch 4 taken 17 times.
17 result.setOutdoorAirFlowRate(*flowPerZone);
74 }
75
1/2
✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
17 if (ach) {
76
2/2
✓ Branch 1 taken 17 times.
✓ Branch 4 taken 17 times.
17 result.setOutdoorAirFlowRate(*ach);
77 }
78
79 } else {
80 ✗ LOG(Error, "Unknown OutdoorAirMethod '" << *outdoorAirMethod << "' specified for DesignSpecification:OutdoorAir named '"
81 << workspaceObject.name().get() << "'");
82 }
83
84
1/1
✓ Branch 1 taken 43 times.
43 OptionalWorkspaceObject target = workspaceObject.getTarget(DesignSpecification_OutdoorAirFields::OutdoorAirScheduleName);
85
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 43 times.
43 if (target) {
86 ✗ OptionalModelObject modelObject = translateAndMapWorkspaceObject(*target);
87 ✗ if (modelObject) {
88 ✗ if (OptionalSchedule intermediate = modelObject->optionalCast<Schedule>()) {
89 ✗ Schedule schedule = *intermediate;
90 ✗ result.setOutdoorAirFlowRateFractionSchedule(schedule);
91 ✗ }
92 }
93 ✗ }
94
95
1/1
✓ Branch 1 taken 43 times.
43 return result;
96 43 }
97
98 } // namespace energyplus
99
100 } // namespace openstudio
101