8. August 2023

Interrupt Procedures During Shift Pause

In INOSIM, the availability of resources and units can be represented using Shift Calendars. A Shift Calendar determines when a unit is available or how the availability of resources changes over the simulation time. In this Tip and Trick, two ways of interrupting the allocation of equipment and resources during shift pause are presented. (→ User Manual / Online Help: Chapter Shift Calendar)

Default Behavior in INOSIM

Unit Allocation

When a unit is currently allocated and enters a shift pause (unavailable), INOSIM executes the running procedure until it is finished. New procedures cannot start during a shift pause. In the screenshot, you can see that the dryer is still allocated when the shift pause (blue area) begins. The procedure is ended within the shift pause. Additionally, the next procedure is delayed until the end of the shift pause.

Gantt chart for an example where the procedure is not interrupted at the beginning of the shift break.

Resource Allocation

If you are using a shift calendar for a resource, a similar behavior occurs. In the example provided, one operator is required for each of the steps: drying, reaction, and filtration. The filtration step has already started when the availability of operators becomes 0 due to the shift pause (blue bar). The filtration step can be completed, and one operator remains allocated during the first half of the shift pause, but the reaction and drying steps cannot start during the shift pause because new operators would need to be allocated. Therefore, there is a waiting time for the resource (yellow bar) on the reactor and dryer.

Gantt chart for an example where the resource allocation is not interrupted at the beginning of the shift break.

Stopping or Delaying Allocation During Shift Pause

In some cases, the default behavior of INOSIM regarding resource and unit allocation during a shift pause is not desired. In such cases, the allocation of a unit should only start if there is enough time before the shift pause, or the execution of a task should be stopped when resources enter a shift pause.

Interruption of Procedures via Breakpoints

In our first example, we looked at a dryer that is unavailable on certain days according to a Shift Calendar. For units, there is an option to allow operations to start only if there is enough time until the next shift pause. To achieve this, a breakpoint needs to be set for the operation that should wait. The breakpoint can be set in the operation’s properties under the Advanced tab. The expected execution time determines how much time needs to be left until the start of the next shift pause for the operation to start. In our example, we set a breakpoint in the drying operation and set the expected duration to the actual drying time, so the drying process would only start if the operation can be completed before the shift pause. In the recipe, operations with breakpoints are shown with bold outer lines. Further information about breakpoints can be found in the INOSIM User Manual / Online Help (→ Recipes and Recipe Modules : Execution of master recipes : Execution of unit operations : Breakpoints).

Left: Dialog for the Equipment properties. In the tab “Advanced”, the breakpoint is set. – Right: In the recipe, operations with a breakpoint appear with thick black outer lines.

It is also possible to enable breakpoints and set the expected duration within VBA. For more information, please refer to the User Manual / Online Help: → Basic: Object Model : Properties : EnableBreakpoint property.

The Gantt chart with a breakpoint in the drying operation would look like this:

Gantt chart for an example where a breakpoint was used and the procedure is interrupted before the shift break.

The transfer into the dryer (blue bar) is still executed before the shift pause, but the drying operation is not allowed to start before the pause because there are not 8 hours left until the shift pause begins. The drying operation starts when the shift pause ends.

Interruption of Operations during Resource shift pause via maintenance

The use of breakpoints ensures that the start operation is delayed. To stop operations that require a resource during a shift pause, a workaround is needed.

When assigning a resource to an operation, it can be set as interruptible.

Dialog for the assignment of resources in the properties of operations. The resource must be set to “Interruptible”.

When the resource is set as interruptible, the allocation of the resource will be interrupted during failure or maintenance. In order to ensure that the resource is actually released during maintenance, a checkmark must be set for Release during maintenance in the resource properties in the Allocation tab. In these examples, maintenance is used to interrupt the allocation of resources but it is also possible to do the same with failures. Then Release during failures has to be checked here.

Dialog for the resource properties. The resource must be released during maintenance.

This behavior is used in the presented workaround to stop operations that have already started before the shift pause begins. In the initialization phase of the simulation, a maintenance is scheduled for the time of the next change in the shift calendar for each unit that needs the resource:

Private Sub Simulation_Init() Handles Simulation.Init
    Dim u As Unit
    Dim NextChange As Double

        For Each u In UnitPools("OperatorUnit").Members 
        'the unit Pool consists of all units that need Operators

        'this Method determines the next change in the shift calendar for the Operators
        NextChange=Resources("Operator").ShiftCalendar.NextChange(Simulation.SimDate)

        'when the next change in the shift calendar happens, the sub "SartMaintenance" is called
         Simulation.ScheduleSub("Macro1.StartMaintenance",NextChange,DateReferenceType.bAbsolute,u)
    Next
End Sub

The StartMaintenance subroutine, called with the ScheduleSub method at the moment of the next shift calendar change, will then invoke the BeginMaintenance method to start maintenance on the unit (u). Within the StartMaintenance subroutine, another subroutine is scheduled to end the maintenance 0.1 seconds after it starts. For the next change in the shift calendar, the StartMaintenance subroutine will be called again.

Sub StartMaintenance(u As Unit)
    Dim NextChange As Double
    
    If Resources("Operator").ShiftCalendar.Value(Simulation.SimDate+1) = 0 Then  
        'If change is setting Operator's availabilty to 0
        u.BeginMaintenance 'begin maintenance
        Simulation.ScheduleSub("Macro1.EndMaintenance",0.01,DateReferenceType.bRelative,u) 
        'end maintenance in 0.01 s
    End If

    'call the sub again, when there is the next change in the shift calendar
    NextChange = Resources("Operator").ShiftCalendar.NextChange(Simulation.SimDate)
    Simulation.ScheduleSub("Macro1.StartMaintenance",NextChange,DateReferenceType.bAbsolute,u)
End Sub

The subroutine that ends maintenance after one second, called with the ScheduleSub method, uses the EndMaintenance method to end the maintenance:

Sub EndMaintenance (u As Unit)
    u.EndMaintenance
End Sub

Using this method, the allocation of the resource will be interrupted due to maintenance when the shift pause starts. As there are no resources available when the maintenance ends due to the shift pause, the operators won’t be allocated again until the shift pause is ended.

Gantt chart for an example where resource allocation is interrupted during the shift break.

Thus, ongoing operations (in this case, on the reactor and dryer) will pause (yellow bar) until the resource is available again.

The approach described to interrupt operations during resource shift pauses can also be applied to interrupt operations during equipment shift pauses. To guarantee the delay of operations throughout the full shift pause, the end of the maintenance must be triggered at the end of the shift pause in this approach.

An example project is available in the Download Area.

More Questions?

Want to know more about this topic or have another question? Please contact us!

Array ( [posts_per_page] => 3 [post_type] => [category__in] => Array ( [0] => 36 ) [orderby] => rand [order] => ASC )

More Tips & Tricks

In your INOSIM project, you can integrate unit failures to represent reality even more precisely in your model, as failures might have a great impact…

Graphical auxiliary functions give live to your plant layout: By animation, you dynamically display filling level changes, transport movements of objects, or the status of…

In INOSIM, the availability of resources and units can be represented using Shift Calendars. A Shift Calendar determines when a unit is available or how…

more

Direct Contact

During local business hours

Germany +49 231 97 00 250