How can I use the resource amount source on the resource pool block?

2 Ansichten (letzte 30 Tage)
I want to model in simulink. I am using a resource pool in my model and each time an entity is generated I want the resource pool amount to increase by 1. I tried to use the option Resource amount source : Change amount through control port but I cannot figure out how to do it. Any help would be appreciated!

Akzeptierte Antwort

Epsilon
Epsilon am 13 Jan. 2025
Bearbeitet: Epsilon am 13 Jan. 2025
Hi John,
Changing the 'Resource amount source:' option to 'Change amount through control ports' is indeed the correct first step towards achieving the above-mentioned goal. On doing so an input port appears. Pass a message using 'Message Send' block to this port, as the 'Resource Pool' block does not accept signals form Constant blocks directly as an input.
To trigger the message only when a new entity is departed, please follow the below mentioned steps:
  1. Enable 'Number of entities departed, d' option in the 'Statistics' tab of the 'Entity Generator block Parameters'. This enables an output signal.
  2. Connect the output signal from 'Entity Generator' block to a 'Detect Change' block input port.
  3. The output signal of the 'Detect Change' block can then be passed on as an input to the 'Message Send' block.
The above steps have been implemented in the attached model and can be used for reference.
Please find links to Documentation on the above-mentioned blocks for further reference:
Hope it helps.
  3 Kommentare
Epsilon
Epsilon am 14 Jan. 2025
To add a delay in the addition of resource in the resource pool consider adding a 'Delay' or 'Delay One Step' block before the 'Detect Change' block. One step delay would mean one minor step delay therefore to match the delay by 1 sec, change the delay length to 5 in the properties section. As the Entity Generator works at discreete time steps, 'Transport Delay' block is not the right fit in this case.
Also the delay blocks delay the signal value by a defined timestep and do not change the defined simulation time, therefore the simulation will still end at 10. To increase the simulation time change the 'Stop Time' value in the Simulation tab on top part of the screen.
john
john am 14 Jan. 2025
ok thanks again have a good day

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Event Functions finden Sie in Help Center und File Exchange

Produkte


Version

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by