src/energyplus/ForwardTranslator/ForwardTranslateBoilerHotWater.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/Curve.hpp" | ||
| 13 | #include "../../model/Curve_Impl.hpp" | ||
| 14 | #include "../../model/BoilerHotWater.hpp" | ||
| 15 | #include "../../model/BoilerHotWater_Impl.hpp" | ||
| 16 | #include "../../utilities/core/Logger.hpp" | ||
| 17 | #include "../../utilities/core/Assert.hpp" | ||
| 18 | #include <utilities/idd/Boiler_HotWater_FieldEnums.hxx> | ||
| 19 | #include "../../utilities/idd/IddEnums.hpp" | ||
| 20 | #include <utilities/idd/IddEnums.hxx> | ||
| 21 | #include <utilities/idd/IddFactory.hxx> | ||
| 22 | |||
| 23 | using namespace openstudio::model; | ||
| 24 | |||
| 25 | using namespace std; | ||
| 26 | |||
| 27 | namespace openstudio { | ||
| 28 | |||
| 29 | namespace energyplus { | ||
| 30 | |||
| 31 | 14 | boost::optional<IdfObject> ForwardTranslator::translateBoilerHotWater(BoilerHotWater& modelObject) { | |
| 32 | 14 | boost::optional<std::string> s; | |
| 33 | 14 | boost::optional<double> value; | |
| 34 | |||
| 35 |
2/2✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
|
14 | IdfObject idfObject(IddObjectType::Boiler_HotWater); |
| 36 | |||
| 37 |
1/1✓ Branch 1 taken 14 times.
|
14 | m_idfObjects.push_back(idfObject); |
| 38 | |||
| 39 | // Name | ||
| 40 | |||
| 41 |
1/1✓ Branch 1 taken 14 times.
|
14 | s = modelObject.name(); |
| 42 |
1/2✓ Branch 0 taken 14 times.
✗ Branch 1 not taken.
|
14 | if (s) { |
| 43 |
2/2✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
|
14 | idfObject.setName(*s); |
| 44 | } | ||
| 45 | |||
| 46 | // FuelType | ||
| 47 | |||
| 48 |
3/4✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
✓ Branch 8 taken 14 times.
✗ Branch 9 not taken.
|
28 | if ((s = modelObject.fuelType())) { |
| 49 |
2/2✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
|
14 | idfObject.setString(Boiler_HotWaterFields::FuelType, s.get()); |
| 50 | } | ||
| 51 | |||
| 52 | // NominalCapacity | ||
| 53 | |||
| 54 |
3/3✓ Branch 1 taken 14 times.
✓ Branch 3 taken 13 times.
✓ Branch 4 taken 1 time.
|
14 | if (modelObject.isNominalCapacityAutosized()) { |
| 55 |
2/2✓ Branch 1 taken 13 times.
✓ Branch 4 taken 13 times.
|
26 | idfObject.setString(Boiler_HotWaterFields::NominalCapacity, "Autosize"); |
| 56 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | } else if ((value = modelObject.nominalCapacity())) { |
| 57 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | idfObject.setDouble(Boiler_HotWaterFields::NominalCapacity, value.get()); |
| 58 | } | ||
| 59 | |||
| 60 | // NominalThermalEfficiency | ||
| 61 | |||
| 62 |
3/4✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
✓ Branch 7 taken 14 times.
✗ Branch 8 not taken.
|
28 | if ((value = modelObject.nominalThermalEfficiency())) { |
| 63 |
2/2✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
|
14 | idfObject.setDouble(Boiler_HotWaterFields::NominalThermalEfficiency, value.get()); |
| 64 | } | ||
| 65 | |||
| 66 | // EfficiencyCurveTemperatureEvaluationVariable | ||
| 67 | |||
| 68 |
2/3✓ Branch 1 taken 14 times.
✓ Branch 5 taken 14 times.
✗ Branch 6 not taken.
|
28 | if ((s = modelObject.efficiencyCurveTemperatureEvaluationVariable())) { |
| 69 |
2/2✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
|
14 | idfObject.setString(Boiler_HotWaterFields::EfficiencyCurveTemperatureEvaluationVariable, s.get()); |
| 70 | } | ||
| 71 | |||
| 72 | // Normalized Boiler Efficiency Curve | ||
| 73 | |||
| 74 |
2/3✓ Branch 1 taken 14 times.
✓ Branch 3 taken 14 times.
✗ Branch 4 not taken.
|
28 | if (auto value = modelObject.efficiencyCurveTemperatureEvaluationVariable()) { |
| 75 |
3/3✓ Branch 1 taken 14 times.
✓ Branch 4 taken 5 times.
✓ Branch 5 taken 9 times.
|
14 | if (!value->empty()) { |
| 76 |
2/3✓ Branch 1 taken 5 times.
✓ Branch 3 taken 5 times.
✗ Branch 4 not taken.
|
10 | if (auto curve = modelObject.normalizedBoilerEfficiencyCurve()) { |
| 77 |
3/4✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 6 taken 5 times.
✗ Branch 7 not taken.
|
10 | if (auto _curve = translateAndMapModelObject(curve.get())) { |
| 78 |
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(Boiler_HotWaterFields::NormalizedBoilerEfficiencyCurveName, _curve->name().get()); |
| 79 | 5 | } | |
| 80 | 5 | } | |
| 81 | } | ||
| 82 | 14 | } | |
| 83 | |||
| 84 | // DesignWaterFlowRate | ||
| 85 | |||
| 86 |
3/3✓ Branch 1 taken 14 times.
✓ Branch 3 taken 13 times.
✓ Branch 4 taken 1 time.
|
14 | if (modelObject.isDesignWaterFlowRateAutosized()) { |
| 87 |
2/2✓ Branch 1 taken 13 times.
✓ Branch 4 taken 13 times.
|
26 | idfObject.setString(Boiler_HotWaterFields::DesignWaterFlowRate, "Autosize"); |
| 88 |
2/3✓ Branch 1 taken 1 time.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
2 | } else if ((value = modelObject.designWaterFlowRate())) { |
| 89 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
1 | idfObject.setDouble(Boiler_HotWaterFields::DesignWaterFlowRate, value.get()); |
| 90 | } | ||
| 91 | |||
| 92 | // MinimumPartLoadRatio | ||
| 93 | |||
| 94 |
3/4✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
✓ Branch 7 taken 14 times.
✗ Branch 8 not taken.
|
28 | if ((value = modelObject.minimumPartLoadRatio())) { |
| 95 |
2/2✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
|
14 | idfObject.setDouble(Boiler_HotWaterFields::MinimumPartLoadRatio, value.get()); |
| 96 | } | ||
| 97 | |||
| 98 | // MaximumPartLoadRatio | ||
| 99 | |||
| 100 |
3/4✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
✓ Branch 7 taken 14 times.
✗ Branch 8 not taken.
|
28 | if ((value = modelObject.maximumPartLoadRatio())) { |
| 101 |
2/2✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
|
14 | idfObject.setDouble(Boiler_HotWaterFields::MaximumPartLoadRatio, value.get()); |
| 102 | } | ||
| 103 | |||
| 104 | // OptimumPartLoadRatio | ||
| 105 | |||
| 106 |
3/4✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
✓ Branch 7 taken 14 times.
✗ Branch 8 not taken.
|
28 | if ((value = modelObject.optimumPartLoadRatio())) { |
| 107 |
2/2✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
|
14 | idfObject.setDouble(Boiler_HotWaterFields::OptimumPartLoadRatio, value.get()); |
| 108 | } | ||
| 109 | |||
| 110 | // BoilerWaterInletNodeName | ||
| 111 | |||
| 112 |
2/3✓ Branch 1 taken 14 times.
✓ Branch 3 taken 14 times.
✗ Branch 4 not taken.
|
28 | if (boost::optional<ModelObject> mo = modelObject.inletModelObject()) { |
| 113 |
3/4✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
✓ Branch 6 taken 14 times.
✗ Branch 7 not taken.
|
28 | if (boost::optional<Node> node = mo->optionalCast<Node>()) { |
| 114 |
4/4✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
✓ Branch 7 taken 14 times.
✓ Branch 10 taken 14 times.
|
14 | idfObject.setString(Boiler_HotWaterFields::BoilerWaterInletNodeName, node->name().get()); |
| 115 | 14 | } | |
| 116 | 14 | } | |
| 117 | |||
| 118 | // BoilerWaterOutletNodeName | ||
| 119 | |||
| 120 |
2/3✓ Branch 1 taken 14 times.
✓ Branch 3 taken 14 times.
✗ Branch 4 not taken.
|
28 | if (boost::optional<ModelObject> mo = modelObject.outletModelObject()) { |
| 121 |
3/4✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
✓ Branch 6 taken 14 times.
✗ Branch 7 not taken.
|
28 | if (boost::optional<Node> node = mo->optionalCast<Node>()) { |
| 122 |
4/4✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
✓ Branch 7 taken 14 times.
✓ Branch 10 taken 14 times.
|
14 | idfObject.setString(Boiler_HotWaterFields::BoilerWaterOutletNodeName, node->name().get()); |
| 123 | 14 | } | |
| 124 | 14 | } | |
| 125 | |||
| 126 | // WaterOutletUpperTemperatureLimit | ||
| 127 | |||
| 128 |
3/4✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
✓ Branch 7 taken 14 times.
✗ Branch 8 not taken.
|
28 | if ((value = modelObject.waterOutletUpperTemperatureLimit())) { |
| 129 |
2/2✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
|
14 | idfObject.setDouble(Boiler_HotWaterFields::WaterOutletUpperTemperatureLimit, value.get()); |
| 130 | } | ||
| 131 | |||
| 132 | // BoilerFlowMode | ||
| 133 | |||
| 134 |
3/4✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
✓ Branch 8 taken 14 times.
✗ Branch 9 not taken.
|
28 | if ((s = modelObject.boilerFlowMode())) { |
| 135 |
2/2✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
|
14 | idfObject.setString(Boiler_HotWaterFields::BoilerFlowMode, s.get()); |
| 136 | } | ||
| 137 | |||
| 138 | // OnCycleParasiticElectricLoad | ||
| 139 | |||
| 140 |
2/2✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
|
14 | idfObject.setDouble(Boiler_HotWaterFields::OnCycleParasiticElectricLoad, modelObject.onCycleParasiticElectricLoad()); |
| 141 | |||
| 142 | // SizingFactor | ||
| 143 | |||
| 144 |
3/4✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
✓ Branch 7 taken 14 times.
✗ Branch 8 not taken.
|
28 | if ((value = modelObject.sizingFactor())) { |
| 145 |
2/2✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
|
14 | idfObject.setDouble(Boiler_HotWaterFields::SizingFactor, value.get()); |
| 146 | } | ||
| 147 | |||
| 148 | // End Use Subcategory | ||
| 149 |
3/4✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
✓ Branch 8 taken 14 times.
✗ Branch 9 not taken.
|
28 | if ((s = modelObject.endUseSubcategory())) { |
| 150 |
2/2✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
|
14 | idfObject.setString(Boiler_HotWaterFields::EndUseSubcategory, s.get()); |
| 151 | } | ||
| 152 | |||
| 153 | // OffCycleParasiticFuelLoad | ||
| 154 | |||
| 155 |
2/2✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
|
14 | idfObject.setDouble(Boiler_HotWaterFields::OffCycleParasiticFuelLoad, modelObject.offCycleParasiticFuelLoad()); |
| 156 | |||
| 157 |
1/1✓ Branch 1 taken 14 times.
|
28 | return boost::optional<IdfObject>(idfObject); |
| 158 | 14 | } | |
| 159 | |||
| 160 | //OPENSTUDIO_ENUM( Boiler_HotWaterFields, | ||
| 161 | // ((NormalizedBoilerEfficiencyCurveName)(Normalized Boiler Efficiency Curve Name)) | ||
| 162 | |||
| 163 | } // namespace energyplus | ||
| 164 | |||
| 165 | } // namespace openstudio | ||
| 166 |