MCPcopy Create free account
hub / github.com/NatLabRockies/OpenStudio / alwaysOffDiscreteSchedule

Method alwaysOffDiscreteSchedule

src/model/Model.cpp:1103–1147  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1101 }
1102
1103 Schedule Model_Impl::alwaysOffDiscreteSchedule() const {
1104 std::string alwaysOffName = this->alwaysOffDiscreteScheduleName();
1105
1106 std::vector<ScheduleConstant> schedules = model().getConcreteModelObjects<ScheduleConstant>();
1107
1108 for (const auto& schedule : schedules) {
1109 if (boost::optional<std::string> name = schedule.name()) {
1110 if (istringEqual(name.get(), alwaysOffName)) {
1111 // DLM: if a schedule matches the name but not these other properties we should reclaim the name or at least warn
1112
1113 if (equal<double>(schedule.value(), 0.0)) {
1114 if (boost::optional<ScheduleTypeLimits> limits = schedule.scheduleTypeLimits()) {
1115 if (boost::optional<std::string> type = limits->numericType()) {
1116 if (istringEqual(type.get(), "Discrete")) {
1117 return schedule;
1118 }
1119 }
1120 }
1121 }
1122 }
1123 }
1124 }
1125
1126 ScheduleConstant schedule(model());
1127
1128 schedule.setName(alwaysOffName);
1129
1130 ScheduleTypeLimits limits(model());
1131
1132 limits.setName("OnOff");
1133
1134 limits.setNumericType("Discrete");
1135
1136 limits.setUnitType("Availability");
1137
1138 limits.setLowerLimitValue(0.0);
1139
1140 limits.setUpperLimitValue(1.0);
1141
1142 schedule.setScheduleTypeLimits(limits);
1143
1144 schedule.setValue(0.0);
1145
1146 return std::move(schedule);
1147 }
1148
1149 std::string Model_Impl::alwaysOffDiscreteScheduleName() const {
1150 return "Always Off Discrete";

Callers 15

translateZnSysMethod · 0.80
SwimmingPoolIndoorMethod · 0.80
TEST_FFunction · 0.80
TEST_FFunction · 0.80
TEST_FFunction · 0.80
TEST_FFunction · 0.80

Calls 14

istringEqualFunction · 0.85
numericTypeMethod · 0.80
setNumericTypeMethod · 0.80
setLowerLimitValueMethod · 0.80
setUpperLimitValueMethod · 0.80
nameMethod · 0.45
getMethod · 0.45
valueMethod · 0.45
scheduleTypeLimitsMethod · 0.45
setNameMethod · 0.45
setUnitTypeMethod · 0.45

Tested by 8

TEST_FFunction · 0.64
TEST_FFunction · 0.64
TEST_FFunction · 0.64
TEST_FFunction · 0.64
TEST_FFunction · 0.64
TEST_FFunction · 0.64
TEST_FFunction · 0.64