Borrar filtros
Borrar filtros

Automatically connecting the simevents blocks

2 visualizaciones (últimos 30 días)
Andanu Vidya Sagar Patro
Andanu Vidya Sagar Patro el 26 de Mzo. de 2022
Editada: ag el 30 de En. de 2024
I have an excel file as input for the matlab script. According to the excel file the blocks are generated automatically. I am facing issues with connecting the blocks. Because there might be sometimes parallel machines, so from one machine, the entities can pass to next three parallel machines. The excel file can be changed by the user according to requirement.
The blocks look like this:
The code should be flexible that if the user changes information in excel file then it should connect accordingly.
The blockas using simevents library are added in simulink model automatically. and that is working well according to my matlab script. but not able to connect the blocks accoridng to excel info. Wherever 'P' stands it connects to the previous 'S'.
I have attached the excel file and mtlab file here.

Respuestas (1)

ag
ag el 30 de En. de 2024
Editada: ag el 30 de En. de 2024
Hi Andanu,
To connect two blocks in Simulink, using MATLAB script, you can use the "add_line" function.
The "add_line" function takes "modelName", and "out" and "in" coordinates. You can either get the required co-ordinates from your excel file, or by using the "get_param" function.
The code snippet below, demonstrates how to connect "Source" and "Machine1" blocks generated by your MATLAB script,
out = get_param('Simevents_Model_01/Source','PortConnectivity').Position;
in = get_param('Simevents_Model_01/Machine1','PortConnectivity').Position;
add_line(Sys, [out ; in]);
You can modify the above logic accordingly, to connect the required blocks as per the data present in the excel file.
For more details, please refer to the following MATLAB documentations,
Hope this helps!

Categorías

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

Productos


Versión

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by