src/energyplus/ReverseTranslator/ReverseTranslateZoneInfiltrationDesignFlowRate.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/SpaceInfiltrationDesignFlowRate.hpp" | ||
| 9 | #include "../../model/SpaceInfiltrationDesignFlowRate_Impl.hpp" | ||
| 10 | #include "../../model/Space.hpp" | ||
| 11 | #include "../../model/Space_Impl.hpp" | ||
| 12 | #include "../../model/SpaceType.hpp" | ||
| 13 | #include "../../model/SpaceType_Impl.hpp" | ||
| 14 | #include "../../model/Schedule.hpp" | ||
| 15 | #include "../../model/Schedule_Impl.hpp" | ||
| 16 | |||
| 17 | #include <utilities/idd/ZoneInfiltration_DesignFlowRate_FieldEnums.hxx> | ||
| 18 | #include "../../utilities/idd/IddEnums.hpp" | ||
| 19 | #include <utilities/idd/IddEnums.hxx> | ||
| 20 | |||
| 21 | #include "../../utilities/core/Assert.hpp" | ||
| 22 | |||
| 23 | using namespace openstudio::model; | ||
| 24 | |||
| 25 | namespace openstudio { | ||
| 26 | |||
| 27 | namespace energyplus { | ||
| 28 | |||
| 29 | 34 | OptionalModelObject ReverseTranslator::translateZoneInfiltrationDesignFlowRate(const WorkspaceObject& workspaceObject) { | |
| 30 |
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::ZoneInfiltration_DesignFlowRate) { |
| 31 | ✗ | LOG(Error, "WorkspaceObject is not IddObjectType: ZoneInfiltration:DesignFlowRate"); | |
| 32 | ✗ | return boost::none; | |
| 33 | } | ||
| 34 | |||
| 35 |
1/1✓ Branch 1 taken 34 times.
|
34 | openstudio::model::SpaceInfiltrationDesignFlowRate infiltration(m_model); |
| 36 | |||
| 37 |
1/1✓ Branch 1 taken 34 times.
|
34 | OptionalString s = workspaceObject.name(); |
| 38 |
1/2✓ Branch 0 taken 34 times.
✗ Branch 1 not taken.
|
34 | if (s) { |
| 39 |
2/2✓ Branch 1 taken 34 times.
✓ Branch 4 taken 34 times.
|
34 | infiltration.setName(*s); |
| 40 | } | ||
| 41 | |||
| 42 | OptionalWorkspaceObject target = | ||
| 43 |
1/1✓ Branch 1 taken 34 times.
|
34 | workspaceObject.getTarget(openstudio::ZoneInfiltration_DesignFlowRateFields::ZoneorZoneListorSpaceorSpaceListName); |
| 44 |
1/2✓ Branch 0 taken 34 times.
✗ Branch 1 not taken.
|
34 | if (target) { |
| 45 |
2/2✓ Branch 1 taken 34 times.
✓ Branch 4 taken 34 times.
|
34 | OptionalModelObject modelObject = translateAndMapWorkspaceObject(*target); |
| 46 |
1/2✓ Branch 0 taken 34 times.
✗ Branch 1 not taken.
|
34 | if (modelObject) { |
| 47 |
4/4✓ Branch 1 taken 34 times.
✓ Branch 4 taken 34 times.
✓ Branch 7 taken 27 times.
✓ Branch 8 taken 7 times.
|
68 | if (modelObject->optionalCast<Space>()) { |
| 48 |
3/3✓ Branch 1 taken 27 times.
✓ Branch 4 taken 27 times.
✓ Branch 7 taken 27 times.
|
27 | infiltration.setSpace(modelObject->cast<Space>()); |
| 49 |
3/4✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
✓ Branch 7 taken 7 times.
✗ Branch 8 not taken.
|
14 | } else if (modelObject->optionalCast<SpaceType>()) { |
| 50 |
3/3✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
✓ Branch 7 taken 7 times.
|
7 | infiltration.setSpaceType(modelObject->cast<SpaceType>()); |
| 51 | } | ||
| 52 | } | ||
| 53 | 34 | } | |
| 54 | |||
| 55 |
1/1✓ Branch 1 taken 34 times.
|
34 | target = workspaceObject.getTarget(openstudio::ZoneInfiltration_DesignFlowRateFields::ScheduleName); |
| 56 |
1/2✓ Branch 0 taken 34 times.
✗ Branch 1 not taken.
|
34 | if (target) { |
| 57 |
2/2✓ Branch 1 taken 34 times.
✓ Branch 4 taken 34 times.
|
34 | OptionalModelObject modelObject = translateAndMapWorkspaceObject(*target); |
| 58 |
1/2✓ Branch 0 taken 34 times.
✗ Branch 1 not taken.
|
34 | if (modelObject) { |
| 59 |
3/4✓ Branch 1 taken 34 times.
✓ Branch 4 taken 34 times.
✓ Branch 6 taken 34 times.
✗ Branch 7 not taken.
|
68 | if (OptionalSchedule intermediate = modelObject->optionalCast<Schedule>()) { |
| 60 |
2/2✓ Branch 1 taken 34 times.
✓ Branch 4 taken 34 times.
|
34 | Schedule schedule(*intermediate); |
| 61 |
1/1✓ Branch 1 taken 34 times.
|
34 | infiltration.setSchedule(schedule); |
| 62 | 68 | } | |
| 63 | } | ||
| 64 | 34 | } | |
| 65 | |||
| 66 |
1/1✓ Branch 1 taken 34 times.
|
34 | s = workspaceObject.getString(openstudio::ZoneInfiltration_DesignFlowRateFields::DesignFlowRateCalculationMethod, true); |
| 67 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 34 times.
✗ Branch 4 not taken.
|
34 | OS_ASSERT(s); |
| 68 | |||
| 69 | 34 | OptionalDouble d; | |
| 70 |
5/5✓ Branch 1 taken 34 times.
✓ Branch 4 taken 34 times.
✓ Branch 7 taken 34 times.
✓ Branch 10 taken 5 times.
✓ Branch 11 taken 29 times.
|
102 | if (istringEqual("Flow/Zone", *s)) { |
| 71 |
1/1✓ Branch 1 taken 5 times.
|
5 | d = workspaceObject.getDouble(openstudio::ZoneInfiltration_DesignFlowRateFields::DesignFlowRate); |
| 72 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if (d) { |
| 73 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | infiltration.setDesignFlowRate(*d); |
| 74 | } else { | ||
| 75 | ✗ | LOG(Error, "Flow/Zone value not found for workspace object " << workspaceObject); | |
| 76 | } | ||
| 77 |
4/5✓ Branch 1 taken 29 times.
✓ Branch 4 taken 29 times.
✓ Branch 7 taken 29 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 29 times.
|
87 | } else if (istringEqual("Flow/Area", *s)) { |
| 78 | ✗ | d = workspaceObject.getDouble(openstudio::ZoneInfiltration_DesignFlowRateFields::FlowRateperFloorArea); | |
| 79 | ✗ | if (d) { | |
| 80 | ✗ | infiltration.setFlowperSpaceFloorArea(*d); | |
| 81 | } else { | ||
| 82 | ✗ | LOG(Error, "Flow/Area value not found for workspace object " << workspaceObject); | |
| 83 | } | ||
| 84 |
5/5✓ Branch 1 taken 29 times.
✓ Branch 4 taken 29 times.
✓ Branch 7 taken 29 times.
✓ Branch 10 taken 26 times.
✓ Branch 11 taken 3 times.
|
87 | } else if (istringEqual("Flow/ExteriorArea", *s)) { |
| 85 |
1/1✓ Branch 1 taken 26 times.
|
26 | d = workspaceObject.getDouble(openstudio::ZoneInfiltration_DesignFlowRateFields::FlowRateperExteriorSurfaceArea); |
| 86 |
1/2✓ Branch 0 taken 26 times.
✗ Branch 1 not taken.
|
26 | if (d) { |
| 87 |
2/2✓ Branch 1 taken 26 times.
✓ Branch 4 taken 26 times.
|
26 | infiltration.setFlowperExteriorSurfaceArea(*d); |
| 88 | } else { | ||
| 89 | ✗ | LOG(Error, "Flow/ExteriorArea value not found for workspace object " << workspaceObject); | |
| 90 | } | ||
| 91 |
4/5✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 3 times.
|
9 | } else if (istringEqual("Flow/ExteriorWallArea", *s)) { |
| 92 | ✗ | d = workspaceObject.getDouble(openstudio::ZoneInfiltration_DesignFlowRateFields::FlowRateperExteriorSurfaceArea); | |
| 93 | ✗ | if (d) { | |
| 94 | ✗ | infiltration.setFlowperExteriorWallArea(*d); | |
| 95 | } else { | ||
| 96 | ✗ | LOG(Error, "Flow/ExteriorWallArea value not found for workspace object " << workspaceObject); | |
| 97 | } | ||
| 98 |
4/5✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✓ Branch 10 taken 3 times.
✗ Branch 11 not taken.
|
9 | } else if (istringEqual("AirChanges/Hour", *s)) { |
| 99 |
1/1✓ Branch 1 taken 3 times.
|
3 | d = workspaceObject.getDouble(openstudio::ZoneInfiltration_DesignFlowRateFields::AirChangesperHour); |
| 100 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | if (d) { |
| 101 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | infiltration.setAirChangesperHour(*d); |
| 102 | } else { | ||
| 103 | ✗ | LOG(Error, "AirChanges/Hour value not found for workspace object " << workspaceObject); | |
| 104 | } | ||
| 105 | } else { | ||
| 106 | ✗ | LOG(Error, "Unknown DesignLevelCalculationMethod value for workspace object" << workspaceObject); | |
| 107 | } | ||
| 108 | |||
| 109 |
1/1✓ Branch 1 taken 34 times.
|
34 | d = workspaceObject.getDouble(openstudio::ZoneInfiltration_DesignFlowRateFields::ConstantTermCoefficient); |
| 110 |
2/2✓ Branch 0 taken 27 times.
✓ Branch 1 taken 7 times.
|
34 | if (d) { |
| 111 |
2/2✓ Branch 1 taken 27 times.
✓ Branch 4 taken 27 times.
|
27 | infiltration.setConstantTermCoefficient(*d); |
| 112 | } | ||
| 113 | |||
| 114 |
1/1✓ Branch 1 taken 34 times.
|
34 | d = workspaceObject.getDouble(openstudio::ZoneInfiltration_DesignFlowRateFields::TemperatureTermCoefficient); |
| 115 |
2/2✓ Branch 0 taken 27 times.
✓ Branch 1 taken 7 times.
|
34 | if (d) { |
| 116 |
2/2✓ Branch 1 taken 27 times.
✓ Branch 4 taken 27 times.
|
27 | infiltration.setTemperatureTermCoefficient(*d); |
| 117 | } | ||
| 118 | |||
| 119 |
1/1✓ Branch 1 taken 34 times.
|
34 | d = workspaceObject.getDouble(openstudio::ZoneInfiltration_DesignFlowRateFields::VelocityTermCoefficient); |
| 120 |
2/2✓ Branch 0 taken 27 times.
✓ Branch 1 taken 7 times.
|
34 | if (d) { |
| 121 |
2/2✓ Branch 1 taken 27 times.
✓ Branch 4 taken 27 times.
|
27 | infiltration.setVelocityTermCoefficient(*d); |
| 122 | } | ||
| 123 | |||
| 124 |
1/1✓ Branch 1 taken 34 times.
|
34 | d = workspaceObject.getDouble(openstudio::ZoneInfiltration_DesignFlowRateFields::VelocitySquaredTermCoefficient); |
| 125 |
2/2✓ Branch 0 taken 27 times.
✓ Branch 1 taken 7 times.
|
34 | if (d) { |
| 126 |
2/2✓ Branch 1 taken 27 times.
✓ Branch 4 taken 27 times.
|
27 | infiltration.setVelocitySquaredTermCoefficient(*d); |
| 127 | } | ||
| 128 | |||
| 129 |
1/1✓ Branch 1 taken 34 times.
|
34 | return infiltration; |
| 130 | 34 | } | |
| 131 | |||
| 132 | } // namespace energyplus | ||
| 133 | |||
| 134 | } // namespace openstudio | ||
| 135 |