MATLAB: How does SimEvents distribute resources when multiple Resource Acquirers are requesting the same resource

acquirercomeentityfirstresourceserveSimEvents

I am modeling a drilling process using SimEvents. There are 4 wells each being drilled multiple times. There is one set of wireline equipment that is being shared by every well, represented as a resource in SimEvents. Each well is modeled as a single entity on its own process even though each process is identical. There is one Resource Acquirer block for each well.
I have noticed some non-intuitive behavior when multiple Resource Acquirer blocks are requesting the same resource. It seems that when two Resource Acquirer blocks are requesting the same resource, the resource will not be given to the entity with the longest wait first. I would expect this to behave as a first come first serve system.
I would like to know how SimEvents determines where a resource is allocated when multiple entities are waiting at multiple Resource Acquirer blocks.
See my model attached as MultipleResourceAcquirer.slx. You can see in Simulation Data Inspector that Entity 3 and 4 wait for a wireline for the whole simulation while the other two continue to get it.

Best Answer

SimEvents currently does not handle multiple resource requests from separate Resource Acquirer blocks in any particular order. SimEvents handles multiple resource requests in somewhat of a random manner. It is “somewhat random” in that the ordering is fixed at model compile time and does not change during model execution time, and it is "random" because the user has no way to influence the ordering.
Regarding how to set up a model such that resources are allocated in a first come first serve basis, try using only one Resource Acquirer per resource. This means that instead of having 4 entities in 4 separate but identical processes, we could have 4 entities all in the same process. For examples of how to create 4 entities all at once, refer to the links below:
or
I have attached a simplified example that shows this, SingleResourceAcquirer.slx. Each entity has an ID number 1-4. If you open up Simulation Data Inspector. You can see that entities are given resources in the order they are received in to the Resource Acquirer.