src/energyplus/ForwardTranslator/ForwardTranslateCoilHeatingDesuperheater.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/CoilHeatingDesuperheater.hpp" | ||
| 9 | |||
| 10 | #include "../../model/ModelObject.hpp" | ||
| 11 | #include "../../model/Schedule.hpp" | ||
| 12 | #include "../../model/Node.hpp" | ||
| 13 | #include "../../model/Node_Impl.hpp" | ||
| 14 | |||
| 15 | #include <utilities/idd/Coil_Heating_Desuperheater_FieldEnums.hxx> | ||
| 16 | #include <utilities/idd/CoilSystem_Cooling_DX_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 | namespace openstudio { | ||
| 24 | |||
| 25 | namespace energyplus { | ||
| 26 | |||
| 27 | 16 | boost::optional<IdfObject> ForwardTranslator::translateCoilHeatingDesuperheater(CoilHeatingDesuperheater& modelObject) { | |
| 28 | 16 | OptionalModelObject omo; | |
| 29 | 16 | OptionalString optS; | |
| 30 | 16 | boost::optional<std::string> s; | |
| 31 | 16 | boost::optional<double> d; | |
| 32 | |||
| 33 | // Name | ||
| 34 |
2/2✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
|
16 | IdfObject object = createRegisterAndNameIdfObject(openstudio::IddObjectType::Coil_Heating_Desuperheater, modelObject); |
| 35 | |||
| 36 | // Availability Schedule Name | ||
| 37 |
1/1✓ Branch 1 taken 16 times.
|
16 | boost::optional<Schedule> availabilitySchedule = modelObject.availabilitySchedule(); |
| 38 | |||
| 39 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16 times.
|
16 | if (availabilitySchedule) { |
| 40 | ✗ | boost::optional<IdfObject> _availabilitySchedule = translateAndMapModelObject(availabilitySchedule.get()); | |
| 41 | |||
| 42 | ✗ | if (_availabilitySchedule && _availabilitySchedule->name()) { | |
| 43 | ✗ | object.setString(Coil_Heating_DesuperheaterFields::AvailabilityScheduleName, _availabilitySchedule->name().get()); | |
| 44 | } | ||
| 45 | ✗ | } | |
| 46 | |||
| 47 | // Heat Recovery Efficiency | ||
| 48 |
2/2✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
|
16 | d = modelObject.heatReclaimRecoveryEfficiency(); |
| 49 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | if (d) { |
| 50 |
2/2✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
|
16 | object.setDouble(Coil_Heating_DesuperheaterFields::HeatReclaimRecoveryEfficiency, d.get()); |
| 51 | } | ||
| 52 | |||
| 53 | // Air Inlet Node Name | ||
| 54 |
2/3✓ Branch 1 taken 16 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 16 times.
|
32 | if (boost::optional<ModelObject> mo = modelObject.inletModelObject()) { |
| 55 | ✗ | if (boost::optional<Node> node = mo->optionalCast<Node>()) { | |
| 56 | ✗ | object.setString(Coil_Heating_DesuperheaterFields::AirInletNodeName, node->name().get()); | |
| 57 | ✗ | } | |
| 58 | 16 | } | |
| 59 | |||
| 60 | // Air Outlet Node Name | ||
| 61 |
2/3✓ Branch 1 taken 16 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 16 times.
|
32 | if (boost::optional<ModelObject> mo = modelObject.outletModelObject()) { |
| 62 | ✗ | if (boost::optional<Node> node = mo->optionalCast<Node>()) { | |
| 63 | ✗ | object.setString(Coil_Heating_DesuperheaterFields::AirOutletNodeName, node->name().get()); | |
| 64 | ✗ | object.setString(Coil_Heating_DesuperheaterFields::TemperatureSetpointNodeName, node->name().get()); | |
| 65 | ✗ | } | |
| 66 | 16 | } | |
| 67 | |||
| 68 | // HeatingSourceObjectType | ||
| 69 | // Heating Source Name | ||
| 70 |
1/1✓ Branch 1 taken 16 times.
|
16 | boost::optional<ModelObject> heatingSource = modelObject.heatingSource(); |
| 71 | |||
| 72 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16 times.
|
16 | if (heatingSource) { |
| 73 | |||
| 74 | ✗ | boost::optional<IdfObject> _heatingSource = translateAndMapModelObject(*heatingSource); | |
| 75 | |||
| 76 | ✗ | if (_heatingSource) { | |
| 77 | |||
| 78 | // Note JM 2019-03-14: | ||
| 79 | // If the coil in question is a DX coil (CoilCoolingDXSingleSpeed, CoilCoolingDXTwoSpeed, CoilCoolingDXTwoStageWithHumidityControlMode, CoilCoolingDX) | ||
| 80 | // and this DX coil isn't already wrapped in a Unitary, then the FT will wrap it into a CoilSystem:Cooling:DX object and return that, but we | ||
| 81 | // need the DX coil here and not the wrapper. | ||
| 82 | // | ||
| 83 | // Note: Other accepted types are Refrigeration objects and don't suffer the same problem | ||
| 84 | // (Refrigeration:Condenser:AirCooled, Refrigeration:Condenser:EvaporativeCooled, Refrigeration:Condenser:WaterCooled, Refrigeration:CompressorRack) | ||
| 85 | |||
| 86 | ✗ | std::string objectType; | |
| 87 | ✗ | std::string objectName; | |
| 88 | |||
| 89 | ✗ | if (_heatingSource->iddObject().type() == IddObjectType::CoilSystem_Cooling_DX) { | |
| 90 | // We must retrieve the coil itself, not the wrapper | ||
| 91 | ✗ | objectType = _heatingSource->getString(CoilSystem_Cooling_DXFields::CoolingCoilObjectType).get(); | |
| 92 | ✗ | objectName = _heatingSource->getString(CoilSystem_Cooling_DXFields::CoolingCoilName).get(); | |
| 93 | } else { | ||
| 94 | ✗ | objectType = _heatingSource->iddObject().name(); | |
| 95 | ✗ | objectName = _heatingSource->name().get(); | |
| 96 | } | ||
| 97 | |||
| 98 | ✗ | if (objectType.empty() || objectName.empty()) { | |
| 99 | // We log an error but let E+ fail eventually | ||
| 100 | ✗ | LOG(Error, "Something went wrong in the translation of " << modelObject.briefDescription() << ", couldn't retrieve the coil"); | |
| 101 | // OS_ASSERT(false); | ||
| 102 | } else { | ||
| 103 | ✗ | object.setString(Coil_Heating_DesuperheaterFields::HeatingSourceObjectType, objectType); | |
| 104 | ✗ | object.setString(Coil_Heating_DesuperheaterFields::HeatingSourceName, objectName); | |
| 105 | } | ||
| 106 | ✗ | } | |
| 107 | ✗ | } | |
| 108 | |||
| 109 | // Temperature Setpoint Node Name | ||
| 110 | // if( boost::optional<Node> node = modelObject.temperatureSetpointNode() ) | ||
| 111 | // { | ||
| 112 | // object.setString(Coil_Heating_DesuperheaterFields::TemperatureSetpointNodeName,node->name().get()); | ||
| 113 | // } | ||
| 114 | // object.setString(Coil_Heating_DesuperheaterFields::TemperatureSetpointNodeName,""); | ||
| 115 | |||
| 116 | // On Cycle Parasitic Electric Load | ||
| 117 |
2/2✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
|
16 | d = modelObject.onCycleParasiticElectricLoad(); |
| 118 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | if (d) { |
| 119 |
2/2✓ Branch 1 taken 16 times.
✓ Branch 4 taken 16 times.
|
16 | object.setDouble(Coil_Heating_DesuperheaterFields::OnCycleParasiticElectricLoad, d.get()); |
| 120 | } | ||
| 121 | |||
| 122 |
1/1✓ Branch 1 taken 16 times.
|
32 | return object; |
| 123 | 16 | } | |
| 124 | } // namespace energyplus | ||
| 125 | } // namespace openstudio | ||
| 126 |