RR_ResumeTimeout: Flow Resumption

Updated: 2026-05-29

The RR_ResumeTimeout procedure restores the system's kinematics once the cause of the jam has disappeared. Its purpose is to "clean up" the blocked state and reschedule the boundary events (Entry and Exit).

Rehydration Mechanics

Unlike a jam, which develops progressively, resumption is atomic for all conveyor vectors:

  1. Limit Removal: RR_StopLimit is reset to its neutral value (-RR_Length), removing any logical barrier.

  2. Vector Synchronization: The conveyor is traversed and, for each stopped box, its new movement timestamp is set (RR_Time = AC1$) and its state is activated (RR_Moving = 1). This allows the renderer to restart interpolation from the current position.

  3. Waking the Orchestrators:

    • Entry: If a box was waiting for space in the buffer (RR_EnteringEntity), its RR_EntryTimeout is triggered again at time 0.

    • Exit: If a leading box was waiting to exit (RR_LeavingEntity), its RR_ExitTimeout is triggered again at time 0 so that it can recalculate its arrival at the end.

Note that RR_ResumeTimeout does not attempt to reconstruct any previous calculation. All pending events are considered potentially obsolete, and the relevant boundaries are recalculated from the system's current state.

Example

PROCEDURE RR_ResumeTimeout

    ; remove active stop limit
    savevalue RR_StopLimit,X$RR_Length * -1

    assign stoppedEntity,0
    ; resume all stopped entities
    FOREACH entityNumber,IN_RESOURCE,RR_Conveyor

        if (P$(RR_Moving,P$entityNumber) == 0)
            assign stoppedEntity, P$entityNumber
            assign RR_Time, AC1$, P$entityNumber
            assign RR_Moving, 1, P$entityNumber
        endif

    ENDFOREACH
    
    savevalue RR_LastStopedEntity, 0

    if (P$stoppedEntity == 0)
        terminate_ve
    endif

    

    call setStatusDisplay

    ; restore pending entry verification
    IF (X$RR_EnteringEntity!=0)
        timeout RR_EntryTimeout, 0, X$RR_EnteringEntity
    ENDIF

    ; restore pending exit verification
    IF (X$RR_LeavingEntity!=0)
        savevalue RR_ExitRegimeVersion, X$RR_ExitRegimeVersion + 1
        timeout RR_ExitTimeout, 0, X$RR_ExitRegimeVersion, 33333
    ENDIF

    savevalue RR_EnteringEntity,0

    terminate_ve

ENDPROCEDURE