Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Simulink: Synchronizing and timing

in order to simulate some processes I have a problem with getting a predefined working order of my self modeled blocks.

How can I be sure, that for example Block A must be finished before Block B and C start working?

The problem is, that some Blocks shall work after some others and some shall not. I must admit I have not much experience with Simulink in order of doing time-depending things (althought basic knowledge of simulink is available).

For instance this scenario shall be realised:

A -> B, C -> D, E, F

The main thing is, that all blocks A-F have no logic correlation to each other, they all do several things. My aim is to make B and C start working, after A has finished. And D/E/F after B AND C have finished. In this case, the word "parallel" was the wrong word, this does not have to be calculated really parallely. Just making sure, that this complies with a predifined steady order.

Edit: My new idea is to use the matlab workspace als buffer, so my block A can push its results to workspace (by the "to workspace" block). But now I have to make sure, that block B and C may read the results (with "From workspace") of A AFTER A pushed its information to workspace...how to do this?

Edit2: Here's a screenshot which should make some thinks clearer: As the documentation of "Sorted order" refers, the set up seems to be ok (including the subsystems timing). But unfortunately problem still exists. The variable "simin" is loaded from workspace, before it was written :( As you see, the display shows "1", which it shouldn't do. In the very first run of the simulation I get an exception, that the variable "simin" does not exist.

It would be nice, if you can help me with my issue.

Greets, poeschlorn

like image 544
poeschlorn Avatar asked Jun 03 '26 23:06

poeschlorn


2 Answers

So in your example, if you have Block A connected with the same wire to both B and C, when Block A is finished, Block B and C will work in parallel.

EDIT: I am using the same blocks as you are, but it works for me. I think you are over complicating things. The way you are setting block priorities is no different than how Simulink runs the blocks without them. Below you can see my setup and the output on both binary displays.

enter image description here

The error you see on the first run is due to Simulink not creating the variable until the first time step is being executed. When Simulink builds the simulation it sees that the variable used as input from the workspace is not created.

like image 132
akd Avatar answered Jun 06 '26 07:06

akd


If the connection between the block are not enough to set the order, you can use block priorities.

A tip to test the execution order is to add an "embedded Matlab block" with a disp command displaying the name of the block.

like image 24
Clement J. Avatar answered Jun 06 '26 07:06

Clement J.