src/model/ScheduleTypeLimits.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 "ScheduleTypeLimits.hpp" | ||
| 7 | #include "ScheduleTypeLimits_Impl.hpp" | ||
| 8 | |||
| 9 | #include <utilities/idd/IddFactory.hxx> | ||
| 10 | |||
| 11 | #include <utilities/idd/OS_ScheduleTypeLimits_FieldEnums.hxx> | ||
| 12 | #include <utilities/idd/IddEnums.hxx> | ||
| 13 | |||
| 14 | #include "../utilities/units/Unit.hpp" | ||
| 15 | #include "../utilities/units/SIUnit.hpp" | ||
| 16 | #include "../utilities/units/IPUnit.hpp" | ||
| 17 | #include "../utilities/units/BTUUnit.hpp" | ||
| 18 | #include "../utilities/units/CFMUnit.hpp" | ||
| 19 | #include "../utilities/units/WhUnit.hpp" | ||
| 20 | #include "../utilities/units/CelsiusUnit.hpp" | ||
| 21 | #include "../utilities/units/FahrenheitUnit.hpp" | ||
| 22 | #include "../utilities/units/TemperatureUnit_Impl.hpp" | ||
| 23 | #include "../utilities/units/UnitFactory.hpp" | ||
| 24 | |||
| 25 | #include "../utilities/core/Assert.hpp" | ||
| 26 | |||
| 27 | namespace openstudio { | ||
| 28 | namespace model { | ||
| 29 | |||
| 30 | namespace detail { | ||
| 31 | |||
| 32 | 6391 | ScheduleTypeLimits_Impl::ScheduleTypeLimits_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle) | |
| 33 | 6391 | : ResourceObject_Impl(idfObject, model, keepHandle) { | |
| 34 |
4/6✓ Branch 1 taken 6391 times.
✓ Branch 4 taken 6391 times.
✓ Branch 7 taken 6391 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 6391 times.
✗ Branch 13 not taken.
|
6391 | OS_ASSERT(idfObject.iddObject().type() == ScheduleTypeLimits::iddObjectType()); |
| 35 | 6391 | } | |
| 36 | |||
| 37 | 1233 | ScheduleTypeLimits_Impl::ScheduleTypeLimits_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, bool keepHandle) | |
| 38 | 1233 | : ResourceObject_Impl(other, model, keepHandle) { | |
| 39 |
4/6✓ Branch 1 taken 1233 times.
✓ Branch 4 taken 1233 times.
✓ Branch 7 taken 1233 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 1233 times.
✗ Branch 13 not taken.
|
1233 | OS_ASSERT(other.iddObject().type() == ScheduleTypeLimits::iddObjectType()); |
| 40 | 1233 | } | |
| 41 | |||
| 42 | 2713 | ScheduleTypeLimits_Impl::ScheduleTypeLimits_Impl(const ScheduleTypeLimits_Impl& other, Model_Impl* model, bool keepHandle) | |
| 43 | 2713 | : ResourceObject_Impl(other, model, keepHandle) {} | |
| 44 | |||
| 45 | 5 | const std::vector<std::string>& ScheduleTypeLimits_Impl::outputVariableNames() const { | |
| 46 |
3/4✓ Branch 0 taken 1 time.
✓ Branch 1 taken 4 times.
✓ Branch 3 taken 1 time.
✗ Branch 4 not taken.
|
5 | static const std::vector<std::string> result; |
| 47 | 5 | return result; | |
| 48 | } | ||
| 49 | |||
| 50 | 27 | IddObjectType ScheduleTypeLimits_Impl::iddObjectType() const { | |
| 51 | 27 | return ScheduleTypeLimits::iddObjectType(); | |
| 52 | } | ||
| 53 | |||
| 54 | 12788 | boost::optional<double> ScheduleTypeLimits_Impl::lowerLimitValue() const { | |
| 55 | 12788 | return getDouble(OS_ScheduleTypeLimitsFields::LowerLimitValue, true); | |
| 56 | } | ||
| 57 | |||
| 58 | 11856 | boost::optional<double> ScheduleTypeLimits_Impl::upperLimitValue() const { | |
| 59 | 11856 | return getDouble(OS_ScheduleTypeLimitsFields::UpperLimitValue, true); | |
| 60 | } | ||
| 61 | |||
| 62 | 2571 | boost::optional<std::string> ScheduleTypeLimits_Impl::numericType() const { | |
| 63 | 2571 | return getString(OS_ScheduleTypeLimitsFields::NumericType, true, true); | |
| 64 | } | ||
| 65 | |||
| 66 | 7836 | std::string ScheduleTypeLimits_Impl::unitType() const { | |
| 67 |
1/1✓ Branch 1 taken 7836 times.
|
7836 | boost::optional<std::string> value = getString(OS_ScheduleTypeLimitsFields::UnitType, true); |
| 68 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 7836 times.
✗ Branch 4 not taken.
|
7836 | OS_ASSERT(value); |
| 69 |
2/2✓ Branch 1 taken 7836 times.
✓ Branch 4 taken 7836 times.
|
15672 | return value.get(); |
| 70 | 7836 | } | |
| 71 | |||
| 72 | 1 | bool ScheduleTypeLimits_Impl::isUnitTypeDefaulted() const { | |
| 73 | 1 | return isEmpty(OS_ScheduleTypeLimitsFields::UnitType); | |
| 74 | } | ||
| 75 | |||
| 76 | ✗ | boost::optional<Unit> ScheduleTypeLimits_Impl::units(bool returnIP) const { | |
| 77 | ✗ | return ScheduleTypeLimits::units(unitType(), returnIP); | |
| 78 | } | ||
| 79 | |||
| 80 | 4879 | bool ScheduleTypeLimits_Impl::setLowerLimitValue(double lowerLimitValue) { | |
| 81 | 4879 | bool result = false; | |
| 82 | 4879 | result = setDouble(OS_ScheduleTypeLimitsFields::LowerLimitValue, lowerLimitValue); | |
| 83 | 4879 | return result; | |
| 84 | } | ||
| 85 | |||
| 86 | 1 | void ScheduleTypeLimits_Impl::resetLowerLimitValue() { | |
| 87 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | bool result = setString(OS_ScheduleTypeLimitsFields::LowerLimitValue, ""); |
| 88 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
|
1 | OS_ASSERT(result); |
| 89 | 1 | } | |
| 90 | |||
| 91 | 4631 | bool ScheduleTypeLimits_Impl::setUpperLimitValue(double upperLimitValue) { | |
| 92 | 4631 | bool result = false; | |
| 93 | 4631 | result = setDouble(OS_ScheduleTypeLimitsFields::UpperLimitValue, upperLimitValue); | |
| 94 | 4631 | return result; | |
| 95 | } | ||
| 96 | |||
| 97 | 1 | void ScheduleTypeLimits_Impl::resetUpperLimitValue() { | |
| 98 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | bool result = setString(OS_ScheduleTypeLimitsFields::UpperLimitValue, ""); |
| 99 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
|
1 | OS_ASSERT(result); |
| 100 | 1 | } | |
| 101 | |||
| 102 | 5065 | bool ScheduleTypeLimits_Impl::setNumericType(const std::string& numericType) { | |
| 103 | 5065 | bool result = false; | |
| 104 | 5065 | result = setString(OS_ScheduleTypeLimitsFields::NumericType, numericType); | |
| 105 | 5065 | return result; | |
| 106 | } | ||
| 107 | |||
| 108 | 1 | void ScheduleTypeLimits_Impl::resetNumericType() { | |
| 109 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | bool result = setString(OS_ScheduleTypeLimitsFields::NumericType, ""); |
| 110 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
|
1 | OS_ASSERT(result); |
| 111 | 1 | } | |
| 112 | |||
| 113 | 4587 | bool ScheduleTypeLimits_Impl::setUnitType(const std::string& unitType) { | |
| 114 | 4587 | bool result = setString(OS_ScheduleTypeLimitsFields::UnitType, unitType); | |
| 115 | 4587 | return result; | |
| 116 | } | ||
| 117 | |||
| 118 | 1 | void ScheduleTypeLimits_Impl::resetUnitType() { | |
| 119 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | bool result = setString(OS_ScheduleTypeLimitsFields::UnitType, ""); |
| 120 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
|
1 | OS_ASSERT(result); |
| 121 | 1 | } | |
| 122 | |||
| 123 | } // namespace detail | ||
| 124 | |||
| 125 | 5150 | ScheduleTypeLimits::ScheduleTypeLimits(const Model& model) : ResourceObject(ScheduleTypeLimits::iddObjectType(), model) { | |
| 126 |
1/3✗ Branch 2 not taken.
✓ Branch 3 taken 5150 times.
✗ Branch 5 not taken.
|
5150 | OS_ASSERT(getImpl<detail::ScheduleTypeLimits_Impl>()); |
| 127 | 5150 | } | |
| 128 | |||
| 129 | 24075 | IddObjectType ScheduleTypeLimits::iddObjectType() { | |
| 130 |
1/1✓ Branch 1 taken 24075 times.
|
24075 | IddObjectType result(IddObjectType::OS_ScheduleTypeLimits); |
| 131 | 24075 | return result; | |
| 132 | } | ||
| 133 | |||
| 134 | ✗ | std::vector<std::string> ScheduleTypeLimits::numericTypeValues() { | |
| 135 | ✗ | return getIddKeyNames(IddFactory::instance().getObject(iddObjectType()).get(), OS_ScheduleTypeLimitsFields::NumericType); | |
| 136 | } | ||
| 137 | |||
| 138 | ✗ | std::vector<std::string> ScheduleTypeLimits::unitTypeValues() { | |
| 139 | ✗ | return getIddKeyNames(IddFactory::instance().getObject(iddObjectType()).get(), OS_ScheduleTypeLimitsFields::UnitType); | |
| 140 | } | ||
| 141 | |||
| 142 | 15658 | boost::optional<Unit> ScheduleTypeLimits::units(std::string unitType, bool returnIP) { | |
| 143 |
1/1✓ Branch 2 taken 15658 times.
|
15658 | boost::to_lower(unitType); |
| 144 | 15658 | OptionalUnit result; | |
| 145 | |||
| 146 |
13/13✓ Branch 1 taken 13543 times.
✓ Branch 2 taken 2115 times.
✓ Branch 4 taken 13543 times.
✓ Branch 6 taken 11433 times.
✓ Branch 7 taken 2110 times.
✓ Branch 9 taken 11433 times.
✓ Branch 11 taken 3419 times.
✓ Branch 12 taken 8014 times.
✓ Branch 14 taken 3419 times.
✓ Branch 16 taken 227 times.
✓ Branch 17 taken 3192 times.
✓ Branch 18 taken 12466 times.
✓ Branch 19 taken 3192 times.
|
15658 | if (unitType.empty() || (unitType == "dimensionless") || (unitType == "availability") || (unitType == "controlmode")) { |
| 147 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12466 times.
|
12466 | if (returnIP) { |
| 148 | ✗ | result = IPUnit(); | |
| 149 | } else { | ||
| 150 |
3/3✓ Branch 1 taken 12466 times.
✓ Branch 5 taken 12466 times.
✓ Branch 8 taken 12466 times.
|
24932 | result = SIUnit(); |
| 151 | } | ||
| 152 | 12466 | return result; | |
| 153 | } | ||
| 154 | |||
| 155 | 3192 | char firstLetter = unitType[0]; | |
| 156 |
9/11✓ Branch 0 taken 132 times.
✓ Branch 1 taken 58 times.
✓ Branch 2 taken 28 times.
✓ Branch 3 taken 10 times.
✓ Branch 4 taken 6 times.
✓ Branch 5 taken 52 times.
✓ Branch 6 taken 22 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 2771 times.
✓ Branch 9 taken 113 times.
✗ Branch 10 not taken.
|
3192 | switch (firstLetter) { |
| 157 | 132 | case 'a': { | |
| 158 |
2/3✓ Branch 1 taken 132 times.
✓ Branch 3 taken 132 times.
✗ Branch 4 not taken.
|
132 | if (unitType == "activitylevel") { |
| 159 |
4/4✓ Branch 1 taken 132 times.
✓ Branch 4 taken 132 times.
✓ Branch 7 taken 132 times.
✓ Branch 10 taken 132 times.
|
132 | result = (createSIPower() / createSIPeople()); |
| 160 | ✗ | } else if (unitType == "angle") { | |
| 161 | ✗ | result = createIPAngle(); | |
| 162 | } | ||
| 163 | 132 | break; | |
| 164 | } | ||
| 165 | 58 | case 'c': { | |
| 166 |
3/3✓ Branch 1 taken 58 times.
✓ Branch 3 taken 6 times.
✓ Branch 4 taken 52 times.
|
58 | if (unitType == "capacity") { |
| 167 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
|
6 | if (returnIP) { |
| 168 | ✗ | result = BTUUnit(BTUExpnt(1, 0, -1)); | |
| 169 | } else { | ||
| 170 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 4 taken 6 times.
|
6 | result = createSIPower(); |
| 171 | } | ||
| 172 |
2/3✓ Branch 1 taken 52 times.
✓ Branch 3 taken 52 times.
✗ Branch 4 not taken.
|
52 | } else if (unitType == "clothinginsulation") { |
| 173 |
3/3✓ Branch 1 taken 52 times.
✓ Branch 4 taken 52 times.
✓ Branch 7 taken 52 times.
|
52 | result = Unit(); |
| 174 |
3/3✓ Branch 1 taken 52 times.
✓ Branch 4 taken 52 times.
✓ Branch 7 taken 52 times.
|
156 | result->setBaseUnitExponent("clo", 1); |
| 175 | ✗ | } else if (unitType == "convectioncoefficient") { | |
| 176 | ✗ | if (returnIP) { | |
| 177 | ✗ | result = BTUUnit(BTUExpnt(1, -2, -1, -1)); | |
| 178 | } else { | ||
| 179 | ✗ | result = createSIThermalConductance(); | |
| 180 | } | ||
| 181 | } | ||
| 182 | 58 | break; | |
| 183 | } | ||
| 184 | 28 | case 'd': { | |
| 185 |
2/3✓ Branch 1 taken 28 times.
✓ Branch 3 taken 28 times.
✗ Branch 4 not taken.
|
28 | if (unitType == "deltatemperature") { |
| 186 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 28 times.
|
28 | if (returnIP) { |
| 187 | ✗ | result = createFahrenheitTemperature(); | |
| 188 | ✗ | result->cast<TemperatureUnit>().setAsRelative(); | |
| 189 | } else { | ||
| 190 |
2/2✓ Branch 1 taken 28 times.
✓ Branch 4 taken 28 times.
|
28 | result = createCelsiusTemperature(); |
| 191 |
3/3✓ Branch 1 taken 28 times.
✓ Branch 4 taken 28 times.
✓ Branch 7 taken 28 times.
|
28 | result->cast<TemperatureUnit>().setAsRelative(); |
| 192 | } | ||
| 193 | } | ||
| 194 | 28 | break; | |
| 195 | } | ||
| 196 | 10 | case 'l': { | |
| 197 |
2/3✓ Branch 1 taken 10 times.
✓ Branch 3 taken 10 times.
✗ Branch 4 not taken.
|
10 | if (unitType == "linearpowerdensity") { |
| 198 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10 times.
|
10 | if (returnIP) { |
| 199 | ✗ | result = (createIPPower() / createIPLength()); | |
| 200 | } else { | ||
| 201 |
4/4✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
✓ Branch 7 taken 10 times.
✓ Branch 10 taken 10 times.
|
10 | result = (createSIPower() / createSILength()); |
| 202 | } | ||
| 203 | } | ||
| 204 | 10 | break; | |
| 205 | } | ||
| 206 | 6 | case 'm': { | |
| 207 |
2/3✓ Branch 1 taken 6 times.
✓ Branch 3 taken 6 times.
✗ Branch 4 not taken.
|
6 | if (unitType == "massflowrate") { |
| 208 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
|
6 | if (returnIP) { |
| 209 | ✗ | result = IPUnit(IPExpnt(1, 0, -1)); | |
| 210 | } else { | ||
| 211 |
3/3✓ Branch 1 taken 6 times.
✓ Branch 5 taken 6 times.
✓ Branch 8 taken 6 times.
|
12 | result = SIUnit(SIExpnt(1, 0, -1)); |
| 212 | } | ||
| 213 | } | ||
| 214 | 6 | break; | |
| 215 | } | ||
| 216 | 52 | case 'p': { | |
| 217 |
3/3✓ Branch 1 taken 52 times.
✓ Branch 3 taken 38 times.
✓ Branch 4 taken 14 times.
|
52 | if (unitType == "percent") { |
| 218 |
3/3✓ Branch 1 taken 38 times.
✓ Branch 4 taken 38 times.
✓ Branch 7 taken 38 times.
|
38 | result = Unit(); |
| 219 |
3/3✓ Branch 1 taken 38 times.
✓ Branch 4 taken 38 times.
✓ Branch 7 taken 38 times.
|
114 | result->setBaseUnitExponent("%", 1); |
| 220 |
2/3✓ Branch 1 taken 14 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 14 times.
|
14 | } else if (unitType == "power") { |
| 221 | ✗ | result = createSIPower(); | |
| 222 |
2/3✓ Branch 1 taken 14 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 14 times.
|
14 | } else if (unitType == "precipitationrate") { |
| 223 | ✗ | if (returnIP) { | |
| 224 | ✗ | result = BTUUnit(BTUExpnt(0, 1, -1)); | |
| 225 | } else { | ||
| 226 | ✗ | result = WhUnit(WhExpnt(0, -1, 1)); | |
| 227 | } | ||
| 228 |
2/3✓ Branch 1 taken 14 times.
✓ Branch 3 taken 14 times.
✗ Branch 4 not taken.
|
14 | } else if (unitType == "pressure") { |
| 229 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14 times.
|
14 | if (returnIP) { |
| 230 | ✗ | result = createIPPressure(); | |
| 231 | } else { | ||
| 232 |
2/2✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
|
14 | result = createSIPressure(); |
| 233 | } | ||
| 234 | } | ||
| 235 | 52 | break; | |
| 236 | } | ||
| 237 | 22 | case 'r': { | |
| 238 |
2/3✓ Branch 1 taken 22 times.
✓ Branch 3 taken 22 times.
✗ Branch 4 not taken.
|
22 | if (unitType == "rotationsperminute") { |
| 239 |
2/2✓ Branch 1 taken 22 times.
✓ Branch 4 taken 22 times.
|
22 | result = createCFMFrequency(); |
| 240 | } | ||
| 241 | 22 | break; | |
| 242 | } | ||
| 243 | ✗ | case 's': { | |
| 244 | ✗ | if (unitType == "solarenergy") { | |
| 245 | ✗ | result = WhUnit(WhExpnt(1, 1, -2)); | |
| 246 | } | ||
| 247 | ✗ | break; | |
| 248 | } | ||
| 249 | 2771 | case 't': { | |
| 250 |
2/3✓ Branch 1 taken 2771 times.
✓ Branch 3 taken 2771 times.
✗ Branch 4 not taken.
|
2771 | if (unitType == "temperature") { |
| 251 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2771 times.
|
2771 | if (returnIP) { |
| 252 | ✗ | result = createFahrenheitTemperature(); | |
| 253 | } else { | ||
| 254 |
2/2✓ Branch 1 taken 2771 times.
✓ Branch 4 taken 2771 times.
|
2771 | result = createCelsiusTemperature(); |
| 255 | } | ||
| 256 | } | ||
| 257 | 2771 | break; | |
| 258 | } | ||
| 259 | 113 | case 'v': { | |
| 260 |
3/3✓ Branch 1 taken 113 times.
✓ Branch 3 taken 74 times.
✓ Branch 4 taken 39 times.
|
113 | if (unitType == "velocity") { |
| 261 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 74 times.
|
74 | if (returnIP) { |
| 262 | ✗ | result = CFMUnit(CFMExpnt(1, -1)); | |
| 263 | } else { | ||
| 264 |
3/3✓ Branch 1 taken 74 times.
✓ Branch 5 taken 74 times.
✓ Branch 8 taken 74 times.
|
148 | result = SIUnit(SIExpnt(0, 1, -1)); |
| 265 | } | ||
| 266 | } | ||
| 267 |
3/3✓ Branch 1 taken 113 times.
✓ Branch 3 taken 39 times.
✓ Branch 4 taken 74 times.
|
113 | if (unitType == "volumetricflowrate") { |
| 268 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 39 times.
|
39 | if (returnIP) { |
| 269 | ✗ | result = IPUnit(IPExpnt(0, 3, -1)); | |
| 270 | } else { | ||
| 271 |
3/3✓ Branch 1 taken 39 times.
✓ Branch 5 taken 39 times.
✓ Branch 8 taken 39 times.
|
78 | result = SIUnit(SIExpnt(0, 3, -1)); |
| 272 | } | ||
| 273 | } | ||
| 274 | 113 | break; | |
| 275 | } | ||
| 276 | } | ||
| 277 | |||
| 278 | 3192 | return result; | |
| 279 | ✗ | } | |
| 280 | |||
| 281 | 12788 | boost::optional<double> ScheduleTypeLimits::lowerLimitValue() const { | |
| 282 |
1/1✓ Branch 3 taken 12788 times.
|
12788 | return getImpl<detail::ScheduleTypeLimits_Impl>()->lowerLimitValue(); |
| 283 | } | ||
| 284 | |||
| 285 | 11856 | boost::optional<double> ScheduleTypeLimits::upperLimitValue() const { | |
| 286 |
1/1✓ Branch 3 taken 11856 times.
|
11856 | return getImpl<detail::ScheduleTypeLimits_Impl>()->upperLimitValue(); |
| 287 | } | ||
| 288 | |||
| 289 | 2571 | boost::optional<std::string> ScheduleTypeLimits::numericType() const { | |
| 290 |
1/1✓ Branch 3 taken 2571 times.
|
2571 | return getImpl<detail::ScheduleTypeLimits_Impl>()->numericType(); |
| 291 | } | ||
| 292 | |||
| 293 | 7836 | std::string ScheduleTypeLimits::unitType() const { | |
| 294 |
1/1✓ Branch 3 taken 7836 times.
|
7836 | return getImpl<detail::ScheduleTypeLimits_Impl>()->unitType(); |
| 295 | } | ||
| 296 | |||
| 297 | 1 | bool ScheduleTypeLimits::isUnitTypeDefaulted() const { | |
| 298 |
1/1✓ Branch 3 taken 1 time.
|
1 | return getImpl<detail::ScheduleTypeLimits_Impl>()->isUnitTypeDefaulted(); |
| 299 | } | ||
| 300 | |||
| 301 | ✗ | boost::optional<Unit> ScheduleTypeLimits::units(bool returnIP) const { | |
| 302 | ✗ | return getImpl<detail::ScheduleTypeLimits_Impl>()->units(returnIP); | |
| 303 | } | ||
| 304 | |||
| 305 | 4879 | bool ScheduleTypeLimits::setLowerLimitValue(double lowerLimitValue) { | |
| 306 |
1/1✓ Branch 3 taken 4879 times.
|
4879 | return getImpl<detail::ScheduleTypeLimits_Impl>()->setLowerLimitValue(lowerLimitValue); |
| 307 | } | ||
| 308 | |||
| 309 | 1 | void ScheduleTypeLimits::resetLowerLimitValue() { | |
| 310 |
1/1✓ Branch 3 taken 1 time.
|
1 | getImpl<detail::ScheduleTypeLimits_Impl>()->resetLowerLimitValue(); |
| 311 | 1 | } | |
| 312 | |||
| 313 | 4631 | bool ScheduleTypeLimits::setUpperLimitValue(double upperLimitValue) { | |
| 314 |
1/1✓ Branch 3 taken 4631 times.
|
4631 | return getImpl<detail::ScheduleTypeLimits_Impl>()->setUpperLimitValue(upperLimitValue); |
| 315 | } | ||
| 316 | |||
| 317 | 1 | void ScheduleTypeLimits::resetUpperLimitValue() { | |
| 318 |
1/1✓ Branch 3 taken 1 time.
|
1 | getImpl<detail::ScheduleTypeLimits_Impl>()->resetUpperLimitValue(); |
| 319 | 1 | } | |
| 320 | |||
| 321 | 5065 | bool ScheduleTypeLimits::setNumericType(const std::string& numericType) { | |
| 322 |
1/1✓ Branch 3 taken 5065 times.
|
5065 | return getImpl<detail::ScheduleTypeLimits_Impl>()->setNumericType(numericType); |
| 323 | } | ||
| 324 | |||
| 325 | 1 | void ScheduleTypeLimits::resetNumericType() { | |
| 326 |
1/1✓ Branch 3 taken 1 time.
|
1 | getImpl<detail::ScheduleTypeLimits_Impl>()->resetNumericType(); |
| 327 | 1 | } | |
| 328 | |||
| 329 | 4587 | bool ScheduleTypeLimits::setUnitType(const std::string& unitType) { | |
| 330 |
1/1✓ Branch 3 taken 4587 times.
|
4587 | return getImpl<detail::ScheduleTypeLimits_Impl>()->setUnitType(unitType); |
| 331 | } | ||
| 332 | |||
| 333 | 1 | void ScheduleTypeLimits::resetUnitType() { | |
| 334 |
1/1✓ Branch 3 taken 1 time.
|
1 | getImpl<detail::ScheduleTypeLimits_Impl>()->resetUnitType(); |
| 335 | 1 | } | |
| 336 | |||
| 337 | /// @cond | ||
| 338 |
1/1✓ Branch 3 taken 22990 times.
|
22990 | ScheduleTypeLimits::ScheduleTypeLimits(std::shared_ptr<detail::ScheduleTypeLimits_Impl> impl) : ResourceObject(std::move(impl)) {} |
| 339 | /// @endcond | ||
| 340 | |||
| 341 | 4848 | bool isCompatible(const ScheduleTypeLimits& parentLimits, const ScheduleTypeLimits& candidate) { | |
| 342 |
2/3✓ Branch 1 taken 4848 times.
✓ Branch 3 taken 4848 times.
✗ Branch 4 not taken.
|
4848 | if (candidate == parentLimits) { |
| 343 | 4848 | return true; | |
| 344 | } | ||
| 345 | |||
| 346 | // check continuous/discrete | ||
| 347 | ✗ | if (OptionalString numericType = parentLimits.numericType()) { | |
| 348 | ✗ | if (!candidate.numericType() || !istringEqual(candidate.numericType().get(), *numericType)) { | |
| 349 | ✗ | return false; | |
| 350 | } | ||
| 351 | ✗ | } | |
| 352 | |||
| 353 | // check unit type | ||
| 354 | ✗ | std::string unitType = parentLimits.unitType(); | |
| 355 | ✗ | if (parentLimits.isUnitTypeDefaulted() || istringEqual("Dimensionless", unitType)) { | |
| 356 | ✗ | if (!(candidate.isUnitTypeDefaulted() || (istringEqual("Dimensionless", candidate.unitType())))) { | |
| 357 | ✗ | return false; | |
| 358 | } | ||
| 359 | } else { | ||
| 360 | ✗ | if (!istringEqual(candidate.unitType(), unitType)) { | |
| 361 | ✗ | return false; | |
| 362 | } | ||
| 363 | } | ||
| 364 | |||
| 365 | // check lower limit | ||
| 366 | ✗ | if (parentLimits.lowerLimitValue()) { | |
| 367 | ✗ | if (!candidate.lowerLimitValue() || (candidate.lowerLimitValue().get() < parentLimits.lowerLimitValue().get())) { | |
| 368 | ✗ | return false; | |
| 369 | } | ||
| 370 | } | ||
| 371 | |||
| 372 | // check upper limit | ||
| 373 | ✗ | if (parentLimits.upperLimitValue()) { | |
| 374 | ✗ | if (!candidate.upperLimitValue() || (candidate.upperLimitValue().get() > parentLimits.upperLimitValue().get())) { | |
| 375 | ✗ | return false; | |
| 376 | } | ||
| 377 | } | ||
| 378 | |||
| 379 | // passed all checks | ||
| 380 | ✗ | return true; | |
| 381 | ✗ | } | |
| 382 | |||
| 383 | } // namespace model | ||
| 384 | } // namespace openstudio | ||
| 385 |