# 06_WhatsNewWSM_WTCtalk

0 (0 Likes / 0 Dislikes)

New in version 4—it’s kind of tight on time so we’ll started directly with that.
Version 4 came out a month or so ago
and one of the key features is that we have improved the built-in libraries.
So we’ve added several libraries from these Modelica Standard libraries
where we show mechanical components and so on,
including already existing libraries—like the rotational and translational libraries—
where we have added capabilities to model the thermal properties of those systems.
And a fundamental wave library, which is basically the old method
in order to make faster simulations of electrical machines and so on.
So this means that with these extended libraries
you can develop more systems just out of the box than you could do before.
But I will not really show there details because the more interesting addition is the SystemModeler Library Store,
which I will spend quite some time on.
So with SystemModeler 4,
we developed a system to add licensed libraries in a streamlined way,
so it’s easy to install additional libraries and that you do from the Library Store.
And as I mentioned in…,
oh it says “Mexico” here and that’s probably because it was a Mexican that has developed this ModelPlug library,
anyway,… today we’ll launch this ModelPlug library
so it’s a library for connecting actually two Arduino
So as you ask for robots, I think actually that this has a small…
even though you asked for some other type of robot I imagine…
This is an example for how you would use the ModelPlug library where you have…
in SystemModeler you build up a system with a control panel, a robot arm,
and then some filters here to get a smoother drive of the system.
And at the end what you will have is a system where you connect a simulation model with a robot arm,
so you have an input from the control panel,
goes to the simulation, returns to the robot arm.
And if we will look at that, it will look something like this.
So you will have a connection where you use the model and you will have a library,
completely drag and drop built this together,
to connect to the Arduino board and communicate with the system.
So you don’t have to do any programming at all—
you just use the drag and drop library just as with the Hydraulic library
or the Mechanical library and so on and then connect,
plug in your Arduino board and it kind of runs.
That came today so I don’t have a slide prepared for that
so that was kind of extra information but the connectivity session will discuss more about that.
But one important thing we added is the Hydraulic library.
But one important thing we added is the Hydraulic library.
Heavy equipment is probably one of those where you would most like to think of—
aircrafts, automotives, robotics and so on,
are all systems that are heavily dependent on hydraulic systems.
The library contains components about cylinders and so on.
So if I look at that…
if I look at the library it has assorted examples.
It has different valves—I can open valves and see the directional control valves of different types,
like conventional solenoid activation valves and so on,
proportional activated valves and so on.
So we have all these different components
and you can use those to build up a system like a cylinder motion system.
So if we look at the hydraulic library system, it will look like this—
where we have the pump here, which was driving at a constant speed,
and that is basically driving a valve, or it goes to the valve,
and depending on how we control the valve with the input signals there
it will either be in different positions where it will do different operations.
We have the pressure relief valve and so on.
And at the end what we activate here is a mass that we’ll try to move forth and back.
So when you have these kinds of systems, it works just the same way as any other system or Modeler model
but I simulate that and I have access to all the components like the position sensor,
so I can open up and look at the sensor and see the position of the mass and how that is moving.
Or I can access, let’s say, go to the…
look at the… the load position, oh that was the same…
the load speed or I can go into any of the tanks,
look at the pressure—that one is boring.
Oh, the tank will, of course, have a constant pressure in this case.
I can go to the pressure relief valve and look at the leakage,
pressure, mass flow and so on and so forth.
So I have access to all these variables and I can connect this, as you saw, to other systems.
We also added a SMART Cooling library—this just is a hydraulic library.
It is a commercial, paid library that you have to pay extra for.
But this is used to model cooling systems, especially in automotive applications.
So if you want to model, for instance, cooling fans or water pumps,
these are included in this library.
And this library, by the way, is developed by a third party: Austin Institute of Technology.
So if you are interested in developing and deploying your own libraries,
you can do that through the library store now and users will be able to buy them
or if you provide it for free, be able to get them, download them for free
and then install them automatically to SystemModeler.
A library that was available from before, so I’m not really going to go into that,is the BioChem library.
This model here, we have...
the biochem library basically enables you to do…
let’s show a very simple example first.
Simple pathways that are…biochem examples
this is the simplest possible biochemical pathway.
Two compounds— glucose 6 phosphate, or however that is pronounced in English,
and fructose 6 phosphate—they are connected with some reaction here
that has some kind of parameters that governs the reaction.
Basically what we are simulating here is the transfer from one to the other
and basically the mass balance between these two.
And as you go, you will develop more complicated and complex systems,
like the metabolic system, which has a lot of these compounds.
And then you can also add. So in these, we have the liver,
we have the cardiovascular system, and we have the blood plasma,
and each of those have those kinds of pathways
that are interconnected to each other and we can do experiments.
In this case, we have insulin that we inject
and we want to see how insulin transfers through the body.
And we can get something like this, where we will see a variation;
we do simulation with different inputs and we’ll get different outputs
on the level of insulin in different parts of the body.
But you can also do, I saw this,
I hadn’t planned this but this is actually an interesting new feature of SystemModeler
where you can play it, where you can see dynamic diagrams.
So this is when you combine Mathematica and SystemModeler now,
the diagram that you saw, this is the diagram as the drag and drop in SystemModeler,
but we have added an app in Mathematica and in Mathematica you can automatically get
these kind of arrows here that show the flow of insulin
between different compartments as the simulation goes on.
And it’s two different simulations—one from a healthy patient
and one from someone with a disease.
So if I repeat that, you can see we are entering the infusion here in the beginning
and we can compare how these two behave differently.
And we can use this to understand how a healthy patient is transporting insulin
compared to a diseased patient.
And if I have time I might show a little bit larger example later on.
There is a planar mechanics library that has also been added.
Yes, the biochem library is free, you can download that.
It is primarily for didactical purposes,
so for education you can use that to do things like Newton’s cradle or similar things.
The wheel that I showed in the previous presentation was done with the planar mechanics library
so that is one example.
And if you’re especially interested in a topic, just stop me and,
just like I did with the biochem, I’ll give you a bit of explanation around that.
There’s a SystemDynamics library, which is used for systems that are,
I would say, quite different from the rest of the systems that are typically developed in SystemModeler.
It could be things like developing a SystemModeler of the energy market—
how do we best meet demand depending on which supply we have of the raw material?
How would we use that to meet demand and maximize our profit?
Or it could be more logistic to see how do we transport our oil
from A to B in the most efficient manner?
It could be disease propagation.
That might be interesting today with Ebola.
So like an influenza epidemic where you would see things like this
where you can study how an influenza outbreak…
You have the green curve here is the non-infected population—
in the beginning no one is infected and up to where I start to get infected,
and I was there like two weeks ago, I started to get here,
and then you get sick or some of us get sick
and then after a while you get healthy
and then one or two days ago I entered into the healthy population again.
So in this way, you can use the model to study what happens
if we try to stop the influenza from spreading in this location or that part.
How can we best prevent an epidemic or even more a pandemic situation?
So that’s the kind of thing you do with the SystemDynamics library.
We have added a lot of help and the Help system has been vastly improved.
So we added a documentation center where everything is gathered together.
So, for instance, if you want to get started,
you click on “Get Started” and it looks similar to Mathematica’s Documentation Center,
where we have introductory videos, tutorials and so on.
And if we go to the question of how are the components documented,
then we can go in, let’s say, to the Mechanical system here,
look at the Rotational library, and each library has the documentation like this where you can find,
let’s say, let’s look at component like inertia.
If I click on that, I will get a list of different features that I could look at.
For instance, I can see examples in which it is used in order to understand the uses of it
so it automatically gives all examples where it is used and I can click into that example,
learn more of how this example is set up, what are the results,
I can open the example, simulate the example and try it that way.
So everything is cross-linked and put together in ways
so you can go from either start from an example and find the different components
or if you start from a component find examples that correspond to that
that will show you how to use it.
This is also available from reference.wolfram.com
so we can see the whole documentation from there and look at it.
That goes for the built-in libraries and everything else too.
I will not talk too much about this as there is a separate session for that.
Connectivity and Deployment is a really important part that we added to SystemModeler
and that is why it has its own session
but basically it’s a way to do things like connecting input devices.
So, sometimes I bring a quadcopter with me or a game pad
and then I have the quadcopter that is modeled in simulation center
and I use the game pad and I can control it and drive the simulation from that.
So that’s one thing you might want to do.
Another thing is going the other way around when you want to
drive a physical system from the model and you can do that, for instance,
by TCP based-communication, which is standardized.
There is also added something call functional mockup interface,
which is a way to export your model.
So once you have the model in SystemModeler
and you want to use it in some other hardware, software, you can export that
in the so-called functional mock up unit, which is a standard and is used by 30, 40 or 50 other tools.
So you can import into them.
Like, for instance, in various
and try real time and develop it for real time applications and so on.
But there is a separate presentation of that.
Another thing you asked for how to get the equations into Mathematica
I will show the other way around first because we added that to SystemModeler 4.
So we have improved the integration into Mathematica a lot,
so things are much smoother, it’s quicker to do things.
But one of the things is that we made it possible to create models from Mathematica.
So if we look at this system here, in Mathematica
you can define states stay systems and transfer systems, like this.
And then we added the function “WSMCreateModel”
that takes the Mathematica system and creates a corresponding model with the name you give it.
So if I press “Shift Enter” here what will happen is that this is created
and if I go to SystemModeler I can now reuse this system within SystemModeler like this.
It kind of doesn’t make any sense to use this probably in the biochem pathway here,
but in that way I can start creating my own components from Mathematica.
It could be based on equations also.
So I could say like creating a bouncing ball model with typical Mathematica equations,
adding events, setting initial equations and so on.
And I can create that and I can either get that up here—what was the name? BouncingBall—
I get that model here but I can also simulate that from within Mathematica
just as any other simulation or model.
But more importantly, I would say, what you can do is
from within Mathematica rather than using the graphical drag and drop way to connect,
sometimes it makes sense to programmatically create your models.
And now you can use WSM components to do connections.
So we’ll create something call “Abs” “sine” here and we have a list of components:
“A”, which is of the class “Abs”, one “sine”, which is of the class “Sine”,
and these classes are Modelica classes from libraries within the Modelica Standard Library.
And then we say some connections that we want to connect “sine.y” with “a.u”—
that’s the two things we want to do when we create this model.
So this is a Mathematica command.
You might wonder with this simple example—why would I like to do this?
This would have been faster to connect in the graphical user interface, of course, right?
But suppose you have a system—let’s say you have an electrical system—
where you have different types of electrical resistors with different behaviors,
like faulty behaviors and so on.
And you want to build a huge set up of different models
where you will use this faulty resistor in different combination at different places.
Then you can generate all of these programmatically to get a table of models
from within Mathematica rather than having to connect each and every one by hand.
So you can get a huge amount of models that you can simulate and then test the behavior.
No I don’t think so but I actually don’t know.
Does it work in the raspberry pi?
So you asked also about how do I get equations into Mathematica.
There is a function here where you can query the model for…
that was in Model Data, I guess…
so I went to the Help and the Help from within Mathematica is the same,
works the same as any other Mathematica help, of course.
So I have the different functions here and I can find “WSMModelData”
and from “WSMModelData”, as you can see, I can query things like, give me the diagram.
There should be an example of system equations here, I guess. Yup.
So you asked for the model name and system equations and you will get those into Mathematica.
And then you can start manipulating this in Mathematica.
There are several examples of online where you can download examples and try it out.
Where did I download that?
I do not have that prepared but we can look at that at the end if you would like.
We have just two more minutes left, I think.
Let’s save that.
So, what is new? This is a very fast go through, like a selection of what’s new.
And try to lift it up to a higher level.
The first is expanding the scope. So adding both built in libraries,
but digital library and additional functionality to the rotational translational library and so on.
I focus quite a lot on this—new add on libraries that you can add functionality,
among those the hydraulic library.
There are also things in the way
that you can more easily get started with it by adding the Documentation Center,
yet again a very quick go through but it is a very important way to kind of gather things together
in a more structured way than in previous versions.
There are also a lot of small improvements in Model Center and Simulation Center
to make it easier to, for instance, construct your parameters and so on.
Connectivity, there’s a separate presentation for that
but I will get back to those in the last slide.
Finally, a lot deeper integration with Mathematica
where I quickly, for instance, showed the dynamic diagrams,
which would perhaps be easier to see on that we have tanks and levels that go up and down
rather than looking at a plot.
There are the program of inspirational models…
But also we have made sure that it is easier to use other built-in functionality with Mathematica
that was available since previous versions, including Mathematica 10,
like using the gauges to visualize your system to make that more direct.
It has control system capabilities in Mathematica
and we’ve made it easier to use that together with SystemModeler and so on.