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