Group Abstract Group Abstract

Message Boards Message Boards

How to connect with the WSMRealTimeSimulate?

Dear members of the community, In trying to make more interactive simulations, I looked into the functions WSMRealTimeSimulate and WSMRealTimePlot. I am using Wolfram Desktop. My code is like this.

s1 = SystemModel[
  "Modelica.Blocks.Sources.Sine", <|
   "ParameterValues" -> {"freqHz" -> 50.0, "amplitude" -> 0.5}|>];

To simply simulate a sinusoidal signal with frequency=50 Hz and an amplitude of 0.5. I also use the WSM link

Needs["WSMLink`"];

Then,

conn = WSMRealTimeSimulate[s1]

and to visualize the signal

WSMRealTimePlot[conn, "y", 0.1, PlotRange -> All]

The connection seems to work, but the viewed signal is always zero. I like to ask if someone may help with this. Simulating the block with the traditional SystemModelSimulate seems fine. Thanks in advance.

Jesus

4 Replies

Sergio,

That is great! Thank you very much.

Cheers,

Jesus

POSTED BY: Sergio Vargas

Sergio, Thanks for your kind response. So, I guess now the important question will be, what is the shortest sample time WSMRealTimeSimulate can handle? A 50 Hz signal is a rather slow signal, I think. Cheers,

Jesus

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