src/energyplus/ForwardTranslator/ForwardTranslatePlantEquipmentOperationOutdoorDewpointDifference.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/PlantEquipmentOperationOutdoorDewpointDifference.hpp" | ||
| 13 | #include "../../model/PlantEquipmentOperationOutdoorDewpointDifference_Impl.hpp" | ||
| 14 | #include "../../utilities/core/Logger.hpp" | ||
| 15 | #include "../../utilities/core/Assert.hpp" | ||
| 16 | #include "../../utilities/idf/IdfExtensibleGroup.hpp" | ||
| 17 | #include "../../utilities/idd/IddEnums.hpp" | ||
| 18 | #include <utilities/idd/PlantEquipmentOperation_OutdoorDewpointDifference_FieldEnums.hxx> | ||
| 19 | #include <utilities/idd/PlantEquipmentList_FieldEnums.hxx> | ||
| 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 | boost::optional<IdfObject> | ||
| 32 | ✗ | ForwardTranslator::translatePlantEquipmentOperationOutdoorDewpointDifference(PlantEquipmentOperationOutdoorDewpointDifference& modelObject) { | |
| 33 | ✗ | IdfObject idfObject(IddObjectType::PlantEquipmentOperation_OutdoorDewpointDifference); | |
| 34 | ✗ | m_idfObjects.push_back(idfObject); | |
| 35 | |||
| 36 | // Name | ||
| 37 | ✗ | auto name = modelObject.nameString(); | |
| 38 | ✗ | idfObject.setName(name); | |
| 39 | |||
| 40 | // ReferenceTemperatureNodeName | ||
| 41 | ✗ | if (const auto& node = modelObject.referenceTemperatureNode()) { | |
| 42 | ✗ | idfObject.setString(PlantEquipmentOperation_OutdoorDewpointDifferenceFields::ReferenceTemperatureNodeName, node->nameString()); | |
| 43 | ✗ | } | |
| 44 | |||
| 45 | ✗ | double lowerLimit = modelObject.minimumLowerLimit(); | |
| 46 | ✗ | int i = 1; | |
| 47 | ✗ | for (auto upperLimit : modelObject.loadRangeUpperLimits()) { | |
| 48 | ✗ | auto equipment = modelObject.equipment(upperLimit); | |
| 49 | ✗ | if (!equipment.empty()) { | |
| 50 | ✗ | auto eg = idfObject.pushExtensibleGroup(); | |
| 51 | ✗ | eg.setDouble(PlantEquipmentOperation_OutdoorDewpointDifferenceExtensibleFields::DewpointTemperatureDifferenceRangeLowerLimit, lowerLimit); | |
| 52 | ✗ | eg.setDouble(PlantEquipmentOperation_OutdoorDewpointDifferenceExtensibleFields::DewpointTemperatureDifferenceRangeUpperLimit, upperLimit); | |
| 53 | |||
| 54 | ✗ | IdfObject equipmentList(IddObjectType::PlantEquipmentList); | |
| 55 | ✗ | m_idfObjects.push_back(equipmentList); | |
| 56 | ✗ | auto equipmentListName = name + " equipment list " + std::to_string(i); | |
| 57 | ✗ | equipmentList.setName(equipmentListName); | |
| 58 | ✗ | eg.setString(PlantEquipmentOperation_OutdoorDewpointDifferenceExtensibleFields::RangeEquipmentListName, equipmentListName); | |
| 59 | |||
| 60 | ✗ | for (auto& component : equipment) { | |
| 61 | ✗ | auto eg2 = equipmentList.pushExtensibleGroup(); | |
| 62 | ✗ | auto idf_component = translateAndMapModelObject(component); | |
| 63 | ✗ | OS_ASSERT(idf_component); | |
| 64 | ✗ | eg2.setString(PlantEquipmentListExtensibleFields::EquipmentObjectType, idf_component->iddObject().name()); | |
| 65 | ✗ | eg2.setString(PlantEquipmentListExtensibleFields::EquipmentName, idf_component->nameString()); | |
| 66 | ✗ | } | |
| 67 | ✗ | } | |
| 68 | |||
| 69 | ✗ | lowerLimit = upperLimit; | |
| 70 | ✗ | ++i; | |
| 71 | ✗ | } | |
| 72 | |||
| 73 | ✗ | return idfObject; | |
| 74 | ✗ | } | |
| 75 | |||
| 76 | } // namespace energyplus | ||
| 77 | |||
| 78 | } // namespace openstudio | ||
| 79 |