Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,930 --> 00:00:02,700
Speaker1:
Hello, my name is Carlos Osorio.
2
00:00:03,660 --> 00:00:05,310
I'm an application engineer at the math
works.
3
00:00:05,880 --> 00:00:10,320
And this is part two of the power
differential equation becomes a robot
4
00:00:10,320 --> 00:00:14,940
seminar. So in this section, we're going to
focus on modeling actuators and modeling
5
00:00:14,940 --> 00:00:20,460
sensors in general, how to model any kind of
linear or nonlinear component and bring and
6
00:00:20,460 --> 00:00:22,260
connect this to your model.
7
00:00:25,080 --> 00:00:31,410
In part one, which hopefully you guys have
watched with, discussed how to create dynamic
8
00:00:31,410 --> 00:00:34,770
models of three dimensional mechanisms.
9
00:00:35,040 --> 00:00:42,240
So once we have the mechanics in order to
move this robot, we need to apply some talks
10
00:00:42,240 --> 00:00:43,890
for which we're going to need motors.
11
00:00:44,040 --> 00:00:48,930
So if those motors are going to have some
effect, some dynamic effect on my mechanism,
12
00:00:48,930 --> 00:00:55,740
I better have mathematical models of those
of those dynamics included in my model.
13
00:00:55,950 --> 00:01:02,340
So for that, where we're going to use this
signaling and let me go back to my MATLAB,
14
00:01:03,150 --> 00:01:07,450
for those of you that don't see me link very
much or having you simulating signaling
15
00:01:07,470 --> 00:01:12,840
starts by typing, simply link on the command
line or by using this icon here.
16
00:01:12,870 --> 00:01:16,500
This is the this is the signaling icon right
here.
17
00:01:18,270 --> 00:01:20,940
So you can just click on that.
18
00:01:20,940 --> 00:01:24,210
And what that would do is it would open the
simulant library browser.
19
00:01:24,300 --> 00:01:27,720
What you're seeing is the base signaling
product right now.
20
00:01:27,720 --> 00:01:34,770
All these are libraries of graphical blocks
that have mathematics already already defined
21
00:01:34,770 --> 00:01:42,060
for them. Signaling is a full fledged
dynamic simulator, so it allows you to create
22
00:01:42,060 --> 00:01:43,440
linear nonlinear.
23
00:01:43,440 --> 00:01:49,440
This continuous, discontinuous models and do
very complicated constructs, which are full
24
00:01:49,440 --> 00:01:50,850
fledged programming language.
25
00:01:50,850 --> 00:01:52,870
So there is lots of capability.
26
00:01:52,890 --> 00:01:55,170
So I'm going to let me open.
27
00:01:55,170 --> 00:01:57,150
I have a little template that I want to use.
28
00:01:57,180 --> 00:02:00,930
So what we're going to do is we're going to
try to create, in this example, a model of a
29
00:02:00,930 --> 00:02:07,590
DC motor. And I have here on the side a
little bit of a mathematical first principles
30
00:02:07,590 --> 00:02:09,780
implementation of the dynamics of a DC
motor.
31
00:02:10,020 --> 00:02:12,870
There's an electrical side and there's a
mechanical side.
32
00:02:12,870 --> 00:02:19,080
So I have kickoffs law doing the dynamic
balance of the electrical side and Newton's
33
00:02:19,080 --> 00:02:22,500
law doing the mechanical balance on this
side here.
34
00:02:22,680 --> 00:02:28,020
So there's the equations are the response of
this motor is going to be a function of the
35
00:02:28,020 --> 00:02:31,500
inductance, the resistances, the friction or
the.
36
00:02:32,100 --> 00:02:38,850
In this case, I have like a little bit of
damping the inertia, the and because there's
37
00:02:38,850 --> 00:02:43,240
a connection between the electrical and the
mechanical side here, I know that the back
38
00:02:43,260 --> 00:02:47,520
EMF voltage is going to be proportional to
the speed of the motor, to the mechanical
39
00:02:47,520 --> 00:02:52,230
rotational speed of the motor and the actual
torque, the electrical torque.
40
00:02:52,230 --> 00:02:56,550
The electromagnetic torque is going to be
proportional to the current circulating
41
00:02:56,550 --> 00:02:58,050
through the armature of the motor.
42
00:02:58,080 --> 00:03:02,850
So this is the system of equations for this
particular case that we want to build.
43
00:03:03,090 --> 00:03:05,220
So how do we do this with signalling?
44
00:03:05,550 --> 00:03:08,250
So I'm going to bring in some blocks.
45
00:03:08,430 --> 00:03:11,070
I just want to keep that on the side so we
can guide ourselves.
46
00:03:11,070 --> 00:03:15,950
So we're going to need some integrators
because we are doing differential equations.
47
00:03:15,960 --> 00:03:19,950
We're going to need in my sync, but I'm
going to need like an oscilloscope to look at
48
00:03:19,950 --> 00:03:25,560
things. I'm going to bring in from my
sources library knowledge that you have all
49
00:03:25,560 --> 00:03:30,210
kinds of like noise generators, sine
generators, random signal generators.
50
00:03:30,210 --> 00:03:35,880
I'm going to bring in a step and I need I'm
going to need some, some from the
51
00:03:35,880 --> 00:03:39,810
mathematical operations, like I'm going to
need some summation blocks because there are
52
00:03:39,820 --> 00:03:45,090
things adding and subtracting, and I'm going
to need a gain to multiply things.
53
00:03:45,330 --> 00:03:50,940
So the way you work on signaling is
basically connecting blocks.
54
00:03:50,940 --> 00:03:52,440
That's how you program in signaling.
55
00:03:52,440 --> 00:03:55,920
So I can connect this step to this scope.
56
00:03:55,950 --> 00:03:59,930
Signaling already has embedded in it the
numerical solvers.
57
00:03:59,940 --> 00:04:06,360
So all I need to do to run a simulation and
the scope will be like a very simple
58
00:04:07,440 --> 00:04:08,570
laboratory scope.
59
00:04:08,580 --> 00:04:12,360
In this case, the horizontal axis is time,
so we're going to run a simulation for 10
60
00:04:12,360 --> 00:04:13,830
seconds, which is the default.
61
00:04:13,830 --> 00:04:15,660
But you can put whatever number you want.
62
00:04:15,930 --> 00:04:19,990
If I press play, what you're going to see
the simulation do is the scope.
63
00:04:20,010 --> 00:04:23,730
Show me is whatever signal is feeding into
the scope, which is a step.
64
00:04:23,760 --> 00:04:27,120
As you can see a time equal one goes to one
remains constant.
65
00:04:27,150 --> 00:04:28,350
How does he know to do that?
66
00:04:28,350 --> 00:04:32,820
Every single block has a parameterization
chart like this, so the default in this case
67
00:04:32,820 --> 00:04:37,410
was a time equal one go from zero to one,
which is what we are seeing on this scope.
68
00:04:37,740 --> 00:04:42,090
But if we want to start out in some dynamics,
all I need to do is let me put an integrator
69
00:04:42,090 --> 00:04:45,840
here. So now what is going to happen is
you're going to see the constant signal that
70
00:04:45,840 --> 00:04:49,590
is coming out of the step is going to be
integrated and the integral of a constant is
71
00:04:49,590 --> 00:04:51,630
going to be a first order dynamic.
72
00:04:51,630 --> 00:04:54,250
So like a line in this case.
73
00:04:54,270 --> 00:04:59,580
So you press play and now you see a line at
time equal one, the signal becomes a constant
74
00:04:59,580 --> 00:05:01,290
guessing. Agreed it becomes a line.
75
00:05:01,950 --> 00:05:06,900
So in this particular case, I am going to
need a couple of integrators, so let me put
76
00:05:06,900 --> 00:05:12,120
another one. Now, what is going to happen
here is that I'm going to be feeding a
77
00:05:12,120 --> 00:05:16,440
constant gets integrated as a first order
like a line and then if you integrate a line
78
00:05:16,440 --> 00:05:18,720
now you will have quadratic behavior.
79
00:05:19,470 --> 00:05:23,490
So I want you to notice that I just put a
couple of silly blocks together.
80
00:05:23,490 --> 00:05:27,390
But really, what the tool is doing for me is
it's solving a second order differential
81
00:05:27,390 --> 00:05:31,860
equation. If this signal was instead of
coming from a stab was coming from an
82
00:05:31,860 --> 00:05:36,270
accelerometer outside, for example, I used
that measurement of an acceleration.
83
00:05:36,420 --> 00:05:39,120
If you integrate an acceleration, you will
have a velocity.
84
00:05:39,120 --> 00:05:42,210
If you integrate a velocity, you have a
position, for example.
85
00:05:43,290 --> 00:05:44,310
I'm going to use that.
86
00:05:44,310 --> 00:05:48,420
Actually, I'm going to disconnect them for a
little bit.
87
00:05:48,750 --> 00:05:54,750
And what I am going to have is so if this
integrator is going to be for my velocity
88
00:05:54,750 --> 00:05:56,940
equation, I have an angular velocity
equation.
89
00:05:57,330 --> 00:06:00,750
I'm going to say that what I'm going to be
feeding to it is the omega T.
90
00:06:01,770 --> 00:06:04,740
And what is going to come out of the
integration will be omega.
91
00:06:04,740 --> 00:06:06,180
So that will be my speed.
92
00:06:06,210 --> 00:06:09,590
And I'm going to use this integrator for
this for the current.
93
00:06:09,600 --> 00:06:12,390
So what I'm going to feed here is the ADT.
94
00:06:13,260 --> 00:06:16,650
And what is going to come out of the
integrator then is I.
95
00:06:16,830 --> 00:06:19,050
So I have to first order differential
equations.
96
00:06:19,680 --> 00:06:21,240
I need to integrators.
97
00:06:21,810 --> 00:06:24,390
So now it's all disconnected.
98
00:06:24,390 --> 00:06:26,040
So let's look at the first one here.
99
00:06:26,050 --> 00:06:30,180
It's I'm doing a balance of voltages
business, so I'm saying did't is going to be
100
00:06:30,180 --> 00:06:31,770
the sum of all the voltages.
101
00:06:31,770 --> 00:06:35,070
So this let's assume this step is my
external voltage.
102
00:06:35,220 --> 00:06:38,580
So I have a V in the applied.
103
00:06:38,580 --> 00:06:41,850
For example, I'm going to bring my summation
block here.
104
00:06:41,940 --> 00:06:44,640
Let me make it a little bigger because I
need three terms.
105
00:06:46,350 --> 00:06:50,460
One is positive and the other two are
negative, so I'm going to construct it that
106
00:06:50,460 --> 00:06:52,770
way. Minus plus minus that opens three
ports.
107
00:06:53,370 --> 00:06:55,940
So the middle one is going to be my VNE
minus.
108
00:06:58,380 --> 00:06:59,730
Let's do our times.
109
00:06:59,730 --> 00:07:01,560
I first minus our times.
110
00:07:01,560 --> 00:07:08,160
I I don't have our time side yet, but I have
AI here so I can actually grab AI and bring
111
00:07:08,160 --> 00:07:12,640
it back here. And this has to be multiplied
by a proportional volume.
112
00:07:12,660 --> 00:07:16,290
So for by R. So this coefficient will be R.
113
00:07:16,530 --> 00:07:22,080
So what I have just constructed is I
multiply by our time, by VN minus our times.
114
00:07:22,080 --> 00:07:29,250
I maybe I want to construct minus the back
MF voltage, but the MF voltage, I know is
115
00:07:29,250 --> 00:07:32,940
proportional to the speed and the speed is
not yet connected.
116
00:07:32,940 --> 00:07:37,410
But it's going to be from. He's going to be
coming from here so I can just pull that one
117
00:07:37,410 --> 00:07:40,530
back and then put another gain on this.
118
00:07:41,220 --> 00:07:44,430
That will be that k mf gain.
119
00:07:46,820 --> 00:07:49,040
Let me make it a little bigger so we can
still see it.
120
00:07:50,900 --> 00:07:56,060
Yeah, so what I have is on mega time scale,
IMF will give me the third term here.
121
00:07:56,060 --> 00:08:01,390
So what I have just constructed is the right
hand side of this equation the minus Bachmann
122
00:08:01,400 --> 00:08:06,530
voltage minus our time psi that is supposed
to be, according to this equation, equal to L
123
00:08:06,530 --> 00:08:07,770
Times DADT.
124
00:08:07,790 --> 00:08:09,140
And I have the ID here.
125
00:08:09,140 --> 00:08:13,760
So the only thing I need to connect this
before is let me bring another game here.
126
00:08:14,840 --> 00:08:16,130
Let make sure it connects, right?
127
00:08:16,340 --> 00:08:21,710
And what I need to do is that some of
voltages, if I divide it by the inductance.
128
00:08:23,200 --> 00:08:29,260
If I drive I the index, so some of voltages
divided by L will give me DADT and by closing
129
00:08:29,260 --> 00:08:34,510
this loop, the way I just did is I
essentially have built this first first order
130
00:08:34,510 --> 00:08:35,800
differential equation.
131
00:08:36,190 --> 00:08:38,710
Yeah. Now notice on the second equation.
132
00:08:38,710 --> 00:08:41,170
On the second equation, I have again the sum
of two things.
133
00:08:41,170 --> 00:08:45,010
So let me bring in my some block here and
one is positive, one is negative.
134
00:08:45,010 --> 00:08:48,820
So I need to change this to plus minus oops.
135
00:08:49,120 --> 00:08:50,230
Plus minus.
136
00:08:52,060 --> 00:08:55,900
And the first term is the talk.
137
00:08:56,140 --> 00:09:00,280
Talk, the talk is proportional to the
current and the current is what is coming out
138
00:09:00,280 --> 00:09:02,290
of here, so I need another one of those
gains.
139
00:09:02,650 --> 00:09:05,680
Let me give myself a little more space here.
140
00:09:07,540 --> 00:09:09,220
So what I need is another one of those
games.
141
00:09:09,790 --> 00:09:11,710
Let me copy and paste this one here.
142
00:09:11,740 --> 00:09:18,070
Let me flip it. So there will be the current
multiply by K.M.
143
00:09:18,070 --> 00:09:21,070
in this case, that's the third constant
care.
144
00:09:21,970 --> 00:09:24,190
So that's its current multiply by K.M.
145
00:09:24,190 --> 00:09:30,160
will give me the talk, the talk talk minus
the friction talk, which is proportional to
146
00:09:30,160 --> 00:09:31,660
the speed. Oops.
147
00:09:32,470 --> 00:09:36,550
Sorry, I should do this to make it look a
little cleaner.
148
00:09:36,580 --> 00:09:39,520
Let me make minus plus here.
149
00:09:40,660 --> 00:09:45,790
So the plus element is the talk and the
minus element will be coming from this side,
150
00:09:45,790 --> 00:09:48,120
from the speech.
151
00:09:48,130 --> 00:09:53,230
So that will be the speed is here and I'm
going to drag and drop it back there and it's
152
00:09:53,230 --> 00:09:54,630
proportional to the speed.
153
00:09:54,640 --> 00:10:00,850
So what I need is another one of these gains
and I need that to be CF Kiev.
154
00:10:01,090 --> 00:10:05,130
So what I just constructed here, same idea as
I showed you a second ago.
155
00:10:05,140 --> 00:10:12,340
No, it's like that summation bloc is giving
me the sum of talk minus the friction torque.
156
00:10:12,340 --> 00:10:14,920
So this is equal to J.
157
00:10:14,950 --> 00:10:16,060
The Omega TT.
158
00:10:16,090 --> 00:10:20,070
So before I connect them, I have to replace
one of these blocks again.
159
00:10:20,080 --> 00:10:24,180
But instead of one over omega, what I'm
going to use sorry one on my l.
160
00:10:24,190 --> 00:10:30,100
What I'm going to use is one over G, so I
guess I have from nothing constructed
161
00:10:30,100 --> 00:10:34,720
essentially a set of two interconnected
first order differential equations in
162
00:10:34,720 --> 00:10:36,310
smelling. Of course you have.
163
00:10:36,400 --> 00:10:41,950
If I have veiled the model, what I want to
do is run it to see what the dynamic effects
164
00:10:41,950 --> 00:10:43,810
are when I press play here.
165
00:10:44,050 --> 00:10:45,490
Let me press play.
166
00:10:45,490 --> 00:10:49,510
This is not going to work, of course, but I
am doing this on purpose because I want to
167
00:10:49,510 --> 00:10:53,020
show you that signaling has a little
debugger that is, in this case, is telling me
168
00:10:53,020 --> 00:10:55,870
that it doesn't know what any of those
parameters are.
169
00:10:55,870 --> 00:10:58,180
So signaling is very powerful, but I cannot
do magic.
170
00:10:58,330 --> 00:11:04,030
So I just define the model where I put our
sales JS, but I never told anybody what those
171
00:11:04,030 --> 00:11:07,690
were. So what I want to emphasize now is
just to connect.
172
00:11:07,710 --> 00:11:12,220
I could obviously go into each one of these
blocks and set up a number and then link
173
00:11:12,220 --> 00:11:14,250
would solve the equations with that number.
174
00:11:14,260 --> 00:11:17,500
But what I want to emphasize is the
connection of signaling to MATLAB.
175
00:11:17,650 --> 00:11:23,710
So I'm going to go back to MATLAB here and
actually I have somewhere here in my command
176
00:11:23,710 --> 00:11:28,180
history a set of parameters that I have
already defined, like J.K RL.
177
00:11:28,180 --> 00:11:31,420
So I'm going to just pick them from my
history and press enter.
178
00:11:31,420 --> 00:11:36,160
So that will run that again and fill up my
my workspace, my MATLAB workspace right now.
179
00:11:36,970 --> 00:11:39,940
So now all those parameters are in my MATLAB
workspace.
180
00:11:40,720 --> 00:11:45,880
So what is going to happen with MATLAB with
signalling now is when I press play is going
181
00:11:45,880 --> 00:11:50,080
to find a variable here is going to say I
don't know what R is, but let me go check if
182
00:11:50,080 --> 00:11:51,400
MATLAB knows what areas.
183
00:11:51,400 --> 00:11:53,140
If MATLAB knows what areas, let me use that
number.
184
00:11:53,470 --> 00:11:58,260
So when I press play, you're going to see
the full dynamic behavior of a DC motor.
185
00:11:58,270 --> 00:12:01,950
In this case, what you're seeing is a time
equal one.
186
00:12:01,960 --> 00:12:06,760
There's a step voltage being applied to the
motor and what you see, the speed is ramping
187
00:12:06,760 --> 00:12:12,490
up. This is a this is a measurement of the
motor speed in this case.
188
00:12:13,570 --> 00:12:18,070
So the speed is ramping up until it reaches
some steady state equilibrium here.
189
00:12:19,450 --> 00:12:23,620
So hopefully, this gives you a sense for the
kind of equations that you can do with
190
00:12:23,620 --> 00:12:28,150
signalling now. Maybe somebody will say,
well, but what if my friction is not just a
191
00:12:28,150 --> 00:12:30,750
damping, it's some kind of a cooling
friction.
192
00:12:31,210 --> 00:12:35,740
For example, there are blocks that allow you
to very easily add discontinuity so I can.
193
00:12:36,040 --> 00:12:38,230
There's an actual Coulomb and this friction
block.
194
00:12:38,530 --> 00:12:42,320
So let me put it there and take out the game
from before.
195
00:12:42,640 --> 00:12:46,660
And all of a sudden, my pretty linear model
has become a non linear model.
196
00:12:46,990 --> 00:12:52,180
Maybe I want my or my resistor is very
important for the phenomena that I'm starting
197
00:12:52,180 --> 00:12:55,990
is that my resistor is changing with
temperature so I can delete that constant
198
00:12:55,990 --> 00:13:00,070
value of the resistance and maybe go into my
lookup tables library.
199
00:13:00,100 --> 00:13:03,300
I'm bringing one of these one dimensional
lookup tables.
200
00:13:03,310 --> 00:13:07,030
Let me flip it and I can place it in.
201
00:13:07,030 --> 00:13:10,600
If I can fit it, I can place it in there,
for example.
202
00:13:10,600 --> 00:13:12,490
No, and now all of a sudden I can bring in.
203
00:13:12,520 --> 00:13:16,420
Maybe I have some experimental data that
shows me the variation.
204
00:13:16,510 --> 00:13:20,290
I have some equation or some shape that
shows me the variation of the value of the
205
00:13:20,290 --> 00:13:25,390
resistance with current, for example, more
current, more he'd more like, maybe the
206
00:13:25,390 --> 00:13:28,960
resistance efficiency changes so I can have.
207
00:13:28,960 --> 00:13:33,340
I can have all kinds of very complicated
models that can be built with fundamental
208
00:13:33,340 --> 00:13:36,620
components in signaling once you put them
all together.
209
00:13:36,640 --> 00:13:39,910
One of the key things about simulation link
is the idea of reusability.
210
00:13:39,910 --> 00:13:44,920
You can grab whatever algorithm you have and
do what is called create subsystems.
211
00:13:44,920 --> 00:13:51,130
So I just created a little box, a little
graphical box where inside that box, if I go
212
00:13:51,130 --> 00:13:54,940
inside, there's the equation or the
algorithmic thing that it just created.
213
00:13:55,240 --> 00:14:02,560
I can. Actually, this is this is the speed of
the motor and this here is the voltage coming
214
00:14:02,560 --> 00:14:04,150
in, voltage coming in.
215
00:14:04,150 --> 00:14:07,370
Not is that not is that as I'm changing,
this immediately changes the box.
216
00:14:07,430 --> 00:14:11,560
No, this will be, let me call it, something
more relevant instead of just default
217
00:14:11,560 --> 00:14:15,580
subsystem, my DC motor, for example.
218
00:14:15,730 --> 00:14:23,950
Now, once I have created this, I can not
only put a I can not only, for example, put a
219
00:14:23,950 --> 00:14:28,230
mask on it, I can create a mask and put
little icons on it.
220
00:14:28,240 --> 00:14:30,670
More important than that, actually, I can
perform it twice it.
221
00:14:30,670 --> 00:14:39,660
So, for example, I can set up armature
armature resistance resistance.
222
00:14:40,350 --> 00:14:42,180
That is associated inside with that
variable.
223
00:14:42,750 --> 00:14:46,920
Ah, I'm just going to do one for the sake of
argument here, OK?
224
00:14:46,950 --> 00:14:50,400
And now when I double click on the blog
instead of opening the mall, it would open a
225
00:14:50,400 --> 00:14:52,230
parameterization chart where you can put
help.
226
00:14:52,740 --> 00:14:59,520
You can put documentation and you can set up
whatever parameters you want to set for the
227
00:14:59,520 --> 00:15:01,020
model that is inside.
228
00:15:01,050 --> 00:15:04,140
Once I have that, I can actually copy and
paste it as many saw.
229
00:15:04,140 --> 00:15:07,320
If my device has many motors like, it's the
case for the robot.
230
00:15:07,410 --> 00:15:09,840
Once I create one component, all I need.
231
00:15:09,960 --> 00:15:11,280
All I need to do reproduce it.
232
00:15:11,280 --> 00:15:14,220
It's just like copy and paste it as many
times as I need.
233
00:15:14,910 --> 00:15:16,950
So this is a very brief introduction to
signaling.
234
00:15:17,430 --> 00:15:25,350
Let me go to my script here, because now
what I want to show you is similarly offers
235
00:15:25,350 --> 00:15:29,370
you as an enormous amount of flexibility to
do models.
236
00:15:29,400 --> 00:15:34,050
So, for example, I have here three
subsystems feeding into one oscilloscope when
237
00:15:34,050 --> 00:15:35,160
I press play here.
238
00:15:35,640 --> 00:15:39,090
What you're going to see is there are three
mathematical models of a DC motor.
239
00:15:39,090 --> 00:15:42,930
The same thing that I just did before all
three models I want you to notice are giving
240
00:15:42,930 --> 00:15:46,590
me the same result when I double click on
the top one.
241
00:15:46,620 --> 00:15:48,090
Well, it's the same thing.
242
00:15:48,090 --> 00:15:51,120
I just bailed in front of you, but well, a
little prettier because I had a little more
243
00:15:51,120 --> 00:15:56,520
time. But it's essentially the what we call
a first principle implementation using
244
00:15:56,520 --> 00:15:59,070
fundamental mathematics for this model.
245
00:15:59,460 --> 00:16:04,530
Now I want you to compare that with the
second implementation, which is now going
246
00:16:04,530 --> 00:16:10,860
down the libraries in signaling and using
some of those advanced libraries to to create
247
00:16:11,340 --> 00:16:12,780
physical components.
248
00:16:12,960 --> 00:16:19,050
So I am using a protocol simsek here where
you see now I have resistors, inductors,
249
00:16:19,050 --> 00:16:21,240
inertial blocks, dumping blocks.
250
00:16:21,270 --> 00:16:25,650
Instead of having to deal with mathematical
equations, I can build electrical circuits
251
00:16:25,650 --> 00:16:29,940
that look like electrical circuits or
mechanical circuits that look like mechanical
252
00:16:29,940 --> 00:16:31,650
circuits. Now this is all.
253
00:16:32,340 --> 00:16:34,230
Let me show you here.
254
00:16:34,230 --> 00:16:37,280
So similarly, the base product is here now.
255
00:16:37,440 --> 00:16:44,370
I can go down under the same stack heading
SIM Scape comes with this foundation library,
256
00:16:44,370 --> 00:16:48,780
which noted, I want you to know this has
multiple domains, multiple physical domains.
257
00:16:48,780 --> 00:16:51,360
So there's hydraulic component mechanical
components.
258
00:16:51,900 --> 00:16:55,830
For example, if I go to the rotational
alignments, you will see springs and dampers
259
00:16:55,830 --> 00:17:00,630
and friction and inertia or on the
electrical domain, you will see resistors,
260
00:17:00,630 --> 00:17:02,400
capacitors, inductors.
261
00:17:02,550 --> 00:17:06,840
So all I need to do to build these models is
use this component directly.
262
00:17:06,940 --> 00:17:09,590
Now I can. This is this this.
263
00:17:09,670 --> 00:17:15,780
These are basic libraries that give you some
fundamental basic components, but there are
264
00:17:15,780 --> 00:17:20,250
additional libraries, and we talked about
some mechanics in the previous recording
265
00:17:20,250 --> 00:17:24,530
where is our three dimensional mechanical
modeling tool?
266
00:17:24,540 --> 00:17:29,070
But we have a hydraulics and an advanced
hydraulics modeling tool and an advanced
267
00:17:29,070 --> 00:17:30,280
electronics modeling tool.
268
00:17:30,310 --> 00:17:35,520
So for example, if I go into my electronics
modeling tool and I look at my actuators
269
00:17:36,420 --> 00:17:41,280
library, you will see there are because ADC
Motors is such a common component we have
270
00:17:41,280 --> 00:17:45,750
already DC Motors already has one simple
single component.
271
00:17:46,080 --> 00:17:51,300
There's all kinds of little electric motors,
several motors, stepper motors, all kinds of
272
00:17:51,300 --> 00:17:53,070
motors already implemented.
273
00:17:53,310 --> 00:17:59,520
So as opposed to the basic libraries where
you have some elementary components that
274
00:17:59,520 --> 00:18:04,770
allow you to build more complex systems in
the in the advanced libraries you have now
275
00:18:04,950 --> 00:18:07,280
there's P.W. driver blocks.
276
00:18:07,290 --> 00:18:09,810
Each bridge amplifier blocks.
277
00:18:09,840 --> 00:18:15,060
There is all kinds of semiconductor devices,
so you can model transistor level things.
278
00:18:15,060 --> 00:18:20,010
For example, there is all kinds of
electrical sensors already model for you, and
279
00:18:20,010 --> 00:18:23,120
this is one of the important things about
the soundscape language.
280
00:18:23,130 --> 00:18:28,260
So slim escape by itself comes with this
library, this basic, fundamental libraries.
281
00:18:28,320 --> 00:18:33,420
But since escape is not only those facing
those fundamental libraries, it's so let me
282
00:18:33,420 --> 00:18:34,710
bring in our rotational spring.
283
00:18:34,710 --> 00:18:37,020
For example, you can parameter tries your
element.
284
00:18:37,500 --> 00:18:42,120
There's a there's documentation associated
to every block that will take you to the
285
00:18:42,120 --> 00:18:44,100
equations that are being used for each
component.
286
00:18:45,990 --> 00:18:51,300
But also, I want you to notice that there is
a little hyperlink here that says View Source
287
00:18:51,300 --> 00:18:52,580
for rotational spring.
288
00:18:52,590 --> 00:18:59,430
So if I click on that, what that is going to
do is it is going to open the file that the
289
00:18:59,430 --> 00:19:01,230
file that is actually defining the
component.
290
00:19:01,830 --> 00:19:04,680
This is our MATLAB based, object oriented
program.
291
00:19:05,130 --> 00:19:11,580
So soundscape is not only the blocks, it's
also this physical modeling language that
292
00:19:11,580 --> 00:19:13,440
allows you to create your own custom
components.
293
00:19:14,440 --> 00:19:17,760
Notice that it's not a function file, it's
not a script.
294
00:19:17,760 --> 00:19:24,780
It's a component called spring in this case,
and there are tutorials that explain step by
295
00:19:24,780 --> 00:19:26,790
step how to program in this language.
296
00:19:26,790 --> 00:19:31,380
But the most important part is like getting
to the equation section on the methods where
297
00:19:31,380 --> 00:19:33,420
you're defining the functionality of this
component.
298
00:19:33,900 --> 00:19:38,330
In this case, the talk is defined as the
spring rate multiply by the angle.
299
00:19:38,340 --> 00:19:39,510
It's a linear spring.
300
00:19:39,690 --> 00:19:43,710
Maybe I want a component that is a
non-linear spring like a cubic spring, all I
301
00:19:43,710 --> 00:19:49,380
would need to do is do angle cube, for
example, and all of a sudden, well, of course
302
00:19:49,380 --> 00:19:53,280
I would save it as a different component,
but I can rebuild this block and create my
303
00:19:53,280 --> 00:19:56,340
own nonlinear cubic spring, for example.
304
00:19:56,610 --> 00:20:03,890
So this language gives you the flexibility to
create an any series of mathematical of of
305
00:20:03,900 --> 00:20:07,560
physical components from any domain that you
wish, really.
306
00:20:07,560 --> 00:20:12,750
So there are some domains defined here, but
you not only can create individual
307
00:20:12,750 --> 00:20:17,790
components, you can also start creating your
own basic domain.
308
00:20:17,800 --> 00:20:22,500
So if you want to define, I don't know,
maybe optics, for example, you define the
309
00:20:22,500 --> 00:20:26,530
domain and you can start creating blocks
using that domain.
310
00:20:26,550 --> 00:20:29,700
And all of this domains connect to each
other directly.
311
00:20:29,820 --> 00:20:36,350
So in this example I had, I have first
principle implementation of a motor.
312
00:20:36,360 --> 00:20:41,130
I have a physical component implementation
of a motor, and there was a third block in
313
00:20:41,130 --> 00:20:44,010
which I am using straight out the same
electronics model.
314
00:20:44,250 --> 00:20:50,460
So this these are multiple ways or multiple
levels of detail in which you can use to
315
00:20:50,460 --> 00:20:51,930
implement the component.
316
00:20:52,830 --> 00:20:55,080
So let me let me close this.
317
00:20:55,720 --> 00:20:58,260
And let me go back to my slides.
318
00:20:59,220 --> 00:21:04,710
So I just showed you how the flexibility
that simulation can simulate combined can
319
00:21:04,710 --> 00:21:10,160
offer you to create mathematical models
directly from physical components.
320
00:21:10,170 --> 00:21:14,370
You can create your own custom physical
components or only or use the fundamental
321
00:21:14,370 --> 00:21:19,170
mathematics of signaling to essentially
create a mathematical model of whatever it is
322
00:21:19,170 --> 00:21:20,440
that you that you want.
323
00:21:20,460 --> 00:21:26,460
You can bring in experimental data and
create using the System ID toolbox, for
324
00:21:26,460 --> 00:21:32,250
example, create black box models based on
input output relationships, for example.
325
00:21:32,280 --> 00:21:36,180
And we're going to talk in a second about how
you can bring in experimental data to
326
00:21:36,450 --> 00:21:38,460
parameterized properly these models.
327
00:21:38,670 --> 00:21:44,220
But first, I want to mention the flexibility
of of switching levels of fidelity in a
328
00:21:44,220 --> 00:21:48,510
particular model. So let me go to my to my
script here.
329
00:21:50,190 --> 00:21:52,170
Let me help in this model here.
330
00:21:53,660 --> 00:21:58,070
So what I have here is an implementation of
a DC motor using some electronic components,
331
00:21:58,070 --> 00:22:02,770
so there is this DC motor from the same
electronics library and I have actually added
332
00:22:03,350 --> 00:22:04,670
power amplifier model.
333
00:22:04,670 --> 00:22:09,560
If I go in here you see a driver and an air
bridge amplifier.
334
00:22:09,590 --> 00:22:15,230
These two are running right now in what is
called average mode for simulation speed.
335
00:22:15,380 --> 00:22:21,980
So even though this is a thousand hertz bw
am, I am using an average implementation of
336
00:22:21,980 --> 00:22:28,120
both of this both the bridge and the driver
in average mode, and that is going to give me
337
00:22:28,130 --> 00:22:29,990
very fast simulation speed.
338
00:22:31,130 --> 00:22:36,920
And notice that I can combine these physical
components with signalling components.
339
00:22:36,920 --> 00:22:41,060
So I have the same capacities as to peers
and peers.
340
00:22:41,210 --> 00:22:46,460
This means signaling to physical signal,
physical signal back to signal, link and
341
00:22:46,460 --> 00:22:51,260
granted, I am using very simple signaling
blocks here, just steps and scopes.
342
00:22:51,260 --> 00:22:57,440
But this is how you would connect this to
controllers, for example, or controller
343
00:22:57,450 --> 00:23:00,820
designing, signaling or mathematical
elements, for example.
344
00:23:00,830 --> 00:23:06,140
In this example, I am running just a quick
simulation where I have a constant duty cycle
345
00:23:06,140 --> 00:23:07,580
that is being applied to the motor.
346
00:23:07,580 --> 00:23:12,260
And you see the speed of the motor ramping
up, reaching equilibrium and at some point is
347
00:23:12,260 --> 00:23:18,560
coming down. And that is because I am
actually applying a load, talking to the
348
00:23:18,560 --> 00:23:19,820
shaft of the motor.
349
00:23:20,030 --> 00:23:25,070
So I have a torque source here and a step
load that is changing at one second.
350
00:23:25,070 --> 00:23:29,720
At one second. I am kind of grabbing hold of
that shaft and putting a torque on it.
351
00:23:29,790 --> 00:23:34,760
Now you can see the effect on the current to
the current goes up four to respond in
352
00:23:34,760 --> 00:23:35,990
response to that torque.
353
00:23:36,590 --> 00:23:41,450
But what I wanted to show you is this little
component here has a little config
354
00:23:41,600 --> 00:23:43,240
configurable subsystem.
355
00:23:43,250 --> 00:23:47,990
This is one of the constructs that similarly
has, so this means that this block is
356
00:23:47,990 --> 00:23:50,220
associated to some particular library.
357
00:23:50,240 --> 00:23:57,170
So if I right click on this block and follow
the link, there is a library that I've made
358
00:23:57,170 --> 00:24:00,740
using a configurable some system component.
359
00:24:00,740 --> 00:24:04,760
So there's a template that is part of
standard signaling libraries and notice that
360
00:24:04,760 --> 00:24:06,650
there's three models associated with that
component.
361
00:24:07,380 --> 00:24:14,300
So by setting this this way, what this does
is it actually if I look into if I right
362
00:24:14,300 --> 00:24:19,340
click on this, this will give me a menu
option that says block choice so I can pick
363
00:24:19,340 --> 00:24:24,590
from an average voltage implementation to a
a full volume switching version of these
364
00:24:24,590 --> 00:24:29,660
devices. So if I look inside, this would
look this would look this less the same as
365
00:24:29,660 --> 00:24:34,320
the one I had before. But now the P, both
the volume and the amplifier are in P.W.
366
00:24:34,340 --> 00:24:38,360
And so that means that I'm going to run a
simulation that is using the full switching
367
00:24:38,360 --> 00:24:44,630
implementations. Or I can even go to what I
call hear an implementation version.
368
00:24:44,630 --> 00:24:49,700
So if I go inside, you will see how now what
I would be using is a full detail
369
00:24:49,710 --> 00:24:53,900
implementation, transistor level
implementation of the electronics of my age
370
00:24:53,900 --> 00:24:58,460
bridge. And so I have multiple transverse
transistors and a full electronic
371
00:24:58,460 --> 00:25:04,700
implementation. So with a drop of a menu,
you can actually switch your simulation model
372
00:25:04,700 --> 00:25:09,590
from us from a simplified version to a more
complex version or to a more detailed version
373
00:25:09,590 --> 00:25:11,540
based on whatever it is that I'm trying to
study.
374
00:25:13,250 --> 00:25:14,330
Let me close that.
375
00:25:15,750 --> 00:25:17,160
Go back to my slides here.
376
00:25:19,530 --> 00:25:26,010
This is what I mentioned before, the ability
to use signaling to use signaling and the
377
00:25:26,010 --> 00:25:30,480
fact that signaling is running on MATLAB to
do optimization, for example, the tool that
378
00:25:30,480 --> 00:25:33,320
I'm going to show you is called signaling
design optimization.
379
00:25:33,330 --> 00:25:40,180
Let me go to my script here, and where I'm
going to open is I have another model here.
380
00:25:40,200 --> 00:25:43,980
So this is again the same this motor with
the power amplifier.
381
00:25:44,340 --> 00:25:46,920
And what I am running in this model.
382
00:25:46,950 --> 00:25:48,780
Let me press play to see what is happening.
383
00:25:48,900 --> 00:25:52,140
What I'm running in this model is I'm
comparing two signals in the scope.
384
00:25:52,140 --> 00:25:57,540
I'm comparing the output of the model, which
is the orange line, and this blue line is
385
00:25:57,540 --> 00:25:59,430
coming from an experimental test.
386
00:25:59,430 --> 00:26:04,890
So I run. I have the robot right here so I
could run some experimental tests and capture
387
00:26:04,890 --> 00:26:06,030
some real data.
388
00:26:06,060 --> 00:26:11,760
This is the result of inputting a square
voltage into the motor, and I'm comparing the
389
00:26:11,760 --> 00:26:15,240
simulation results with what my experimental
data is doing.
390
00:26:15,450 --> 00:26:18,690
And of course, my parameter guesses for the
motor.
391
00:26:19,200 --> 00:26:23,580
The armature resistance inductance
apparently are not very good because my
392
00:26:23,580 --> 00:26:28,530
orange is very far away from the blue so I
can manually go in and say, Well, maybe the
393
00:26:28,530 --> 00:26:33,240
resistance is larger, maybe the inertia is
smaller, but even on a simple point like
394
00:26:33,240 --> 00:26:35,340
this, this could become really cumbersome.
395
00:26:35,760 --> 00:26:39,540
And now imagine if you have something where
you have 200 parameters, that will be almost
396
00:26:39,540 --> 00:26:43,190
impossible. So think about this as an
optimization problem.
397
00:26:43,200 --> 00:26:47,130
There is an error between what I want my
orange, where I want my orange line to be and
398
00:26:47,130 --> 00:26:51,870
the blue line. So if I define a cost
function that penalizes that error and can
399
00:26:51,870 --> 00:26:56,070
play with those parameters to minimize that
error, then I will have the right result.
400
00:26:56,670 --> 00:27:01,480
So from the tools menu, if you have the
simulate design optimization product, you
401
00:27:01,500 --> 00:27:03,420
have an option for call parameter
estimation.
402
00:27:04,710 --> 00:27:08,910
What I'm going to do is I'm going to open it
directly from here because I have the my
403
00:27:08,910 --> 00:27:11,400
optimization project already loaded up.
404
00:27:11,730 --> 00:27:16,650
And what I want to stress is that what I am
doing is straight on seemingly taking
405
00:27:16,650 --> 00:27:21,360
advantage of the fact that this tool is not
only very good for modeling things, but it
406
00:27:21,360 --> 00:27:25,800
also running on MATLAB and MATLAB has all
kinds of very powerful numerical optimization
407
00:27:26,640 --> 00:27:28,360
tools, algorithmic tools.
408
00:27:28,380 --> 00:27:33,780
So what this is going to do is instead of me
having to write a script to do the same
409
00:27:33,780 --> 00:27:38,190
command and do multiple loops, this is
setting the optimization automatically for
410
00:27:38,190 --> 00:27:43,860
me. So it's one test data vector where I
define the input output data.
411
00:27:43,890 --> 00:27:48,420
If you have if I was doing this for real, I
would probably have many, many more tests
412
00:27:48,630 --> 00:27:49,770
test data sets.
413
00:27:49,950 --> 00:27:54,070
So you can pick some for for the estimation,
pick some for validation.
414
00:27:54,090 --> 00:27:56,880
This is just that blue line that you saw on
the simulation.
415
00:27:56,880 --> 00:27:59,760
It's my experimentally measured velocity.
416
00:27:59,760 --> 00:28:04,290
In this case, you defined the variables from
the model that that are going to be used for
417
00:28:04,290 --> 00:28:09,030
the optimization. You can constrain them to
the region where you want the optimizer to
418
00:28:09,030 --> 00:28:12,630
search. In this case, I am just doing brute
force.
419
00:28:12,960 --> 00:28:16,560
Essentially, I'm just telling the tool that
the parameters have to be positive, but I'm
420
00:28:16,560 --> 00:28:20,530
not giving them much information and then I
can proceed to the estimation.
421
00:28:20,550 --> 00:28:22,650
Here you will see the data sets won.
422
00:28:22,650 --> 00:28:25,230
In this case, we have just one what
parameters I have.
423
00:28:25,230 --> 00:28:26,700
I have my minimum and maximum.
424
00:28:26,700 --> 00:28:32,880
If I have information from the manufacturer
that tells me the armature resistance is in a
425
00:28:32,880 --> 00:28:37,800
certain range, for example, or tells me the
armature resistance is forearms plus minus 10
426
00:28:37,800 --> 00:28:41,730
percent tolerance, then that would define
the range where I want this tool to work.
427
00:28:42,180 --> 00:28:47,070
And once I have all that set up, all I need
to do is set up a proceed to the estimation
428
00:28:47,460 --> 00:28:48,780
when I hit start here.
429
00:28:48,780 --> 00:28:53,310
What is going to happen is the tool is
automatically setting up this optimization
430
00:28:53,310 --> 00:28:57,030
problem using underneath the MATLAB
optimization toolbox.
431
00:28:57,540 --> 00:29:01,710
I want you to notice that what is happening
here is behind this.
432
00:29:01,710 --> 00:29:03,870
Behind all of these plots.
433
00:29:03,870 --> 00:29:08,910
The simulation model is being run many, many
times is being used as part of the cost
434
00:29:08,910 --> 00:29:15,240
function. So this tool connects
automatically to the parallel computing
435
00:29:15,240 --> 00:29:16,320
toolbox, for example.
436
00:29:16,320 --> 00:29:19,620
So if you have a model that takes a long
time to run or we are doing this for many
437
00:29:19,620 --> 00:29:25,200
parameters and you want to speed up this
process, you can by by clicking a switch, you
438
00:29:25,200 --> 00:29:29,790
can make use of multiple cores in your
computer and run multiple simulations at the
439
00:29:29,790 --> 00:29:31,050
same time, for example.
440
00:29:31,230 --> 00:29:33,000
This is giving me a progress view.
441
00:29:33,030 --> 00:29:37,410
So the gray line is my experimental data.
442
00:29:37,440 --> 00:29:39,300
The blue line is where my model is
currently.
443
00:29:39,960 --> 00:29:43,440
And here I am, seeing how the tool is
changing all the parameters in this case,
444
00:29:43,440 --> 00:29:48,150
five parameters at the same time as opposed
to me changing this by hand.
445
00:29:48,180 --> 00:29:53,370
This is actually checking sensitivity in
each directionality and approaching that
446
00:29:53,370 --> 00:29:58,530
sweet spot as fast as it possibly can and is
doing a gradient optimization in this case.
447
00:29:58,560 --> 00:30:03,390
Notice that after four iterations, I am
already where I want to be for what I'm going
448
00:30:03,390 --> 00:30:04,770
to be using this motor.
449
00:30:05,160 --> 00:30:08,670
This model is going to be used to do
controls later, so I need to have.
450
00:30:08,850 --> 00:30:14,190
I need to make sure that my motor matches
the actual motors that I have in my robot, at
451
00:30:14,190 --> 00:30:18,080
least as close as I. Possibly make sure of.
452
00:30:19,550 --> 00:30:23,000
Actually, this was stopping a little bit,
but what I'm going to do is I'm going to just
453
00:30:23,000 --> 00:30:26,180
stop it here. Yes, because we're almost
there, really.
454
00:30:26,330 --> 00:30:30,020
So I can now I have a once it finishes.
455
00:30:30,020 --> 00:30:34,370
Yes, here here you can see the cost function
started at two point twenty four and it's
456
00:30:34,550 --> 00:30:37,020
it's gone down to 0.23.
457
00:30:37,040 --> 00:30:41,180
You have control over the tolerances, how
many iterations you want to do when you want
458
00:30:41,180 --> 00:30:43,640
to stop. So you have this is, after all,
MATLAB.
459
00:30:43,970 --> 00:30:49,550
So you have access to different algorithms
and parallel options.
460
00:30:49,550 --> 00:30:54,890
As I was mentioning before, the point here
is once I have my model, my motor permit
461
00:30:54,890 --> 00:30:56,930
tries to match to my actual motor.
462
00:30:56,960 --> 00:31:01,340
I can just save this with this part with the
right parameters into a library.
463
00:31:01,370 --> 00:31:05,930
So this is one of the reusability
characteristics of sawmilling.
464
00:31:05,930 --> 00:31:10,820
So when I started here, I said, Well, this
is the basic simulant product, but if you go
465
00:31:10,820 --> 00:31:13,550
down here, those are all our own products to
MyLink.45845
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.