Defining a weekly schedule
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 Days/Weeks view.
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.
- Drag the Schedule
element from the Agent
palette on the graphical diagram of the agent.
- Go to the Properties
- Specify the name of the element in the Name
field. This name will be used later on for accessing the schedule from
AnyLogic object(s) properties, or programmatically from code.
- Go to the Data section
of the schedule properties. Choose the type of the value that will be
this schedule from the Type
group of butttons: on/off, integer, or real.
Since we want to define only how the availability status for
resources controlled by this schedule changes in time (workers are
either working (on state), or
not (off)), leave the option on/off
- 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
- Choose the most suitable Duration type for your
task: Week, Days/Weeks,
or Custom (no calendar mapping)
and define the schedule in the chosen view. Since our schedule has
weekly recurrence, we choose the most suitable view - Week.
- In the Default
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
Now you can complete the schedule definition by defining its
intervals. In our case we can mark
morning worktime before lunch from 9AM to 2 PM and afterlunch time
from 3PM to 8PM.
- Intervals are defined in the table in the Data section of the schedule
interval is defined in a separate row of the
- To add a new interval, click the
button to the right of the table. You will see a new row added
- By default five work days (from Monday till Friday) are
in the row - the corresponding cells have ticked
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 Sat
column also. To change the state of some day of the week, just click in
the corresponding cell of the table.
note that until you choose any day(s) in
the row, you are not able to add more rows to the
- Now we need to specify the work
interval that corresponds to the time before lunch for these
days. Choose 09:00
in the Start
cell and 14:00
in the End
cell of this table row.
- Now 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,
is already selected and all you need is to define start and end times
for this interval: 15:00
Considering national holidays
defined in the modes mapped to calendar (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 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
Now you can preview a schedule in the convenient way that is
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 Preview
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
our case there are intervals of two types: work intervals are marked
with blue stripes, "off" intervals - with white ones:
- In case you have defined holidays for the schedule, you may use
to date chooser 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
Please 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.
If 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 on
value for this time interval with off
value, and as the result we get the required pattern (you can check how
the schedule looks like on the Preview
page of the schedule):
However, if the intervals are defined in another order (see
the figure below), they will define quite different pattern:
In conclusion, we can recommend you to use the approach from
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.
You may delete any intervals from the table and move them in
up and down (in this case you should contain the schedule
yourself). This can be done by selecting the row in the table and using
the corresponding buttons , and 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 ResourcePool
that it should use this schedule as a work timetable for the resources
the object ResourcePool
- Select the required ResourcePool
object and go to the Properties
- Choose the option By
"on/off" schedule from the Capacity
defined drop-down list.
- Type the name of the schedule in the property Schedule below (you
may use code
completion assistant here).
In 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 on/off), choose By schedule in the Capacity
defined list and type the name of the schedule in the Schedule field below.
Schedule with N Days/Weeks duration
with no calendar mapping