SimEvents: What is the correct usage of testEntry?

1 view (last 30 days)
I really like the MATLAB Discrete-Event System (MDES) block in SimEvents library. I found it very flexible yet simple to work with and I have used it in lots of models. I am familiar with syntax of MDES methods. However, I haven't been able to understand how to use the event method eventTestEntry and its companion event action method testEntry. I have read all the possible documentations and, as far as I know, it is the equivalent of the entity gate block. I have the following two semantic guesses about how testEntry works and I want to know which one is right. For both cases a simple sever is considered that forward incoming entities after a while. the server receives failure events in the form of entities. I have also attached the complete model.
  • (a) When a failure entity arrives, first an obj.eventTestEntry(1) is used as an event within the FailuerEntry method to indicate that the acceptance policy on Storage 1 has changed. Then the TaskTestEntry method is invoked as an event action, where the isAllowed is set to false, meaning that Storage 1 does not accept entities anymore. When the next failure entity arrives (with its attribute equal to 1, meaning that the server should resume) the Storage 1 resumes to accept entities without any methods to be invoked for each arriving entity in storage 1.
  • (b) When a failuer entity arrives in Storage 2, a local variable (a private property of the MDES object, say Status) is set to 0. So that when a Task entity arrives in storage 1, it invokes obj.eventTestEntry, which in turn invokes TaskTestEntry to read the current failure status from the property Status. In this scenario, each entity has to query the acceptance policy separately.
I have tested both of them on the attached model bot didn't get the desired results. My guess is that because testEntry acts on storages, scenario (a) should be correct, but I haven't been able to implement it correctly.

Answers (1)

Krishna Akella
Krishna Akella on 1 Dec 2020
Hi Abdolkarim,
From what you have described, both (a) and (b) are correct. To summarize:
The event testEntry explicitly tells the engine that a specific storage wants to try accepting entities, whether there are any entities waiting outside or not. When the engine executes the event, it tries to push any ready to leave entities in an upstream storage, one after another, into the storage specified by the event. The event action testEntry, on the other hand, is invoked by the engine whenever an entity wants to enter a storage. This can happen because an upstream storage is trying to push entities out. The event action's return value (boolean) informs the engine whether it would like to admit the entity or not.
In brief, the testEntry event triggers any pending upstream entities to flow. And the event action determines whether each of the incoming entities would be admitted in or not. One can use either or both while implementing a custom DES system.
You can see the implementation of Entity Matcher block where both the testEntry event and the event action are used. The Entity Conveyor block too is another example, but is far more complex to follow.
Thanks & regards,

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by