SimEvents: Which entity type should event actions be assigned to? Invoker type or target type?

조회 수: 1 (최근 30일)
Event actions of MATLAB discrete-event system should be named according to this rule: entityType + eventAction. The rule is rather easy to understand for events that target entities. But I got confused for events that target storages, especially testEntry and iterate.
For example, assume that we have 2 storages. Storage1 accepts entities of type Task, while Storage2 accepts entities of type Failure. We want the DES system to open or close the gate of Storage1 via testEntry, when a Failure entity arrives in Storage2. In this situation, should FailureEntry invoke TaskTestEntry (type of the storage that is affected) or FailureTestEntry (type of the storage that invokes the event action)?

채택된 답변

Krishna Akella
Krishna Akella 2019년 7월 1일
Hi Kar,
The testEntry method is invoked before an entity enters a storage. This method allows to either accept or refuse an entity from entering that particular storage. In the case of the storage for Task entities, the callback method name would be TaskTestEntry and for the Failure storage it would be FailureTestEntry.
For this example, when a Failure entity arrives into storage 2, an internal flag can be set in the block that would block Task entities from entering the block. When we are done processing the Failure entity, we can reset the flag so that we can start accepting entities into Storage 1. To check if any entities are waiting to enter storage 1, we can schedule a testEntry event for storage 1.
Regards,
Krishna
  댓글 수: 1
Abdolkarim Mohammadi
Abdolkarim Mohammadi 2019년 7월 1일
편집: Abdolkarim Mohammadi 2019년 7월 1일
Thanks a lot, Krishna. I summarize it as follows:
  • For events that target entities, the event action method is named according to the targetted entity type.
  • For events that target storages, the event action method is named according to the entity type of the targetted storage.
Note that a storage can accept only one type of entity.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Discrete-Event Simulation에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by