Main Content

resourceReleased

Class: matlab.DiscreteEventSystem
Namespace: matlab

Event action upon successful resource release

Syntax

[entity,event,out1,...] = resourceReleased(obj,storage,... entity,resources,tag,in1,...)

Description

[entity,event,out1,...] = resourceReleased(obj,storage,... entity,resources,tag,in1,...) specifies event actions for a discrete-event System object™ upon successful resource release.

Input Arguments

expand all

Discrete-event System object.

Index of the storage element.

Entity releasing the resource. Entity has these fields:

  • sys (MATLAB structure) consisting of:

    • id (double) — Entity ID

    • priority (double) — Entity priority

  • data — Entity data

An array of structures that specifies the resources that have been released.

Tag of the currently executing resource release event.

First data input.

Output Arguments

expand all

Entity releasing the resource.

Events to be scheduled. Use matlab.DiscreteEventSystem class methods to create events. Each event has these fields:

  • type (character vector) — Type of the event

  • delay (double) — Delay before the event

  • priority (double) — Priority of the event

  • storage (double) — Index of the storage element

  • tag (character vector) — Event tag

  • location (MATLAB structure) — Source or destination location of entity (see source)

First data output.

Examples

expand all

Suppose that an entity releases resources successfully with a scheduled eventReleaseResource method and the tag of this event is MyResourceAcquireEvent. The successful release of the resources invokes the resourceReleased method to forward the entity to the output.

function [entity,events] = entry(obj, storage, entity, source)
  % On entry, release one resource of type Resource1.
  resRequest = obj.resourceSpecification('Resource1', 1);
  events = obj.eventReleaseResource(resRequest, 'MyResourceAcquireEvent');       
end
        
function [entity,events] = resourceReleased(obj, storage,...  
                            entity, resources, tag)
  % After resource release, forward the entity to the output.                     
  events = obj.eventForward('output', storage, 0.0);
end

Version History

Introduced in R2019a