WSMLink`
WSMLink`

WSMRealTimePlot

WSMRealTimePlot[conn,{"v1","v2",},dt]

plots the latest dt seconds of variables vi from WSMSimulationConnection conn.

WSMRealTimePlot[conn,{"v1",}]

accumulates data until the simulation is stopped.

WSMRealTimePlot["mmodel",{"v1","v2",},dt]

plots from a new real-time simulation of mmodel.

Details and Options

  • WSMRealTimePlot has the same options as ListPlot, with the following additions and changes:
  • Paneled Trueshow panel with buttons
    ShrinkingDelay Automatictime before shrinking plot range
    Ticks "Relative"tick labels and behavior
    WSMPlotUpdating Automaticupdating behavior
  • WSMRealTimePlot defaults to PlotLegends->Automatic and uses variable names vi in the legend.
  • Ticks accepts the following values:
  • "Relative"time relative to current simulation time
    "Absolute"time since simulation start
  • WSMPlotUpdating accepts the following values:
  • "Scrolling"max extra space after last data
    "Overwrite"overwrite earlier plot data
    {"mode","p1"->v1,}use mode with suboptions pi

Examples

open allclose all

Basic Examples  (4)

Load Wolfram System Modeler Link:

Start a real-time simulation and plot two variables:

Plot the last seven seconds of simulation:

Start the simulation:

Stop the simulation:

Plot with an overwriting scroll mode:

Plot the last seven seconds of simulation:

Start the simulation:

Stop the simulation:

Show a plot of a new real-time simulation of a model:

Generalizations & Extensions  (1)

To plot a single variable, it can be given without a list to WSMRealTimePlot:

Options  (7)

Paneled  (1)

Show a real-time plot without a frame and buttons:

Start the simulation:

Stop the simulation:

PlotLegends  (1)

Use variable names as PlotLegends:

Use variable descriptions:

Use a custom legend:

ShrinkingDelay  (1)

Shrink the plot range to fit data after two seconds:

Never shrink the plot range:

Immediately shrink the plot range:

WSMPlotUpdating  (2)

Use a scrolling plot mode:

Pad the plot area with a maximum of 2 seconds:

Use an overwriting plot mode:

Ticks  (2)

Show absolute ticks in a scrolling plot mode:

Show relative ticks in a scrolling plot mode:

Show absolute ticks in an overwriting plot mode:

Show relative ticks in an overwriting plot mode:

Properties & Relations  (2)

WSMRealTimeSimulate returns a WSMSimulationConnection used in WSMRealTimePlot:

Use WSMPlot to plot static simulation results: