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