Skip to end of metadata
Go to start of metadata

Overview

Q: is Delay of Schedule MES event read and loaded at a time of a schedule entry creation?
A: The event is executed (read and compiled once then looked up from a cache) 
once each minute for each pending schedule that has a begin date before current time.

Q: if I have something scheduled and something running, and I change the Event Script to, for example, add a piece of code to stop the automatic delay ..
what influence will this have, after save on

  • the already running schedule entry
  • the scheduled and not yet executed entry

A: Changing the event and saving will
1) not affect the running schedule since that won't be delayed since it has been executed and
2) the next time the event is run for the pending schedule the code in the event will fire

Q: will ANY piece of code will prevent this Event, hence the automatic Delay of Schedule, to execute?

A: Any piece of code that does not call event.runDefaultHandler()
(since the default handler is what does the delay, and we run that if the user has not supplied a script, or they can call it explicitly)
With event.runDefaultHandler(), users can hook into the default behavior and add customizations before or after
(or they can just make their own new behavior and not call that)

Q: what code can I use if I get logs like "Delay Of Schedules took suspiciously long time" in the Status Log ? 

A: add the following:
in the MES Event: OperationsRequest - ScheduleDelay

pass


in the MES Event: RequestSegment - Schedule

params = event.getParameters()
params.put('reschedule', False)
event.runDefaultHandler()


This works by overriding the default behavior of two events.

This first event OperationsRequest - ScheduleDelay is fired once a minute for each operation that has a request that has a start time in the past.
When there is a script defined, that should be run instead of the default handler.


The default handler checks if a param enableDelay is true, and if it is, we pass the operations request to the same delaySchedule method that is available in scripting.
https://help.sepasoft.com/docs/display/MHD/system.mes.delaySchedule.
By having a script that just does pass, it should run that "no-operation" python code rather than calling delaySchedule. 

The second event RequestSegment - Schedule is fired whenever a request segment is scheduled (via scripting, or the schedule component, or rescheduling from delaySchedule),
when the reschedule flag is true, we will keep rescheduling the request until it doesn't overlap with an existing schedule,
but we want to skip this and just let the operation be schedule at the time in the event params.


The code in the requestSegment - Schedule does not mean the OperationsRequest - ScheduleDelay event does not need overridden,
but it does ensure we don't get stuck trying to find an appropriate time for the schedule if delaySchedules is called by something other
than the OperationsRequest - ScheduleDelay event. 
We found it also helped with getting the ongoing OperationsRequest - ScheduleDelay to finish after adding the script since
it could be stuck in the delay logic for a while depending on the amount of schedules.

Applies To and Version Info

2.0

Details

Test 1: MES Event Script is empty

 

 

Test 2: MES Event Script has code

 

Release the second run

 

Test 3: with a Manual - Pending Schedule

 
This Schedule is Manual - Pending 
i.e. the Operation will NOT Start Automatically, On Time

Despite being Schedule on 12/12 and with no code OperationsRequest - ScheduleDelay in the Schedule Entry keeps on being rescheduled 

adding "pass"

now the Schedule entry is not pushed out anymore

Additional Definition Information

The default value when a schedule is created is 'Manual Pending'
When the schedule is saved, if the first segment of the operation is set to auto start, that state is changed to Auto Pending

The schedule manager periodically looks at all the schedules and sees if either
1) it is 'Manual Pending' and current time is past schedule start and a delay needs to happen

(behavior can be overridden by implementing a body for the Schedule Delay event on the Operations Request that does not call event.runDefaultHandler())

or

2) it is 'Auto Pending' and the operation should be started by the system.

When the operation is started, that state is switched to either 
'Manual Executed' or 'Auto Executed'  (or 'Failed' if an exception happened in the automatic start).

When an operation is aborted, the schedule state is reverted to either 'Manual Pending' or 'Auto Pending'

Scripting

N/A

References

MES Object Events

Prevent an 'Active' Work Order Schedule Entry from being dragged to a different Date:Time

Prevent Manually starting a Schedule BEFORE its Original Schedule Date

Keywords

Use the following keywords as labels. Remove the words which are not associated with this article.

OEE

Configuration, Scheduling, Run-control-and-Monitoring: Adjusting-OEE-Run-values or Adjusting-Production-count, Analysis-and-reports, Production-data.



  • No labels