src/energyplus/ReverseTranslator/ReverseTranslateZoneInfiltrationEffectiveLeakageArea.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/Model.hpp" | ||
| 9 | #include "../../model/SpaceInfiltrationEffectiveLeakageArea.hpp" | ||
| 10 | #include "../../model/SpaceInfiltrationEffectiveLeakageArea_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_EffectiveLeakageArea_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 | namespace openstudio { | ||
| 28 | |||
| 29 | namespace energyplus { | ||
| 30 | |||
| 31 | 1 | OptionalModelObject ReverseTranslator::translateZoneInfiltrationEffectiveLeakageArea(const WorkspaceObject& workspaceObject) { | |
| 32 |
4/5✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✗ Branch 11 not taken.
✓ Branch 12 taken 1 time.
|
1 | if (workspaceObject.iddObject().type() != IddObjectType::ZoneInfiltration_EffectiveLeakageArea) { |
| 33 | ✗ | LOG(Error, "WorkspaceObject " << workspaceObject.briefDescription() << " is not IddObjectType: SpaceInfiltration_EffectiveLeakageArea"); | |
| 34 | ✗ | return boost::none; | |
| 35 | } | ||
| 36 | |||
| 37 | // create the instance | ||
| 38 |
1/1✓ Branch 1 taken 1 time.
|
1 | SpaceInfiltrationEffectiveLeakageArea spaceInfiltrationEffectiveLeakageArea(m_model); |
| 39 | |||
| 40 |
1/1✓ Branch 1 taken 1 time.
|
1 | OptionalString s = workspaceObject.name(); |
| 41 |
1/2✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
|
1 | if (s) { |
| 42 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | spaceInfiltrationEffectiveLeakageArea.setName(*s); |
| 43 | } | ||
| 44 | |||
| 45 |
1/1✓ Branch 1 taken 1 time.
|
1 | OptionalWorkspaceObject target = workspaceObject.getTarget(ZoneInfiltration_EffectiveLeakageAreaFields::ZoneorSpaceName); |
| 46 |
1/2✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
|
1 | if (target) { |
| 47 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | OptionalModelObject modelObject = translateAndMapWorkspaceObject(*target); |
| 48 |
1/2✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
|
1 | if (modelObject) { |
| 49 |
3/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✗ Branch 8 not taken.
|
2 | if (modelObject->optionalCast<Space>()) { |
| 50 |
3/3✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
|
1 | spaceInfiltrationEffectiveLeakageArea.setSpace(modelObject->cast<Space>()); |
| 51 | ✗ | } else if (modelObject->optionalCast<SpaceType>()) { | |
| 52 | ✗ | spaceInfiltrationEffectiveLeakageArea.setSpaceType(modelObject->cast<SpaceType>()); | |
| 53 | } | ||
| 54 | } | ||
| 55 | 1 | } | |
| 56 | |||
| 57 |
1/1✓ Branch 1 taken 1 time.
|
1 | target = workspaceObject.getTarget(ZoneInfiltration_EffectiveLeakageAreaFields::ScheduleName); |
| 58 |
1/2✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
|
1 | if (target) { |
| 59 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | OptionalModelObject modelObject = translateAndMapWorkspaceObject(*target); |
| 60 |
1/2✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
|
1 | if (modelObject) { |
| 61 |
3/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 6 taken 1 time.
✗ Branch 7 not taken.
|
2 | if (OptionalSchedule intermediate = modelObject->optionalCast<Schedule>()) { |
| 62 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | Schedule schedule(*intermediate); |
| 63 |
1/1✓ Branch 1 taken 1 time.
|
1 | spaceInfiltrationEffectiveLeakageArea.setSchedule(schedule); |
| 64 | 2 | } | |
| 65 | } | ||
| 66 | 1 | } | |
| 67 | |||
| 68 |
1/1✓ Branch 1 taken 1 time.
|
1 | boost::optional<double> value = workspaceObject.getDouble(ZoneInfiltration_EffectiveLeakageAreaFields::EffectiveAirLeakageArea); |
| 69 |
1/2✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
|
1 | if (value) { |
| 70 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | spaceInfiltrationEffectiveLeakageArea.setEffectiveAirLeakageArea(value.get()); |
| 71 | } | ||
| 72 | |||
| 73 |
1/1✓ Branch 1 taken 1 time.
|
1 | value = workspaceObject.getDouble(ZoneInfiltration_EffectiveLeakageAreaFields::StackCoefficient); |
| 74 |
1/2✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
|
1 | if (value) { |
| 75 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | spaceInfiltrationEffectiveLeakageArea.setStackCoefficient(value.get()); |
| 76 | } | ||
| 77 | |||
| 78 |
1/1✓ Branch 1 taken 1 time.
|
1 | value = workspaceObject.getDouble(ZoneInfiltration_EffectiveLeakageAreaFields::WindCoefficient); |
| 79 |
1/2✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
|
1 | if (value) { |
| 80 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | spaceInfiltrationEffectiveLeakageArea.setWindCoefficient(value.get()); |
| 81 | } | ||
| 82 | |||
| 83 |
1/1✓ Branch 1 taken 1 time.
|
1 | return spaceInfiltrationEffectiveLeakageArea; |
| 84 | 1 | } | |
| 85 | |||
| 86 | } // namespace energyplus | ||
| 87 | |||
| 88 | } // namespace openstudio | ||
| 89 |