Main Content


Class: simevents.SimulationObserver
Namespace: simevents

Specify behavior after an entity enters a block that has entity storage




postEntry(obj,evSrc,evData) is used to specify behavior after an entity enters a block that has entity storage. The simulation observer uses this method as a callback for post-entry event notification and provides handles to the entity, the block and its storage, and the event.

Input Arguments

expand all

Object of class SimulationObserver

Handle to block storage in which the entity entered. The handle will be populated by the simulation observer.

List of handles for block, storage, and entities. The list will be populated by the simulation observer.


expand all

Specify listener to execute when entity enters a storage element such as a queue or server.

function postEntry(this, evSrc, evData)
            % Override to specify listener for entry into a storage (queue/server)

            entity = evData.CurrentEntity;

            if strcmp(evData.Block.BlockPath, [this.mModel '/Have Dinner'])
                % Identify which table the customer is going to
                tblId = this.occupyTable(entity);
                % Schedule motion for this customer to the appropriate
                % table
                target = this.cTablePos(tblId, :);
                this.scheduleMotion(entity, target);
                % Decrement the waiting statistic
                this.updateStats(this.mTxtWaiting, this.DECREMENT);
            elseif strcmp(evData.Block.BlockPath, [this.mModel '/Patron Leave'])
                % Schedule motion for this entity from its current position
                % to the exit position
                if isKey(this.mEntityGlyphs, num2str(entity.ID))
                    this.scheduleMotion(entity, this.cExitPos);
                % Schedule for the entity dot to be destroyed when it has
                % completed its pending motion
                this.scheduleMotion(entity, [NaN, NaN]);

Version History

Introduced in R2016a