RR_InputBuffer: The Entry Funnel

Updated: 2026-05-29

When a box arrives in the system, its only possible action is to enter the Entry Funnel (RR_InputBuffer). At this point, the ON_REST procedure is triggered, evaluating the situation under three logical scenarios:

Admission Scenarios

  1. Queue Waiting: If the box is not the only one in the funnel (IN > 1), it remains asleep. It does nothing else; the box ahead of it will be responsible for managing the flow when it moves forward.

  2. Immediate Entry: If there is enough free space on the conveyor (validated against RR_EntryLimit), the box wakes up immediately, atomically consumes the available space, and transitions to the next state (RR_Conveyor).

  3. Constraint Calculation: If there is not enough space, the Virtual Entity RR_EntryTimeout is scheduled. This event represents the next known reevaluation of the geometric constraint. It does not search for an entry opportunity; instead, it identifies the exact moment when the constraint might no longer be valid.
    In other words: when does it try to enter again? That calculation is left to the timeout.

 

Example

PROCEDURE RR_InputBuffer

    if (R$(RR_InputBuffer,IN)>1)
        terminate_ve
    endif

    ; entity may enter conveyor immediately
    if (X$RR_EntryLimit >= P$(RR_Length,P$ENTITYNUMBER) * 0.5 + X$RR_Gap) 
        ; input ownership consumed atomically
        savevalue RR_EntryLimit,0
        ;timeout RR_Admission,0,P$ENTITYNUMBER
        WAKE RR_InputBuffer,-1,P$ENTITYNUMBER
        terminate_ve
    endif

    timeout RR_EntryTimeout,0,P$ENTITYNUMBER

    TERMINATE_VE

ENDPROCEDURE