GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 64.0% 16 / 0 / 25
Functions: 100.0% 1 / 0 / 1
Branches: 48.8% 20 / 0 / 41

src/energyplus/ReverseTranslator/ReverseTranslateConstructionAirBoundary.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/ConstructionAirBoundary.hpp"
9 #include "../../model/ConstructionAirBoundary_Impl.hpp"
10 #include "../../model/Schedule.hpp"
11 #include "../../model/Schedule_Impl.hpp"
12
13 #include "../../utilities/idf/WorkspaceExtensibleGroup.hpp"
14
15 #include <utilities/idd/Construction_AirBoundary_FieldEnums.hxx>
16 #include "../../utilities/idd/IddEnums.hpp"
17 #include <utilities/idd/IddEnums.hxx>
18
19 #include "../../utilities/core/Assert.hpp"
20
21 using namespace openstudio::model;
22
23 namespace openstudio {
24
25 namespace energyplus {
26
27 6 OptionalModelObject ReverseTranslator::translateConstructionAirBoundary(const WorkspaceObject& workspaceObject) {
28
4/5
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 6 times.
6 if (workspaceObject.iddObject().type() != IddObjectType::Construction_AirBoundary) {
29 ✗ LOG(Error, "WorkspaceObject is not IddObjectType: Construction:AirBoundary");
30 ✗ return boost::none;
31 }
32
33
1/1
✓ Branch 1 taken 6 times.
6 ConstructionAirBoundary constructionAirBoundary(m_model);
34
35
1/1
✓ Branch 1 taken 6 times.
6 OptionalString optS = workspaceObject.name();
36
1/2
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
6 if (optS) {
37
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 constructionAirBoundary.setName(*optS);
38 }
39
40
1/1
✓ Branch 1 taken 6 times.
6 optS = workspaceObject.getString(Construction_AirBoundaryFields::AirExchangeMethod);
41
1/2
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
6 if (optS) {
42
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 constructionAirBoundary.setAirExchangeMethod(*optS);
43 }
44
45
1/1
✓ Branch 1 taken 6 times.
6 boost::optional<double> optD = workspaceObject.getDouble(Construction_AirBoundaryFields::SimpleMixingAirChangesperHour);
46
1/2
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
6 if (optD) {
47
2/2
✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
6 constructionAirBoundary.setSimpleMixingAirChangesPerHour(*optD);
48 }
49
50
1/1
✓ Branch 1 taken 6 times.
6 boost::optional<WorkspaceObject> target = workspaceObject.getTarget(Construction_AirBoundaryFields::SimpleMixingAirChangesperHour);
51
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
6 if (target) {
52 ✗ OptionalModelObject modelObject = translateAndMapWorkspaceObject(*target);
53 ✗ if (modelObject) {
54 ✗ if (OptionalSchedule intermediate = modelObject->optionalCast<Schedule>()) {
55 ✗ Schedule schedule(*intermediate);
56 ✗ constructionAirBoundary.setSimpleMixingSchedule(schedule);
57 ✗ }
58 }
59 ✗ }
60
61
1/1
✓ Branch 1 taken 6 times.
6 return constructionAirBoundary;
62 6 }
63
64 } // namespace energyplus
65
66 } // namespace openstudio
67