AnyLogic provides users with a Schedule - a special element allowing to define how some value changes in time according to the defined (optionally cyclic) pattern.
Schedule is frequently used to define:
Moreover, you can use schedule in none AnyLogic objects but work with it programmatically, obtaining its value using the corresponding API.
The following demo model illustrates how Source generates agents according to the daily rate pattern defined by rate schedule:
Demo model: Source Arrival Modes
Schedule works in one of two modes: it can either define intervals, or discrete time moments.
The first mode (intervals) is used when you need to define how some value continuously changes in time (usually according to some cyclic pattern). In the present case at any moment of time there is current value defined by the schedule. Intervals are used to define work timetables for worker shifts, cyclic pattern of pedestrian/agent arrival rate, etc.
The second mode (moments) is used when you need to define a sequence of key time moments and some values corresponding to this particular moments (or perform some actions, see the abstract below). The example - train arrival schedule: the specified number of pedestrians appears in the railway station model at the defined arrival moments.
Moreover, you can associate actions with key moments of the schedule (either interval switch times, or time moments - it depends on the schedule mode), by typing Java code in the Action section of the schedule properties. Actions are executed in those key moments, so that you can use schedule as a perfect tool for scheduling an unlimited number of actions in the future (probably, mapped to the particular calendar dates).
You can define a schedule in one of three alternative views:
Schedules defined in the calendar views (Week and Days/Weeks) may have exceptions - particular time intervals when the value defined by this schedule should have other values, differing from the ones specified in the schedule.
The most frequent use cases of exceptions are national holidays and workday transfers caused by the holidays. Exceptions can be also used for modeling less trivial tasks like the demand boost in the New Year's and Christmas Eve, or extension of the shop staff in those days.
In general, you define schedule similarly in all views: first, you select the type of the value that you want to control with this schedule (on/off, integer or real), and then define time intervals (or just time moments, it depends on the schedule mode) and specify values for each particular interval/moment. When defined the complete cycle of intervals/moments, you tell the schedule what is the recurrence time for this cycle.
But since the schedule definition varies a bit depending on the currently used view, we decided to consider several examples of schedule definitions:
Defining a weekly bank office timetable
Defining a shift schedule in the (duration = 4 days, Duration type: Days/Weeks)
Defining a device maintenance schedule (Duration type: Custom, no calendar mapping)
Name – The name of the schedule. The name is used to access the schedule from object properties and from code.
Show name – If selected, the name of the schedule is displayed on the presentation diagram.
Ignore – If selected, the schedule is excluded from the model.
Visible – If selected, the schedule icon is visible on a presentation at runtime.
Type – Type of the value defined by this schedule: on/off (the schedule defines the resource availability for ResourcePool), integer, real, or Rate (the schedule defines time pattern of agent / pedestrian arrival rate for Source / PedSource).
Unit – [Visible and applies when the schedule's Type is set to Rate] Here you define the units for the rate values defined in the schedule's table. The options are: per second, per minute, per hour, per day, etc.
– Here you can choose the schedule mode: whether it
or discrete Time moments.
Duration type – Here you choose the duration type of the schedule. Depending on this choice, the schedule is defined in one of three alternative views:
Default value – [Visible if The schedule defines option is not set to Moments] Here you define the default value for the schedule - the value that will be used for the intervals not defined in the schedule.
Repeat schedule weekly – [Visible if Duration type is set to Week] Here you need to define the weekly schedule for employees, which week days are working and which are not, when the shift starts and ends. Select on / off vor Value for each weekly schedule variant.
Repeat every – [Visible if the Duration type is set to Days/Weeks, or Custom (no calendar mapping)] Here you define the recurrence of the schedule.
Snap to – [Visible if the Duration type is set to Days/Weeks or Custom (no calendar mapping)] If you want your schedule to be applied not from its start moment on model launch, here you can define, what model time corresponds to the start moment of the schedule. Please note that this setting does not define the time when the schedule starts applying - it defines how the start of the schedule is shifted regarding the zero model time.
Repeat every is set to Weeks]
The first day of the
week in some countries (e.g. USA) is Sunday, while in some
other (e.g. Russia) - Monday. Therefore
if you will define a schedule with N-weekly recurrence
that the first day of the week is Sunday and then send the
to the user from some other country, where the week starts from Monday,
the schedule will be misinterpreted. So if you expect that
your model will be used in other countries
too, please define explicitly the first day of the week in your
schedule so that this schedule will be locale-independent. And please
do it before
schedule intervals, because all interval data in the table are deleted
when you change the Weeks
Loaded from database –
[Visible if the Duration
is set to Days/Weeks,
(no calendar mapping)] If checked, allows to load
data from the existing
AnyLogic database defined by the user.
- here you can specify
Choice conditions - here you define a condition that specifies the particular value to be selected from the specified table column. You can add , duplicate , delete and arrange the conditions ( , ).
Start column - here you define the start column of the database.
End сolumn - here you define the end column of the database.
Value column - here you define the value column of the database.
Here you can type Java code to be executed in key moments of the schedule (either interval switch times, or time moments - it depends on the schedule mode). Actions are executed in those key moments, so that you can use schedule as a perfect tool for scheduling an unlimited number of actions in the future (probably, mapped to the particular calendar dates).
On this page you can define exceptions for the schedule - particular time intervals when the value defined by this schedule should have other values, differing from the ones specified in the schedule.
Here you can preview the schedule in the convenient way that is commonly used in digital diaries, organizers and office software tools. This may help you to check whether the schedule was defined correctly and the resulting picture is the one you have expected to see.
System dynamics units – If selected, you will be able to specify units of measurements for the value returned by this schedule in the edit box to the right. Having specified units for elements of your model, you may perform unit checking to find out dimension inconsistencies in the model.
In some countries Daylight Saving Time (DST) is practiced: time is temporarily adjusted to achieve longer evening daylight by setting the clocks an hour ahead of the standard time (you can find more information on DST in wikipedia).
AnyLogic schedules consider DST automatically. The information about DST dates in the current country is taken from the computer's OS settings (the Current locale is taken into account).
Schedule with N Days/Weeks duration
Schedule with no calendar mapping