How can an entity in a process simulation that stays in the system after the simulation time is over move on?

10 views (last 30 days)
Hello, recently I have encountered such a problem in the learning of process simulation, when I set the simulation time, at the end of the simulation there will exist some entities still in the system without the completion of the service, I need this part of the unfinished service of the entity to move on, how to do it? I have searched to use the trigger subsystem to complete this function, but did not find the relevant examples can refer to, I hope someone can answer my question, thank you!

Answers (1)

Ashok
Ashok on 21 Nov 2024 at 10:36
Hey @inori,
From what I understand, a SimEvents simulation is being run, and some entities haven't reached the terminal state by the end of the simulation.
A straightforward way to handle dynamic termination is to set the simulation's Stop Time to 'inf' (or a very high value) and use the Stop Simulation block to end the simulation when needed.
The attached file example_R2021b.slx includes the following model.
In this setup, the Gen_5s block generates entities for the first 5 seconds at a rate of 10 entities per second. The Entity Server has a capacity limit of 6, so some entities don't reach the terminal state if Stop Time is set to 10 seconds.
Instead, the Stop Time is set as ‘inf’ and a condition is used to monitor when the number of entities in the server reaches 0, using the Compare to Zero block. The resulting boolean signal triggers the Stop Simulation block, which then terminates the simulation.
For more details on the Stop Simulation block, check out this documentation page: 
I believe this will assist you!

Categories

Find more on Discrete-Event Simulation in Help Center and File Exchange

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!