src/model/AvailabilityManagerLowTemperatureTurnOff.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 "AvailabilityManagerLowTemperatureTurnOff.hpp" | ||
| 7 | #include "AvailabilityManagerLowTemperatureTurnOff_Impl.hpp" | ||
| 8 | #include "Model.hpp" | ||
| 9 | #include "Node.hpp" | ||
| 10 | #include "Node_Impl.hpp" | ||
| 11 | #include "Schedule.hpp" | ||
| 12 | #include "Schedule_Impl.hpp" | ||
| 13 | #include <utilities/idd/IddEnums.hxx> | ||
| 14 | #include <utilities/idd/OS_AvailabilityManager_LowTemperatureTurnOff_FieldEnums.hxx> | ||
| 15 | #include "../utilities/units/Unit.hpp" | ||
| 16 | #include "../utilities/core/Assert.hpp" | ||
| 17 | |||
| 18 | namespace openstudio { | ||
| 19 | namespace model { | ||
| 20 | |||
| 21 | namespace detail { | ||
| 22 | |||
| 23 | 8 | AvailabilityManagerLowTemperatureTurnOff_Impl::AvailabilityManagerLowTemperatureTurnOff_Impl(const IdfObject& idfObject, Model_Impl* model, | |
| 24 | 8 | bool keepHandle) | |
| 25 | 8 | : AvailabilityManager_Impl(idfObject, model, keepHandle) { | |
| 26 |
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() == AvailabilityManagerLowTemperatureTurnOff::iddObjectType()); |
| 27 | 8 | } | |
| 28 | |||
| 29 | ✗ | AvailabilityManagerLowTemperatureTurnOff_Impl::AvailabilityManagerLowTemperatureTurnOff_Impl( | |
| 30 | ✗ | const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, bool keepHandle) | |
| 31 | ✗ | : AvailabilityManager_Impl(other, model, keepHandle) { | |
| 32 | ✗ | OS_ASSERT(other.iddObject().type() == AvailabilityManagerLowTemperatureTurnOff::iddObjectType()); | |
| 33 | ✗ | } | |
| 34 | |||
| 35 | 10 | AvailabilityManagerLowTemperatureTurnOff_Impl::AvailabilityManagerLowTemperatureTurnOff_Impl( | |
| 36 | 10 | const AvailabilityManagerLowTemperatureTurnOff_Impl& other, Model_Impl* model, bool keepHandle) | |
| 37 | 10 | : AvailabilityManager_Impl(other, model, keepHandle) {} | |
| 38 | |||
| 39 | ✗ | const std::vector<std::string>& AvailabilityManagerLowTemperatureTurnOff_Impl::outputVariableNames() const { | |
| 40 | ✗ | static const std::vector<std::string> result{"Availability Manager Low Temperature Turn Off Control Status"}; | |
| 41 | ✗ | return result; | |
| 42 | ✗ | } | |
| 43 | |||
| 44 | 3 | IddObjectType AvailabilityManagerLowTemperatureTurnOff_Impl::iddObjectType() const { | |
| 45 | 3 | return AvailabilityManagerLowTemperatureTurnOff::iddObjectType(); | |
| 46 | } | ||
| 47 | |||
| 48 | ✗ | std::vector<ScheduleTypeKey> AvailabilityManagerLowTemperatureTurnOff_Impl::getScheduleTypeKeys(const Schedule& schedule) const { | |
| 49 | ✗ | std::vector<ScheduleTypeKey> result; | |
| 50 | ✗ | UnsignedVector fieldIndices = getSourceIndices(schedule.handle()); | |
| 51 | ✗ | UnsignedVector::const_iterator b(fieldIndices.begin()); | |
| 52 | ✗ | UnsignedVector::const_iterator e(fieldIndices.end()); | |
| 53 | ✗ | if (std::find(b, e, OS_AvailabilityManager_LowTemperatureTurnOffFields::ApplicabilityScheduleName) != e) { | |
| 54 | ✗ | result.push_back(ScheduleTypeKey("AvailabilityManagerLowTemperatureTurnOff", "Applicability Schedule")); | |
| 55 | } | ||
| 56 | ✗ | return result; | |
| 57 | ✗ | } | |
| 58 | |||
| 59 | 11 | boost::optional<Node> AvailabilityManagerLowTemperatureTurnOff_Impl::sensorNode() const { | |
| 60 |
2/2✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
|
11 | return getObject<ModelObject>().getModelObjectTarget<Node>(OS_AvailabilityManager_LowTemperatureTurnOffFields::SensorNodeName); |
| 61 | } | ||
| 62 | |||
| 63 | 4 | double AvailabilityManagerLowTemperatureTurnOff_Impl::temperature() const { | |
| 64 |
1/1✓ Branch 1 taken 4 times.
|
4 | boost::optional<double> value = getDouble(OS_AvailabilityManager_LowTemperatureTurnOffFields::Temperature, true); |
| 65 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 4 not taken.
|
4 | OS_ASSERT(value); |
| 66 |
1/1✓ Branch 1 taken 4 times.
|
8 | return value.get(); |
| 67 | } | ||
| 68 | |||
| 69 | 4 | bool AvailabilityManagerLowTemperatureTurnOff_Impl::setSensorNode(const Node& node) { | |
| 70 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | bool result = setPointer(OS_AvailabilityManager_LowTemperatureTurnOffFields::SensorNodeName, node.handle()); |
| 71 | 4 | return result; | |
| 72 | } | ||
| 73 | |||
| 74 | 1 | void AvailabilityManagerLowTemperatureTurnOff_Impl::resetSensorNode() { | |
| 75 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | bool result = setString(OS_AvailabilityManager_LowTemperatureTurnOffFields::SensorNodeName, ""); |
| 76 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
|
1 | OS_ASSERT(result); |
| 77 | 1 | } | |
| 78 | |||
| 79 | 10 | bool AvailabilityManagerLowTemperatureTurnOff_Impl::setTemperature(double temperature) { | |
| 80 | 10 | bool result = setDouble(OS_AvailabilityManager_LowTemperatureTurnOffFields::Temperature, temperature); | |
| 81 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10 times.
|
10 | OS_ASSERT(result); |
| 82 | 10 | return result; | |
| 83 | } | ||
| 84 | |||
| 85 | 4 | Schedule AvailabilityManagerLowTemperatureTurnOff_Impl::applicabilitySchedule() const { | |
| 86 |
1/1✓ Branch 1 taken 4 times.
|
4 | boost::optional<Schedule> value = optionalApplicabilitySchedule(); |
| 87 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
|
4 | if (!value) { |
| 88 | ✗ | LOG_AND_THROW(briefDescription() << " does not have an Applicability Schedule attached."); | |
| 89 | } | ||
| 90 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
8 | return value.get(); |
| 91 | 4 | } | |
| 92 | |||
| 93 | 4 | boost::optional<Schedule> AvailabilityManagerLowTemperatureTurnOff_Impl::optionalApplicabilitySchedule() const { | |
| 94 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
4 | return getObject<ModelObject>().getModelObjectTarget<Schedule>(OS_AvailabilityManager_LowTemperatureTurnOffFields::ApplicabilityScheduleName); |
| 95 | } | ||
| 96 | |||
| 97 | 10 | bool AvailabilityManagerLowTemperatureTurnOff_Impl::setApplicabilitySchedule(Schedule& schedule) { | |
| 98 |
3/3✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
✓ Branch 7 taken 10 times.
|
40 | bool result = setSchedule(OS_AvailabilityManager_LowTemperatureTurnOffFields::ApplicabilityScheduleName, |
| 99 | "AvailabilityManagerLowTemperatureTurnOff", "Applicability Schedule", schedule); | ||
| 100 | 10 | return result; | |
| 101 | } | ||
| 102 | |||
| 103 | } // namespace detail | ||
| 104 | |||
| 105 | 8 | AvailabilityManagerLowTemperatureTurnOff::AvailabilityManagerLowTemperatureTurnOff(const Model& model) | |
| 106 | 8 | : AvailabilityManager(AvailabilityManagerLowTemperatureTurnOff::iddObjectType(), model) { | |
| 107 |
1/3✗ Branch 2 not taken.
✓ Branch 3 taken 8 times.
✗ Branch 5 not taken.
|
8 | OS_ASSERT(getImpl<detail::AvailabilityManagerLowTemperatureTurnOff_Impl>()); |
| 108 | |||
| 109 | // Set Applicability Schedule to alwaysOnDiscreteSchedule | ||
| 110 | { | ||
| 111 |
1/1✓ Branch 1 taken 8 times.
|
8 | auto schedule = model.alwaysOnDiscreteSchedule(); |
| 112 |
1/1✓ Branch 1 taken 8 times.
|
8 | setApplicabilitySchedule(schedule); |
| 113 | 8 | } | |
| 114 |
1/1✓ Branch 1 taken 8 times.
|
8 | setTemperature(30); |
| 115 | 8 | } | |
| 116 | |||
| 117 | 7617 | IddObjectType AvailabilityManagerLowTemperatureTurnOff::iddObjectType() { | |
| 118 |
1/1✓ Branch 1 taken 7617 times.
|
7617 | return {IddObjectType::OS_AvailabilityManager_LowTemperatureTurnOff}; |
| 119 | } | ||
| 120 | |||
| 121 | 11 | boost::optional<Node> AvailabilityManagerLowTemperatureTurnOff::sensorNode() const { | |
| 122 |
1/1✓ Branch 3 taken 11 times.
|
11 | return getImpl<detail::AvailabilityManagerLowTemperatureTurnOff_Impl>()->sensorNode(); |
| 123 | } | ||
| 124 | |||
| 125 | 4 | double AvailabilityManagerLowTemperatureTurnOff::temperature() const { | |
| 126 |
1/1✓ Branch 3 taken 4 times.
|
4 | return getImpl<detail::AvailabilityManagerLowTemperatureTurnOff_Impl>()->temperature(); |
| 127 | } | ||
| 128 | |||
| 129 | 4 | bool AvailabilityManagerLowTemperatureTurnOff::setSensorNode(const Node& node) { | |
| 130 |
1/1✓ Branch 3 taken 4 times.
|
4 | return getImpl<detail::AvailabilityManagerLowTemperatureTurnOff_Impl>()->setSensorNode(node); |
| 131 | } | ||
| 132 | |||
| 133 | 1 | void AvailabilityManagerLowTemperatureTurnOff::resetSensorNode() { | |
| 134 |
1/1✓ Branch 3 taken 1 time.
|
1 | getImpl<detail::AvailabilityManagerLowTemperatureTurnOff_Impl>()->resetSensorNode(); |
| 135 | 1 | } | |
| 136 | |||
| 137 | 10 | bool AvailabilityManagerLowTemperatureTurnOff::setTemperature(double temperature) { | |
| 138 |
1/1✓ Branch 3 taken 10 times.
|
10 | return getImpl<detail::AvailabilityManagerLowTemperatureTurnOff_Impl>()->setTemperature(temperature); |
| 139 | } | ||
| 140 | |||
| 141 | 4 | Schedule AvailabilityManagerLowTemperatureTurnOff::applicabilitySchedule() const { | |
| 142 |
1/1✓ Branch 3 taken 4 times.
|
4 | return getImpl<detail::AvailabilityManagerLowTemperatureTurnOff_Impl>()->applicabilitySchedule(); |
| 143 | } | ||
| 144 | |||
| 145 | 10 | bool AvailabilityManagerLowTemperatureTurnOff::setApplicabilitySchedule(Schedule& schedule) { | |
| 146 |
1/1✓ Branch 3 taken 10 times.
|
10 | return getImpl<detail::AvailabilityManagerLowTemperatureTurnOff_Impl>()->setApplicabilitySchedule(schedule); |
| 147 | } | ||
| 148 | |||
| 149 | /// @cond | ||
| 150 | 2 | AvailabilityManagerLowTemperatureTurnOff::AvailabilityManagerLowTemperatureTurnOff( | |
| 151 | 2 | std::shared_ptr<detail::AvailabilityManagerLowTemperatureTurnOff_Impl> impl) | |
| 152 |
1/1✓ Branch 2 taken 2 times.
|
2 | : AvailabilityManager(impl) {} |
| 153 | /// @endcond | ||
| 154 | |||
| 155 | } // namespace model | ||
| 156 | } // namespace openstudio | ||
| 157 |