MATLAB: In SimEvents, how can I block “plants” that are occupied so that the batch uses another plant

manufacturingMATLABproductionSimEventssimulinkstatestateflow

Hello, everyone,
I am currently in the process of modeling a production line with SimEvents. Unfortunately I can't get any further and need help urgently.
There are 3 stations and each station has several facilities. That means I can run several batches at the same time. How can I set that a new batch should start a free plant?
I also try to find out how I can define the states for the individual plants in SimEvents.
Example:
Plant 1 has the following states: Water supply, Heat, Rest and then Ready for discharge.
Do you have an idea?

Best Answer

The best option here is the entity output switch block. Each plant is connected to a port of this block. There are several options available for selecting the plant. If you want new entities to be directed to an idle plant, you can choose the "First port that is not blocked" option. You can also create set and get functions to query the status of the plants and use a MATLAB function block to randomly choose from idle plants.