| 1201 | } |
| 1202 | |
| 1203 | Schedule Model_Impl::alwaysOnContinuousSchedule() const { |
| 1204 | std::string alwaysOnName = this->alwaysOnContinuousScheduleName(); |
| 1205 | |
| 1206 | std::vector<ScheduleConstant> schedules = model().getConcreteModelObjects<ScheduleConstant>(); |
| 1207 | |
| 1208 | for (const auto& schedule : schedules) { |
| 1209 | if (boost::optional<std::string> name = schedule.name()) { |
| 1210 | if (istringEqual(name.get(), alwaysOnName)) { |
| 1211 | // DLM: if a schedule matches the name but not these other properties we should reclaim the name or at least warn |
| 1212 | |
| 1213 | if (equal<double>(schedule.value(), 1.0)) { |
| 1214 | if (boost::optional<ScheduleTypeLimits> limits = schedule.scheduleTypeLimits()) { |
| 1215 | if (boost::optional<std::string> type = limits->numericType()) { |
| 1216 | if (istringEqual(type.get(), "Continuous")) { |
| 1217 | return schedule; |
| 1218 | } |
| 1219 | } |
| 1220 | } |
| 1221 | } |
| 1222 | } |
| 1223 | } |
| 1224 | } |
| 1225 | |
| 1226 | ScheduleConstant schedule(model()); |
| 1227 | |
| 1228 | schedule.setName(alwaysOnName); |
| 1229 | |
| 1230 | ScheduleTypeLimits limits(model()); |
| 1231 | |
| 1232 | limits.setName("Fractional"); |
| 1233 | |
| 1234 | limits.setNumericType("Continuous"); |
| 1235 | |
| 1236 | limits.setUnitType(""); |
| 1237 | |
| 1238 | limits.setLowerLimitValue(0.0); |
| 1239 | |
| 1240 | limits.setUpperLimitValue(1.0); |
| 1241 | |
| 1242 | schedule.setScheduleTypeLimits(limits); |
| 1243 | |
| 1244 | schedule.setValue(1.0); |
| 1245 | |
| 1246 | return std::move(schedule); |
| 1247 | } |
| 1248 | |
| 1249 | std::string Model_Impl::alwaysOnContinuousScheduleName() const { |
| 1250 | return "Always On Continuous"; |