View Single Post
Old February 6th, 2018, 09:55 PM   #7
Geoff White
Member
Australia

Geoff White is offline
 
Join Date: Oct 2005
Location: Brisbane
Posts: 266
The old shifts don't align with the calendar trick.
Stricly speaking you don't need to store the date as the index is the day on month.
If you only need one bucket for 24 hours

if ActualHour>6 then
if WorkingDOM <> ActualDOM
WorkingDOM:=ActualDOM;
Robot_wait[WorkingDOM].Shift :=0
end_if;
end_if;

if Idle then
run idle timer
if timer done
Robot_Wait[WorkingDOM].Shift := Robot_Wait[WorkingDOM].Shift + 1
reset timer
end_if
end_if

You can also put this in a 1 second periodic task then it will accumulate seconds without any timers.
  Reply With Quote