src/energyplus/ForwardTranslator/ForwardTranslatePlantComponentTemperatureSource.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/PlantComponentTemperatureSource.hpp" | ||
| 9 | #include "../../model/PlantComponentTemperatureSource_Impl.hpp" | ||
| 10 | #include "../../model/Schedule.hpp" | ||
| 11 | #include "../../model/Node.hpp" | ||
| 12 | #include "../../utilities/core/Logger.hpp" | ||
| 13 | #include <utilities/idd/PlantComponent_TemperatureSource_FieldEnums.hxx> | ||
| 14 | #include <utilities/idd/IddEnums.hxx> | ||
| 15 | |||
| 16 | using namespace openstudio::model; | ||
| 17 | |||
| 18 | namespace openstudio { | ||
| 19 | |||
| 20 | namespace energyplus { | ||
| 21 | |||
| 22 | ✗ | boost::optional<IdfObject> ForwardTranslator::translatePlantComponentTemperatureSource(PlantComponentTemperatureSource& modelObject) { | |
| 23 | ✗ | OptionalString s; | |
| 24 | ✗ | OptionalDouble value; | |
| 25 | ✗ | OptionalModelObject temp; | |
| 26 | |||
| 27 | //Name | ||
| 28 | ✗ | IdfObject idfObject = createRegisterAndNameIdfObject(openstudio::IddObjectType::PlantComponent_TemperatureSource, modelObject); | |
| 29 | |||
| 30 | // InletNode | ||
| 31 | ✗ | if (auto node = modelObject.inletModelObject()) { | |
| 32 | ✗ | idfObject.setString(PlantComponent_TemperatureSourceFields::InletNode, node->name().get()); | |
| 33 | ✗ | } | |
| 34 | |||
| 35 | // OutletNode | ||
| 36 | ✗ | if (auto node = modelObject.outletModelObject()) { | |
| 37 | ✗ | idfObject.setString(PlantComponent_TemperatureSourceFields::OutletNode, node->name().get()); | |
| 38 | ✗ | } | |
| 39 | |||
| 40 | // DesignVolumeFlowRate | ||
| 41 | ✗ | if (modelObject.isDesignVolumeFlowRateAutosized()) { | |
| 42 | ✗ | idfObject.setString(PlantComponent_TemperatureSourceFields::DesignVolumeFlowRate, "Autosize"); | |
| 43 | ✗ | } else if ((value = modelObject.designVolumeFlowRate())) { | |
| 44 | ✗ | idfObject.setDouble(PlantComponent_TemperatureSourceFields::DesignVolumeFlowRate, value.get()); | |
| 45 | } | ||
| 46 | |||
| 47 | // TemperatureSpecificationType | ||
| 48 | ✗ | if ((s = modelObject.temperatureSpecificationType())) { | |
| 49 | ✗ | idfObject.setString(PlantComponent_TemperatureSourceFields::TemperatureSpecificationType, s.get()); | |
| 50 | } | ||
| 51 | |||
| 52 | // SourceTemperature | ||
| 53 | ✗ | if ((value = modelObject.sourceTemperature())) { | |
| 54 | ✗ | idfObject.setDouble(PlantComponent_TemperatureSourceFields::SourceTemperature, value.get()); | |
| 55 | } | ||
| 56 | |||
| 57 | // SourceTemperatureScheduleName | ||
| 58 | ✗ | if (auto schedule = modelObject.sourceTemperatureSchedule()) { | |
| 59 | ✗ | if (auto _schedule = translateAndMapModelObject(schedule.get())) { | |
| 60 | ✗ | idfObject.setString(PlantComponent_TemperatureSourceFields::SourceTemperatureScheduleName, _schedule->name().get()); | |
| 61 | ✗ | } | |
| 62 | ✗ | } | |
| 63 | |||
| 64 | ✗ | return idfObject; | |
| 65 | ✗ | } | |
| 66 | |||
| 67 | } // namespace energyplus | ||
| 68 | |||
| 69 | } // namespace openstudio | ||
| 70 |