src/energyplus/ForwardTranslator/ForwardTranslateCoilHeatingWaterToAirHeatPumpVariableSpeedEquationFit.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/Node.hpp" | ||
| 9 | #include "../../model/CoilHeatingWaterToAirHeatPumpVariableSpeedEquationFit.hpp" | ||
| 10 | #include "../../model/CoilHeatingWaterToAirHeatPumpVariableSpeedEquationFitSpeedData.hpp" | ||
| 11 | #include "../../model/Schedule.hpp" | ||
| 12 | #include "../../model/Schedule_Impl.hpp" | ||
| 13 | |||
| 14 | #include <utilities/idd/Coil_Heating_WaterToAirHeatPump_VariableSpeedEquationFit_FieldEnums.hxx> | ||
| 15 | #include "../../model/Curve.hpp" | ||
| 16 | #include "../../utilities/core/Logger.hpp" | ||
| 17 | #include "../../utilities/core/Assert.hpp" | ||
| 18 | #include "../../utilities/idf/IdfExtensibleGroup.hpp" | ||
| 19 | |||
| 20 | #include "../../utilities/idd/IddEnums.hpp" | ||
| 21 | #include <utilities/idd/IddEnums.hxx> | ||
| 22 | #include <utilities/idd/IddFactory.hxx> | ||
| 23 | |||
| 24 | using namespace openstudio::model; | ||
| 25 | |||
| 26 | namespace openstudio { | ||
| 27 | |||
| 28 | namespace energyplus { | ||
| 29 | |||
| 30 | 3 | boost::optional<IdfObject> ForwardTranslator::translateCoilHeatingWaterToAirHeatPumpVariableSpeedEquationFit( | |
| 31 | CoilHeatingWaterToAirHeatPumpVariableSpeedEquationFit& modelObject) { | ||
| 32 | //setup boost optionals to use to store get method returns | ||
| 33 | 3 | boost::optional<std::string> s; | |
| 34 | 3 | boost::optional<double> value; | |
| 35 | 3 | boost::optional<Node> node; | |
| 36 | |||
| 37 | // Name | ||
| 38 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | IdfObject idfObject = createRegisterAndNameIdfObject(IddObjectType::Coil_Heating_WaterToAirHeatPump_VariableSpeedEquationFit, modelObject); |
| 39 | |||
| 40 | // AvailabilityScheduleName | ||
| 41 | { | ||
| 42 |
1/1✓ Branch 1 taken 3 times.
|
3 | auto schedule = modelObject.availabilitySchedule(); |
| 43 |
2/3✓ Branch 1 taken 3 times.
✓ Branch 3 taken 3 times.
✗ Branch 4 not taken.
|
6 | if (boost::optional<IdfObject> _schedule = translateAndMapModelObject(schedule)) { |
| 44 |
4/4✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✓ Branch 10 taken 3 times.
|
3 | idfObject.setString(Coil_Heating_WaterToAirHeatPump_VariableSpeedEquationFitFields::AvailabilityScheduleName, _schedule->name().get()); |
| 45 | 3 | } | |
| 46 | 3 | } | |
| 47 | |||
| 48 | // WatertoRefrigerantHXWaterInletNodeName | ||
| 49 |
3/3✓ Branch 1 taken 3 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 2 times.
|
6 | if (auto node = modelObject.waterInletModelObject()) { |
| 50 |
4/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
|
1 | idfObject.setString(Coil_Heating_WaterToAirHeatPump_VariableSpeedEquationFitFields::WatertoRefrigerantHXWaterInletNodeName, node->name().get()); |
| 51 | 3 | } | |
| 52 | |||
| 53 | // WatertoRefrigerantHXWaterOutletNodeName | ||
| 54 |
3/3✓ Branch 1 taken 3 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 2 times.
|
6 | if (auto node = modelObject.waterOutletModelObject()) { |
| 55 | 1 | idfObject.setString(Coil_Heating_WaterToAirHeatPump_VariableSpeedEquationFitFields::WatertoRefrigerantHXWaterOutletNodeName, | |
| 56 |
4/4✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
|
1 | node->name().get()); |
| 57 | 3 | } | |
| 58 | |||
| 59 | // IndoorAirInletNodeName | ||
| 60 |
2/3✓ Branch 1 taken 3 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 3 times.
|
6 | if (auto node = modelObject.airInletModelObject()) { |
| 61 | ✗ | idfObject.setString(Coil_Heating_WaterToAirHeatPump_VariableSpeedEquationFitFields::IndoorAirInletNodeName, node->name().get()); | |
| 62 | 3 | } | |
| 63 | |||
| 64 | // IndoorAirOutletNodeName | ||
| 65 |
2/3✓ Branch 1 taken 3 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 3 times.
|
6 | if (auto node = modelObject.airOutletModelObject()) { |
| 66 | ✗ | idfObject.setString(Coil_Heating_WaterToAirHeatPump_VariableSpeedEquationFitFields::IndoorAirOutletNodeName, node->name().get()); | |
| 67 | 3 | } | |
| 68 | |||
| 69 | // NominalSpeedLevel | ||
| 70 |
2/3✓ Branch 1 taken 3 times.
✓ Branch 3 taken 3 times.
✗ Branch 4 not taken.
|
3 | if (auto speedLevel = modelObject.nominalSpeedLevel()) { |
| 71 |
1/1✓ Branch 1 taken 3 times.
|
3 | idfObject.setInt(Coil_Heating_WaterToAirHeatPump_VariableSpeedEquationFitFields::NominalSpeedLevel, speedLevel); |
| 72 | } | ||
| 73 | |||
| 74 | // RatedHeatingCapacityAtSelectedNominalSpeedLevel | ||
| 75 |
3/3✓ Branch 1 taken 3 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 1 time.
|
3 | if (modelObject.isRatedHeatingCapacityAtSelectedNominalSpeedLevelAutosized()) { |
| 76 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
4 | idfObject.setString(Coil_Heating_WaterToAirHeatPump_VariableSpeedEquationFitFields::RatedHeatingCapacityAtSelectedNominalSpeedLevel, |
| 77 | "AutoSize"); | ||
| 78 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | } else if ((value = modelObject.ratedHeatingCapacityAtSelectedNominalSpeedLevel())) { |
| 79 | 1 | idfObject.setDouble(Coil_Heating_WaterToAirHeatPump_VariableSpeedEquationFitFields::RatedHeatingCapacityAtSelectedNominalSpeedLevel, | |
| 80 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | value.get()); |
| 81 | } | ||
| 82 | |||
| 83 | // RatedAirFlowRateAtSelectedNominalSpeedLevel | ||
| 84 |
3/3✓ Branch 1 taken 3 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 1 time.
|
3 | if (modelObject.isRatedAirFlowRateAtSelectedNominalSpeedLevelAutosized()) { |
| 85 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
4 | idfObject.setString(Coil_Heating_WaterToAirHeatPump_VariableSpeedEquationFitFields::RatedAirFlowRateAtSelectedNominalSpeedLevel, "AutoSize"); |
| 86 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | } else if ((value = modelObject.ratedAirFlowRateAtSelectedNominalSpeedLevel())) { |
| 87 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | idfObject.setDouble(Coil_Heating_WaterToAirHeatPump_VariableSpeedEquationFitFields::RatedAirFlowRateAtSelectedNominalSpeedLevel, value.get()); |
| 88 | } | ||
| 89 | |||
| 90 | // RatedWaterFlowRateAtSelectedNominalSpeedLevel | ||
| 91 |
3/3✓ Branch 1 taken 3 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 1 time.
|
3 | if (modelObject.isRatedWaterFlowRateAtSelectedNominalSpeedLevelAutosized()) { |
| 92 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
4 | idfObject.setString(Coil_Heating_WaterToAirHeatPump_VariableSpeedEquationFitFields::RatedWaterFlowRateAtSelectedNominalSpeedLevel, "AutoSize"); |
| 93 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | } else if ((value = modelObject.ratedWaterFlowRateAtSelectedNominalSpeedLevel())) { |
| 94 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | idfObject.setDouble(Coil_Heating_WaterToAirHeatPump_VariableSpeedEquationFitFields::RatedWaterFlowRateAtSelectedNominalSpeedLevel, value.get()); |
| 95 | } | ||
| 96 | |||
| 97 | // EnergyPartLoadFractionCurveName | ||
| 98 | { | ||
| 99 |
1/1✓ Branch 1 taken 3 times.
|
3 | auto curve = modelObject.energyPartLoadFractionCurve(); |
| 100 |
2/3✓ Branch 1 taken 3 times.
✓ Branch 3 taken 3 times.
✗ Branch 4 not taken.
|
6 | if (auto _curve = translateAndMapModelObject(curve)) { |
| 101 |
4/4✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✓ Branch 10 taken 3 times.
|
3 | idfObject.setString(Coil_Heating_WaterToAirHeatPump_VariableSpeedEquationFitFields::EnergyPartLoadFractionCurveName, _curve->name().get()); |
| 102 | 3 | } | |
| 103 | 3 | } | |
| 104 | |||
| 105 |
1/1✓ Branch 1 taken 3 times.
|
3 | auto const speeds = modelObject.speeds(); |
| 106 | |||
| 107 | // NumberofSpeeds | ||
| 108 |
1/2✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
|
3 | if (auto num = speeds.size()) { |
| 109 |
1/1✓ Branch 1 taken 3 times.
|
3 | idfObject.setInt(Coil_Heating_WaterToAirHeatPump_VariableSpeedEquationFitFields::NumberofSpeeds, num); |
| 110 | } | ||
| 111 | |||
| 112 |
2/2✓ Branch 5 taken 12 times.
✓ Branch 6 taken 3 times.
|
15 | for (auto const& speed : speeds) { |
| 113 |
1/1✓ Branch 1 taken 12 times.
|
12 | auto eg = idfObject.pushExtensibleGroup(); |
| 114 | |||
| 115 | // SpeedReferenceUnitGrossRatedHeatingCapacity | ||
| 116 |
3/4✓ Branch 1 taken 12 times.
✓ Branch 4 taken 12 times.
✓ Branch 7 taken 12 times.
✗ Branch 8 not taken.
|
24 | if ((value = speed.referenceUnitGrossRatedHeatingCapacity())) { |
| 117 | 12 | eg.setDouble(Coil_Heating_WaterToAirHeatPump_VariableSpeedEquationFitExtensibleFields::SpeedReferenceUnitGrossRatedHeatingCapacity, | |
| 118 |
2/2✓ Branch 1 taken 12 times.
✓ Branch 4 taken 12 times.
|
12 | value.get()); |
| 119 | } | ||
| 120 | |||
| 121 | // SpeedReferenceUnitGrossRatedHeatingCOP | ||
| 122 |
3/4✓ Branch 1 taken 12 times.
✓ Branch 4 taken 12 times.
✓ Branch 7 taken 12 times.
✗ Branch 8 not taken.
|
24 | if ((value = speed.referenceUnitGrossRatedHeatingCOP())) { |
| 123 |
2/2✓ Branch 1 taken 12 times.
✓ Branch 4 taken 12 times.
|
12 | eg.setDouble(Coil_Heating_WaterToAirHeatPump_VariableSpeedEquationFitExtensibleFields::SpeedReferenceUnitGrossRatedHeatingCOP, value.get()); |
| 124 | } | ||
| 125 | |||
| 126 | // SpeedReferenceUnitRatedAirFlow | ||
| 127 |
3/4✓ Branch 1 taken 12 times.
✓ Branch 4 taken 12 times.
✓ Branch 7 taken 12 times.
✗ Branch 8 not taken.
|
24 | if ((value = speed.referenceUnitRatedAirFlow())) { |
| 128 |
2/2✓ Branch 1 taken 12 times.
✓ Branch 4 taken 12 times.
|
12 | eg.setDouble(Coil_Heating_WaterToAirHeatPump_VariableSpeedEquationFitExtensibleFields::SpeedReferenceUnitRatedAirFlowRate, value.get()); |
| 129 | } | ||
| 130 | |||
| 131 | // SpeedReferenceUnitRatedWaterFlowRate | ||
| 132 |
3/4✓ Branch 1 taken 12 times.
✓ Branch 4 taken 12 times.
✓ Branch 7 taken 12 times.
✗ Branch 8 not taken.
|
24 | if ((value = speed.referenceUnitRatedWaterFlowRate())) { |
| 133 |
2/2✓ Branch 1 taken 12 times.
✓ Branch 4 taken 12 times.
|
12 | eg.setDouble(Coil_Heating_WaterToAirHeatPump_VariableSpeedEquationFitExtensibleFields::SpeedReferenceUnitRatedWaterFlowRate, value.get()); |
| 134 | } | ||
| 135 | |||
| 136 | // SpeedHeatingCapacityFunctionofTemperatureCurveName | ||
| 137 | { | ||
| 138 |
1/1✓ Branch 1 taken 12 times.
|
12 | auto curve = speed.heatingCapacityFunctionofTemperatureCurve(); |
| 139 |
2/3✓ Branch 1 taken 12 times.
✓ Branch 3 taken 12 times.
✗ Branch 4 not taken.
|
24 | if (auto _curve = translateAndMapModelObject(curve)) { |
| 140 | 12 | eg.setString(Coil_Heating_WaterToAirHeatPump_VariableSpeedEquationFitExtensibleFields::SpeedHeatingCapacityFunctionofTemperatureCurveName, | |
| 141 |
4/4✓ Branch 1 taken 12 times.
✓ Branch 4 taken 12 times.
✓ Branch 7 taken 12 times.
✓ Branch 10 taken 12 times.
|
12 | _curve->name().get()); |
| 142 | 12 | } | |
| 143 | 12 | } | |
| 144 | |||
| 145 | // SpeedTotalHeatingCapacityFunctionofAirFlowFractionCurveName | ||
| 146 | { | ||
| 147 |
1/1✓ Branch 1 taken 12 times.
|
12 | auto curve = speed.totalHeatingCapacityFunctionofAirFlowFractionCurve(); |
| 148 |
2/3✓ Branch 1 taken 12 times.
✓ Branch 3 taken 12 times.
✗ Branch 4 not taken.
|
24 | if (auto _curve = translateAndMapModelObject(curve)) { |
| 149 | 12 | eg.setString( | |
| 150 | Coil_Heating_WaterToAirHeatPump_VariableSpeedEquationFitExtensibleFields::SpeedTotalHeatingCapacityFunctionofAirFlowFractionCurveName, | ||
| 151 |
4/4✓ Branch 1 taken 12 times.
✓ Branch 4 taken 12 times.
✓ Branch 7 taken 12 times.
✓ Branch 10 taken 12 times.
|
12 | _curve->name().get()); |
| 152 | 12 | } | |
| 153 | 12 | } | |
| 154 | |||
| 155 | // SpeedHeatingCapacityFunctionofWaterFlowFractionCurveName | ||
| 156 | { | ||
| 157 |
1/1✓ Branch 1 taken 12 times.
|
12 | auto curve = speed.heatingCapacityFunctionofWaterFlowFractionCurve(); |
| 158 |
2/3✓ Branch 1 taken 12 times.
✓ Branch 3 taken 12 times.
✗ Branch 4 not taken.
|
24 | if (auto _curve = translateAndMapModelObject(curve)) { |
| 159 | 12 | eg.setString( | |
| 160 | Coil_Heating_WaterToAirHeatPump_VariableSpeedEquationFitExtensibleFields::SpeedHeatingCapacityFunctionofWaterFlowFractionCurveName, | ||
| 161 |
4/4✓ Branch 1 taken 12 times.
✓ Branch 4 taken 12 times.
✓ Branch 7 taken 12 times.
✓ Branch 10 taken 12 times.
|
12 | _curve->name().get()); |
| 162 | 12 | } | |
| 163 | 12 | } | |
| 164 | |||
| 165 | // SpeedEnergyInputRatioFunctionofTemperatureCurveName | ||
| 166 | { | ||
| 167 |
1/1✓ Branch 1 taken 12 times.
|
12 | auto curve = speed.energyInputRatioFunctionofTemperatureCurve(); |
| 168 |
2/3✓ Branch 1 taken 12 times.
✓ Branch 3 taken 12 times.
✗ Branch 4 not taken.
|
24 | if (auto _curve = translateAndMapModelObject(curve)) { |
| 169 | 12 | eg.setString(Coil_Heating_WaterToAirHeatPump_VariableSpeedEquationFitExtensibleFields::SpeedEnergyInputRatioFunctionofTemperatureCurveName, | |
| 170 |
4/4✓ Branch 1 taken 12 times.
✓ Branch 4 taken 12 times.
✓ Branch 7 taken 12 times.
✓ Branch 10 taken 12 times.
|
12 | _curve->name().get()); |
| 171 | 12 | } | |
| 172 | 12 | } | |
| 173 | |||
| 174 | // SpeedEnergyInputRatioFunctionofAirFlowFractionCurveName | ||
| 175 | { | ||
| 176 |
1/1✓ Branch 1 taken 12 times.
|
12 | auto curve = speed.energyInputRatioFunctionofAirFlowFractionCurve(); |
| 177 |
2/3✓ Branch 1 taken 12 times.
✓ Branch 3 taken 12 times.
✗ Branch 4 not taken.
|
24 | if (auto _curve = translateAndMapModelObject(curve)) { |
| 178 | 12 | eg.setString( | |
| 179 | Coil_Heating_WaterToAirHeatPump_VariableSpeedEquationFitExtensibleFields::SpeedEnergyInputRatioFunctionofAirFlowFractionCurveName, | ||
| 180 |
4/4✓ Branch 1 taken 12 times.
✓ Branch 4 taken 12 times.
✓ Branch 7 taken 12 times.
✓ Branch 10 taken 12 times.
|
12 | _curve->name().get()); |
| 181 | 12 | } | |
| 182 | 12 | } | |
| 183 | |||
| 184 | // SpeedEnergyInputRatioFunctionofWaterFlowFractionCurveName | ||
| 185 | { | ||
| 186 |
1/1✓ Branch 1 taken 12 times.
|
12 | auto curve = speed.energyInputRatioFunctionofWaterFlowFractionCurve(); |
| 187 |
2/3✓ Branch 1 taken 12 times.
✓ Branch 3 taken 12 times.
✗ Branch 4 not taken.
|
24 | if (auto _curve = translateAndMapModelObject(curve)) { |
| 188 | 12 | eg.setString( | |
| 189 | Coil_Heating_WaterToAirHeatPump_VariableSpeedEquationFitExtensibleFields::SpeedEnergyInputRatioFunctionofWaterFlowFractionCurveName, | ||
| 190 |
4/4✓ Branch 1 taken 12 times.
✓ Branch 4 taken 12 times.
✓ Branch 7 taken 12 times.
✓ Branch 10 taken 12 times.
|
12 | _curve->name().get()); |
| 191 | 12 | } | |
| 192 | 12 | } | |
| 193 | |||
| 194 | // SpeedReferenceUnitWasteHeatFractionofInputPowerAtRatedConditions | ||
| 195 |
3/4✓ Branch 1 taken 12 times.
✓ Branch 4 taken 12 times.
✓ Branch 7 taken 12 times.
✗ Branch 8 not taken.
|
24 | if ((value = speed.referenceUnitWasteHeatFractionofInputPowerAtRatedConditions())) { |
| 196 | 12 | eg.setDouble( | |
| 197 | Coil_Heating_WaterToAirHeatPump_VariableSpeedEquationFitExtensibleFields::SpeedReferenceUnitWasteHeatFractionofInputPowerAtRatedConditions, | ||
| 198 |
2/2✓ Branch 1 taken 12 times.
✓ Branch 4 taken 12 times.
|
12 | value.get()); |
| 199 | } | ||
| 200 | |||
| 201 | // SpeedWasteHeatFunctionofTemperatureCurveName | ||
| 202 | { | ||
| 203 |
1/1✓ Branch 1 taken 12 times.
|
12 | auto curve = speed.wasteHeatFunctionofTemperatureCurve(); |
| 204 |
2/3✓ Branch 1 taken 12 times.
✓ Branch 3 taken 12 times.
✗ Branch 4 not taken.
|
24 | if (auto _curve = translateAndMapModelObject(curve)) { |
| 205 | 12 | eg.setString(Coil_Heating_WaterToAirHeatPump_VariableSpeedEquationFitExtensibleFields::SpeedWasteHeatFunctionofTemperatureCurveName, | |
| 206 |
4/4✓ Branch 1 taken 12 times.
✓ Branch 4 taken 12 times.
✓ Branch 7 taken 12 times.
✓ Branch 10 taken 12 times.
|
12 | _curve->name().get()); |
| 207 | 12 | } | |
| 208 | 12 | } | |
| 209 | 12 | } | |
| 210 | |||
| 211 |
1/1✓ Branch 1 taken 3 times.
|
6 | return idfObject; |
| 212 | 3 | } | |
| 213 | |||
| 214 | } // namespace energyplus | ||
| 215 | |||
| 216 | } // namespace openstudio | ||
| 217 |