src/energyplus/ForwardTranslator/ForwardTranslateDistrictHeatingWater.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/DistrictHeatingWater.hpp" | ||
| 9 | #include "../../model/DistrictHeatingWater_Impl.hpp" | ||
| 10 | #include "../../model/Schedule.hpp" | ||
| 11 | #include "../../model/Schedule_Impl.hpp" | ||
| 12 | #include "../../utilities/idf/IdfExtensibleGroup.hpp" | ||
| 13 | #include "../../utilities/idf/Workspace.hpp" | ||
| 14 | #include "../../utilities/idf/WorkspaceObjectOrder.hpp" | ||
| 15 | #include "../../utilities/core/Logger.hpp" | ||
| 16 | #include <utilities/idd/DistrictHeating_Water_FieldEnums.hxx> | ||
| 17 | #include <utilities/idd/IddEnums.hxx> | ||
| 18 | |||
| 19 | using namespace openstudio::model; | ||
| 20 | |||
| 21 | namespace openstudio { | ||
| 22 | |||
| 23 | namespace energyplus { | ||
| 24 | |||
| 25 | ✗ | boost::optional<IdfObject> ForwardTranslator::translateDistrictHeatingWater(DistrictHeatingWater& modelObject) { | |
| 26 | |||
| 27 | // Name | ||
| 28 | ✗ | IdfObject idfObject = createRegisterAndNameIdfObject(IddObjectType::DistrictHeating_Water, modelObject); | |
| 29 | |||
| 30 | // Inlet Node Name | ||
| 31 | ✗ | if (auto node_ = modelObject.inletModelObject()) { | |
| 32 | ✗ | idfObject.setString(DistrictHeating_WaterFields::HotWaterInletNodeName, node_->nameString()); | |
| 33 | ✗ | } | |
| 34 | |||
| 35 | // Outlet Node Name | ||
| 36 | ✗ | if (auto node_ = modelObject.outletModelObject()) { | |
| 37 | ✗ | idfObject.setString(DistrictHeating_WaterFields::HotWaterOutletNodeName, node_->nameString()); | |
| 38 | ✗ | } | |
| 39 | |||
| 40 | // Nominal Capacity | ||
| 41 | ✗ | if (modelObject.isNominalCapacityAutosized()) { | |
| 42 | ✗ | idfObject.setString(DistrictHeating_WaterFields::NominalCapacity, "Autosize"); | |
| 43 | ✗ | } else if (auto value_ = modelObject.nominalCapacity()) { | |
| 44 | ✗ | idfObject.setDouble(DistrictHeating_WaterFields::NominalCapacity, *value_); | |
| 45 | } | ||
| 46 | |||
| 47 | // Capacity Fraction Schedule Name | ||
| 48 | { | ||
| 49 | ✗ | Schedule capacityFractionSchedule = modelObject.capacityFractionSchedule(); | |
| 50 | ✗ | if (auto sch_ = translateAndMapModelObject(capacityFractionSchedule)) { | |
| 51 | ✗ | idfObject.setString(DistrictHeating_WaterFields::CapacityFractionScheduleName, sch_->nameString()); | |
| 52 | ✗ | } | |
| 53 | ✗ | } | |
| 54 | |||
| 55 | ✗ | return idfObject; | |
| 56 | ✗ | } | |
| 57 | } // namespace energyplus | ||
| 58 | |||
| 59 | } // namespace openstudio | ||
| 60 |