remove_from_schedule¶
Syntax¶
If called by the meta agent:
remove_from_schedule(place_type, day_string, start_closed_hour, start_closed_minute, end_closed_hour, end_closed_minute)
If called by a group agent:
remove_from_schedule(day_string, start_closed_hour, start_closed_minute, end_closed_hour, end_closed_minute)
Parameters¶
place_type- The type of place for which scheduled closed hours are to be written. Required if and only if this action is called by the meta agent.
day_string- The days of the week for which scheduled closed hours are to be written. Valid values are:
-
Everyday-Weekdays-Weekends-Sun-Mon-Tue-Wed-Thu-Fri-Sat start_closed_hour- The starting hour for the range in which scheduled closed times are to be written. This can be in form of a range on a 24 hour clock (0-23), or a 12-hour time string (e.g. 12am, 9pm, etc.)
start_closed_minute- The starting minute for the range in which scheduled closed times are to be written (0-59).
end_closed_hour- The final hour of the range for which closed times are to be written. This can be in form of a range on a 24 hour clock (0-23), or a 12-hour time string (e.g. 12am, 9pm, etc.)
end_closed_minute- The final minute for the range in which scheduled closed times are to be written (0-59).
Description¶
Specifies a range of hours for a location to be closed for the given place type.
Examples¶
agents.txt
main.fred
simulation {
start_date = 2022-Jan-01
end_date = 2022-Jan-03
locations = none
default_model = none
}
startup {
read_agent_file(agents.txt)
add_to_schedule(Work,Everyday,12am,0,3pm,59)
print("-- Work is open from 0000-1559 --")
}
agent_startup {
join(Work)
}
place Work {
site = 555,0,0,0
}
condition IsOpenChecker {
start_state = Start
state Start {
print("Work is open at ", mod(now, 24), "?: ", is_open(Work))
wait(8)
next()
}
}
condition ScheduleAdjuster {
meta_start_state = Start
state Start {
wait(24)
next(OpenLater)
}
state OpenLater {
remove_from_schedule(Work, Everyday, 12am, 00, 1am, 30)
print("-- Work is now open from 0131-1559 --")
wait(24)
next(StayOpenTil6pm)
}
state StayOpenTil6pm {
add_to_schedule(Work, Everyday, 12, 0, 18, 0)
print("-- Work is now open from 0131-1800 --")
wait()
next(Excluded)
}
}
Executing the above results in the following output:
-- Work is open from 0000-1559 --
Work is open at 0?: 1
Work is open at 8?: 1
Work is open at 16?: 0
-- Work is now open from 0131-1559 --
Work is open at 0?: 0
Work is open at 8?: 1
Work is open at 16?: 0
-- Work is now open from 0131-1800 --
Work is open at 0?: 0
Work is open at 8?: 1
Work is open at 16?: 1