I'm busy with a model with the following shift pattern:
On the last Friday of each month, Shift-1 works from 6:10 - 10:10. (Shift 2 and 3 are constant)
I am not sure if the Calendar Tab will cater for this beacuse if you entered a reduced time (00:00 - 10:10) then SHifts 2 and 3 will not work.
I am thinking of having an observer look at a variable called "DAY_Number" that changes each day using dayofweek(eventcontroller.abssimtime) and once the last friday of the month is hit it will import the following using shiftcalendar.shiftplan
This method will be tedious because the last fridays of each month will have to be set manually.
Any suggestions to improve/change this approach?
Solved! Go to Solution.
freelance simulation specialist
What about something like triggering a method like the one below anytime you identify a friday.
is month:integer; friday:integer; do inspect month when 2 then if Friday>21 then "change calendar since it will be last friday"; end; when 1,3,5,7,8,10,12 then if Friday>24 then "change calendar since it will be last friday"; end; else if Friday>23 then "change calendar since it will be last friday"; end; end; not
Thanks for the feedback!
I used the following method and it works perfectly
--Called as observer on day_number variable (attribute: string; oldValue: any) is do local x:= month(eventcontroller.abssimTime); --add one week to check if this Friday is last friday of month local z := eventcontroller.abssimTime + str_to_time("7:00:00:00"); local y:= month(z); if day_Number = 5 then --5 = Friday if x/=y then --different month shiftcalendar_2E.shiftPlan := import_shifts_LAST_FRIDAY; end; elseif day_number = 0 or day_Number = 1 or day_Number = 6 then --import regular shifts on SAturday, SUnday or Monday shiftcalendar_20E_CSR.shiftPlan := import_shifts_2E; end; end;