"From Workspace" time delay

3 visualizaciones (últimos 30 días)
Tobias
Tobias el 2 de Feb. de 2011
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

Respuesta aceptada

Martijn
Martijn el 2 de Feb. de 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 comentarios
Kaustubha Govind
Kaustubha Govind el 2 de Feb. de 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.
Tobias
Tobias el 8 de Feb. de 2011
damn, I clicked at "accepted" by accident, sorry for that. The problem of getting an order to my blocks has been solved by the "Enabled Subsystem" blocks

Iniciar sesión para comentar.

Más respuestas (1)

Kaustubha Govind
Kaustubha Govind el 2 de Feb. de 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 comentarios
Tobias
Tobias el 8 de Feb. de 2011
hey, I just tried using from/goto but how can I parametrize the tags that they can be assigned by a m-file (by the preLoadFcn callback)? I need to use a dynamic way to assign the output ports of one block to one or more input ports of another block...
This whole procedure shall simulate several signals which are processed and written back to it's source to be written from the next block (which does the same and so on...)
Kaustubha Govind
Kaustubha Govind el 8 de Feb. de 2011
Try something like:
set_param('mymodel/From', 'GotoTag', 'A')
set_param('mymodel/Goto', 'GotoTag', 'A')

Iniciar sesión para comentar.

Categorías

Más información sobre Interactive Model Editing en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by