Message Boards Message Boards

0
|
8943 Views
|
3 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Dynamic Diagrams of components

Posted 9 years ago

Dynamic Diagrams allow me to visualize the whole process of model simulation.

Import["dynamicTEst.mo", {"ModelicaModel"}]
conn = WSMLink`Simulate`Launch["dynamicTEst", 200, Method -> {"RealTime" -> True}]
Dynamic[Refresh[conn["Diagram", ImageSize -> 500], UpdateInterval -> 0.05, TrackedSymbols :> {}]]

But the most interesting things is happening in the components of the model. How can I visualize Dynamic Diagram of the model component?

POSTED BY: Alex Misnt
3 Replies

This is not possible in the released 4.2.

There will be some support for diagrams of components in the next release, but I cannot promise that it will make it to all variants, like the "Diagram" property of a running simulation.

POSTED BY: Malte Lenz

As far as I understand, you can only visualize the dynamic diagrams currently from Mathematica. this might change in a future version but I don't have access to that information. I'll show how to do this for the tank example in SystemModeler examples. Do the following in Mathematica:

Needs["WSMLink`"]

dsim = WSMSimulate["MathematicaExamples.Simulation.Tanks.TankSystem"]

diagram = dsim["Diagram", x];

Animate[diagram /. x -> t, {t, 0, 250}, AnimationRate -> 10]

This will give you the animated diagram in Mathematica and you can step through it. I found that you can programatically change many graphical features by putting variables into the annotations. (Things like adding a red slash through an icon when something goes wrong or out of bounds)

I am not sure if the original question is that you want to dynamically view classes that are inside of another class. In that case I would suggest making an empty graphical object and link the parameter of that object to the variable of interest. I hacked up the tank example to show how to make a graphic respond to what is going on in a sub-model. See the attached file.

enter image description here

Attachments:
POSTED BY: Neil Singer
Posted 8 years ago

I am also trying to figure out the same. Have you find any solution? If so, please share or inbox me, appreciate your help.

Thx!

POSTED BY: Roger Gerry
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract