src/energyplus/ForwardTranslator/ForwardTranslateCoilCoolingWater.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/Model.hpp" | ||
| 8 | #include "../../model/Schedule.hpp" | ||
| 9 | #include "../../model/Schedule_Impl.hpp" | ||
| 10 | #include "../../model/Node.hpp" | ||
| 11 | #include "../../model/Node_Impl.hpp" | ||
| 12 | #include "../../model/CoilCoolingWater.hpp" | ||
| 13 | #include "../../model/CoilCoolingWater_Impl.hpp" | ||
| 14 | #include "../../utilities/core/Logger.hpp" | ||
| 15 | #include "../../utilities/core/Assert.hpp" | ||
| 16 | #include <utilities/idd/Coil_Cooling_Water_FieldEnums.hxx> | ||
| 17 | #include "../../utilities/idd/IddEnums.hpp" | ||
| 18 | #include <utilities/idd/IddEnums.hxx> | ||
| 19 | #include <utilities/idd/IddFactory.hxx> | ||
| 20 | |||
| 21 | using namespace openstudio::model; | ||
| 22 | |||
| 23 | using namespace std; | ||
| 24 | |||
| 25 | namespace openstudio { | ||
| 26 | |||
| 27 | namespace energyplus { | ||
| 28 | |||
| 29 | 13 | boost::optional<IdfObject> ForwardTranslator::translateCoilCoolingWater(CoilCoolingWater& modelObject) { | |
| 30 | 13 | boost::optional<std::string> s; | |
| 31 | 13 | boost::optional<double> value; | |
| 32 | |||
| 33 |
2/2✓ Branch 1 taken 13 times.
✓ Branch 4 taken 13 times.
|
13 | IdfObject idfObject(IddObjectType::Coil_Cooling_Water); |
| 34 | |||
| 35 |
1/1✓ Branch 1 taken 13 times.
|
13 | m_idfObjects.push_back(idfObject); |
| 36 | |||
| 37 |
1/1✓ Branch 1 taken 13 times.
|
13 | s = modelObject.name(); |
| 38 |
1/2✓ Branch 0 taken 13 times.
✗ Branch 1 not taken.
|
13 | if (s) { |
| 39 |
2/2✓ Branch 1 taken 13 times.
✓ Branch 4 taken 13 times.
|
13 | idfObject.setName(*s); |
| 40 | } | ||
| 41 | |||
| 42 |
1/1✓ Branch 1 taken 13 times.
|
13 | Schedule sched = modelObject.availableSchedule(); |
| 43 |
1/1✓ Branch 1 taken 13 times.
|
13 | boost::optional<IdfObject> _sched = translateAndMapModelObject(sched); |
| 44 |
1/2✓ Branch 0 taken 13 times.
✗ Branch 1 not taken.
|
13 | if (_sched) { |
| 45 |
4/4✓ Branch 1 taken 13 times.
✓ Branch 4 taken 13 times.
✓ Branch 7 taken 13 times.
✓ Branch 10 taken 13 times.
|
13 | idfObject.setString(Coil_Cooling_WaterFields::AvailabilityScheduleName, _sched->name().get()); |
| 46 | } | ||
| 47 | |||
| 48 | // DesignWaterFlowRate | ||
| 49 | |||
| 50 |
2/3✓ Branch 1 taken 13 times.
✓ Branch 3 taken 13 times.
✗ Branch 4 not taken.
|
13 | if (modelObject.isDesignWaterFlowRateAutosized()) { |
| 51 |
2/2✓ Branch 1 taken 13 times.
✓ Branch 4 taken 13 times.
|
26 | idfObject.setString(Coil_Cooling_WaterFields::DesignWaterFlowRate, "Autosize"); |
| 52 | ✗ | } else if ((value = modelObject.designWaterFlowRate())) { | |
| 53 | ✗ | idfObject.setDouble(Coil_Cooling_WaterFields::DesignWaterFlowRate, value.get()); | |
| 54 | } | ||
| 55 | |||
| 56 | // DesignAirFlowRate | ||
| 57 | |||
| 58 |
2/3✓ Branch 1 taken 13 times.
✓ Branch 3 taken 13 times.
✗ Branch 4 not taken.
|
13 | if (modelObject.isDesignAirFlowRateAutosized()) { |
| 59 |
2/2✓ Branch 1 taken 13 times.
✓ Branch 4 taken 13 times.
|
26 | idfObject.setString(Coil_Cooling_WaterFields::DesignAirFlowRate, "Autosize"); |
| 60 | ✗ | } else if ((value = modelObject.designAirFlowRate())) { | |
| 61 | ✗ | idfObject.setDouble(Coil_Cooling_WaterFields::DesignAirFlowRate, value.get()); | |
| 62 | } | ||
| 63 | |||
| 64 | // DesignInletWaterTemperature | ||
| 65 | |||
| 66 |
2/3✓ Branch 1 taken 13 times.
✓ Branch 3 taken 13 times.
✗ Branch 4 not taken.
|
13 | if (modelObject.isDesignInletWaterTemperatureAutosized()) { |
| 67 |
2/2✓ Branch 1 taken 13 times.
✓ Branch 4 taken 13 times.
|
26 | idfObject.setString(Coil_Cooling_WaterFields::DesignInletWaterTemperature, "Autosize"); |
| 68 | ✗ | } else if ((value = modelObject.designInletWaterTemperature())) { | |
| 69 | ✗ | idfObject.setDouble(Coil_Cooling_WaterFields::DesignInletWaterTemperature, value.get()); | |
| 70 | } | ||
| 71 | |||
| 72 | // DesignInletAirTemperature | ||
| 73 | |||
| 74 |
2/3✓ Branch 1 taken 13 times.
✓ Branch 3 taken 13 times.
✗ Branch 4 not taken.
|
13 | if (modelObject.isDesignInletAirTemperatureAutosized()) { |
| 75 |
2/2✓ Branch 1 taken 13 times.
✓ Branch 4 taken 13 times.
|
26 | idfObject.setString(Coil_Cooling_WaterFields::DesignInletAirTemperature, "Autosize"); |
| 76 | ✗ | } else if ((value = modelObject.designInletAirTemperature())) { | |
| 77 | ✗ | idfObject.setDouble(Coil_Cooling_WaterFields::DesignInletAirTemperature, value.get()); | |
| 78 | } | ||
| 79 | |||
| 80 | // DesignOutletAirTemperature | ||
| 81 | |||
| 82 |
2/3✓ Branch 1 taken 13 times.
✓ Branch 3 taken 13 times.
✗ Branch 4 not taken.
|
13 | if (modelObject.isDesignOutletAirTemperatureAutosized()) { |
| 83 |
2/2✓ Branch 1 taken 13 times.
✓ Branch 4 taken 13 times.
|
26 | idfObject.setString(Coil_Cooling_WaterFields::DesignOutletAirTemperature, "Autosize"); |
| 84 | ✗ | } else if ((value = modelObject.designOutletAirTemperature())) { | |
| 85 | ✗ | idfObject.setDouble(Coil_Cooling_WaterFields::DesignOutletAirTemperature, value.get()); | |
| 86 | } | ||
| 87 | |||
| 88 | // DesignInletAirHumidityRatio | ||
| 89 | |||
| 90 |
2/3✓ Branch 1 taken 13 times.
✓ Branch 3 taken 13 times.
✗ Branch 4 not taken.
|
13 | if (modelObject.isDesignInletAirHumidityRatioAutosized()) { |
| 91 |
2/2✓ Branch 1 taken 13 times.
✓ Branch 4 taken 13 times.
|
26 | idfObject.setString(Coil_Cooling_WaterFields::DesignInletAirHumidityRatio, "Autosize"); |
| 92 | ✗ | } else if ((value = modelObject.designInletAirHumidityRatio())) { | |
| 93 | ✗ | idfObject.setDouble(Coil_Cooling_WaterFields::DesignInletAirHumidityRatio, value.get()); | |
| 94 | } | ||
| 95 | |||
| 96 | // DesignOutletAirHumidityRatio | ||
| 97 | |||
| 98 |
2/3✓ Branch 1 taken 13 times.
✓ Branch 3 taken 13 times.
✗ Branch 4 not taken.
|
13 | if (modelObject.isDesignOutletAirHumidityRatioAutosized()) { |
| 99 |
2/2✓ Branch 1 taken 13 times.
✓ Branch 4 taken 13 times.
|
26 | idfObject.setString(Coil_Cooling_WaterFields::DesignOutletAirHumidityRatio, "Autosize"); |
| 100 | ✗ | } else if ((value = modelObject.designOutletAirHumidityRatio())) { | |
| 101 | ✗ | idfObject.setDouble(Coil_Cooling_WaterFields::DesignOutletAirHumidityRatio, value.get()); | |
| 102 | } | ||
| 103 | |||
| 104 | // WaterInletNodeName | ||
| 105 | |||
| 106 |
2/3✓ Branch 1 taken 13 times.
✓ Branch 3 taken 13 times.
✗ Branch 4 not taken.
|
26 | if (boost::optional<ModelObject> mo = modelObject.waterInletModelObject()) { |
| 107 |
3/4✓ Branch 1 taken 13 times.
✓ Branch 4 taken 13 times.
✓ Branch 6 taken 13 times.
✗ Branch 7 not taken.
|
26 | if (boost::optional<Node> node = mo->optionalCast<Node>()) { |
| 108 |
4/4✓ Branch 1 taken 13 times.
✓ Branch 4 taken 13 times.
✓ Branch 7 taken 13 times.
✓ Branch 10 taken 13 times.
|
13 | idfObject.setString(Coil_Cooling_WaterFields::WaterInletNodeName, node->name().get()); |
| 109 | 13 | } | |
| 110 | 13 | } | |
| 111 | |||
| 112 | // WaterOutletNodeName | ||
| 113 | |||
| 114 |
2/3✓ Branch 1 taken 13 times.
✓ Branch 3 taken 13 times.
✗ Branch 4 not taken.
|
26 | if (boost::optional<ModelObject> mo = modelObject.waterOutletModelObject()) { |
| 115 |
3/4✓ Branch 1 taken 13 times.
✓ Branch 4 taken 13 times.
✓ Branch 6 taken 13 times.
✗ Branch 7 not taken.
|
26 | if (boost::optional<Node> node = mo->optionalCast<Node>()) { |
| 116 |
4/4✓ Branch 1 taken 13 times.
✓ Branch 4 taken 13 times.
✓ Branch 7 taken 13 times.
✓ Branch 10 taken 13 times.
|
13 | idfObject.setString(Coil_Cooling_WaterFields::WaterOutletNodeName, node->name().get()); |
| 117 | 13 | } | |
| 118 | 13 | } | |
| 119 | |||
| 120 | // AirInletNodeName | ||
| 121 | |||
| 122 |
3/3✓ Branch 1 taken 13 times.
✓ Branch 3 taken 5 times.
✓ Branch 4 taken 8 times.
|
26 | if (boost::optional<ModelObject> mo = modelObject.airInletModelObject()) { |
| 123 |
3/4✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 6 taken 5 times.
✗ Branch 7 not taken.
|
10 | if (boost::optional<Node> node = mo->optionalCast<Node>()) { |
| 124 |
4/4✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
|
5 | idfObject.setString(Coil_Cooling_WaterFields::AirInletNodeName, node->name().get()); |
| 125 | 5 | } | |
| 126 | 13 | } | |
| 127 | |||
| 128 | // AirOutletNodeName | ||
| 129 | |||
| 130 |
3/3✓ Branch 1 taken 13 times.
✓ Branch 3 taken 5 times.
✓ Branch 4 taken 8 times.
|
26 | if (boost::optional<ModelObject> mo = modelObject.airOutletModelObject()) { |
| 131 |
3/4✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 6 taken 5 times.
✗ Branch 7 not taken.
|
10 | if (boost::optional<Node> node = mo->optionalCast<Node>()) { |
| 132 |
4/4✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
✓ Branch 10 taken 5 times.
|
5 | idfObject.setString(Coil_Cooling_WaterFields::AirOutletNodeName, node->name().get()); |
| 133 | 5 | } | |
| 134 | 13 | } | |
| 135 | |||
| 136 | // TypeofAnalysis | ||
| 137 | |||
| 138 |
2/2✓ Branch 1 taken 13 times.
✓ Branch 4 taken 13 times.
|
13 | s = modelObject.typeOfAnalysis(); |
| 139 |
1/2✓ Branch 0 taken 13 times.
✗ Branch 1 not taken.
|
13 | if (s) { |
| 140 |
2/2✓ Branch 1 taken 13 times.
✓ Branch 4 taken 13 times.
|
13 | idfObject.setString(Coil_Cooling_WaterFields::TypeofAnalysis, s.get()); |
| 141 | } | ||
| 142 | |||
| 143 | // HeatExchangerConfiguration | ||
| 144 | |||
| 145 |
2/2✓ Branch 1 taken 13 times.
✓ Branch 4 taken 13 times.
|
13 | s = modelObject.heatExchangerConfiguration(); |
| 146 |
1/2✓ Branch 0 taken 13 times.
✗ Branch 1 not taken.
|
13 | if (s) { |
| 147 |
2/2✓ Branch 1 taken 13 times.
✓ Branch 4 taken 13 times.
|
13 | idfObject.setString(Coil_Cooling_WaterFields::HeatExchangerConfiguration, s.get()); |
| 148 | } | ||
| 149 | |||
| 150 |
1/1✓ Branch 1 taken 13 times.
|
26 | return boost::optional<IdfObject>(idfObject); |
| 151 | 13 | } | |
| 152 | |||
| 153 | //((Name)(Name)) | ||
| 154 | //((AvailabilityScheduleName)(Availability Schedule Name)) | ||
| 155 | |||
| 156 | } // namespace energyplus | ||
| 157 | |||
| 158 | } // namespace openstudio | ||
| 159 |