There is a variety of factors that affect the output WSMRealTimePlot
, which could also be machine-dependent for high sampling frequencies. But there are a couple of options that allow you to have some control in real time simulation.
The first aspect to consider is that WSMRealTimeSimulate
has the option RefreshRate
which, to an extent, allows you to control the simulation communication rate (see the documentation page
https://reference.wolfram.com/language/WSMLink/ref/WSMRealTimeSimulate.html
).
In addition, the simulation settings of the model itself can be chosen so that a small simulation step size is used togetether with an integration method that accepts a fixed step size. These are set with the "SimulationSettings"
key in SystemModel
.
Using these 2 in combination you can sample more effectively a frequency like the one you request.
Finally, as I mentioned, the output of WSMRealTimePlot
is tricky, in the sense that it will generally be an approximation of the actual simulation data. This you can check by, at the end of your simulation, extracting the simulation data and plotting the now static data, where you'll generally find a smoother signal.
Here you see all these factors playing together with your original model frequency and amplitude:
And here's what the actual static data looks like in those last 0.1 seconds: