src/model/SetpointManagerSingleZoneOneStageCooling.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 "SetpointManagerSingleZoneOneStageCooling.hpp" | ||
| 7 | #include "SetpointManagerSingleZoneOneStageCooling_Impl.hpp" | ||
| 8 | |||
| 9 | #include "ThermalZone.hpp" | ||
| 10 | #include "ThermalZone_Impl.hpp" | ||
| 11 | #include "Node.hpp" | ||
| 12 | #include "Node_Impl.hpp" | ||
| 13 | #include "Model.hpp" | ||
| 14 | #include "AirLoopHVAC.hpp" | ||
| 15 | |||
| 16 | #include <utilities/idd/IddFactory.hxx> | ||
| 17 | #include <utilities/idd/OS_SetpointManager_SingleZone_OneStageCooling_FieldEnums.hxx> | ||
| 18 | #include <utilities/idd/IddEnums.hxx> | ||
| 19 | #include "../utilities/core/Assert.hpp" | ||
| 20 | |||
| 21 | namespace openstudio { | ||
| 22 | namespace model { | ||
| 23 | |||
| 24 | namespace detail { | ||
| 25 | |||
| 26 | 8 | SetpointManagerSingleZoneOneStageCooling_Impl::SetpointManagerSingleZoneOneStageCooling_Impl(const IdfObject& idfObject, Model_Impl* model, | |
| 27 | 8 | bool keepHandle) | |
| 28 | 8 | : SetpointManager_Impl(idfObject, model, keepHandle) { | |
| 29 |
4/6✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
✓ Branch 7 taken 8 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 8 times.
✗ Branch 13 not taken.
|
8 | OS_ASSERT(idfObject.iddObject().type() == SetpointManagerSingleZoneOneStageCooling::iddObjectType()); |
| 30 | 8 | } | |
| 31 | |||
| 32 | ✗ | SetpointManagerSingleZoneOneStageCooling_Impl::SetpointManagerSingleZoneOneStageCooling_Impl( | |
| 33 | ✗ | const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, bool keepHandle) | |
| 34 | ✗ | : SetpointManager_Impl(other, model, keepHandle) { | |
| 35 | ✗ | OS_ASSERT(other.iddObject().type() == SetpointManagerSingleZoneOneStageCooling::iddObjectType()); | |
| 36 | ✗ | } | |
| 37 | |||
| 38 | 6 | SetpointManagerSingleZoneOneStageCooling_Impl::SetpointManagerSingleZoneOneStageCooling_Impl( | |
| 39 | 6 | const SetpointManagerSingleZoneOneStageCooling_Impl& other, Model_Impl* model, bool keepHandle) | |
| 40 | 6 | : SetpointManager_Impl(other, model, keepHandle) {} | |
| 41 | |||
| 42 | ✗ | const std::vector<std::string>& SetpointManagerSingleZoneOneStageCooling_Impl::outputVariableNames() const { | |
| 43 | ✗ | static const std::vector<std::string> result; | |
| 44 | ✗ | return result; | |
| 45 | } | ||
| 46 | |||
| 47 | ✗ | IddObjectType SetpointManagerSingleZoneOneStageCooling_Impl::iddObjectType() const { | |
| 48 | ✗ | return SetpointManagerSingleZoneOneStageCooling::iddObjectType(); | |
| 49 | } | ||
| 50 | |||
| 51 | 8 | bool SetpointManagerSingleZoneOneStageCooling_Impl::addToNode(Node& node) { | |
| 52 | 8 | bool added = SetpointManager_Impl::addToNode(node); | |
| 53 |
2/2✓ Branch 0 taken 7 times.
✓ Branch 1 taken 1 time.
|
8 | if (added) { |
| 54 |
2/3✓ Branch 1 taken 7 times.
✓ Branch 3 taken 7 times.
✗ Branch 4 not taken.
|
14 | if (boost::optional<AirLoopHVAC> _airLoop = node.airLoopHVAC()) { |
| 55 |
3/3✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
✓ Branch 7 taken 7 times.
|
7 | ModelObjectVector modelObjectVector = _airLoop->demandComponents(openstudio::IddObjectType::OS_ThermalZone); |
| 56 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 7 times.
|
7 | if (!modelObjectVector.empty()) { |
| 57 | ✗ | ModelObject mo = modelObjectVector.front(); | |
| 58 | ✗ | auto thermalZone = mo.cast<ThermalZone>(); | |
| 59 | ✗ | this->setControlZone(thermalZone); | |
| 60 | ✗ | } | |
| 61 | 7 | return true; | |
| 62 | 14 | } | |
| 63 | } | ||
| 64 | 1 | return false; | |
| 65 | } | ||
| 66 | |||
| 67 | 3 | ModelObject SetpointManagerSingleZoneOneStageCooling_Impl::clone(Model model) const { | |
| 68 |
3/3✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
|
3 | auto clonedObject = SetpointManager_Impl::clone(model).cast<SetpointManagerSingleZoneOneStageCooling>(); |
| 69 |
1/1✓ Branch 1 taken 3 times.
|
3 | clonedObject.resetControlZone(); |
| 70 | 6 | return std::move(clonedObject); | |
| 71 | 3 | } | |
| 72 | |||
| 73 | 8 | std::string SetpointManagerSingleZoneOneStageCooling_Impl::controlVariable() const { | |
| 74 |
1/1✓ Branch 1 taken 8 times.
|
8 | boost::optional<std::string> value = getString(OS_SetpointManager_SingleZone_OneStageCoolingFields::ControlVariable, true); |
| 75 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
✗ Branch 4 not taken.
|
8 | OS_ASSERT(value); |
| 76 |
2/2✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
|
16 | return value.get(); |
| 77 | 8 | } | |
| 78 | |||
| 79 | 9 | double SetpointManagerSingleZoneOneStageCooling_Impl::coolingStageOnSupplyAirSetpointTemperature() const { | |
| 80 | boost::optional<double> value = | ||
| 81 |
1/1✓ Branch 1 taken 9 times.
|
9 | getDouble(OS_SetpointManager_SingleZone_OneStageCoolingFields::CoolingStageOnSupplyAirSetpointTemperature, true); |
| 82 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 9 times.
✗ Branch 4 not taken.
|
9 | OS_ASSERT(value); |
| 83 |
1/1✓ Branch 1 taken 9 times.
|
18 | return value.get(); |
| 84 | } | ||
| 85 | |||
| 86 | 9 | double SetpointManagerSingleZoneOneStageCooling_Impl::coolingStageOffSupplyAirSetpointTemperature() const { | |
| 87 | boost::optional<double> value = | ||
| 88 |
1/1✓ Branch 1 taken 9 times.
|
9 | getDouble(OS_SetpointManager_SingleZone_OneStageCoolingFields::CoolingStageOffSupplyAirSetpointTemperature, true); |
| 89 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 9 times.
✗ Branch 4 not taken.
|
9 | OS_ASSERT(value); |
| 90 |
1/1✓ Branch 1 taken 9 times.
|
18 | return value.get(); |
| 91 | } | ||
| 92 | |||
| 93 | 9 | boost::optional<ThermalZone> SetpointManagerSingleZoneOneStageCooling_Impl::controlZone() const { | |
| 94 |
2/2✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
|
9 | return getObject<ModelObject>().getModelObjectTarget<ThermalZone>(OS_SetpointManager_SingleZone_OneStageCoolingFields::ControlZoneName); |
| 95 | } | ||
| 96 | |||
| 97 | 18 | boost::optional<Node> SetpointManagerSingleZoneOneStageCooling_Impl::setpointNode() const { | |
| 98 |
2/2✓ Branch 1 taken 18 times.
✓ Branch 4 taken 18 times.
|
18 | return getObject<ModelObject>().getModelObjectTarget<Node>(OS_SetpointManager_SingleZone_OneStageCoolingFields::SetpointNodeorNodeListName); |
| 99 | } | ||
| 100 | |||
| 101 | 15 | bool SetpointManagerSingleZoneOneStageCooling_Impl::setControlVariable(const std::string& controlVariable) { | |
| 102 | 15 | bool result = setString(OS_SetpointManager_SingleZone_OneStageCoolingFields::ControlVariable, controlVariable); | |
| 103 | 15 | return result; | |
| 104 | } | ||
| 105 | |||
| 106 | 9 | bool SetpointManagerSingleZoneOneStageCooling_Impl::setCoolingStageOnSupplyAirSetpointTemperature( | |
| 107 | double coolingStageOnSupplyAirSetpointTemperature) { | ||
| 108 | 9 | bool result = setDouble(OS_SetpointManager_SingleZone_OneStageCoolingFields::CoolingStageOnSupplyAirSetpointTemperature, | |
| 109 | coolingStageOnSupplyAirSetpointTemperature); | ||
| 110 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 9 times.
|
9 | OS_ASSERT(result); |
| 111 | 9 | return result; | |
| 112 | } | ||
| 113 | |||
| 114 | 9 | bool SetpointManagerSingleZoneOneStageCooling_Impl::setCoolingStageOffSupplyAirSetpointTemperature( | |
| 115 | double coolingStageOffSupplyAirSetpointTemperature) { | ||
| 116 | 9 | bool result = setDouble(OS_SetpointManager_SingleZone_OneStageCoolingFields::CoolingStageOffSupplyAirSetpointTemperature, | |
| 117 | coolingStageOffSupplyAirSetpointTemperature); | ||
| 118 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 9 times.
|
9 | OS_ASSERT(result); |
| 119 | 9 | return result; | |
| 120 | } | ||
| 121 | |||
| 122 | 3 | bool SetpointManagerSingleZoneOneStageCooling_Impl::setControlZone(const ThermalZone& thermalZone) { | |
| 123 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | bool result = setPointer(OS_SetpointManager_SingleZone_OneStageCoolingFields::ControlZoneName, thermalZone.handle()); |
| 124 | 3 | return result; | |
| 125 | } | ||
| 126 | |||
| 127 | 3 | void SetpointManagerSingleZoneOneStageCooling_Impl::resetControlZone() { | |
| 128 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
6 | bool result = setString(OS_SetpointManager_SingleZone_OneStageCoolingFields::ControlZoneName, ""); |
| 129 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
|
3 | OS_ASSERT(result); |
| 130 | 3 | } | |
| 131 | |||
| 132 | 7 | bool SetpointManagerSingleZoneOneStageCooling_Impl::setSetpointNode(const Node& node) { | |
| 133 |
2/2✓ Branch 1 taken 7 times.
✓ Branch 4 taken 7 times.
|
7 | bool result = setPointer(OS_SetpointManager_SingleZone_OneStageCoolingFields::SetpointNodeorNodeListName, node.handle()); |
| 134 | 7 | return result; | |
| 135 | } | ||
| 136 | |||
| 137 | 3 | void SetpointManagerSingleZoneOneStageCooling_Impl::resetSetpointNode() { | |
| 138 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
6 | bool result = setString(OS_SetpointManager_SingleZone_OneStageCoolingFields::SetpointNodeorNodeListName, ""); |
| 139 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
|
3 | OS_ASSERT(result); |
| 140 | 3 | } | |
| 141 | |||
| 142 | } // namespace detail | ||
| 143 | |||
| 144 | 8 | SetpointManagerSingleZoneOneStageCooling::SetpointManagerSingleZoneOneStageCooling(const Model& model) | |
| 145 | 8 | : SetpointManager(SetpointManagerSingleZoneOneStageCooling::iddObjectType(), model) { | |
| 146 |
1/3✗ Branch 2 not taken.
✓ Branch 3 taken 8 times.
✗ Branch 5 not taken.
|
8 | OS_ASSERT(getImpl<detail::SetpointManagerSingleZoneOneStageCooling_Impl>()); |
| 147 | |||
| 148 |
2/2✓ Branch 1 taken 8 times.
✓ Branch 4 taken 8 times.
|
8 | setControlVariable("Temperature"); |
| 149 |
1/1✓ Branch 1 taken 8 times.
|
8 | setCoolingStageOnSupplyAirSetpointTemperature(-99); |
| 150 |
1/1✓ Branch 1 taken 8 times.
|
8 | setCoolingStageOffSupplyAirSetpointTemperature(99); |
| 151 | 8 | } | |
| 152 | |||
| 153 | 7748 | IddObjectType SetpointManagerSingleZoneOneStageCooling::iddObjectType() { | |
| 154 |
1/1✓ Branch 1 taken 7748 times.
|
7748 | return {IddObjectType::OS_SetpointManager_SingleZone_OneStageCooling}; |
| 155 | } | ||
| 156 | |||
| 157 | ✗ | std::vector<std::string> SetpointManagerSingleZoneOneStageCooling::controlVariableValues() { | |
| 158 | ✗ | return getIddKeyNames(IddFactory::instance().getObject(iddObjectType()).get(), | |
| 159 | ✗ | OS_SetpointManager_SingleZone_OneStageCoolingFields::ControlVariable); | |
| 160 | } | ||
| 161 | |||
| 162 | 6 | std::string SetpointManagerSingleZoneOneStageCooling::controlVariable() const { | |
| 163 |
1/1✓ Branch 3 taken 6 times.
|
6 | return getImpl<detail::SetpointManagerSingleZoneOneStageCooling_Impl>()->controlVariable(); |
| 164 | } | ||
| 165 | |||
| 166 | 9 | double SetpointManagerSingleZoneOneStageCooling::coolingStageOnSupplyAirSetpointTemperature() const { | |
| 167 |
1/1✓ Branch 3 taken 9 times.
|
9 | return getImpl<detail::SetpointManagerSingleZoneOneStageCooling_Impl>()->coolingStageOnSupplyAirSetpointTemperature(); |
| 168 | } | ||
| 169 | |||
| 170 | 9 | double SetpointManagerSingleZoneOneStageCooling::coolingStageOffSupplyAirSetpointTemperature() const { | |
| 171 |
1/1✓ Branch 3 taken 9 times.
|
9 | return getImpl<detail::SetpointManagerSingleZoneOneStageCooling_Impl>()->coolingStageOffSupplyAirSetpointTemperature(); |
| 172 | } | ||
| 173 | |||
| 174 | 9 | boost::optional<ThermalZone> SetpointManagerSingleZoneOneStageCooling::controlZone() const { | |
| 175 |
1/1✓ Branch 3 taken 9 times.
|
9 | return getImpl<detail::SetpointManagerSingleZoneOneStageCooling_Impl>()->controlZone(); |
| 176 | } | ||
| 177 | |||
| 178 | 14 | boost::optional<Node> SetpointManagerSingleZoneOneStageCooling::setpointNode() const { | |
| 179 |
1/1✓ Branch 3 taken 14 times.
|
14 | return getImpl<detail::SetpointManagerSingleZoneOneStageCooling_Impl>()->setpointNode(); |
| 180 | } | ||
| 181 | |||
| 182 | 15 | bool SetpointManagerSingleZoneOneStageCooling::setControlVariable(const std::string& controlVariable) { | |
| 183 |
1/1✓ Branch 3 taken 15 times.
|
15 | return getImpl<detail::SetpointManagerSingleZoneOneStageCooling_Impl>()->setControlVariable(controlVariable); |
| 184 | } | ||
| 185 | |||
| 186 | 9 | bool SetpointManagerSingleZoneOneStageCooling::setCoolingStageOnSupplyAirSetpointTemperature(double coolingStageOnSupplyAirSetpointTemperature) { | |
| 187 |
1/1✓ Branch 3 taken 9 times.
|
18 | return getImpl<detail::SetpointManagerSingleZoneOneStageCooling_Impl>()->setCoolingStageOnSupplyAirSetpointTemperature( |
| 188 | 18 | coolingStageOnSupplyAirSetpointTemperature); | |
| 189 | } | ||
| 190 | |||
| 191 | 9 | bool SetpointManagerSingleZoneOneStageCooling::setCoolingStageOffSupplyAirSetpointTemperature(double coolingStageOffSupplyAirSetpointTemperature) { | |
| 192 |
1/1✓ Branch 3 taken 9 times.
|
18 | return getImpl<detail::SetpointManagerSingleZoneOneStageCooling_Impl>()->setCoolingStageOffSupplyAirSetpointTemperature( |
| 193 | 18 | coolingStageOffSupplyAirSetpointTemperature); | |
| 194 | } | ||
| 195 | |||
| 196 | 3 | bool SetpointManagerSingleZoneOneStageCooling::setControlZone(const ThermalZone& thermalZone) { | |
| 197 |
1/1✓ Branch 3 taken 3 times.
|
3 | return getImpl<detail::SetpointManagerSingleZoneOneStageCooling_Impl>()->setControlZone(thermalZone); |
| 198 | } | ||
| 199 | |||
| 200 | 3 | void SetpointManagerSingleZoneOneStageCooling::resetControlZone() { | |
| 201 |
1/1✓ Branch 3 taken 3 times.
|
3 | getImpl<detail::SetpointManagerSingleZoneOneStageCooling_Impl>()->resetControlZone(); |
| 202 | 3 | } | |
| 203 | |||
| 204 | /// @cond | ||
| 205 | 12 | SetpointManagerSingleZoneOneStageCooling::SetpointManagerSingleZoneOneStageCooling( | |
| 206 | 12 | std::shared_ptr<detail::SetpointManagerSingleZoneOneStageCooling_Impl> impl) | |
| 207 |
1/1✓ Branch 3 taken 12 times.
|
12 | : SetpointManager(std::move(impl)) {} |
| 208 | /// @endcond | ||
| 209 | |||
| 210 | } // namespace model | ||
| 211 | } // namespace openstudio | ||
| 212 |