src/energyplus/ForwardTranslator/ForwardTranslateWaterUseEquipment.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 | #include "../../model/WaterUseEquipment.hpp" | ||
| 8 | #include "../../model/WaterUseEquipment_Impl.hpp" | ||
| 9 | #include "../../model/WaterUseEquipmentDefinition.hpp" | ||
| 10 | #include "../../model/WaterUseEquipmentDefinition_Impl.hpp" | ||
| 11 | #include "../../model/Model.hpp" | ||
| 12 | #include "../../model/Schedule.hpp" | ||
| 13 | #include "../../model/Schedule_Impl.hpp" | ||
| 14 | #include "../../model/ThermalZone.hpp" | ||
| 15 | #include "../../model/ThermalZone_Impl.hpp" | ||
| 16 | #include "../../model/Space.hpp" | ||
| 17 | #include "../../model/Space_Impl.hpp" | ||
| 18 | #include "../../model/LifeCycleCost.hpp" | ||
| 19 | |||
| 20 | #include "../../utilities/core/Assert.hpp" | ||
| 21 | #include <utilities/idd/WaterUse_Equipment_FieldEnums.hxx> | ||
| 22 | #include <utilities/idd/IddEnums.hxx> | ||
| 23 | #include "../../utilities/idf/IdfExtensibleGroup.hpp" | ||
| 24 | |||
| 25 | using namespace openstudio::model; | ||
| 26 | |||
| 27 | using namespace std; | ||
| 28 | |||
| 29 | namespace openstudio { | ||
| 30 | |||
| 31 | namespace energyplus { | ||
| 32 | |||
| 33 | 22 | boost::optional<IdfObject> ForwardTranslator::translateWaterUseEquipment(WaterUseEquipment& modelObject) { | |
| 34 | 22 | boost::optional<std::string> s; | |
| 35 | 22 | boost::optional<double> value; | |
| 36 | 22 | OptionalSchedule schedule; | |
| 37 | |||
| 38 |
1/1✓ Branch 1 taken 22 times.
|
22 | model::WaterUseEquipmentDefinition definition = modelObject.waterUseEquipmentDefinition(); |
| 39 | |||
| 40 |
2/2✓ Branch 1 taken 22 times.
✓ Branch 4 taken 22 times.
|
22 | IdfObject idfObject(IddObjectType::WaterUse_Equipment); |
| 41 |
1/1✓ Branch 1 taken 22 times.
|
22 | m_idfObjects.push_back(idfObject); |
| 42 | |||
| 43 |
2/4✓ Branch 1 taken 22 times.
✗ Branch 7 not taken.
✗ Branch 11 not taken.
✓ Branch 12 taken 22 times.
|
22 | for (LifeCycleCost lifeCycleCost : modelObject.lifeCycleCosts()) { |
| 44 | ✗ | translateAndMapModelObject(lifeCycleCost); | |
| 45 | 22 | } | |
| 46 | |||
| 47 | // Name | ||
| 48 | |||
| 49 |
1/1✓ Branch 1 taken 22 times.
|
22 | s = modelObject.name(); |
| 50 |
1/2✓ Branch 0 taken 22 times.
✗ Branch 1 not taken.
|
22 | if (s) { |
| 51 |
2/2✓ Branch 1 taken 22 times.
✓ Branch 4 taken 22 times.
|
22 | idfObject.setName(*s); |
| 52 | } | ||
| 53 | |||
| 54 | // EndUseSubcategory | ||
| 55 | |||
| 56 |
2/2✓ Branch 1 taken 22 times.
✓ Branch 4 taken 22 times.
|
22 | s = definition.endUseSubcategory(); |
| 57 |
1/2✓ Branch 0 taken 22 times.
✗ Branch 1 not taken.
|
22 | if (s) { |
| 58 |
2/2✓ Branch 1 taken 22 times.
✓ Branch 4 taken 22 times.
|
22 | idfObject.setString(WaterUse_EquipmentFields::EndUseSubcategory, s.get()); |
| 59 | } | ||
| 60 | |||
| 61 | // PeakFlowRate | ||
| 62 | |||
| 63 |
2/2✓ Branch 1 taken 22 times.
✓ Branch 4 taken 22 times.
|
22 | value = definition.peakFlowRate(); |
| 64 |
1/2✓ Branch 0 taken 22 times.
✗ Branch 1 not taken.
|
22 | if (value) { |
| 65 |
2/2✓ Branch 1 taken 22 times.
✓ Branch 4 taken 22 times.
|
22 | idfObject.setDouble(WaterUse_EquipmentFields::PeakFlowRate, value.get()); |
| 66 | } | ||
| 67 | |||
| 68 | // FlowRateFractionScheduleName | ||
| 69 | |||
| 70 |
2/3✓ Branch 1 taken 22 times.
✓ Branch 3 taken 22 times.
✗ Branch 4 not taken.
|
44 | if (boost::optional<Schedule> s = modelObject.flowRateFractionSchedule()) { |
| 71 |
2/2✓ Branch 1 taken 22 times.
✓ Branch 4 taken 22 times.
|
22 | translateAndMapModelObject(s.get()); |
| 72 | |||
| 73 |
4/4✓ Branch 1 taken 22 times.
✓ Branch 4 taken 22 times.
✓ Branch 7 taken 22 times.
✓ Branch 10 taken 22 times.
|
22 | idfObject.setString(WaterUse_EquipmentFields::FlowRateFractionScheduleName, s->name().get()); |
| 74 | 22 | } | |
| 75 | |||
| 76 | // TargetTemperatureScheduleName | ||
| 77 | |||
| 78 |
3/3✓ Branch 1 taken 22 times.
✓ Branch 3 taken 20 times.
✓ Branch 4 taken 2 times.
|
44 | if (boost::optional<Schedule> s = definition.targetTemperatureSchedule()) { |
| 79 |
2/2✓ Branch 1 taken 20 times.
✓ Branch 4 taken 20 times.
|
20 | translateAndMapModelObject(s.get()); |
| 80 | |||
| 81 |
4/4✓ Branch 1 taken 20 times.
✓ Branch 4 taken 20 times.
✓ Branch 7 taken 20 times.
✓ Branch 10 taken 20 times.
|
20 | idfObject.setString(WaterUse_EquipmentFields::TargetTemperatureScheduleName, s->name().get()); |
| 82 | 22 | } | |
| 83 | |||
| 84 | // ZoneName | ||
| 85 | |||
| 86 |
3/3✓ Branch 1 taken 22 times.
✓ Branch 3 taken 20 times.
✓ Branch 4 taken 2 times.
|
44 | if (boost::optional<Space> space = modelObject.space()) { |
| 87 |
3/4✓ Branch 1 taken 20 times.
✓ Branch 4 taken 20 times.
✓ Branch 6 taken 20 times.
✗ Branch 7 not taken.
|
40 | if (boost::optional<ThermalZone> zone = space->thermalZone()) { |
| 88 |
2/2✓ Branch 1 taken 20 times.
✓ Branch 4 taken 20 times.
|
20 | translateAndMapModelObject(zone.get()); |
| 89 | |||
| 90 |
4/4✓ Branch 1 taken 20 times.
✓ Branch 4 taken 20 times.
✓ Branch 7 taken 20 times.
✓ Branch 10 taken 20 times.
|
20 | idfObject.setString(WaterUse_EquipmentFields::ZoneName, zone->name().get()); |
| 91 | 20 | } | |
| 92 | 22 | } | |
| 93 | |||
| 94 | // SensibleFractionScheduleName | ||
| 95 | |||
| 96 |
2/3✓ Branch 1 taken 22 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 22 times.
|
44 | if (boost::optional<Schedule> s = definition.sensibleFractionSchedule()) { |
| 97 | ✗ | translateAndMapModelObject(s.get()); | |
| 98 | |||
| 99 | ✗ | idfObject.setString(WaterUse_EquipmentFields::SensibleFractionScheduleName, s->name().get()); | |
| 100 | 22 | } | |
| 101 | |||
| 102 | // LatentFractionScheduleName | ||
| 103 | |||
| 104 |
2/3✓ Branch 1 taken 22 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 22 times.
|
44 | if (boost::optional<Schedule> s = definition.latentFractionSchedule()) { |
| 105 | ✗ | translateAndMapModelObject(s.get()); | |
| 106 | |||
| 107 | ✗ | idfObject.setString(WaterUse_EquipmentFields::LatentFractionScheduleName, s->name().get()); | |
| 108 | 22 | } | |
| 109 | |||
| 110 |
1/1✓ Branch 1 taken 22 times.
|
44 | return idfObject; |
| 111 | 22 | } | |
| 112 | |||
| 113 | } // namespace energyplus | ||
| 114 | } // namespace openstudio | ||
| 115 |