System Modeling in the Wolfram Language

Patrik Ekenberg, Wolfram MathCore

Outline

Motivation

What is New?

How Does it Work?

What is System Modeling?

Analyze, understand and design systems

Introduction to SystemModeler

Switch to SystemModeler

SystemModeler[]

System and Software Requirements

Most Major Platforms

Compiler Needed

What’s New?

Previous situation

System modeling was a package for Wolfram SystemModeler users

What is new?

System modeling natively built in

Introduction

Central Object

SystemModel["Systems.InvertedPendulum"]

Information

SystemModel["Systems.InvertedPendulum"]["Summary"]

Properties

SystemModel["Systems.InvertedPendulum"]["Properties"]

Simulation

Plotting

SystemModelPlot[]

What to Plot?

SystemModel[,"PlotNames"]//TableForm

Customize Simulations

SystemModelSimulate[,<|"InitialValues"-> {"pendulum.pendulumJoint.phi"-> 0Degree}|>]

More Customization

SystemModelSimulate[,{0,4},
<|
"Inputs"->{"Vi"->TimeSeries[]},
"ParameterValues"->{"C1"->0.03,"C2"->0.115}|>
]

What to Customize?

SystemModel[,"InputVariables"]

SystemModel[,{"ParameterNames",Except["."]..}]

SystemModel[,{"SystemVariables",Except["."]..}]

Visualization

Simulation Results

trajectory=SystemModelSimulate[ImportString[,"MO"],{0,10}][{"x","y"},t]

Combining Graphics

Show[
ParametricPlot[trajectory,{t,0,10},Axes-> {True,None},PlotRange->{-5,5}],
Plot[0.5` +0.5` Cos[1.5` x] Sin[x],{x,-5,5}]
]

Parametric Simulations

sol=SystemModelParametricSimulate[,"z",{"a"}]

Plot[Evaluate[Table[sol[a][t],{a,0,1,.1}]],{t,0,10}]

Manipulate

Manipulate[SystemModelPlot[SystemModelSimulate[,<|"ParameterValues"-> {"a"-> a}|>],"z"],{a,0,1,0.1},ContinuousAction->False]

Creation

Changing Model Properties

SystemModel["DocumentationExamples.Modeling.ElectricCircuit.LowpassFilter"][<|"ParameterValues"-> {"C1"-> 0.1,"C2"-> 0.01}|>]

Creating Components

datamodel=CreateDataSystemModel[TimeSeries[RandomFunction[ARProcess[{0.7},0.1],{0,10}]]]

CreateSystemModel[PIDTune[(TransferFunctionModelFull[((1.`)/(((1+s))^3)), , , ])]]

Connecting Components

ConnectSystemModelComponents[{"datamodel"∈datamodel,"lowPass"∈},{"datamodel.y[1]"-> "lowPass.Vi"}]

Equations

CreateSystemModel[{y[t]==Abs[Sin[t Cos[2t]]]t},t,<|"Extends"->"Modelica.Blocks.Interfaces.SignalSource"|>]

Questions?

What Happens to Previous Code and Functions?

The WSMLink` package with all the previous functionality will still be available.

New features will primarily be added to the fully integrated system, so switching to the new functions is encouraged.