Wolfram Blog
Patrik Ekenberg

Announcing Wolfram SystemModeler 4.3

October 25, 2016 — Patrik Ekenberg, Applications Engineer, Wolfram MathCore

Today I am excited to announce SystemModeler 4.3. This release focuses on three key areas: model analytics, collaboration and performance, which I will illustrate in this blog. You can see more on the What’s New page, or download a trial to try it yourself.

I’ll start by talking about our improvements in collaboration. I develop lots of models in SystemModeler, and when I do, I seldom develop them in a vacuum. Either I send a model to my colleagues for them to use, I receive one from them or models get sent back and forth while we work on them together. This is, of course, also true for novice users. A great way to learn how to use SystemModeler—or any product, for that matter—is to look at things other people have done, whether it be a coworker or other users online, and build upon that.

Whether you send your models to other people, receive models or send models between your own platforms, we want to make sure that you have everything you need to start using the model, straight out of the box.

As an example, I have built a model of an inverted pendulum using the PlanarMechanics library. It has a linear-quadratic regulator built using the Modelica Standard Library, and it also includes components from the ModelPlug library that connect to real-life hardware, such as actuators and sensors on an Arduino board (or any other board following the Firmata protocol).

Model of an inverted pendulum

In the model, you can apply a force to different parts of the pendulum using input from an Arduino board. When simulated, the model produces an automatically generated animation.

Automatically generated animation

As a developer of this model, I usually know of quite a few things that will be interesting to plot. In this particular case, for example, you can create interesting results by studying the different forces acting on the pendulum and the different states of the controller. In SystemModeler 4.3, you can predefine plots in a model. After choosing a set of variables to plot, simply right-click “Add Plot to Model” and give it a name, e.g. ControllerInputs.

Add plot to model

Now the stored plot can easily be accessed each time the model is simulated.

Simulating the model

Even if model parameters or the model structure are changed, the plots will remain and be available next time you need to use the model. Storing plots is not only a useful feature when you revisit models that you yourself have built, but it is also useful when you share or receive models from others.

Now, let me save this model and send it to a colleague. Previously I would have needed to make sure that they had all the resources to run the model, including all the libraries I have used. In SystemModeler 4.3, I can now easily save all this in one convenient file with the improved Save Total Model feature. Everything needed, including libraries, stored plots and animation objects, will be available for the person who receives the file.

Everything included

So a coworker receives my model—how would he or she begin analyzing it? In SystemModeler 4.3, we have introduced new model analytics features that help answer that question. Starting out, we can get a quick look at the model using the new summary property for WSMModelData.

WSMModelData["InvertedPendulum", "Summary"]

InvertedPendulum summary

The pie chart shows how large of a percentage of components are from a particular domain. A majority of the components comes from the dark blue slice, the PlanarMechanics library. In Mathematica, you can mouse over the slices to see the domain name.

Another good place for my coworker to start would be by looking at the plots I defined in the model before sending it. Support for the stored plots have, of course, also been included in the Wolfram Language. If a plot has been chosen as the preferred plot, a very neat one-liner in the Wolfram Language makes it easy to start exploring the model.

WSMPlot["InvertedPendulum"]

Plot of InvertedPendulum

In Simulation Center, you will find a list of all stored plots in the experiment browser. You can list all the available plots with the Wolfram Language via the "PlotNames" property.

WSMModelData["InvertedPendulum", "PlotNames"]

{"ControllerInputs", "XY-Position", "PositionVelocityAcceleration", \ "AppliedForces"}

Parametric plots can be stored and plotted.

WSMPlot["InvertedPendulum", "XY-Position"]

XY plot of InvertedPendulum

Use the stored plot functionality to easily measure the response to changes in parameters.

WSMPlot[WSMSimulate["InvertedPendulum",    WSMParameterValues -> {"body.m" -> {0.25, 0.5,        0.75}}], "AppliedForce"]

InvertedPendulum applied force plot

A stored plot can consist of multiple plots.

WSMPlot["InvertedPendulum", "AngleAndPosition"]

Plot of InvertedPendulum with angle and position

One area where we have made heavy use of this new functionality is with our SystemModeler examples. On our webpage, we have for a long time provided a large selection of SystemModeler models collected from different industries and education areas. Whether it be the internal states of a digital adder or the heat flows in a freezer, these examples usually contain a lot of different things that you can study. We have now added the most important plots to analyze and understand each example model using stored plots.

Furthermore, the models that we have created over the years have now also been included directly in the product. Whether you want to get started using SystemModeler using models from your domain or study new concepts, the new included curated models will be useful.

Now let’s return to the model my colleague just received. Suppose that he or she would like to perform some further analysis on it. A new set of templates has been included in order to facilitate this. The following command, for example, creates a template in Mathematica that allows you to change an input in real time and plot the response.

WSMCreateTemplateCell["InvertedPendulumControl", "ChangeRealTimeInput"]

Just fill in the blanks, and the simulation models will come alive with real-time interaction in Mathematica.

Real-time simulation

Templates for many other tasks are available, such as FFT analyses, model calibrations, parameters, initial value sweeps and much more.

These are just some of the new, exciting model analytics and collaboration features in SystemModeler 4.3. For a more complete view, check out our What’s New page. If you try out the new SystemModeler, you will experience one of the things that I haven’t mentioned, namely that it is snappier and faster than before. Actually, performance has been improved across the board, including faster model compilation times and faster simulations from the Wolfram Language.

Leave a Comment

No Comments




Leave a comment

Loading...

Or continue as a guest (your comment will be held for moderation):