src/model/ScheduleFixedInterval.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 "ScheduleFixedInterval.hpp" | ||
| 7 | #include "ScheduleFixedInterval_Impl.hpp" | ||
| 8 | #include "Model.hpp" | ||
| 9 | #include "ModelExtensibleGroup.hpp" | ||
| 10 | |||
| 11 | #include "ScheduleTypeLimits.hpp" | ||
| 12 | #include "ScheduleTypeLimits_Impl.hpp" | ||
| 13 | #include "YearDescription.hpp" | ||
| 14 | #include "YearDescription_Impl.hpp" | ||
| 15 | |||
| 16 | #include <utilities/idd/OS_Schedule_FixedInterval_FieldEnums.hxx> | ||
| 17 | #include <utilities/idd/IddEnums.hxx> | ||
| 18 | |||
| 19 | #include "../utilities/time/DateTime.hpp" | ||
| 20 | #include "../utilities/data/TimeSeries.hpp" | ||
| 21 | #include "../utilities/core/Assert.hpp" | ||
| 22 | |||
| 23 | namespace openstudio { | ||
| 24 | namespace model { | ||
| 25 | |||
| 26 | namespace detail { | ||
| 27 | |||
| 28 | 12 | ScheduleFixedInterval_Impl::ScheduleFixedInterval_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle) | |
| 29 | 12 | : ScheduleInterval_Impl(idfObject, model, keepHandle) { | |
| 30 |
4/6✓ Branch 1 taken 12 times.
✓ Branch 4 taken 12 times.
✓ Branch 7 taken 12 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 12 times.
✗ Branch 13 not taken.
|
12 | OS_ASSERT(idfObject.iddObject().type() == ScheduleFixedInterval::iddObjectType()); |
| 31 | 12 | } | |
| 32 | |||
| 33 | ✗ | ScheduleFixedInterval_Impl::ScheduleFixedInterval_Impl(const openstudio::detail::WorkspaceObject_Impl& other, Model_Impl* model, bool keepHandle) | |
| 34 | ✗ | : ScheduleInterval_Impl(other, model, keepHandle) { | |
| 35 | ✗ | OS_ASSERT(other.iddObject().type() == ScheduleFixedInterval::iddObjectType()); | |
| 36 | ✗ | } | |
| 37 | |||
| 38 | 9 | ScheduleFixedInterval_Impl::ScheduleFixedInterval_Impl(const ScheduleFixedInterval_Impl& other, Model_Impl* model, bool keepHandle) | |
| 39 | 9 | : ScheduleInterval_Impl(other, model, keepHandle) {} | |
| 40 | |||
| 41 | ✗ | IddObjectType ScheduleFixedInterval_Impl::iddObjectType() const { | |
| 42 | ✗ | return ScheduleFixedInterval::iddObjectType(); | |
| 43 | } | ||
| 44 | |||
| 45 | 9 | boost::optional<ScheduleTypeLimits> ScheduleFixedInterval_Impl::scheduleTypeLimits() const { | |
| 46 |
2/2✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
|
9 | return getObject<ModelObject>().getModelObjectTarget<ScheduleTypeLimits>(OS_Schedule_FixedIntervalFields::ScheduleTypeLimitsName); |
| 47 | } | ||
| 48 | |||
| 49 | ✗ | bool ScheduleFixedInterval_Impl::setScheduleTypeLimits(const ScheduleTypeLimits& scheduleTypeLimits) { | |
| 50 | ✗ | if (scheduleTypeLimits.model() != model()) { | |
| 51 | ✗ | return false; | |
| 52 | } | ||
| 53 | ✗ | if (!candidateIsCompatibleWithCurrentUse(scheduleTypeLimits)) { | |
| 54 | ✗ | return false; | |
| 55 | } | ||
| 56 | ✗ | return setPointer(OS_Schedule_FixedIntervalFields::ScheduleTypeLimitsName, scheduleTypeLimits.handle()); | |
| 57 | } | ||
| 58 | |||
| 59 | ✗ | bool ScheduleFixedInterval_Impl::resetScheduleTypeLimits() { | |
| 60 | // can only reset if not used | ||
| 61 | ✗ | if (okToResetScheduleTypeLimits()) { | |
| 62 | ✗ | return setString(OS_Schedule_FixedIntervalFields::ScheduleTypeLimitsName, ""); | |
| 63 | } | ||
| 64 | ✗ | return false; | |
| 65 | } | ||
| 66 | |||
| 67 | 14 | openstudio::TimeSeries ScheduleFixedInterval_Impl::timeSeries() const { | |
| 68 | 14 | int year = | |
| 69 | 2009; // we need to pass assumed year in here, otherwise it uses YearDescription().assumedYear from Date.cpp which doesn't return the same assumed year (?) | ||
| 70 |
4/4✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
✓ Branch 8 taken 10 times.
✓ Branch 9 taken 4 times.
|
28 | if (boost::optional<YearDescription> yd = this->model().getOptionalUniqueModelObject<YearDescription>()) { |
| 71 |
2/2✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
|
10 | year = yd->assumedYear(); |
| 72 | 14 | } | |
| 73 | |||
| 74 |
4/4✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
✓ Branch 7 taken 14 times.
✓ Branch 10 taken 14 times.
|
14 | const Date startDate(openstudio::MonthOfYear(this->startMonth()), this->startDay(), year); |
| 75 |
2/2✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
|
14 | const Time intervalLength(0, 0, this->intervalLength()); |
| 76 | |||
| 77 |
2/2✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
|
14 | Vector values(this->numExtensibleGroups()); |
| 78 | 14 | unsigned i = 0; | |
| 79 |
4/4✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
✓ Branch 11 taken 53748 times.
✓ Branch 12 taken 14 times.
|
53762 | for (const ModelExtensibleGroup& group : castVector<ModelExtensibleGroup>(extensibleGroups())) { |
| 80 |
1/1✓ Branch 1 taken 53748 times.
|
53748 | OptionalDouble x = group.getDouble(0); |
| 81 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 53748 times.
✗ Branch 4 not taken.
|
53748 | OS_ASSERT(x); |
| 82 |
2/2✓ Branch 1 taken 53748 times.
✓ Branch 4 taken 53748 times.
|
53748 | values[i] = *x; |
| 83 | 53748 | ++i; | |
| 84 | 14 | } | |
| 85 | |||
| 86 |
2/2✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
|
14 | TimeSeries result(startDate, intervalLength, values, ""); |
| 87 |
2/2✓ Branch 1 taken 14 times.
✓ Branch 4 taken 14 times.
|
14 | result.setOutOfRangeValue(this->outOfRangeValue()); |
| 88 | |||
| 89 | 28 | return result; | |
| 90 | 14 | } | |
| 91 | |||
| 92 | 13 | bool ScheduleFixedInterval_Impl::setTimeSeries(const openstudio::TimeSeries& timeSeries) { | |
| 93 | // check the interval | ||
| 94 |
1/1✓ Branch 1 taken 13 times.
|
13 | boost::optional<openstudio::Time> intervalTime = timeSeries.intervalLength(); |
| 95 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 13 times.
|
13 | if (!intervalTime) { |
| 96 | ✗ | return false; | |
| 97 | } | ||
| 98 | |||
| 99 | 26 | auto intervalLengthAsInteger = [](const double value) -> int { | |
| 100 | 26 | double integralPart = 0.0; | |
| 101 |
1/2✓ Branch 0 taken 26 times.
✗ Branch 1 not taken.
|
26 | if (std::modf(value, &integralPart) == 0.0) { |
| 102 | // The intervalLength is actually an int, not a double | ||
| 103 | 26 | return static_cast<int>(integralPart); | |
| 104 | } | ||
| 105 | ✗ | return -1; | |
| 106 | }; | ||
| 107 | |||
| 108 | // check the interval | ||
| 109 |
2/2✓ Branch 1 taken 13 times.
✓ Branch 4 taken 13 times.
|
13 | const double intervalLengthDouble = intervalTime->totalMinutes(); |
| 110 | 13 | const int intervalLength = intervalLengthAsInteger(intervalLengthDouble); | |
| 111 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 13 times.
|
13 | if (intervalLength < 0) { |
| 112 | ✗ | return false; | |
| 113 | } | ||
| 114 | |||
| 115 | // check that first report is whole number of intervals from start date | ||
| 116 |
1/1✓ Branch 1 taken 13 times.
|
13 | const DateTime firstReportDateTime = timeSeries.firstReportDateTime(); |
| 117 |
1/1✓ Branch 1 taken 13 times.
|
13 | const DateTime startDateTime = timeSeries.startDateTime(); |
| 118 |
1/1✓ Branch 1 taken 13 times.
|
13 | const Date startDate = startDateTime.date(); |
| 119 | |||
| 120 |
1/1✓ Branch 1 taken 13 times.
|
13 | const Time firstReportTime = firstReportDateTime.time(); |
| 121 | |||
| 122 |
1/1✓ Branch 1 taken 13 times.
|
13 | const double numIntervalsToFirstReportDouble = std::max(1.0, firstReportTime.totalMinutes() / intervalLengthDouble); |
| 123 | 13 | const int numIntervalsToFirstReport = intervalLengthAsInteger(numIntervalsToFirstReportDouble); | |
| 124 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 13 times.
|
13 | if (numIntervalsToFirstReport < 0) { |
| 125 | ✗ | return false; | |
| 126 | } | ||
| 127 | |||
| 128 | // check the values | ||
| 129 |
1/1✓ Branch 1 taken 13 times.
|
13 | const openstudio::Vector values = timeSeries.values(); |
| 130 |
5/5✓ Branch 1 taken 13 times.
✓ Branch 4 taken 13 times.
✓ Branch 8 taken 44655 times.
✓ Branch 10 taken 44644 times.
✓ Branch 11 taken 11 times.
|
44655 | for (size_t pos = 0; const auto& value : values) { |
| 131 | // Check validity, cannot be NaN, Inf, etc | ||
| 132 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 2 taken 44643 times.
|
44644 | if (std::isinf(value)) { |
| 133 |
9/9✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 13 taken 1 time.
✓ Branch 16 taken 1 time.
✓ Branch 20 taken 1 time.
✓ Branch 23 taken 1 time.
✓ Branch 26 taken 1 time.
|
1 | LOG(Warn, "There is Infinity on position " << pos << " in the timeSeries provided for " << this->briefDescription()); |
| 134 | 1 | return false; | |
| 135 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 2 taken 44642 times.
|
44643 | } else if (std::isnan(value)) { |
| 136 |
9/9✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 13 taken 1 time.
✓ Branch 16 taken 1 time.
✓ Branch 20 taken 1 time.
✓ Branch 23 taken 1 time.
✓ Branch 26 taken 1 time.
|
1 | LOG(Warn, "There is a NaN on position " << pos << " in the timeSeries provided for " << this->briefDescription()); |
| 137 | 1 | return false; | |
| 138 | } | ||
| 139 | 44642 | ++pos; | |
| 140 | 15 | } | |
| 141 | |||
| 142 | // at this point we are going to change the object | ||
| 143 |
1/1✓ Branch 1 taken 11 times.
|
11 | clearExtensibleGroups(false); |
| 144 | |||
| 145 | // set the interval | ||
| 146 |
1/1✓ Branch 1 taken 11 times.
|
11 | this->setIntervalLength(intervalLength, false); |
| 147 | |||
| 148 | // set the start date | ||
| 149 |
3/3✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
✓ Branch 7 taken 11 times.
|
11 | this->setStartMonth(startDate.monthOfYear().value(), false); |
| 150 |
2/2✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
|
11 | this->setStartDay(startDate.dayOfMonth(), false); |
| 151 | |||
| 152 | // set the out of range value | ||
| 153 |
1/1✓ Branch 1 taken 11 times.
|
11 | const double outOfRangeValue = timeSeries.outOfRangeValue(); |
| 154 | |||
| 155 | // add in numIntervalsToFirstReport-1 outOfRangeValues to pad the timeseries | ||
| 156 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 11 times.
|
11 | for (int i = 0; i < numIntervalsToFirstReport - 1; ++i) { |
| 157 | ✗ | std::vector<std::string> temp; | |
| 158 | ✗ | temp.push_back(toString(outOfRangeValue)); | |
| 159 | |||
| 160 | ✗ | const auto group = pushExtensibleGroup(temp, false).cast<ModelExtensibleGroup>(); | |
| 161 | ✗ | OS_ASSERT(!group.empty()); | |
| 162 | ✗ | } | |
| 163 | |||
| 164 | // set the values | ||
| 165 |
5/5✓ Branch 1 taken 11 times.
✓ Branch 4 taken 11 times.
✓ Branch 9 taken 44633 times.
✓ Branch 11 taken 44622 times.
✓ Branch 12 taken 11 times.
|
44633 | for (const double value : values) { |
| 166 | 44622 | std::vector<std::string> temp; | |
| 167 |
2/2✓ Branch 1 taken 44622 times.
✓ Branch 4 taken 44622 times.
|
44622 | temp.push_back(toString(value)); |
| 168 | |||
| 169 |
2/2✓ Branch 1 taken 44622 times.
✓ Branch 4 taken 44622 times.
|
44622 | const auto group = pushExtensibleGroup(temp, false).cast<ModelExtensibleGroup>(); |
| 170 |
2/4✓ Branch 1 taken 44622 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 44622 times.
✗ Branch 6 not taken.
|
44622 | OS_ASSERT(!group.empty()); |
| 171 | 44633 | } | |
| 172 | |||
| 173 |
1/1✓ Branch 1 taken 11 times.
|
11 | this->emitChangeSignals(); |
| 174 | |||
| 175 | 11 | return true; | |
| 176 | 13 | } | |
| 177 | |||
| 178 | 9 | bool ScheduleFixedInterval_Impl::interpolatetoTimestep() const { | |
| 179 |
1/1✓ Branch 1 taken 9 times.
|
9 | boost::optional<std::string> value = getString(OS_Schedule_FixedIntervalFields::InterpolatetoTimestep, true); |
| 180 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 9 times.
✗ Branch 4 not taken.
|
9 | OS_ASSERT(value); |
| 181 |
3/3✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
✓ Branch 7 taken 9 times.
|
18 | return openstudio::istringEqual(value.get(), "Yes"); |
| 182 | 9 | } | |
| 183 | |||
| 184 | ✗ | bool ScheduleFixedInterval_Impl::isInterpolatetoTimestepDefaulted() const { | |
| 185 | ✗ | return isEmpty(OS_Schedule_FixedIntervalFields::InterpolatetoTimestep); | |
| 186 | } | ||
| 187 | |||
| 188 | 10 | bool ScheduleFixedInterval_Impl::translatetoScheduleFile() const { | |
| 189 |
1/1✓ Branch 1 taken 10 times.
|
10 | boost::optional<std::string> value = getString(OS_Schedule_FixedIntervalFields::TranslatetoScheduleFile, true); |
| 190 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 10 times.
✗ Branch 4 not taken.
|
10 | OS_ASSERT(value); |
| 191 |
3/3✓ Branch 1 taken 10 times.
✓ Branch 4 taken 10 times.
✓ Branch 7 taken 10 times.
|
20 | return openstudio::istringEqual(value.get(), "Yes"); |
| 192 | 10 | } | |
| 193 | |||
| 194 | ✗ | bool ScheduleFixedInterval_Impl::isTranslatetoScheduleFileDefaulted() const { | |
| 195 | ✗ | return isEmpty(OS_Schedule_FixedIntervalFields::TranslatetoScheduleFile); | |
| 196 | } | ||
| 197 | |||
| 198 | 19 | int ScheduleFixedInterval_Impl::startMonth() const { | |
| 199 |
1/1✓ Branch 1 taken 19 times.
|
19 | boost::optional<int> value = getInt(OS_Schedule_FixedIntervalFields::StartMonth, true); |
| 200 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 19 times.
✗ Branch 4 not taken.
|
19 | OS_ASSERT(value); |
| 201 |
1/1✓ Branch 1 taken 19 times.
|
38 | return value.get(); |
| 202 | } | ||
| 203 | |||
| 204 | 19 | int ScheduleFixedInterval_Impl::startDay() const { | |
| 205 |
1/1✓ Branch 1 taken 19 times.
|
19 | boost::optional<int> value = getInt(OS_Schedule_FixedIntervalFields::StartDay, true); |
| 206 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 19 times.
✗ Branch 4 not taken.
|
19 | OS_ASSERT(value); |
| 207 |
1/1✓ Branch 1 taken 19 times.
|
38 | return value.get(); |
| 208 | } | ||
| 209 | |||
| 210 | 23 | int ScheduleFixedInterval_Impl::intervalLength() const { | |
| 211 |
1/1✓ Branch 1 taken 23 times.
|
23 | boost::optional<int> value = getInt(OS_Schedule_FixedIntervalFields::IntervalLength, true); |
| 212 |
2/2✓ Branch 0 taken 21 times.
✓ Branch 1 taken 2 times.
|
23 | if (value) { |
| 213 |
1/1✓ Branch 1 taken 21 times.
|
21 | return value.get(); |
| 214 | } | ||
| 215 | 2 | return 0; | |
| 216 | } | ||
| 217 | |||
| 218 | 14 | double ScheduleFixedInterval_Impl::outOfRangeValue() const { | |
| 219 |
1/1✓ Branch 1 taken 14 times.
|
14 | boost::optional<double> value = getDouble(OS_Schedule_FixedIntervalFields::OutOfRangeValue, true); |
| 220 |
1/3✗ Branch 1 not taken.
✓ Branch 2 taken 14 times.
✗ Branch 4 not taken.
|
14 | OS_ASSERT(value); |
| 221 |
1/1✓ Branch 1 taken 14 times.
|
28 | return value.get(); |
| 222 | } | ||
| 223 | |||
| 224 | ✗ | bool ScheduleFixedInterval_Impl::isOutOfRangeValueDefaulted() const { | |
| 225 | ✗ | return isEmpty(OS_Schedule_FixedIntervalFields::OutOfRangeValue); | |
| 226 | } | ||
| 227 | |||
| 228 | ✗ | bool ScheduleFixedInterval_Impl::setInterpolatetoTimestep(bool interpolatetoTimestep, bool driverMethod) { | |
| 229 | ✗ | bool result = false; | |
| 230 | ✗ | if (interpolatetoTimestep) { | |
| 231 | ✗ | result = setString(OS_Schedule_FixedIntervalFields::InterpolatetoTimestep, "Yes", driverMethod); | |
| 232 | } else { | ||
| 233 | ✗ | result = setString(OS_Schedule_FixedIntervalFields::InterpolatetoTimestep, "No", driverMethod); | |
| 234 | } | ||
| 235 | ✗ | OS_ASSERT(result); | |
| 236 | ✗ | return result; | |
| 237 | } | ||
| 238 | |||
| 239 | ✗ | void ScheduleFixedInterval_Impl::resetInterpolatetoTimestep(bool driverMethod) { | |
| 240 | ✗ | const bool result = setString(OS_Schedule_FixedIntervalFields::InterpolatetoTimestep, "", driverMethod); | |
| 241 | ✗ | OS_ASSERT(result); | |
| 242 | ✗ | } | |
| 243 | |||
| 244 | 1 | bool ScheduleFixedInterval_Impl::setTranslatetoScheduleFile(bool translatetoScheduleFile, bool driverMethod) { | |
| 245 | 1 | bool result = false; | |
| 246 |
1/2✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
|
1 | if (translatetoScheduleFile) { |
| 247 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
3 | result = setString(OS_Schedule_FixedIntervalFields::TranslatetoScheduleFile, "Yes", driverMethod); |
| 248 | } else { | ||
| 249 | ✗ | result = setString(OS_Schedule_FixedIntervalFields::TranslatetoScheduleFile, "No", driverMethod); | |
| 250 | } | ||
| 251 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
|
1 | OS_ASSERT(result); |
| 252 | 1 | return result; | |
| 253 | } | ||
| 254 | |||
| 255 | ✗ | void ScheduleFixedInterval_Impl::resetTranslatetoScheduleFile(bool driverMethod) { | |
| 256 | ✗ | const bool result = setString(OS_Schedule_FixedIntervalFields::TranslatetoScheduleFile, "", driverMethod); | |
| 257 | ✗ | OS_ASSERT(result); | |
| 258 | ✗ | } | |
| 259 | |||
| 260 | 11 | bool ScheduleFixedInterval_Impl::setStartMonth(int startMonth, bool driverMethod) { | |
| 261 | 11 | const bool result = setInt(OS_Schedule_FixedIntervalFields::StartMonth, startMonth, driverMethod); | |
| 262 | 11 | return result; | |
| 263 | } | ||
| 264 | |||
| 265 | 11 | bool ScheduleFixedInterval_Impl::setStartDay(int startDay, bool driverMethod) { | |
| 266 | 11 | const bool result = setInt(OS_Schedule_FixedIntervalFields::StartDay, startDay, driverMethod); | |
| 267 | 11 | return result; | |
| 268 | } | ||
| 269 | |||
| 270 | 11 | bool ScheduleFixedInterval_Impl::setIntervalLength(int intervalLength, bool driverMethod) { | |
| 271 | 11 | const bool result = setDouble(OS_Schedule_FixedIntervalFields::IntervalLength, intervalLength, driverMethod); | |
| 272 | 11 | return result; | |
| 273 | } | ||
| 274 | |||
| 275 | ✗ | bool ScheduleFixedInterval_Impl::setOutOfRangeValue(double outOfRangeValue, bool driverMethod) { | |
| 276 | ✗ | const bool result = setDouble(OS_Schedule_FixedIntervalFields::OutOfRangeValue, outOfRangeValue, driverMethod); | |
| 277 | ✗ | OS_ASSERT(result); | |
| 278 | ✗ | return result; | |
| 279 | } | ||
| 280 | |||
| 281 | ✗ | void ScheduleFixedInterval_Impl::resetOutOfRangeValue(bool driverMethod) { | |
| 282 | ✗ | const bool result = setString(OS_Schedule_FixedIntervalFields::OutOfRangeValue, "", driverMethod); | |
| 283 | ✗ | OS_ASSERT(result); | |
| 284 | ✗ | } | |
| 285 | |||
| 286 | ✗ | void ScheduleFixedInterval_Impl::ensureNoLeapDays() { | |
| 287 | ✗ | boost::optional<int> month; | |
| 288 | ✗ | boost::optional<int> day; | |
| 289 | |||
| 290 | ✗ | month = getInt(OS_Schedule_FixedIntervalFields::StartMonth); | |
| 291 | ✗ | if (month && (month.get() == 2)) { | |
| 292 | ✗ | day = this->getInt(OS_Schedule_FixedIntervalFields::StartDay); | |
| 293 | ✗ | if (day && (day.get() == 29)) { | |
| 294 | ✗ | this->setInt(OS_Schedule_FixedIntervalFields::StartDay, 28); | |
| 295 | } | ||
| 296 | } | ||
| 297 | ✗ | } | |
| 298 | |||
| 299 | } // namespace detail | ||
| 300 | |||
| 301 | 12 | ScheduleFixedInterval::ScheduleFixedInterval(const Model& model) : ScheduleInterval(ScheduleFixedInterval::iddObjectType(), model) { | |
| 302 |
1/3✗ Branch 2 not taken.
✓ Branch 3 taken 12 times.
✗ Branch 5 not taken.
|
12 | OS_ASSERT(getImpl<detail::ScheduleFixedInterval_Impl>()); |
| 303 | 12 | } | |
| 304 | |||
| 305 | 7623 | IddObjectType ScheduleFixedInterval::iddObjectType() { | |
| 306 |
1/1✓ Branch 1 taken 7623 times.
|
7623 | IddObjectType result(IddObjectType::OS_Schedule_FixedInterval); |
| 307 | 7623 | return result; | |
| 308 | } | ||
| 309 | |||
| 310 | 9 | bool ScheduleFixedInterval::interpolatetoTimestep() const { | |
| 311 |
1/1✓ Branch 3 taken 9 times.
|
9 | return getImpl<detail::ScheduleFixedInterval_Impl>()->interpolatetoTimestep(); |
| 312 | } | ||
| 313 | |||
| 314 | ✗ | bool ScheduleFixedInterval::isInterpolatetoTimestepDefaulted() const { | |
| 315 | ✗ | return getImpl<detail::ScheduleFixedInterval_Impl>()->isInterpolatetoTimestepDefaulted(); | |
| 316 | } | ||
| 317 | |||
| 318 | 10 | bool ScheduleFixedInterval::translatetoScheduleFile() const { | |
| 319 |
1/1✓ Branch 3 taken 10 times.
|
10 | return getImpl<detail::ScheduleFixedInterval_Impl>()->translatetoScheduleFile(); |
| 320 | } | ||
| 321 | |||
| 322 | ✗ | bool ScheduleFixedInterval::isTranslatetoScheduleFileDefaulted() const { | |
| 323 | ✗ | return getImpl<detail::ScheduleFixedInterval_Impl>()->isTranslatetoScheduleFileDefaulted(); | |
| 324 | } | ||
| 325 | |||
| 326 | 5 | int ScheduleFixedInterval::startMonth() const { | |
| 327 |
1/1✓ Branch 3 taken 5 times.
|
5 | return getImpl<detail::ScheduleFixedInterval_Impl>()->startMonth(); |
| 328 | } | ||
| 329 | |||
| 330 | 5 | int ScheduleFixedInterval::startDay() const { | |
| 331 |
1/1✓ Branch 3 taken 5 times.
|
5 | return getImpl<detail::ScheduleFixedInterval_Impl>()->startDay(); |
| 332 | } | ||
| 333 | |||
| 334 | 9 | int ScheduleFixedInterval::intervalLength() const { | |
| 335 |
1/1✓ Branch 3 taken 9 times.
|
9 | return getImpl<detail::ScheduleFixedInterval_Impl>()->intervalLength(); |
| 336 | } | ||
| 337 | |||
| 338 | ✗ | double ScheduleFixedInterval::outOfRangeValue() const { | |
| 339 | ✗ | return getImpl<detail::ScheduleFixedInterval_Impl>()->outOfRangeValue(); | |
| 340 | } | ||
| 341 | |||
| 342 | ✗ | bool ScheduleFixedInterval::isOutOfRangeValueDefaulted() const { | |
| 343 | ✗ | return getImpl<detail::ScheduleFixedInterval_Impl>()->isOutOfRangeValueDefaulted(); | |
| 344 | } | ||
| 345 | |||
| 346 | ✗ | bool ScheduleFixedInterval::setInterpolatetoTimestep(bool interpolatetoTimestep) { | |
| 347 | ✗ | return getImpl<detail::ScheduleFixedInterval_Impl>()->setInterpolatetoTimestep(interpolatetoTimestep); | |
| 348 | } | ||
| 349 | |||
| 350 | ✗ | void ScheduleFixedInterval::resetInterpolatetoTimestep() { | |
| 351 | ✗ | getImpl<detail::ScheduleFixedInterval_Impl>()->resetInterpolatetoTimestep(); | |
| 352 | ✗ | } | |
| 353 | |||
| 354 | 1 | bool ScheduleFixedInterval::setTranslatetoScheduleFile(bool translatetoScheduleFile) { | |
| 355 |
1/1✓ Branch 3 taken 1 time.
|
1 | return getImpl<detail::ScheduleFixedInterval_Impl>()->setTranslatetoScheduleFile(translatetoScheduleFile); |
| 356 | } | ||
| 357 | |||
| 358 | ✗ | void ScheduleFixedInterval::resetTranslatetoScheduleFile() { | |
| 359 | ✗ | getImpl<detail::ScheduleFixedInterval_Impl>()->resetTranslatetoScheduleFile(); | |
| 360 | ✗ | } | |
| 361 | |||
| 362 | ✗ | bool ScheduleFixedInterval::setStartMonth(int startMonth) { | |
| 363 | ✗ | return getImpl<detail::ScheduleFixedInterval_Impl>()->setStartMonth(startMonth); | |
| 364 | } | ||
| 365 | |||
| 366 | ✗ | bool ScheduleFixedInterval::setStartDay(int startDay) { | |
| 367 | ✗ | return getImpl<detail::ScheduleFixedInterval_Impl>()->setStartDay(startDay); | |
| 368 | } | ||
| 369 | |||
| 370 | ✗ | bool ScheduleFixedInterval::setIntervalLength(int intervalLength) { | |
| 371 | ✗ | return getImpl<detail::ScheduleFixedInterval_Impl>()->setIntervalLength(intervalLength); | |
| 372 | } | ||
| 373 | |||
| 374 | ✗ | bool ScheduleFixedInterval::setOutOfRangeValue(double outOfRangeValue) { | |
| 375 | ✗ | return getImpl<detail::ScheduleFixedInterval_Impl>()->setOutOfRangeValue(outOfRangeValue); | |
| 376 | } | ||
| 377 | |||
| 378 | ✗ | void ScheduleFixedInterval::resetOutOfRangeValue() { | |
| 379 | ✗ | getImpl<detail::ScheduleFixedInterval_Impl>()->resetOutOfRangeValue(); | |
| 380 | ✗ | } | |
| 381 | |||
| 382 | /// @cond | ||
| 383 |
1/1✓ Branch 3 taken 24 times.
|
24 | ScheduleFixedInterval::ScheduleFixedInterval(std::shared_ptr<detail::ScheduleFixedInterval_Impl> impl) : ScheduleInterval(std::move(impl)) {} |
| 384 | /// @endcond | ||
| 385 | |||
| 386 | } // namespace model | ||
| 387 | } // namespace openstudio | ||
| 388 |