src/energyplus/ForwardTranslator/ForwardTranslateGeneratorFuelCellPowerModule.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 | |||
| 8 | #include "../../model/Model.hpp" | ||
| 9 | #include "../../model/GeneratorFuelCellPowerModule.hpp" | ||
| 10 | #include "../../model/GeneratorFuelCellPowerModule_Impl.hpp" | ||
| 11 | |||
| 12 | #include "../../model/CurveQuadratic.hpp" | ||
| 13 | #include "../../model/CurveQuadratic_Impl.hpp" | ||
| 14 | #include "../../model/ThermalZone.hpp" | ||
| 15 | #include "../../model/ThermalZone_Impl.hpp" | ||
| 16 | #include "../../model/Node.hpp" | ||
| 17 | #include "../../model/Node_Impl.hpp" | ||
| 18 | |||
| 19 | #include "../../utilities/idf/IdfExtensibleGroup.hpp" | ||
| 20 | |||
| 21 | #include <utilities/idd/Generator_FuelCell_PowerModule_FieldEnums.hxx> | ||
| 22 | #include "../../utilities/idd/IddEnums.hpp" | ||
| 23 | #include <utilities/idd/IddEnums.hxx> | ||
| 24 | #include <utilities/idd/IddFactory.hxx> | ||
| 25 | |||
| 26 | using namespace openstudio::model; | ||
| 27 | |||
| 28 | using namespace std; | ||
| 29 | |||
| 30 | namespace openstudio { | ||
| 31 | |||
| 32 | namespace energyplus { | ||
| 33 | |||
| 34 | 3 | boost::optional<IdfObject> ForwardTranslator::translateGeneratorFuelCellPowerModule(GeneratorFuelCellPowerModule& modelObject) { | |
| 35 | 3 | boost::optional<std::string> s; | |
| 36 | 3 | boost::optional<double> d; | |
| 37 | 3 | boost::optional<Node> node; | |
| 38 | 3 | boost::optional<CurveQuadratic> curve; | |
| 39 | 3 | boost::optional<ThermalZone> tz; | |
| 40 | |||
| 41 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | IdfObject pcm = createAndRegisterIdfObject(openstudio::IddObjectType::Generator_FuelCell_PowerModule, modelObject); |
| 42 | //Name | ||
| 43 |
1/1✓ Branch 1 taken 3 times.
|
3 | s = modelObject.name(); |
| 44 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | if (s) { |
| 45 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | pcm.setName(*s); |
| 46 | } | ||
| 47 | |||
| 48 | //EfficiencyCurveMode | ||
| 49 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | s = modelObject.efficiencyCurveMode(); |
| 50 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | if (s) { |
| 51 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | pcm.setString(Generator_FuelCell_PowerModuleFields::EfficiencyCurveMode, s.get()); |
| 52 | } | ||
| 53 | |||
| 54 | //EfficiencyCurveName | ||
| 55 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | curve = modelObject.efficiencyCurve(); |
| 56 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | if (curve) { |
| 57 |
3/3✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
|
3 | pcm.setString(Generator_FuelCell_PowerModuleFields::EfficiencyCurveName, curve.get().nameString()); |
| 58 | } | ||
| 59 | |||
| 60 | //NominalEfficiency | ||
| 61 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | d = modelObject.nominalEfficiency(); |
| 62 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | if (d) { |
| 63 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | pcm.setDouble(Generator_FuelCell_PowerModuleFields::NominalEfficiency, d.get()); |
| 64 | } | ||
| 65 | |||
| 66 | //NominalElectricalPower | ||
| 67 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | d = modelObject.nominalElectricalPower(); |
| 68 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | if (d) { |
| 69 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | pcm.setDouble(Generator_FuelCell_PowerModuleFields::NominalElectricalPower, d.get()); |
| 70 | } | ||
| 71 | |||
| 72 | //NumberofStopsatStartofSimulation | ||
| 73 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | d = modelObject.numberofStopsatStartofSimulation(); |
| 74 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | if (d) { |
| 75 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | pcm.setDouble(Generator_FuelCell_PowerModuleFields::NumberofStopsatStartofSimulation, d.get()); |
| 76 | } | ||
| 77 | |||
| 78 | //CyclingPerformanceDegradationCoefficient | ||
| 79 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | d = modelObject.cyclingPerformanceDegradationCoefficient(); |
| 80 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | if (d) { |
| 81 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | pcm.setDouble(Generator_FuelCell_PowerModuleFields::CyclingPerformanceDegradationCoefficient, d.get()); |
| 82 | } | ||
| 83 | |||
| 84 | //NumberofRunHoursatBeginningofSimulation | ||
| 85 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | d = modelObject.numberofRunHoursatBeginningofSimulation(); |
| 86 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | if (d) { |
| 87 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | pcm.setDouble(Generator_FuelCell_PowerModuleFields::NumberofRunHoursatBeginningofSimulation, d.get()); |
| 88 | } | ||
| 89 | |||
| 90 | //AccumulatedRunTimeDegradationCoefficient | ||
| 91 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | d = modelObject.accumulatedRunTimeDegradationCoefficient(); |
| 92 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | if (d) { |
| 93 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | pcm.setDouble(Generator_FuelCell_PowerModuleFields::AccumulatedRunTimeDegradationCoefficient, d.get()); |
| 94 | } | ||
| 95 | |||
| 96 | //RunTimeDegradationInitiationTimeThreshold | ||
| 97 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | d = modelObject.runTimeDegradationInitiationTimeThreshold(); |
| 98 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | if (d) { |
| 99 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | pcm.setDouble(Generator_FuelCell_PowerModuleFields::RunTimeDegradationInitiationTimeThreshold, d.get()); |
| 100 | } | ||
| 101 | |||
| 102 | //PowerUpTransientLimit | ||
| 103 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | d = modelObject.powerUpTransientLimit(); |
| 104 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | if (d) { |
| 105 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | pcm.setDouble(Generator_FuelCell_PowerModuleFields::PowerUpTransientLimit, d.get()); |
| 106 | } | ||
| 107 | |||
| 108 | //PowerDownTransientLimit | ||
| 109 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | d = modelObject.powerDownTransientLimit(); |
| 110 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | if (d) { |
| 111 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | pcm.setDouble(Generator_FuelCell_PowerModuleFields::PowerDownTransientLimit, d.get()); |
| 112 | } | ||
| 113 | |||
| 114 | //StartUpTime | ||
| 115 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | d = modelObject.startUpTime(); |
| 116 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | if (d) { |
| 117 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | pcm.setDouble(Generator_FuelCell_PowerModuleFields::StartUpTime, d.get()); |
| 118 | } | ||
| 119 | |||
| 120 | //StartUpFuel | ||
| 121 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | d = modelObject.startUpFuel(); |
| 122 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | if (d) { |
| 123 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | pcm.setDouble(Generator_FuelCell_PowerModuleFields::StartUpFuel, d.get()); |
| 124 | } | ||
| 125 | |||
| 126 | //StartUpElectricityConsumption | ||
| 127 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | d = modelObject.startUpElectricityConsumption(); |
| 128 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | if (d) { |
| 129 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | pcm.setDouble(Generator_FuelCell_PowerModuleFields::StartUpElectricityConsumption, d.get()); |
| 130 | } | ||
| 131 | |||
| 132 | //StartUpElectricityProduced | ||
| 133 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | d = modelObject.startUpElectricityProduced(); |
| 134 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | if (d) { |
| 135 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | pcm.setDouble(Generator_FuelCell_PowerModuleFields::StartUpElectricityProduced, d.get()); |
| 136 | } | ||
| 137 | |||
| 138 | //ShutDownTime | ||
| 139 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | d = modelObject.shutDownTime(); |
| 140 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | if (d) { |
| 141 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | pcm.setDouble(Generator_FuelCell_PowerModuleFields::ShutDownTime, d.get()); |
| 142 | } | ||
| 143 | |||
| 144 | //ShutDownFuel | ||
| 145 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | d = modelObject.shutDownFuel(); |
| 146 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | if (d) { |
| 147 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | pcm.setDouble(Generator_FuelCell_PowerModuleFields::ShutDownFuel, d.get()); |
| 148 | } | ||
| 149 | |||
| 150 | //ShutDownElectricityConsumption | ||
| 151 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | d = modelObject.shutDownElectricityConsumption(); |
| 152 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | if (d) { |
| 153 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | pcm.setDouble(Generator_FuelCell_PowerModuleFields::ShutDownElectricityConsumption, d.get()); |
| 154 | } | ||
| 155 | |||
| 156 | //AncillaryElectricityConstantTerm | ||
| 157 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | d = modelObject.ancillaryElectricityConstantTerm(); |
| 158 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | if (d) { |
| 159 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | pcm.setDouble(Generator_FuelCell_PowerModuleFields::AncillaryElectricityConstantTerm, d.get()); |
| 160 | } | ||
| 161 | |||
| 162 | //AncillaryElectricityLinearTerm | ||
| 163 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | d = modelObject.ancillaryElectricityLinearTerm(); |
| 164 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | if (d) { |
| 165 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | pcm.setDouble(Generator_FuelCell_PowerModuleFields::AncillaryElectricityLinearTerm, d.get()); |
| 166 | } | ||
| 167 | |||
| 168 | //SkinLossCalculationMode | ||
| 169 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | s = modelObject.skinLossCalculationMode(); |
| 170 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | if (s) { |
| 171 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | pcm.setString(Generator_FuelCell_PowerModuleFields::SkinLossCalculationMode, s.get()); |
| 172 | } | ||
| 173 | |||
| 174 | //ZoneName | ||
| 175 |
1/1✓ Branch 1 taken 3 times.
|
3 | tz = modelObject.zone(); |
| 176 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
|
3 | if (tz) { |
| 177 | ✗ | pcm.setString(Generator_FuelCell_PowerModuleFields::ZoneName, tz.get().nameString()); | |
| 178 | } | ||
| 179 | |||
| 180 | //skinLossRadiativeFraction | ||
| 181 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | d = modelObject.skinLossRadiativeFraction(); |
| 182 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | if (d) { |
| 183 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | pcm.setDouble(Generator_FuelCell_PowerModuleFields::SkinLossRadiativeFraction, d.get()); |
| 184 | } | ||
| 185 | |||
| 186 | //ConstantSkinLossRate | ||
| 187 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | d = modelObject.constantSkinLossRate(); |
| 188 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | if (d) { |
| 189 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | pcm.setDouble(Generator_FuelCell_PowerModuleFields::ConstantSkinLossRate, d.get()); |
| 190 | } | ||
| 191 | |||
| 192 | //SkinLossUFactorTimesAreaTerm | ||
| 193 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | d = modelObject.skinLossUFactorTimesAreaTerm(); |
| 194 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | if (d) { |
| 195 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | pcm.setDouble(Generator_FuelCell_PowerModuleFields::SkinLossUFactorTimesAreaTerm, d.get()); |
| 196 | } | ||
| 197 | |||
| 198 | //SkinLossQuadraticCurveName | ||
| 199 |
1/1✓ Branch 1 taken 3 times.
|
3 | curve = modelObject.skinLossQuadraticCurve(); |
| 200 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | if (curve) { |
| 201 |
3/3✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
|
3 | pcm.setString(Generator_FuelCell_PowerModuleFields::SkinLossQuadraticCurveName, curve.get().nameString()); |
| 202 | } | ||
| 203 | |||
| 204 | //DilutionAirFlowRate | ||
| 205 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | d = modelObject.dilutionAirFlowRate(); |
| 206 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | if (d) { |
| 207 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | pcm.setDouble(Generator_FuelCell_PowerModuleFields::DilutionAirFlowRate, d.get()); |
| 208 | } | ||
| 209 | |||
| 210 | //StackHeatlosstoDilutionAir | ||
| 211 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | d = modelObject.stackHeatlosstoDilutionAir(); |
| 212 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | if (d) { |
| 213 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | pcm.setDouble(Generator_FuelCell_PowerModuleFields::StackHeatlosstoDilutionAir, d.get()); |
| 214 | } | ||
| 215 | |||
| 216 | //DilutionInletAirNodeName | ||
| 217 |
1/1✓ Branch 1 taken 3 times.
|
3 | node = modelObject.dilutionInletAirNode(); |
| 218 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
|
3 | if (node) { |
| 219 | ✗ | pcm.setString(Generator_FuelCell_PowerModuleFields::DilutionInletAirNodeName, node.get().nameString()); | |
| 220 | //} else if( tz ) { | ||
| 221 | // pcm.setString(Generator_FuelCell_PowerModuleFields::DilutionInletAirNodeName, tz->zoneAirNode().nameString()); | ||
| 222 | } else { | ||
| 223 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | auto name = modelObject.nameString() + " OA Node"; |
| 224 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | IdfObject oaNodeListIdf(openstudio::IddObjectType::OutdoorAir_NodeList); |
| 225 |
1/1✓ Branch 1 taken 3 times.
|
3 | oaNodeListIdf.setString(0, name); |
| 226 |
1/1✓ Branch 1 taken 3 times.
|
3 | m_idfObjects.push_back(oaNodeListIdf); |
| 227 | |||
| 228 |
1/1✓ Branch 1 taken 3 times.
|
3 | pcm.setString(Generator_FuelCell_PowerModuleFields::DilutionInletAirNodeName, name); |
| 229 | 3 | } | |
| 230 | |||
| 231 | //DilutionOutletAirNodeName | ||
| 232 |
1/1✓ Branch 1 taken 3 times.
|
3 | node = modelObject.dilutionOutletAirNode(); |
| 233 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
|
3 | if (node) { |
| 234 | ✗ | pcm.setString(Generator_FuelCell_PowerModuleFields::DilutionOutletAirNodeName, node.get().nameString()); | |
| 235 | } else { | ||
| 236 |
3/3✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
|
3 | pcm.setString(Generator_FuelCell_PowerModuleFields::DilutionOutletAirNodeName, modelObject.nameString() + " Dilution Outlet Air Node"); |
| 237 | } | ||
| 238 | |||
| 239 | //MinimumOperatingPoint | ||
| 240 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | d = modelObject.minimumOperatingPoint(); |
| 241 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | if (d) { |
| 242 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | pcm.setDouble(Generator_FuelCell_PowerModuleFields::MinimumOperatingPoint, d.get()); |
| 243 | } | ||
| 244 | |||
| 245 | //MaximumOperatingPoint | ||
| 246 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | d = modelObject.maximumOperatingPoint(); |
| 247 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | if (d) { |
| 248 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | pcm.setDouble(Generator_FuelCell_PowerModuleFields::MaximumOperatingPoint, d.get()); |
| 249 | } | ||
| 250 | |||
| 251 |
1/1✓ Branch 1 taken 3 times.
|
6 | return pcm; |
| 252 | 3 | } | |
| 253 | |||
| 254 | } // namespace energyplus | ||
| 255 | |||
| 256 | } // namespace openstudio | ||
| 257 |