src/model/AvailabilityManagerDifferentialThermostat.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 "AvailabilityManagerDifferentialThermostat.hpp" | ||
| 7 | #include "AvailabilityManagerDifferentialThermostat_Impl.hpp" | ||
| 8 | #include "Node.hpp" | ||
| 9 | #include "Node_Impl.hpp" | ||
| 10 | #include <utilities/idd/IddEnums.hxx> | ||
| 11 | #include <utilities/idd/OS_AvailabilityManager_DifferentialThermostat_FieldEnums.hxx> | ||
| 12 | #include "../utilities/units/Unit.hpp" | ||
| 13 | #include "../utilities/core/Assert.hpp" | ||
| 14 | |||
| 15 | namespace openstudio { | ||
| 16 | namespace model { | ||
| 17 | |||
| 18 | namespace detail { | ||
| 19 | |||
| 20 | 4 | AvailabilityManagerDifferentialThermostat_Impl::AvailabilityManagerDifferentialThermostat_Impl(const IdfObject& idfObject, Model_Impl* model, | |
| 21 | 4 | bool keepHandle) | |
| 22 | 4 | : AvailabilityManager_Impl(idfObject, model, keepHandle) { | |
| 23 |
4/6✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 7 taken 4 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 4 times.
✗ Branch 13 not taken.
|
4 | OS_ASSERT(idfObject.iddObject().type() == AvailabilityManagerDifferentialThermostat::iddObjectType()); |
| 24 | 4 | } | |
| 25 | |||
| 26 | ✗ | AvailabilityManagerDifferentialThermostat_Impl::AvailabilityManagerDifferentialThermostat_Impl( | |
| 27 | ✗ | const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, bool keepHandle) | |
| 28 | ✗ | : AvailabilityManager_Impl(other, model, keepHandle) { | |
| 29 | ✗ | OS_ASSERT(other.iddObject().type() == AvailabilityManagerDifferentialThermostat::iddObjectType()); | |
| 30 | ✗ | } | |
| 31 | |||
| 32 | 8 | AvailabilityManagerDifferentialThermostat_Impl::AvailabilityManagerDifferentialThermostat_Impl( | |
| 33 | 8 | const AvailabilityManagerDifferentialThermostat_Impl& other, Model_Impl* model, bool keepHandle) | |
| 34 | 8 | : AvailabilityManager_Impl(other, model, keepHandle) {} | |
| 35 | |||
| 36 | ✗ | const std::vector<std::string>& AvailabilityManagerDifferentialThermostat_Impl::outputVariableNames() const { | |
| 37 | ✗ | static const std::vector<std::string> result{"Availability Manager Differential Thermostat Control Status"}; | |
| 38 | ✗ | return result; | |
| 39 | ✗ | } | |
| 40 | |||
| 41 | 1 | IddObjectType AvailabilityManagerDifferentialThermostat_Impl::iddObjectType() const { | |
| 42 | 1 | return AvailabilityManagerDifferentialThermostat::iddObjectType(); | |
| 43 | } | ||
| 44 | |||
| 45 | ✗ | boost::optional<Node> AvailabilityManagerDifferentialThermostat_Impl::hotNode() const { | |
| 46 | ✗ | return getObject<ModelObject>().getModelObjectTarget<Node>(OS_AvailabilityManager_DifferentialThermostatFields::HotNode); | |
| 47 | } | ||
| 48 | |||
| 49 | ✗ | boost::optional<Node> AvailabilityManagerDifferentialThermostat_Impl::coldNode() const { | |
| 50 | ✗ | return getObject<ModelObject>().getModelObjectTarget<Node>(OS_AvailabilityManager_DifferentialThermostatFields::ColdNode); | |
| 51 | } | ||
| 52 | |||
| 53 | ✗ | double AvailabilityManagerDifferentialThermostat_Impl::temperatureDifferenceOnLimit() const { | |
| 54 | ✗ | boost::optional<double> value = getDouble(OS_AvailabilityManager_DifferentialThermostatFields::TemperatureDifferenceOnLimit, true); | |
| 55 | ✗ | OS_ASSERT(value); | |
| 56 | ✗ | return value.get(); | |
| 57 | } | ||
| 58 | |||
| 59 | ✗ | double AvailabilityManagerDifferentialThermostat_Impl::temperatureDifferenceOffLimit() const { | |
| 60 | ✗ | boost::optional<double> value = getDouble(OS_AvailabilityManager_DifferentialThermostatFields::TemperatureDifferenceOffLimit, true); | |
| 61 | ✗ | OS_ASSERT(value); | |
| 62 | ✗ | return value.get(); | |
| 63 | } | ||
| 64 | |||
| 65 | ✗ | bool AvailabilityManagerDifferentialThermostat_Impl::setHotNode(const boost::optional<Node>& node) { | |
| 66 | ✗ | bool result(false); | |
| 67 | ✗ | if (node) { | |
| 68 | ✗ | result = setPointer(OS_AvailabilityManager_DifferentialThermostatFields::HotNode, node.get().handle()); | |
| 69 | } else { | ||
| 70 | ✗ | resetHotNode(); | |
| 71 | ✗ | result = true; | |
| 72 | } | ||
| 73 | ✗ | return result; | |
| 74 | } | ||
| 75 | |||
| 76 | ✗ | void AvailabilityManagerDifferentialThermostat_Impl::resetHotNode() { | |
| 77 | ✗ | bool result = setString(OS_AvailabilityManager_DifferentialThermostatFields::HotNode, ""); | |
| 78 | ✗ | OS_ASSERT(result); | |
| 79 | ✗ | } | |
| 80 | |||
| 81 | ✗ | bool AvailabilityManagerDifferentialThermostat_Impl::setColdNode(const boost::optional<Node>& node) { | |
| 82 | ✗ | bool result(false); | |
| 83 | ✗ | if (node) { | |
| 84 | ✗ | result = setPointer(OS_AvailabilityManager_DifferentialThermostatFields::ColdNode, node.get().handle()); | |
| 85 | } else { | ||
| 86 | ✗ | resetColdNode(); | |
| 87 | ✗ | result = true; | |
| 88 | } | ||
| 89 | ✗ | return result; | |
| 90 | } | ||
| 91 | |||
| 92 | ✗ | void AvailabilityManagerDifferentialThermostat_Impl::resetColdNode() { | |
| 93 | ✗ | bool result = setString(OS_AvailabilityManager_DifferentialThermostatFields::ColdNode, ""); | |
| 94 | ✗ | OS_ASSERT(result); | |
| 95 | ✗ | } | |
| 96 | |||
| 97 | 4 | bool AvailabilityManagerDifferentialThermostat_Impl::setTemperatureDifferenceOnLimit(double temperatureDifferenceOnLimit) { | |
| 98 | 4 | bool result = setDouble(OS_AvailabilityManager_DifferentialThermostatFields::TemperatureDifferenceOnLimit, temperatureDifferenceOnLimit); | |
| 99 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | OS_ASSERT(result); |
| 100 | 4 | return result; | |
| 101 | } | ||
| 102 | |||
| 103 | 4 | bool AvailabilityManagerDifferentialThermostat_Impl::setTemperatureDifferenceOffLimit(double temperatureDifferenceOffLimit) { | |
| 104 | 4 | bool result = setDouble(OS_AvailabilityManager_DifferentialThermostatFields::TemperatureDifferenceOffLimit, temperatureDifferenceOffLimit); | |
| 105 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | OS_ASSERT(result); |
| 106 | 4 | return result; | |
| 107 | } | ||
| 108 | |||
| 109 | } // namespace detail | ||
| 110 | |||
| 111 | 4 | AvailabilityManagerDifferentialThermostat::AvailabilityManagerDifferentialThermostat(const Model& model) | |
| 112 | 4 | : AvailabilityManager(AvailabilityManagerDifferentialThermostat::iddObjectType(), model) { | |
| 113 |
1/3✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
✗ Branch 5 not taken.
|
4 | OS_ASSERT(getImpl<detail::AvailabilityManagerDifferentialThermostat_Impl>()); |
| 114 | |||
| 115 |
1/1✓ Branch 1 taken 4 times.
|
4 | setTemperatureDifferenceOnLimit(10.0); |
| 116 |
1/1✓ Branch 1 taken 4 times.
|
4 | setTemperatureDifferenceOffLimit(2.0); |
| 117 | 4 | } | |
| 118 | |||
| 119 | 7737 | IddObjectType AvailabilityManagerDifferentialThermostat::iddObjectType() { | |
| 120 |
1/1✓ Branch 1 taken 7737 times.
|
7737 | return {IddObjectType::OS_AvailabilityManager_DifferentialThermostat}; |
| 121 | } | ||
| 122 | |||
| 123 | ✗ | boost::optional<Node> AvailabilityManagerDifferentialThermostat::hotNode() const { | |
| 124 | ✗ | return getImpl<detail::AvailabilityManagerDifferentialThermostat_Impl>()->hotNode(); | |
| 125 | } | ||
| 126 | |||
| 127 | ✗ | boost::optional<Node> AvailabilityManagerDifferentialThermostat::coldNode() const { | |
| 128 | ✗ | return getImpl<detail::AvailabilityManagerDifferentialThermostat_Impl>()->coldNode(); | |
| 129 | } | ||
| 130 | |||
| 131 | ✗ | double AvailabilityManagerDifferentialThermostat::temperatureDifferenceOnLimit() const { | |
| 132 | ✗ | return getImpl<detail::AvailabilityManagerDifferentialThermostat_Impl>()->temperatureDifferenceOnLimit(); | |
| 133 | } | ||
| 134 | |||
| 135 | ✗ | double AvailabilityManagerDifferentialThermostat::temperatureDifferenceOffLimit() const { | |
| 136 | ✗ | return getImpl<detail::AvailabilityManagerDifferentialThermostat_Impl>()->temperatureDifferenceOffLimit(); | |
| 137 | } | ||
| 138 | |||
| 139 | ✗ | bool AvailabilityManagerDifferentialThermostat::setHotNode(const Node& node) { | |
| 140 | ✗ | return getImpl<detail::AvailabilityManagerDifferentialThermostat_Impl>()->setHotNode(node); | |
| 141 | } | ||
| 142 | |||
| 143 | ✗ | void AvailabilityManagerDifferentialThermostat::resetHotNode() { | |
| 144 | ✗ | getImpl<detail::AvailabilityManagerDifferentialThermostat_Impl>()->resetHotNode(); | |
| 145 | ✗ | } | |
| 146 | |||
| 147 | ✗ | bool AvailabilityManagerDifferentialThermostat::setColdNode(const Node& node) { | |
| 148 | ✗ | return getImpl<detail::AvailabilityManagerDifferentialThermostat_Impl>()->setColdNode(node); | |
| 149 | } | ||
| 150 | |||
| 151 | ✗ | void AvailabilityManagerDifferentialThermostat::resetColdNode() { | |
| 152 | ✗ | getImpl<detail::AvailabilityManagerDifferentialThermostat_Impl>()->resetColdNode(); | |
| 153 | ✗ | } | |
| 154 | |||
| 155 | 4 | bool AvailabilityManagerDifferentialThermostat::setTemperatureDifferenceOnLimit(double temperatureDifferenceOnLimit) { | |
| 156 |
1/1✓ Branch 3 taken 4 times.
|
4 | return getImpl<detail::AvailabilityManagerDifferentialThermostat_Impl>()->setTemperatureDifferenceOnLimit(temperatureDifferenceOnLimit); |
| 157 | } | ||
| 158 | |||
| 159 | 4 | bool AvailabilityManagerDifferentialThermostat::setTemperatureDifferenceOffLimit(double temperatureDifferenceOffLimit) { | |
| 160 |
1/1✓ Branch 3 taken 4 times.
|
4 | return getImpl<detail::AvailabilityManagerDifferentialThermostat_Impl>()->setTemperatureDifferenceOffLimit(temperatureDifferenceOffLimit); |
| 161 | } | ||
| 162 | |||
| 163 | /// @cond | ||
| 164 | ✗ | AvailabilityManagerDifferentialThermostat::AvailabilityManagerDifferentialThermostat( | |
| 165 | ✗ | std::shared_ptr<detail::AvailabilityManagerDifferentialThermostat_Impl> impl) | |
| 166 | ✗ | : AvailabilityManager(std::move(impl)) {} | |
| 167 | /// @endcond | ||
| 168 | |||
| 169 | } // namespace model | ||
| 170 | } // namespace openstudio | ||
| 171 |