Trying to create multiple entities at periodic interval in Simulink

I want to simulate people entering a system in Simulink, where a certain number of people begin at specified time intervals. However it seems the entity generator can only generate 1 entity at a time on a recurring basis, or generate multiple entities only at time zero, and then no more.

Answers (1)

Hi Kurt,
I understand that you want to simulate people entering a system in Simulink with specified time intervals.
You can use a combination of Entity Generator blocks and MATLAB Function blocks. Here's an approach you can follow:
  1. Start by placing an Entity Generator block in your Simulink model. This block will generate entities at a specified time interval.
  2. Connect the output of the Entity Generator block to a MATLAB Function block. This block will handle the logic for generating multiple entities at different time intervals.
  3. Inside the MATLAB Function block, use MATLAB code to implement the desired logic. You can use a counter variable to keep track of the number of entities generated and their time intervals.
  4. In the MATLAB code, specify the time intervals at which you want to generate entities. You can use a loop to generate entities at each specified time interval.
  5. Use the 'entity' function inside the MATLAB code to create new entities.
  6. Connect the output of the MATLAB Function block to the rest of your simulation model to simulate the behavior of the system with the incoming entities.
Hope this helps.

Products

Release

R2022a

Asked:

on 8 Jun 2022

Answered:

on 23 Oct 2023

Community Treasure Hunt

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

Start Hunting!