clear_schedule¶
Syntax¶
If called by the meta agent:
If called by a group agent:
Parameters¶
place_type- The place type for which the schedules of all sites are to cleared.
Description¶
Clears a schedule for a specified place. By clearing a schedule, a place is set such that it is always closed.
This action can be called by either a group agent or the meta agent.
If called by the meta agent, all sites of the given place type have their schedules cleared.
If called by a group agent, the site associated with the group agent has its schedule cleared.
Examples¶
simulation {
start_date = 2022-Jan-01
end_date = 2022-Jan-02
locations = none
default_model = none
}
startup {
read_agent_file(agents.txt)
add_to_schedule(Work,Everyday,12am,0,11pm,59)
print("-- Work is open from 0000-2359 --")
}
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(12)
next()
}
}
condition ScheduleAdjuster {
meta_start_state = Start
state Start {
wait(24)
next(ClearSchedule)
}
state ClearSchedule {
clear_schedule(Work)
print("-- Work Schedule is now cleared --")
wait()
next(Excluded)
}
}
Running the above results in the following output:
-- Work is open from 0000-2359 --
Work is open at 0?: 1
Work is open at 12?: 1
-- Work Schedule is now cleared --
Work is open at 0?: 0
Work is open at 12?: 0