主要内容

MATLAB。DiscreteEventSystem class

Package:MATLAB
Superclasses:MATLAB.SYSTEM

Base class for discrete-event system objects

描述

MATLAB。DiscreteEventSystemis the base class for discrete-event System objects. In your class definition file, you must subclass your object from this base class (or from another class that derives from this base class). Subclassing allows you to use the implementation and service methods provided by this base class to build your object. For more information about implementingMATLAB。DiscreteEventSystemMATLAB Discrete-Event Systemblock, see使用MATLAB离散事件系统块创建自定义块

Type this syntax as the first line of your class definition file to directly inherit from theMATLAB。DiscreteEventSystem基础班,哪里ObjectNameis the name of your object:

classdefObjectName < matlab.DiscreteEventSystem

For more information about implementing a discrete-event System object™, see创建一个离散事件系统对象。有关将离散事件系统对象链接到simevents的信息®model and creating a custom behavior, see使用自定义实体存储块延迟实体

TheMATLAB。DiscreteEventSystem班级是handleclass.

Class Attributes

抽象的
false
HandleCompatible
真的
StrictDefaults
false

For information on class attributes, seeClass Attributes

方法

expand all

Examples

collapse all

此示例显示了如何使用离散事件系统对象方法创建具有一个输入端口,一个输出端口和一个存储元素的自定义实体存储块。离散事件系统对象是MATLAB。DiscreteEventSystem类,您可以使用此类提供的实现和服务方法。然后,您使用MATLAB Discrete-Event Systemblock to integrate the System object into a SimEvents model. The customMATLAB Discrete-Event Systemblock accepts an entity from its input port and forwards it to its output port with a specified delay. For more information, see使用自定义实体存储块延迟实体

classdef定义性存储block %一个具有一个输入,一个输出和一个存储的自定义实体存储块。%非戒毒属性特性(无义)% CapacityCapacity = 1;% DelayDelay=4;end方法(Access=protected)功能num = getNumInputSimpl(〜)num = 1;end功能num = getNumOutputsImpl(~) num = 1;end功能entityTypes = getenTityTypesimpl(obj)entityTypes = obj.entityType('车');end功能[inputTypes,outputTypes] = getentityportsimpl(obj)inputTypes = {'车'};outputTypes = {'车'};end功能[storagespecs,i,o] = getentityStorageimpl(obj)storagespecs = obj.queuefifo('车', obj.Capacity); I = 1; O = 1;endend方法功能[entity,event] = CarEntry(obj,storage,entity,source)% Specify event actions when entity enters storage.event = obj.eventForward('output',1,obj.delay);endendend

Version History

Introduced in R2016a