Borrar filtros
Borrar filtros

Varying the amount of available resource in Resource Pool block [updated]

2 visualizaciones (últimos 30 días)
I am currently developing a model using SimEvents (MATLAB/Simulink R2017b) as shown in the picture below.
One of the parameters inside the Resource Pool block is Resource Amount, which is the number of available resource unit to be taken by entities before entering the server.
I would like to have a varying value for this parameter, for example:
Time 0 to 50, Resource Amount = 100
Time 51 to 100, Resource Amount = 0, and so on,
to have the effect that the resource is only available at certain periods.
So my questions were:
  1. Is it possible for a block parameter to have this kind of behavior?
  2. If so, how can I do it? For the moment, I am thinking about using Stateflow (different state = different value of Resource Amount or something like that, if possible) but I have not tried anything.
__________________________________________
Any other suggestions will be appreciated since I am still working on this kind of model.
I'll update this question again when I try something else.
Thank you in advance.

Respuesta aceptada

Renato SL
Renato SL el 30 de Jul. de 2019
[UPDATE per 30/07/2019, 15h08]
For anyone interested,
I changed what I wanted from "varying the amount of resource" to "varying the access to obtain the resource".
I will show another model that I used to figure this out.
So, the Resource Amount will be constant all the time, but at certain periods the incoming entities are simply blocked from using the resources.
This is achieved by using Entity Gate as an Enable gate, with trigger signal coming from a Pulse Generator. The activation/deactivation period will be configured in the Pulse Generator (amplitude, period, pulse width, etc). When the amplitude of the pulse is 0 then the Entity Gate is closed and when the amplitude of the pulse is a positive value then the Entity Gate is open.
Therefore, the end result is that the entities 'cannot use the resource at certain periods' which is exactly what I want.
  1 comentario
Renato SL
Renato SL el 31 de Jul. de 2019
[UPDATE per 31/07/2019, 11h37]
My first answer works fine, but only if there is only 1 server with a capacity of 1 and service time of 1 unit. If the number of server or the capacity or the service time is increased, then at the 'period when the resource should be inaccessible', some amount of resource unit may still be in use (and will be returned once the service is done).
Furthermore, by putting the Entity Gate before the Resource Acquirer, it means that even if the Gate is closed (in due time), there could be at least 1 entity still waiting in the Resource Acquirer for an available Server, which is not what I want.
Therefore, I did:
  1. Replace the position of the Entity Gate to after the Resource Acquirer. Even if there is an entity inside the Resource Acquirer, when the Gate is closed, it will not move to any servers.
  2. Add the capability to flush the servers from entities that are using the resources, by feeding it entities with higher priority that are not using any resources. The preempted entities will be fed back to the waiting queue to emulate the entities' services being denied and to let it wait until it can access the resources (therefore, services) again. A Resource Releaser is introduced before the input to the queue.
And voila, now it looks like this.
entity_gate_for_limit_plus_flush.png
I hope the colored areas help to show the different functionalities and relations of the components.
In the end, the resources have the so-called period when it is accessible and when it is not and at the very start of the inaccessible period, the servers will be flushed of the entities that are using the resource units + the resource units will be released.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Discrete-Event Simulation en Help Center y File Exchange.

Productos


Versión

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by