src/energyplus/ReverseTranslator/ReverseTranslateEvaporativeCoolerDirectResearchSpecial.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 "../ReverseTranslator.hpp" | ||
| 7 | #include "../../model/EvaporativeCoolerDirectResearchSpecial.hpp" | ||
| 8 | #include "../../model/EvaporativeCoolerDirectResearchSpecial_Impl.hpp" | ||
| 9 | #include "../../model/Schedule.hpp" | ||
| 10 | #include "../../model/Schedule_Impl.hpp" | ||
| 11 | #include <utilities/idd/EvaporativeCooler_Direct_ResearchSpecial_FieldEnums.hxx> | ||
| 12 | #include "../../utilities/idd/IddEnums.hpp" | ||
| 13 | #include <utilities/idd/IddEnums.hxx> | ||
| 14 | |||
| 15 | using namespace openstudio::model; | ||
| 16 | |||
| 17 | namespace openstudio { | ||
| 18 | |||
| 19 | namespace energyplus { | ||
| 20 | |||
| 21 | ✗ | OptionalModelObject ReverseTranslator::translateEvaporativeCoolerDirectResearchSpecial(const WorkspaceObject& workspaceObject) { | |
| 22 | ✗ | if (workspaceObject.iddObject().type() != IddObjectType::EvaporativeCooler_Direct_ResearchSpecial) { | |
| 23 | ✗ | LOG(Error, "WorkspaceObject is not IddObjectType: EvaporativeCooler_Direct_ResearchSpecial"); | |
| 24 | ✗ | return boost::none; | |
| 25 | } | ||
| 26 | |||
| 27 | ✗ | boost::optional<Schedule> schedule; | |
| 28 | ✗ | boost::optional<EvaporativeCoolerDirectResearchSpecial> mo; | |
| 29 | |||
| 30 | ✗ | boost::optional<WorkspaceObject> wo = workspaceObject.getTarget(EvaporativeCooler_Direct_ResearchSpecialFields::AvailabilityScheduleName); | |
| 31 | ✗ | if (wo) { | |
| 32 | ✗ | boost::optional<ModelObject> mo2 = translateAndMapWorkspaceObject(wo.get()); | |
| 33 | ✗ | if (mo2) { | |
| 34 | ✗ | if (!(schedule = mo2->optionalCast<Schedule>())) { | |
| 35 | ✗ | LOG(Error, workspaceObject.briefDescription() << " does not have an associated availability schedule"); | |
| 36 | |||
| 37 | ✗ | return boost::none; | |
| 38 | } | ||
| 39 | } | ||
| 40 | ✗ | } | |
| 41 | |||
| 42 | ✗ | if (schedule) { | |
| 43 | ✗ | mo = EvaporativeCoolerDirectResearchSpecial(m_model, schedule.get()); | |
| 44 | } | ||
| 45 | |||
| 46 | ✗ | if (mo) { | |
| 47 | ✗ | boost::optional<std::string> s = workspaceObject.getString(EvaporativeCooler_Direct_ResearchSpecialFields::Name); | |
| 48 | ✗ | if (s) { | |
| 49 | ✗ | mo->setName(s.get()); | |
| 50 | } | ||
| 51 | |||
| 52 | ✗ | boost::optional<double> value = workspaceObject.getDouble(EvaporativeCooler_Direct_ResearchSpecialFields::CoolerDesignEffectiveness); | |
| 53 | ✗ | if (s) { | |
| 54 | ✗ | mo->setCoolerEffectiveness(value.get()); | |
| 55 | } | ||
| 56 | |||
| 57 | ✗ | value = workspaceObject.getDouble(EvaporativeCooler_Direct_ResearchSpecialFields::RecirculatingWaterPumpDesignPower); | |
| 58 | ✗ | if (value) { | |
| 59 | ✗ | mo->setRecirculatingWaterPumpPowerConsumption(value.get()); | |
| 60 | } | ||
| 61 | |||
| 62 | ✗ | value = workspaceObject.getDouble(EvaporativeCooler_Direct_ResearchSpecialFields::DriftLossFraction); | |
| 63 | ✗ | if (value) { | |
| 64 | ✗ | mo->setDriftLossFraction(value.get()); | |
| 65 | } | ||
| 66 | |||
| 67 | ✗ | value = workspaceObject.getDouble(EvaporativeCooler_Direct_ResearchSpecialFields::BlowdownConcentrationRatio); | |
| 68 | ✗ | if (value) { | |
| 69 | ✗ | mo->setBlowdownConcentrationRatio(value.get()); | |
| 70 | } | ||
| 71 | |||
| 72 | ✗ | return mo.get(); | |
| 73 | ✗ | } else { | |
| 74 | ✗ | LOG(Error, "Unknown error translating " << workspaceObject.briefDescription()); | |
| 75 | |||
| 76 | ✗ | return boost::none; | |
| 77 | } | ||
| 78 | ✗ | } | |
| 79 | |||
| 80 | } // namespace energyplus | ||
| 81 | |||
| 82 | } // namespace openstudio | ||
| 83 |