src/energyplus/ForwardTranslator/ForwardTranslateCoilHeatingElectricMultiStage.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/CoilHeatingElectricMultiStage.hpp" | ||
| 9 | #include "../../model/CoilHeatingElectricMultiStage_Impl.hpp" | ||
| 10 | #include "../../model/CoilHeatingElectricMultiStageStageData.hpp" | ||
| 11 | #include "../../model/CoilHeatingElectricMultiStageStageData_Impl.hpp" | ||
| 12 | #include "../../model/Node.hpp" | ||
| 13 | #include "../../model/Node_Impl.hpp" | ||
| 14 | #include "../../model/Schedule.hpp" | ||
| 15 | #include "../../model/Schedule_Impl.hpp" | ||
| 16 | #include <utilities/idd/Coil_Heating_Electric_MultiStage_FieldEnums.hxx> | ||
| 17 | #include "../../utilities/idd/IddEnums.hpp" | ||
| 18 | #include <utilities/idd/IddEnums.hxx> | ||
| 19 | #include <utilities/idd/IddFactory.hxx> | ||
| 20 | #include "../../utilities/idf/IdfExtensibleGroup.hpp" | ||
| 21 | |||
| 22 | using namespace openstudio::model; | ||
| 23 | |||
| 24 | namespace openstudio { | ||
| 25 | |||
| 26 | namespace energyplus { | ||
| 27 | |||
| 28 | 6 | boost::optional<IdfObject> ForwardTranslator::translateCoilHeatingElectricMultiStage(CoilHeatingElectricMultiStage& modelObject) { | |
| 29 | 6 | boost::optional<std::string> s; | |
| 30 | 6 | boost::optional<double> value; | |
| 31 | |||
| 32 | // Name | ||
| 33 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
|
6 | IdfObject idfObject = createRegisterAndNameIdfObject(openstudio::IddObjectType::Coil_Heating_Electric_MultiStage, modelObject); |
| 34 | |||
| 35 | // AvailabilityScheduleName | ||
| 36 | { | ||
| 37 |
1/1✓ Branch 1 taken 6 times.
|
6 | auto schedule = modelObject.availabilitySchedule(); |
| 38 |
2/3✓ Branch 1 taken 6 times.
✓ Branch 3 taken 6 times.
✗ Branch 4 not taken.
|
12 | if (boost::optional<IdfObject> _schedule = translateAndMapModelObject(schedule)) { |
| 39 |
4/4✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
✓ Branch 10 taken 6 times.
|
6 | idfObject.setString(Coil_Heating_Electric_MultiStageFields::AvailabilityScheduleName, _schedule->name().get()); |
| 40 | 6 | } | |
| 41 | 6 | } | |
| 42 | |||
| 43 | // AirInletNodeName | ||
| 44 |
2/3✓ Branch 1 taken 6 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 times.
|
12 | if (auto node = modelObject.inletModelObject()) { |
| 45 | ✗ | idfObject.setString(Coil_Heating_Electric_MultiStageFields::AirInletNodeName, node->name().get()); | |
| 46 | 6 | } | |
| 47 | |||
| 48 | // AirOutletNodeName | ||
| 49 | // TemperatureSetpointNodeName | ||
| 50 |
2/3✓ Branch 1 taken 6 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 times.
|
12 | if (auto node = modelObject.outletModelObject()) { |
| 51 | ✗ | idfObject.setString(Coil_Heating_Electric_MultiStageFields::AirOutletNodeName, node->name().get()); | |
| 52 | ✗ | idfObject.setString(Coil_Heating_Electric_MultiStageFields::TemperatureSetpointNodeName, node->name().get()); | |
| 53 | 6 | } | |
| 54 | |||
| 55 |
1/1✓ Branch 1 taken 6 times.
|
6 | const auto stages = modelObject.stages(); |
| 56 | |||
| 57 | // NumberofStages | ||
| 58 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 2 taken 3 times.
|
6 | if (!stages.empty()) { |
| 59 |
1/1✓ Branch 2 taken 3 times.
|
3 | idfObject.setInt(Coil_Heating_Electric_MultiStageFields::NumberofStages, stages.size()); |
| 60 | } | ||
| 61 | |||
| 62 |
2/2✓ Branch 5 taken 3 times.
✓ Branch 6 taken 6 times.
|
9 | for (const auto& stage : stages) { |
| 63 |
1/1✓ Branch 1 taken 3 times.
|
3 | auto eg = idfObject.pushExtensibleGroup(); |
| 64 | |||
| 65 | // Stage1Efficiency | ||
| 66 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | eg.setDouble(Coil_Heating_Electric_MultiStageExtensibleFields::StageEfficiency, stage.efficiency()); |
| 67 | |||
| 68 | // Stage1NominalCapacity | ||
| 69 |
2/3✓ Branch 1 taken 3 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 3 times.
|
3 | if (stage.isNominalCapacityAutosized()) { |
| 70 | ✗ | eg.setString(Coil_Heating_Electric_MultiStageExtensibleFields::StageNominalCapacity, "AutoSize"); | |
| 71 |
2/3✓ Branch 1 taken 3 times.
✓ Branch 3 taken 3 times.
✗ Branch 4 not taken.
|
6 | } else if ((value = stage.nominalCapacity())) { |
| 72 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | eg.setDouble(Coil_Heating_Electric_MultiStageExtensibleFields::StageNominalCapacity, value.get()); |
| 73 | } | ||
| 74 | 3 | } | |
| 75 | |||
| 76 |
1/1✓ Branch 1 taken 6 times.
|
12 | return idfObject; |
| 77 | 6 | } | |
| 78 | |||
| 79 | } // namespace energyplus | ||
| 80 | |||
| 81 | } // namespace openstudio | ||
| 82 |