- https://in.mathworks.com/help/simulink/slref/add_line.html
- https://in.mathworks.com/help/simulink/ug/approach-modeling-programmatically.html#:~:text=add%20lines%20to%20connect%20all%20the%20blocks%20in%20the%20model
Automatically connecting the simevents blocks
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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.
0 comentarios
Respuestas (1)
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!
0 comentarios
Ver también
Categorías
Más información sobre Discrete-Event Simulation en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!