Defining a weekly schedule
view when your schedule has weekly recurrence, e.g. if you need to define a weekly schedule for office men.
If you need to define a schedule as a sequence of calendar dates and times, but with nonweekly recurrence, please use the
Let's study how to define a simple weekly schedule of a bank office.
Bank office works from Monday till Saturday, from 9 AM till 8 PM, with a dinner hour from 2PM to 3PM. Sunday is day off.
Create a schedule
- Drag the
element from the
palette on the graphical diagram of the agent.
- Go to the
- Specify the name of the element in the
field. This name will be used later on for accessing the schedule from
AnyLogic object(s) properties, or programmatically from code.
- Go to the
section of the schedule properties. Choose the type of the value that will be controlled by this schedule from the
group of butttons:
Since we want to define only how the availability status for the
resources controlled by this schedule changes in time (workers are
either working (on
state), or not (off)), leave the option
- Since we want to define values not for some discrete moments, but for time intervals, choose
Intervals (Start, End)
option from the group of buttons
The schedule defines.
- Choose the most suitable
for your task:
Custom (no calendar mapping)
and define the schedule in the chosen view. Since our schedule has weekly recurrence, we choose the most suitable view -
- In the
you can specify the default value for the schedule - the value that
will be used for the intervals not defined in the schedule. In our case
we want to define only work intervals and to assume that the staff is
not working in other times, so leave the default off
choice selected here.
you can complete the schedule definition by defining its intervals. In
our case we can mark out two intervals: morning worktime before lunch
from 9AM to 2 PM and afterlunch time from 3PM to 8PM.
Define schedule intervals
- Intervals are defined in the table in the
section of the schedule properties. Each interval is defined in a separate row of the table.
- To add a new interval, click the
button to the right of the table. You will see a new row added in the table.
default five work days (from Monday till Friday) are selected in the
row - the corresponding cells have ticked off checks inside. These
checks mean that the interval defined in this row will be applied to
these particular days.
- We need to define the interval for the Saturday too, so tick off the cell in the
column also. To change the state of some day of the week, just click in the corresponding cell of the table.
Please note that until you choose any day(s) in the row, you are not able to add more rows to the table.
- Now we need to specify the work interval that corresponds to the time before lunch for these days. Choose
cell of this table row.
let's define the afterlunch worktime for the same days. Thereto we will
add one more row into the table. You will see that the same days as in
the previous row are automatically selected, so Satuday
is already selected and all you need is to define start and end times for this interval:
Considering national holidays
Schedules defined in the modes mapped to calendar (Week
Days/Weeks) may have
particular time intervals when the value defined by this schedule
should have other values, differing from the ones defined in the
schedule. This is the way you can e.g. consider national holidays in
your schedule. You can find more information on defining exceptions here.
Previewing the schedule
you can preview a 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.
Preview the schedule
- Go to the
section of the schedule properties. You will see the calendar for
several days shown in the tabular form. Columns of this table
correspond to days. Schedule intervals are drawn with stripes of
different colors. In our case there are intervals of two types: work
intervals are marked with blue stripes, "off" intervals - with white
- In case you have defined holidays for the schedule, you may use the
control to scroll the calendar e.g. to the beginnnig of the year and
check that the New Year day is day off in this schedule.
The importance of the intervals order in the table
note that here we defined only work intervals. There is no necessity in
explicit definition of the lunch time since we have chosen off
as the default value, so this particular value will be used in the 2PM - 3PM interval that is not explicitly defined.
several intervals refer to the same time (overlap each other), the one
that is defined later has greater priority and overrides values of the
intervals defined above.
For example, we could define the same schedule in another way (see the figure below).
Since here the interval 14:00 - 15:00 is defined after the interval 09:00 - 20:00, it overrides the
value for this time interval with
value, and as the result we get the required pattern (you can check how the schedule looks like on the
properties page of the schedule):
However, if the intervals are defined in another order (see the figure below), they will define quite different pattern:
conclusion, we can recommend you to use the approach from the scenario
described above (all intervals are defined explicitly in the natural
sequence (09:00 - 14:00, 15:00 - 20:00)) if you are not sure how intervals in the table override each other.
may delete any intervals from the table and move them in the table up
and down (in this case you should contain the schedule integrity by
yourself). This can be done by selecting the row in the table and using
the corresponding buttons ,
to the right of the table.
Specifying the schedule in your ResourcePool object
If your schedule defines work timetable for some resources, you should tell your
object that it should use this schedule as a work timetable for the resources it defines.
Specify the schedule in the object ResourcePool
- Select the required
object and go to the
- Choose the option
By "on/off" schedule
- Type the name of the schedule in the property
below (you may use
the given example all resources are either working, or not. In more
complex cases, when the number of working resources changes over time
(the value type of the schedule is integer, not
list and type the name of the schedule in the
Schedule with N Days/Weeks duration
Schedule with no calendar mapping