Main Content

实体Generator

Generate Entities

  • 实体Generator block

Libraries:
SimEvents

Description

The实体Generatorblock generates entities. Entities are discrete items of interest that you can define in a discrete-event simulation. An entity can carry scalar, bus, or vector data. The meaning of an entity depends on the model. Entity can represent customers in a queuing system, data packets from a remote controller to an actuator, or any discrete item you define.

By default the block entity generation method isTime-based. In this method, the block generates entities using intergeneration times specified by thePeriod, from an input signal or statistical distribution. SeeEntities in a SimEvents Model, for more information about creating time-based and randomized entities.

The block also creates event-based entities. ChooseEvent-basedas theGeneration Methodfor an external event to specify the entity intergeneration time. For an example, seeGenerate Entities When Events Occur.

To customize actions when the entity is generated or it exits the block, in theEvent actionstab, in theGenerate action, orExit actionfield, enter MATLAB®code. For more information, seeEvents and Event Actions.

Ports

Input

expand all

Dependencies

To enable this port, click the实体generationtab and selectEvent-basedfor theGeneration method.

Data Types:single|double|int8|int16|int32|int64|uint8|uint16|uint32|uint64|Boolean|enumerated|bus|不动点

Dependencies

To enable this port, click the实体generationtab and selectTime-basedfor theGeneration methodandSignal portfor theTime source.

Data Types:double

Output

expand all

Output port for the generated entities departing the generator.

Data Types:single|double|int8|int16|int32|int64|uint8|uint16|uint32|uint64|Boolean|enumerated|bus|不动点

de数量的实体parted the block.

Dependencies

To enable this port, click theStatisticstab and select the box labeledNumber of entities departed, d.

Data Types:double

Outputs1for a pending entity, and0otherwise.

Dependencies

To enable this port, select theStatistics>Pending entity in block, pe.

Data Types:double

Outputs the average time between generation of entities.

Dependencies

To enable this port, select theStatistics>Average intergeneration time, w.

Data Types:double

Parameters

expand all

Choose the entity generation method. ChooseTime-basedto generate entities using intergeneration times from an input signal or statistical distribution. ChooseEvent-based对于一个外部事件来确定实体强度rgeneration time.

Programmatic Use

Block Parameter:GenerationMethod
Type: character vector
Values:'Time-based'|'Event-based'
Default:'Time-based'

Specify the source for entity intergeneration time.

  • SelectDialogto specify a fixed period between entity generations.

  • SelectSignal portto generate entities based on an input signal.

  • SelectMATLAB actionto define a MATLAB Script that defines the intergeneration time represented bydt.

For more information about specifying intergeneration times for entities, seeSpecify Intergeneration Times for Entities.

Dependencies

This parameter is visible when theGeneration methodis set toTime-based.

Programmatic Use

Block Parameter:TimeSource
Type: character vector
Values:'Dialog'|'Signal port'|'MATLAB action'
Default:'Dialog'

Specify the time between entity intergeneration. For instance, if thePeriodis1, the block waits1simulation time in between entity generations. See,Specify Intergeneration Times for Entitiesfor more information.

可调:Yes

Dependencies

This parameter is visible whenGeneration methodis set toTime-based.

Programmatic Use

Block Parameter:Period
Type: character vector
Values:'1'| scalar
Default:'1'

Use MATLAB code to specify service time.dtspecifies the time between entity generations. You can manually specifydtor useInsert patternbutton to generate entities with a repeating sequence or from a distribution. The block uses this parameter every time it is ready for entity generation. For an example, seeSpecify Intergeneration Times for Entities.

Dependencies

This parameter is visible whenService time sourceis set toMATLAB action.

Programmatic Use

Block Parameter:IntergenerationTimeAction
Type: character vector
Values: MATLAB code
Default:'dt = rand(1,1);'

Generates entity at the start of the simulation.

Programmatic Use

Block Parameter:GenerateEntityAtSimulationStart
Type: character vector
Values:'on'|'off'
Default:'on'

Choose the type of entity to generate.

  • TheAnonymoustype has one data value associated with it.

  • TheStructuredtype (default) includes name and initial value attributes that you can specify.

    • You can attach more than one attribute to an entity by clicking.

    • You can delete attributes by clicking.

    • You can change the order of the attributes by clickingand.

    • You can convert aStructuredtype entity to a bus object by clicking

  • TheBus objecttype lets you generate bus objects as entities.

    ClickLaunch Type Editorto open the Type Editor to generate bus objects. A bus object can be an element of another bus object which can be used to create hierarchy in the data that is attached to an entity.

For more information, seeEntities in a SimEvents Model.

Programmatic Use

Block Parameter:实体Type
Type: character vector
Values:'Structured'|'Anonymous'|'Bus object'
Default:'Structured'

Determines the priority of the generated entity. The lower the value the higher the priority For more information, seeWorking with Entity Attributes and Entity Priorities.

Programmatic Use

Block Parameter:实体Priority
Type: character vector
Values:'300'| scalar
Default:'300'

Determines the name of the generated entity.

Dependencies

This parameter is visible when实体typeis set toBus objectorStructured.

Programmatic Use

Block Parameter:实体TypeName
Type: character vector
Values:'Entity'| character vector
Default:'Entity'

Set the anonymous entity data initial value. This value cannot be of type int64 or fixed-point.

Dependencies

This parameter is visible when you set实体typetoAnonymous.

Programmatic Use

Block Parameter:DataInitialValue
Type: character vector
Values:'0'| scalar | vector | matrix
Default:'0'

Define entity attribute name.

Note

When done, you can export the structured entity type as a bus object, with the name实体type name, to the base workspace. Export the bus object when using theMATLAB Discrete-Event Systemand离散事件图blocks.

Dependencies

This parameter is visible when实体typeis set toStructured.

Programmatic Use

Block Parameter:AttributeName
Type: character vector
Values:'Attribute1'| character vector
Default:'Attribute1'

Specify the entity attribute initial value. This parameter is visible when实体typeis set toStructured. This value can not be of type fixed-point.

Programmatic Use

Block Parameter:AttributeInitialValue
Type: character vector
Values:1| scalar
Default:'1'

Define the behavior in theEvent actionparameter. TheGenerateaction is called when an entity is generated and theExitaction is called just before an entity exits the block.

Programmatic Use

Block Parameter:GenerateAction, ExitAction
Type: character vector
Values: MATLAB code
Default:''

de数量的实体parted the block.

Programmatic Use

Block Parameter:NumberEntitiesDeparted
Type: character vector
Values:'on'|'off'
Default:'off'

Indicates whether an entity that is yet to depart is present in the block. The value is1for a pending entity, and0otherwise. This block can have at most one pending entity because its storage capacity is one. If there is an existing pending entity, the block does not generate another entity until the pending entity departs the block.

Programmatic Use

Block Parameter:PendingEntityInBlock
Type: character vector
Values:'on'|'off'
Default:'off'

Outputs the average time between generation of entities.Average intergeneration time, wis the ratio of the total generation time to the total number of generated entities.

Programmatic Use

Block Parameter:AverageIntergenerationTime
Type: character vector
Values:'on'|'off'
Default:'off'

Version History

Introduced in R2016a