src/energyplus/ReverseTranslator/ReverseTranslateSetpointManagerSystemNodeResetHumidity.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 | |||
| 8 | #include "../../model/SetpointManagerSystemNodeResetHumidity.hpp" | ||
| 9 | |||
| 10 | #include "../../model/Node.hpp" | ||
| 11 | #include "../../model/Node_Impl.hpp" | ||
| 12 | |||
| 13 | #include <utilities/idd/SetpointManager_SystemNodeReset_Humidity_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<ModelObject> ReverseTranslator::translateSetpointManagerSystemNodeResetHumidity(const WorkspaceObject& workspaceObject) { | |
| 23 | |||
| 24 | ✗ | boost::optional<Node> setpointNode; | |
| 25 | ✗ | if (boost::optional<std::string> setpointNodeName = | |
| 26 | ✗ | workspaceObject.getString(SetpointManager_SystemNodeReset_HumidityFields::SetpointNodeorNodeListName)) { | |
| 27 | ✗ | setpointNode = m_model.getConcreteModelObjectByName<Node>(setpointNodeName.get()); | |
| 28 | ✗ | } | |
| 29 | |||
| 30 | ✗ | if (!setpointNode) { | |
| 31 | ✗ | LOG(Error, workspaceObject.briefDescription() << " is not attached to a Setpoint Node in the model"); | |
| 32 | |||
| 33 | ✗ | return boost::none; | |
| 34 | } | ||
| 35 | |||
| 36 | ✗ | boost::optional<Node> referenceNode; | |
| 37 | ✗ | if (boost::optional<std::string> referenceNodeName = | |
| 38 | ✗ | workspaceObject.getString(SetpointManager_SystemNodeReset_HumidityFields::ReferenceNodeName)) { | |
| 39 | ✗ | referenceNode = m_model.getConcreteModelObjectByName<Node>(referenceNodeName.get()); | |
| 40 | ✗ | } | |
| 41 | |||
| 42 | ✗ | if (!referenceNode) { | |
| 43 | ✗ | LOG(Error, workspaceObject.briefDescription() << " is not attached to a Reference Node in the model"); | |
| 44 | |||
| 45 | ✗ | return boost::none; | |
| 46 | } | ||
| 47 | |||
| 48 | ✗ | openstudio::model::SetpointManagerSystemNodeResetHumidity modelObject(m_model); | |
| 49 | |||
| 50 | // Name | ||
| 51 | ✗ | if (boost::optional<std::string> _name = workspaceObject.name()) { | |
| 52 | ✗ | modelObject.setName(_name.get()); | |
| 53 | ✗ | } | |
| 54 | |||
| 55 | // Control Variable: Required String | ||
| 56 | ✗ | if (boost::optional<std::string> _controlVariable = workspaceObject.getString(SetpointManager_SystemNodeReset_HumidityFields::ControlVariable)) { | |
| 57 | ✗ | modelObject.setControlVariable(_controlVariable.get()); | |
| 58 | } else { | ||
| 59 | ✗ | LOG(Warn, "For " << workspaceObject.briefDescription() << ", cannot find required property 'Control Variable'"); | |
| 60 | ✗ | } | |
| 61 | |||
| 62 | // Setpoint at Low Reference Humidity Ratio: Required Double | ||
| 63 | ✗ | if (boost::optional<double> _setpointatLowReferenceHumidityRatio = | |
| 64 | ✗ | workspaceObject.getDouble(SetpointManager_SystemNodeReset_HumidityFields::SetpointatLowReferenceHumidityRatio)) { | |
| 65 | ✗ | modelObject.setSetpointatLowReferenceHumidityRatio(_setpointatLowReferenceHumidityRatio.get()); | |
| 66 | } else { | ||
| 67 | ✗ | LOG(Warn, "For " << workspaceObject.briefDescription() << ", cannot find required property 'Setpoint at Low Reference Humidity Ratio'"); | |
| 68 | } | ||
| 69 | |||
| 70 | // Setpoint at High Reference Humidity Ratio: Required Double | ||
| 71 | ✗ | if (boost::optional<double> _setpointatHighReferenceHumidityRatio = | |
| 72 | ✗ | workspaceObject.getDouble(SetpointManager_SystemNodeReset_HumidityFields::SetpointatHighReferenceHumidityRatio)) { | |
| 73 | ✗ | modelObject.setSetpointatHighReferenceHumidityRatio(_setpointatHighReferenceHumidityRatio.get()); | |
| 74 | } else { | ||
| 75 | ✗ | LOG(Warn, "For " << workspaceObject.briefDescription() << ", cannot find required property 'Setpoint at High Reference Humidity Ratio'"); | |
| 76 | } | ||
| 77 | |||
| 78 | // Low Reference Humidity Ratio: Required Double | ||
| 79 | ✗ | if (boost::optional<double> _lowReferenceHumidityRatio = | |
| 80 | ✗ | workspaceObject.getDouble(SetpointManager_SystemNodeReset_HumidityFields::LowReferenceHumidityRatio)) { | |
| 81 | ✗ | modelObject.setLowReferenceHumidityRatio(_lowReferenceHumidityRatio.get()); | |
| 82 | } else { | ||
| 83 | ✗ | LOG(Warn, "For " << workspaceObject.briefDescription() << ", cannot find required property 'Low Reference Humidity Ratio'"); | |
| 84 | } | ||
| 85 | |||
| 86 | // High Reference Humidity Ratio: Required Double | ||
| 87 | ✗ | if (boost::optional<double> _highReferenceHumidityRatio = | |
| 88 | ✗ | workspaceObject.getDouble(SetpointManager_SystemNodeReset_HumidityFields::HighReferenceHumidityRatio)) { | |
| 89 | ✗ | modelObject.setHighReferenceHumidityRatio(_highReferenceHumidityRatio.get()); | |
| 90 | } else { | ||
| 91 | ✗ | LOG(Warn, "For " << workspaceObject.briefDescription() << ", cannot find required property 'High Reference Humidity Ratio'"); | |
| 92 | } | ||
| 93 | |||
| 94 | // Reference Node Name: Required Node | ||
| 95 | ✗ | modelObject.setReferenceNode(referenceNode.get()); | |
| 96 | |||
| 97 | // Setpoint Node or NodeList Name: Required Node | ||
| 98 | ✗ | modelObject.addToNode(setpointNode.get()); | |
| 99 | |||
| 100 | ✗ | return modelObject; | |
| 101 | ✗ | } // End of translate function | |
| 102 | |||
| 103 | } // end namespace energyplus | ||
| 104 | } // end namespace openstudio | ||
| 105 |