src/energyplus/ForwardTranslator/ForwardTranslateControllerWaterCoil.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/Node.hpp" | ||
| 9 | #include "../../model/Node_Impl.hpp" | ||
| 10 | #include "../../model/ControllerWaterCoil.hpp" | ||
| 11 | #include "../../model/ControllerWaterCoil_Impl.hpp" | ||
| 12 | #include "../../model/WaterToAirComponent.hpp" | ||
| 13 | #include "../../model/WaterToAirComponent_Impl.hpp" | ||
| 14 | #include "../../utilities/core/Logger.hpp" | ||
| 15 | #include "../../utilities/core/Assert.hpp" | ||
| 16 | #include <utilities/idd/Controller_WaterCoil_FieldEnums.hxx> | ||
| 17 | #include "../../utilities/idd/IddEnums.hpp" | ||
| 18 | #include <utilities/idd/IddEnums.hxx> | ||
| 19 | #include <utilities/idd/IddFactory.hxx> | ||
| 20 | |||
| 21 | using namespace openstudio::model; | ||
| 22 | |||
| 23 | using namespace std; | ||
| 24 | |||
| 25 | namespace openstudio { | ||
| 26 | |||
| 27 | namespace energyplus { | ||
| 28 | |||
| 29 | 6 | boost::optional<IdfObject> ForwardTranslator::translateControllerWaterCoil(ControllerWaterCoil& modelObject) { | |
| 30 | 6 | boost::optional<std::string> s; | |
| 31 | 6 | boost::optional<double> value; | |
| 32 | |||
| 33 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
|
6 | IdfObject idfObject(IddObjectType::Controller_WaterCoil); |
| 34 | |||
| 35 |
1/1✓ Branch 1 taken 6 times.
|
6 | m_idfObjects.push_back(idfObject); |
| 36 | |||
| 37 | // Name | ||
| 38 | |||
| 39 |
1/1✓ Branch 1 taken 6 times.
|
6 | s = modelObject.name(); |
| 40 |
1/2✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
|
6 | if (s) { |
| 41 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
|
6 | idfObject.setName(*s); |
| 42 | } | ||
| 43 | |||
| 44 | // ControlVariable | ||
| 45 | |||
| 46 |
2/3✓ Branch 1 taken 6 times.
✓ Branch 5 taken 6 times.
✗ Branch 6 not taken.
|
12 | if ((s = modelObject.controlVariable())) { |
| 47 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
|
6 | idfObject.setString(Controller_WaterCoilFields::ControlVariable, s.get()); |
| 48 | } | ||
| 49 | |||
| 50 | // Action | ||
| 51 | |||
| 52 |
2/3✓ Branch 1 taken 6 times.
✓ Branch 5 taken 6 times.
✗ Branch 6 not taken.
|
12 | if ((s = modelObject.action())) { |
| 53 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
|
6 | idfObject.setString(Controller_WaterCoilFields::Action, s.get()); |
| 54 | } | ||
| 55 | |||
| 56 | // ActuatorVariable | ||
| 57 | |||
| 58 |
2/3✓ Branch 1 taken 6 times.
✓ Branch 5 taken 6 times.
✗ Branch 6 not taken.
|
12 | if ((s = modelObject.actuatorVariable())) { |
| 59 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
|
6 | idfObject.setString(Controller_WaterCoilFields::ActuatorVariable, s.get()); |
| 60 | } | ||
| 61 | |||
| 62 | 6 | boost::optional<model::WaterToAirComponent> waterCoil; | |
| 63 |
2/3✓ Branch 3 taken 6 times.
✓ Branch 7 taken 6 times.
✗ Branch 8 not taken.
|
12 | if (auto hvacComp = modelObject.getImpl<model::detail::ControllerWaterCoil_Impl>()->waterCoil()) { |
| 64 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
|
6 | waterCoil = hvacComp->optionalCast<model::WaterToAirComponent>(); |
| 65 | 6 | } | |
| 66 | |||
| 67 | // SensorNodeName | ||
| 68 | |||
| 69 |
2/3✓ Branch 1 taken 6 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 times.
|
12 | if (boost::optional<Node> node = modelObject.sensorNode()) { |
| 70 | ✗ | idfObject.setString(Controller_WaterCoilFields::SensorNodeName, node->name().get()); | |
| 71 |
1/2✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
|
6 | } else if (waterCoil) { |
| 72 |
4/4✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 6 taken 3 times.
✓ Branch 7 taken 3 times.
|
12 | if (auto node = waterCoil->airOutletModelObject()) { |
| 73 |
4/4✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✓ Branch 10 taken 3 times.
|
3 | idfObject.setString(Controller_WaterCoilFields::SensorNodeName, node->name().get()); |
| 74 | 6 | } | |
| 75 | 6 | } | |
| 76 | |||
| 77 | // ActuatorNodeName | ||
| 78 | |||
| 79 |
2/3✓ Branch 1 taken 6 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 times.
|
12 | if (boost::optional<Node> node = modelObject.actuatorNode()) { |
| 80 | ✗ | idfObject.setString(Controller_WaterCoilFields::ActuatorNodeName, node->name().get()); | |
| 81 |
1/2✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
|
6 | } else if (waterCoil) { |
| 82 |
3/4✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 6 taken 6 times.
✗ Branch 7 not taken.
|
12 | if (auto node = waterCoil->waterInletModelObject()) { |
| 83 |
4/4✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
✓ Branch 10 taken 6 times.
|
6 | idfObject.setString(Controller_WaterCoilFields::ActuatorNodeName, node->name().get()); |
| 84 | 6 | } | |
| 85 | 6 | } | |
| 86 | |||
| 87 | // ControllerConvergenceTolerance | ||
| 88 | |||
| 89 |
2/3✓ Branch 1 taken 6 times.
✓ Branch 3 taken 6 times.
✗ Branch 4 not taken.
|
6 | if (modelObject.isControllerConvergenceToleranceAutosized()) { |
| 90 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
|
12 | idfObject.setString(Controller_WaterCoilFields::ControllerConvergenceTolerance, "Autosize"); |
| 91 | ✗ | } else if ((value = modelObject.controllerConvergenceTolerance())) { | |
| 92 | ✗ | idfObject.setDouble(Controller_WaterCoilFields::ControllerConvergenceTolerance, value.get()); | |
| 93 | } | ||
| 94 | |||
| 95 | // MaximumActuatedFlow | ||
| 96 | |||
| 97 |
2/3✓ Branch 1 taken 6 times.
✓ Branch 3 taken 6 times.
✗ Branch 4 not taken.
|
6 | if (modelObject.isMaximumActuatedFlowAutosized()) { |
| 98 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
|
12 | idfObject.setString(Controller_WaterCoilFields::MaximumActuatedFlow, "Autosize"); |
| 99 | ✗ | } else if ((value = modelObject.maximumActuatedFlow())) { | |
| 100 | ✗ | idfObject.setDouble(Controller_WaterCoilFields::MaximumActuatedFlow, value.get()); | |
| 101 | } | ||
| 102 | |||
| 103 | // MinimumActuatedFlow | ||
| 104 | |||
| 105 |
3/4✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 7 taken 6 times.
✗ Branch 8 not taken.
|
12 | if ((value = modelObject.minimumActuatedFlow())) { |
| 106 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
|
6 | idfObject.setDouble(Controller_WaterCoilFields::MinimumActuatedFlow, value.get()); |
| 107 | } | ||
| 108 | |||
| 109 |
1/1✓ Branch 1 taken 6 times.
|
12 | return boost::optional<IdfObject>(idfObject); |
| 110 | 6 | } | |
| 111 | |||
| 112 | } // namespace energyplus | ||
| 113 | |||
| 114 | } // namespace openstudio | ||
| 115 |