"From Workspace" time delay
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello community, I have a tricky problem with the "From workspace" block.
I want the output of my Block A to be written to workspace (which works fine) and then be red by a "from workspace" block for beeing processed by block B.
My problem is now to make sure, that the "from workspace" block reads the variable AFTER block A has written down the information to the workspace.
In my case I have a 2-block demo for getting along with this issue. My aim is to build up a simulation with about a hundered of timedepending blocks, connected through to-and-from-workspace blocks.
The reason for using the workspace is that I can't say which output belongs to which input. This will be assigned by a m-File at the beginning of the simulation.
Edit: here is an screenshot, which shows the use of priority: http://img825.imageshack.us/i/screenshotbs.jpg/ As you see, the display on the right should show "0" instead of "1" (which was my former test value). This shows, that the "From workspace" block is beeing handled before the "to workspace" block. In this case there's another problem: When I start my simulation the first time, I get an exception, that the variable "simin" does not yet exist. If the order of priority would have been handled correctly, this problem may have not been occure...
It would be nice, if someone can give me a hint onto this topic.
Greets, Tobias
0 Kommentare
Akzeptierte Antwort
Martijn
am 2 Feb. 2011
If you right-click a block and select "Block Properties..." you can enter a Priority which influences the order in which blocks are executed. More about block priorities can be found in the documentation:
http://www.mathworks.com/help/releases/R2010b/toolbox/simulink/ug/f13-91940.html#f13-91958
3 Kommentare
Kaustubha Govind
am 2 Feb. 2011
Tobias: Again, even though the From/To Workspace blocks may be executing in the correct priority, it only means that their "Output" methods have executed in the given order. For example, it could mean the To Workspace block maintains an internal buffer to write the data, that it dumps to the workspace much later. There is no guarantee that it is written to the workspace in time for the To Workspace block to read it.
Weitere Antworten (1)
Kaustubha Govind
am 2 Feb. 2011
I am not sure if the From/To Workspace blocks lock down the workspace variable at any point during the simulation, but passing data through the model using these blocks may not be the best idea since they are meant solely for reading static data and data-logging, respectively. Is there a reason you wouldn't consider using the From / Goto blocks instead?
Note that assigning block priorities will be non-trivial if you plan to connect hundreds of blocks in this fashion. Also, Simulink will honor your setting only if there are no data-dependency violations.
4 Kommentare
Kaustubha Govind
am 8 Feb. 2011
Try something like:
set_param('mymodel/From', 'GotoTag', 'A')
set_param('mymodel/Goto', 'GotoTag', 'A')
Siehe auch
Kategorien
Mehr zu Interactive Model Editing finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!