src/energyplus/ForwardTranslator/ForwardTranslateCoilHeatingWaterToAirHeatPumpEquationFit.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/CoilHeatingWaterToAirHeatPumpEquationFit.hpp" | ||
| 13 | #include "../../model/CoilHeatingWaterToAirHeatPumpEquationFit_Impl.hpp" | ||
| 14 | #include "../../model/Curve.hpp" | ||
| 15 | |||
| 16 | #include "../../utilities/core/Logger.hpp" | ||
| 17 | #include "../../utilities/core/Assert.hpp" | ||
| 18 | |||
| 19 | #include <utilities/idd/Coil_Heating_WaterToAirHeatPump_EquationFit_FieldEnums.hxx> | ||
| 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 | //using namespace std; | ||
| 27 | |||
| 28 | namespace openstudio { | ||
| 29 | |||
| 30 | namespace energyplus { | ||
| 31 | |||
| 32 | boost::optional<IdfObject> | ||
| 33 | 4 | ForwardTranslator::translateCoilHeatingWaterToAirHeatPumpEquationFit(CoilHeatingWaterToAirHeatPumpEquationFit& modelObject) { | |
| 34 | //setup boost optionals to use to store get method returns | ||
| 35 | 4 | boost::optional<std::string> s; | |
| 36 | 4 | boost::optional<double> value; | |
| 37 | 4 | boost::optional<Node> node; | |
| 38 | |||
| 39 | // Make sure the modelObject gets put into the map, and the new idfObject gets put into the final file. | ||
| 40 | // Also sets the idfObjects name | ||
| 41 | |||
| 42 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | IdfObject idfObject = createRegisterAndNameIdfObject(IddObjectType::Coil_Heating_WaterToAirHeatPump_EquationFit, modelObject); |
| 43 | |||
| 44 | // Object Name | ||
| 45 | //std::string baseName = idfObject.name().get(); | ||
| 46 | |||
| 47 | // AvailabilityScheduleName | ||
| 48 | { | ||
| 49 |
1/1✓ Branch 1 taken 4 times.
|
4 | auto schedule = modelObject.availabilitySchedule(); |
| 50 |
2/3✓ Branch 1 taken 4 times.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
|
8 | if (boost::optional<IdfObject> _schedule = translateAndMapModelObject(schedule)) { |
| 51 |
4/4✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
✓ Branch 10 taken 4 times.
|
4 | idfObject.setString(Coil_Heating_WaterToAirHeatPump_EquationFitFields::AvailabilityScheduleName, _schedule->name().get()); |
| 52 | 4 | } | |
| 53 | 4 | } | |
| 54 | |||
| 55 | // Water Inlet Node Name | ||
| 56 |
2/3✓ Branch 1 taken 4 times.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
|
8 | if (boost::optional<ModelObject> mo = modelObject.waterInletModelObject()) { |
| 57 |
3/4✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 6 taken 4 times.
✗ Branch 7 not taken.
|
8 | if (boost::optional<Node> node = mo->optionalCast<Node>()) { |
| 58 |
4/4✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
✓ Branch 10 taken 4 times.
|
4 | idfObject.setString(Coil_Heating_WaterToAirHeatPump_EquationFitFields::WaterInletNodeName, node->name().get()); |
| 59 | 4 | } | |
| 60 | 4 | } | |
| 61 | |||
| 62 | // Water Outlet Node Name | ||
| 63 |
2/3✓ Branch 1 taken 4 times.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
|
8 | if (boost::optional<ModelObject> mo = modelObject.waterOutletModelObject()) { |
| 64 |
3/4✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 6 taken 4 times.
✗ Branch 7 not taken.
|
8 | if (boost::optional<Node> node = mo->optionalCast<Node>()) { |
| 65 |
4/4✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
✓ Branch 10 taken 4 times.
|
4 | idfObject.setString(Coil_Heating_WaterToAirHeatPump_EquationFitFields::WaterOutletNodeName, node->name().get()); |
| 66 | 4 | } | |
| 67 | 4 | } | |
| 68 | |||
| 69 | // Air Inlet Node Name | ||
| 70 |
2/3✓ Branch 1 taken 4 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4 times.
|
8 | if (boost::optional<ModelObject> mo = modelObject.airInletModelObject()) { |
| 71 | ✗ | if (boost::optional<Node> node = mo->optionalCast<Node>()) { | |
| 72 | ✗ | idfObject.setString(Coil_Heating_WaterToAirHeatPump_EquationFitFields::AirInletNodeName, node->name().get()); | |
| 73 | ✗ | } | |
| 74 | 4 | } | |
| 75 | |||
| 76 | // Air Outlet Node Name | ||
| 77 |
2/3✓ Branch 1 taken 4 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4 times.
|
8 | if (boost::optional<ModelObject> mo = modelObject.airOutletModelObject()) { |
| 78 | ✗ | if (boost::optional<Node> node = mo->optionalCast<Node>()) { | |
| 79 | ✗ | idfObject.setString(Coil_Heating_WaterToAirHeatPump_EquationFitFields::AirOutletNodeName, node->name().get()); | |
| 80 | ✗ | } | |
| 81 | 4 | } | |
| 82 | |||
| 83 | // Rated Air Flow Rate | ||
| 84 |
3/3✓ Branch 1 taken 4 times.
✓ Branch 3 taken 3 times.
✓ Branch 4 taken 1 time.
|
4 | if (modelObject.isRatedAirFlowRateAutosized()) { |
| 85 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
6 | idfObject.setString(Coil_Heating_WaterToAirHeatPump_EquationFitFields::RatedAirFlowRate, "Autosize"); |
| 86 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | } else if ((value = modelObject.ratedAirFlowRate())) { |
| 87 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | idfObject.setDouble(Coil_Heating_WaterToAirHeatPump_EquationFitFields::RatedAirFlowRate, value.get()); |
| 88 | } | ||
| 89 | |||
| 90 | // Rated Water Flow Rate | ||
| 91 |
2/3✓ Branch 1 taken 4 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4 times.
|
4 | if (modelObject.isRatedWaterFlowRateAutosized()) { |
| 92 | ✗ | idfObject.setString(Coil_Heating_WaterToAirHeatPump_EquationFitFields::RatedWaterFlowRate, "Autosize"); | |
| 93 |
2/3✓ Branch 1 taken 4 times.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
|
8 | } else if ((value = modelObject.ratedWaterFlowRate())) { |
| 94 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | idfObject.setDouble(Coil_Heating_WaterToAirHeatPump_EquationFitFields::RatedWaterFlowRate, value.get()); |
| 95 | } | ||
| 96 | |||
| 97 | // Rated Heating Capacity | ||
| 98 |
2/3✓ Branch 1 taken 4 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4 times.
|
4 | if (modelObject.isRatedHeatingCapacityAutosized()) { |
| 99 | ✗ | idfObject.setString(Coil_Heating_WaterToAirHeatPump_EquationFitFields::GrossRatedHeatingCapacity, "Autosize"); | |
| 100 |
2/3✓ Branch 1 taken 4 times.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
|
8 | } else if ((value = modelObject.ratedHeatingCapacity())) { |
| 101 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | idfObject.setDouble(Coil_Heating_WaterToAirHeatPump_EquationFitFields::GrossRatedHeatingCapacity, value.get()); |
| 102 | } | ||
| 103 | |||
| 104 | // Heating Coefficient of Performance | ||
| 105 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | idfObject.setDouble(Coil_Heating_WaterToAirHeatPump_EquationFitFields::GrossRatedHeatingCOP, modelObject.ratedHeatingCoefficientofPerformance()); |
| 106 | |||
| 107 | // Rated Entering Water Temperature | ||
| 108 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | idfObject.setDouble(Coil_Heating_WaterToAirHeatPump_EquationFitFields::RatedEnteringWaterTemperature, |
| 109 | modelObject.ratedEnteringWaterTemperature()); | ||
| 110 | |||
| 111 | // Rated Entering Air Dry-Bulb Temperature | ||
| 112 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | idfObject.setDouble(Coil_Heating_WaterToAirHeatPump_EquationFitFields::RatedEnteringAirDryBulbTemperature, |
| 113 | modelObject.ratedEnteringAirDryBulbTemperature()); | ||
| 114 | |||
| 115 | // Ratio of Rated Heating Capacity to Rated Cooling Capacity | ||
| 116 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | idfObject.setDouble(Coil_Heating_WaterToAirHeatPump_EquationFitFields::RatioofRatedHeatingCapacitytoRatedCoolingCapacity, |
| 117 | modelObject.ratioofRatedHeatingCapacitytoRatedCoolingCapacity()); | ||
| 118 | |||
| 119 | // Heating Capacity Curve Name | ||
| 120 | { | ||
| 121 |
1/1✓ Branch 1 taken 4 times.
|
4 | auto curve = modelObject.heatingCapacityCurve(); |
| 122 |
2/3✓ Branch 1 taken 4 times.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
|
8 | if (auto _curve = translateAndMapModelObject(curve)) { |
| 123 |
3/3✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
|
4 | idfObject.setString(Coil_Heating_WaterToAirHeatPump_EquationFitFields::HeatingCapacityCurveName, _curve->nameString()); |
| 124 | 4 | } | |
| 125 | 4 | } | |
| 126 | |||
| 127 | // Heating Power Consumption Curve Name | ||
| 128 | { | ||
| 129 |
1/1✓ Branch 1 taken 4 times.
|
4 | auto curve = modelObject.heatingPowerConsumptionCurve(); |
| 130 |
2/3✓ Branch 1 taken 4 times.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
|
8 | if (auto _curve = translateAndMapModelObject(curve)) { |
| 131 |
3/3✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
|
4 | idfObject.setString(Coil_Heating_WaterToAirHeatPump_EquationFitFields::HeatingPowerConsumptionCurveName, _curve->nameString()); |
| 132 | 4 | } | |
| 133 | 4 | } | |
| 134 | |||
| 135 | // Part Load Fraction Correlation Curve Name | ||
| 136 | { | ||
| 137 |
1/1✓ Branch 1 taken 4 times.
|
4 | auto curve = modelObject.partLoadFractionCorrelationCurve(); |
| 138 |
2/3✓ Branch 1 taken 4 times.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
|
8 | if (auto _curve = translateAndMapModelObject(curve)) { |
| 139 |
3/3✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
|
4 | idfObject.setString(Coil_Heating_WaterToAirHeatPump_EquationFitFields::PartLoadFractionCorrelationCurveName, _curve->nameString()); |
| 140 | 4 | } | |
| 141 | 4 | } | |
| 142 | |||
| 143 |
1/1✓ Branch 1 taken 4 times.
|
8 | return idfObject; |
| 144 | 4 | } | |
| 145 | |||
| 146 | } // namespace energyplus | ||
| 147 | |||
| 148 | } // namespace openstudio | ||
| 149 |