Getting Started with Model Simulation and Analysis

System modeling functionality is included in the Wolfram Language, allowing simulation and analysis of real-world phenomena in many domains.
The full Wolfram SystemModeler product also includes dedicated graphical user interfaces for model creation, exploration, simulation and analysis.
This tutorial gives an introduction to the functionality included in the Wolfram Language.
Explore Examples
SystemModeler comes with bundled examples from many domains and of varying complexity. All the bundled examples can be explored and simulated using the SystemModelExamples command. Evaluate the cell below to create the interactive example browser.
It is also possible to list all example models.
Other sources of examples and models include:
Model Representation
System models in the Wolfram Language are represented with a SystemModel. Models are available either from other functions like the SystemModelExamples above or referring to them by their name as a string.
The resulting object can be copy-pasted, used in inputs to other functions and queried for properties.
Simulation
SystemModelSimulate runs a simulation of a model created in the Model Center and returns a SystemModelSimulationData object. SystemModelPlot is used to visualize results from that simulation.
SystemModelSimulate[model]
simulate the model
SystemModelSimulationData[]
object containing simulation results
SystemModelPlot[sd,"MyPlot"]
show stored plot "MyPlot" from the SystemModelSimulationData sd
SystemModelPlot[sd,{"v1",}]
plot variables vi
Basic system model simulation functions.

Basic Simulation and Plotting

To simulate a model, use the command SystemModelSimulate with the model as the argument.
The output from SystemModelSimulate is a SystemModelSimulationData object. This object can be used in SystemModelPlot to plot variables from the simulation. For many example models, there are stored plots defined by the model creator. These can be listed using the "PlotNames" property of the simulation result.
Such a plot can easily be shown in SystemModelPlot.

Simulation Data

The simulation result object also has a number of properties.
Take a look at the variable names in the simulation.
Plot two variables using SystemModelPlot.
Retrieve the value of the variables "syse.sys.resistor.i" and "syse.sys.resistor.v" at time 2.

Parameter Changes

Simulate again, changing two parameters using "ParameterValues" and compare a result variable between the simulations.

Parameter Sweeps

Multiple simulations for a number of values of a parameter are automatically done in parallel. Simulate a bouncing ball with different amounts of bounciness "e".
Plot the height of the balls over time.

Custom Plots

By retrieving the simulation results as data, results can be visualized and analyzed in many waysfor example, by plotting the results from a Chua circuit on a ParametricPlot.
Pick out the variables "C1.v" and "C2.v".
A Lorenz attractor makes for a beautiful simulation result with ParametricPlot3D.
Model Data
In addition to driving simulations of models from the Wolfram Language, it is also possible to work with the model more directly. SystemModel is used to retrieve information about models, and FindSystemModelEquilibrium and SystemModelLinearize are used to obtain equilibrium points and linear state-space representations.
SystemModel[model,]
retrieve information about model
FindSystemModelEquilibrium[model]
find equilibrium points for model
SystemModelLinearize[model]
get a linear state-space representation of model
System modeling functions.

Equations from Model

Retrieve information about a model with SystemModel. First, get an overview of the model information.
Get the system equations depending on the time variable t.
Find a point where all derivatives are zero, also called an equilibrium point.
There are a large number of properties of SystemModel that can be used to get information about the model.

Equilibrium Points and Linear Representation

Use FindSystemModelEquilibrium to find an equilibrium point for a model of a mixing tank.
The function SystemModelLinearize gives a linear state-space representation of a model at an equilibrium point. The result is a Wolfram Language StateSpaceModel.
The control functionality in the Wolfram Language can be used to further work with this representation. Design a controller using pole placement and show the output response to unit step inputs.