WSMLink`
WSMLink`

WSMSetPlot

WSMSetPlot is being phased out in favor of SystemModel, which was introduced experimentally in Version 11.3.

WSMSetPlot["mmodel","name",{"v1","v2",}]

stores a plot of variables "vi" as "name" in the model "mmodel".

WSMSetPlot["mmodel","name",{{"v1,x","v1,y"},}]

stores a parametric plot with x and y coordinates vi,x and vi,y as a function of time.

WSMSetPlot["mmodel","name",,{tmin,tmax}]

stores a plot for the time interval tmin<t<tmax.

WSMSetPlot["mmodel","oldname""newname"]

renames the plot from oldname to newname

Details and Options

  • A stored plot can be shown with WSMPlot["mmodel","name"].
  • WSMSetPlot[,{{"v1", "p1", d1},}] stores variables vi with sensitivity bounds when parameter pi varies 100 di %.
  • The shortest unique model name mmodel can be used where WSMNames["*.mmodel"] gives a unique match.
  • Using "group/plot" as a name puts plot in group.
  • The following options can be given:
  • AxesLabelAutomaticaxes labels
    PlotLegendsAutomaticlegends for curves
    PlotRangeAutomaticrange of values to include
    "Preferred"Falsewhether the plot is a preferred one
  • AxesLabel can be Automatic, None, a string label for the y axis or {"xlabel","ylabel"}.
  • Possible PlotLegends are Automatic, None or a list of one string per variable in the plot.
  • PlotRange is Automatic, {ymin,ymax} or y, which is interpreted as {-y,y}.
  • If "Preferred" is True, it will be included when plotting preferred plots with WSMPlot[sim].

Examples

open allclose all

Basic Examples  (4)

Load Wolfram SystemModeler Link:

Store a plot to a model:

Simulate and show the newly defined plot:

Store a parametric plot:

Simulate and show the newly defined plot:

Store a sensitivity plot:

Plot the sensitivity of "integrator1.y" to the parameter "sine.freqHz", varying by 10%.

Simulate with sensitivity analysis against the frequency parameter:

Show the stored plot:

Scope  (5)

Store two plots in a group:

Simulate and show all plots in the group:

Store a plot with custom plot legends:

Simulate and show the plot:

Store a plot with custom axis labels:

Simulate and show the plot:

Restrict the plot range:

Simulate and show the plot:

Rename plots:

Store a plot that will then be renamed:

WSMSetPlot can rename the plot but keep the contents:

Simulate and show the renamed plot:

Generalizations & Extensions  (1)

Get the full plot specification for stored plots:

Options  (7)

AxesLabel  (2)

Turn off axes labels completely:

Simulate and show the plot:

Specify an axis label for one axis:

Simulate and show the plot:

PlotLegends  (2)

Turn off plot legends:

Simulate and show the plot:

Turn off the plot legend for one variable:

Simulate and show the plot:

PlotRange  (2)

Store a plot range symmetrical around 0:

Simulate and show the plot:

Constrain the time range:

Simulate and show the plot:

"Preferred"  (1)

Make a plot preferred:

Preferred plots are used in WSMPlot if no plot name or variables are given:

Properties & Relations  (4)

Giving the same name as an existing plot overwrites the plot:

The last stored plot is used:

List the names of saved plots using WSMModelData:

Saved plots are inherited:

The base model has a saved plot:

Create a model that extends baseModel:

The newly created model inherits the base plot:

The new model does not have any local plots defined:

Delete plots using WSMClearPlot:

Store a plot that will then be deleted:

WSMClearPlot removes the plot from the model:

Possible Issues  (1)

Models are not saved unless explicitly saved in SystemModeler Model Center:

After quitting the Wolfram Language kernel and SystemModeler, the copied model is gone: