Vehicle Dynamics Simulation Using MATLAB and Simulink for Student Competitions
Overview
In this webinar, we will provide an overview of how to use MATLAB and Simulink for vehicle modeling relevant to student automotive competitions and projects. First, we will introduce MATLAB by generating an optimal racing line for a race circuit useful for lap time simulations. We will then model a Formula Student Suspension with Simscape and Simscape Multibody. Finally, we will explore how to simulate longitudinal and lateral vehicle dynamics using Vehicle Dynamics Blockset.
Highlights
- Racing line optimization
- Modeling Formula Student suspension system
- Simulating longitudinal and lateral vehicle dynamics
Recorded: 28 Oct 2021
Welcome all of you. First of all, thanks for joining. And welcome all of you for the first session of the Vehicle Design Webinar Series. My name is Veer Alakshendra, and I am a part of math student competition team.
And along with me, I have Sudhakar, Pratyay, and Himanshu. So they'll be supporting this whole event. And Sudhakar will also present one of the demos with us.
So before we get into the cool part of the webinar, let me take back to some kind of important things. So first one is that this is the whole webinar series. We have three topics. One topic is the vehicle dynamics simulation, which we'll be covering today. And then we have vehicle powertrain modeling. And the most interesting is the full vehicle simulation, where we are inviting a guest who has in reality built a whole vehicle model and even validate the whole vehicle model what he has built using MATLAB assembly.
And last one is, again, a very in-depth and detailed webinar on communicating with CAN networks. So this is on 11th of November. So Sam will be joining on that day. So Sam is from our master student competition team.
And if you have not registered-- so we are going to share this link in the chat. Do register for this. Or maybe you can save it and feel free to join these sessions as well.
So next important thing is if you have any technical questions, maybe-- I mean, anything can come up. Maybe while I'm showing some kind of demos, you might have some questions regarding that. Those are all technical questions. So make sure that you use the Q&A section. And while sending it, send to all the panelists so that you all can see.
And then if there are some non-technical questions-- for example, if you want to have some-- I mean, if the voice is not audible or if you want me to zoom in, zoom out. And one more thing, which is kind of interesting, this in between when we are presenting the content, we'll be trying to have a conversation with you. For that, again, we'll be using the chat. So when you are doing so, make sure that you're sending it to everyone.
OK, so with this, we have a very packed agenda today. And whatever we are going to show today-- and you can see that we have around one hour, 15 minutes for the whole presentation. And then 15 minutes will be Q&A section. And we have so many topics to cover.
So don't worry. Whatever topics we are going to cover, we are providing an overview. And for each of these topics, we have the models available. You can have-- I mean, you can go through the links to the models what we are going to give you. And even a lot of content will also be having a tutorial video. So no need to worry. You have the whole-- I mean, access to all the models and the videos of these examples as well.
So we'll be talking about something interesting, which we never used to talk about while introducing MATLAB-- that is, a racing line optimization. And we always used to talk about tire modeling. So this is one of the new content which we have added to this webinar series.
And then Sudhakar will be talking about equation-based vehicle model. And then we'll move to longitudinal and lateral vehicle dynamics and also controls as well. And then we'll spend some good amount of time on the multibody suspension system model, which will help you to make or build whole vehicle dynamics model using bodies, joints, and even CAD assemblies. And then we'll share some interesting resources. And then we'll have some Q&A session just to answer to your queries.
So with this, the first topic what we have is a racing line optimization. Now, given a track or maybe if you are doing some kind of lap time simulation, like a lot of students are doing it. So there are different tools. You can use those tools. Or maybe if you are in a learning phase and you want to build something from scratch, at the same time learning the maths or physics behind that, this is what we are going to show today in today's-- this demo.
So how many of you think that this racing line optimization-- or maybe if you ask me what is racing line, it is simply optimal path to a race course. Do you think that it is important when you are doing lap time simulation? If yes, I mean, it would be great if you can let us know the reason. If not, then also, it's fine. No problem.
So in the chat box-- I mean, we have one minute. You can type your response or your interest. Or if you worked on this earlier, you can type that in the chat box. I mean, we have a good amount of time, one minute, so please go ahead, OK.
OK, we are getting some yes. Good amount of yes, OK. OK. OK, I mean, extremely important, yeah. I mean, dependant on my factors. OK, no. I mean, yeah. I mean, important to make corner fast, OK. OK, fine, fine.
Set of best lap. Yes, exactly, exactly. Set of best lap. A lot of people get confused with the fact that they think that this is only for autonomous driving. No, no. It's not the case. I mean, whether it is a driver or driver-less competition, you need to have that calculation. Or maybe, for example, if you're doing a closed loop simulation for any track, you would want the lap band as well as the velocity profile or maybe dry cycle. OK.
Yeah, I mean, that also makes sense, like what Apulo is telling. So Apulo is telling the recent optimization makes sense in motorsports, where a driver has to width of the track to utilize. FSA, where the width is constrained by cones, I probably wouldn't care too much about racing. I mean, I agree to some extent. OK, OK, fine.
OK, mixed kind of response. And a lot of you agree that it is important. A few of you have the question that we don't need this. OK, that's also good. But however, the main aim over here is-- I mean, an example, which could be relevant to a formal student or maybe some automotive competitions, which can also give you an intro. Or you can say-- I mean, motivation how MATLAB can be used for this. So given a track-- for example, this kind of track, a land test track, there could be two approaches when you are doing lap time simulation or you are trying to do some kind of tracking stuff.
So first one is either you can just take the center line and go to the midpoint and grab all the center points, and then you can do your further calculations, or the other way would be that, OK, given a width and a track, let's try to study this track, like where we can have the maximum speed or where we can have-- where we have to reduce the speed, all those kind of study. For example, this is an optimized path, which is based on minimum curvature.
Now, there are different-- there's a whole research going on this shortest path or minimum curvature path. AI is also involved in this. But we are not going to get into all these-- so many different approaches. The idea is that, OK-- I mean, one is that you just take the center line. Or you try to study the track, and based on certain mathematics, physics, and optimization techniques, you'll find the optimized path.
So what it can do? So it has a lot of effects it can give you when you're performing vehicle simulations. So one is, of course, it will improve the lap time. And as an overview-- I mean, as an overall idea, it definitely improves the whole completely overall vehicle performance.
Why? Because this is not only-- I would say that only the optimized path, but once you have the optimized path, the other task will be finding the velocity profile. Like how well we should accelerate, where we should decelerate. So this all-- again, when you start doing that, even if you start with the point-mass simulation, definitely mass, force, these all factors will come. So it has a lot of effect on different things as well.
So just as a simple problem statement that, OK, we have a given track of a given width, we need to find optimized path. So we shared this project as one of our recent program called MathWorks Excellence and Innovation Program, where Jacob-- Jacob is from University of Waterloo. He submitted the solution. We'll talk about this program later.
But what he did was he used the minimum curvature approach. So what he did is that he has a track, OK. So then he describes those track into different segments. He found the centerline. And then he optimized the path.
And then for the velocity, generating the velocity profile, he used a simple point-mass simulation model, which is also very effective. And then he also has a lot of animations for generating GIFs and all and PNG and images and all. And the good part is he recently-- I think three, four days back, he came up with a nice, detailed tutorial video of what work he has done. And this is also available on git. So with this-- I mean, just going to the motivation and the problem statement.
And one more thing is that, we can talk a lot about this. But just considering the time constraint, we are just giving an overview of the problem statement. And we'll go to the script what he has written.
So let's switch to MATLAB. So I think-- most of you, I think, are aware of MATLAB and this is how it looks like. And don't worry if you are new to MATLAB. There are different courses through which you can go. There's Onramp, which will get you started with MATLAB. There are different tutorials as well.
So we are not going to go through the basics of MATLAB. Rather, we'll try to see how the solution came up. So what Jacob did-- first of all, what Jacob did--
OK, so I can see one query. I'm new here. So Aisha, don't worry if you are new. And we all know that within 1 and 1/2 hours you can't learn everything. We have enough resources to get you started.
We have resources of getting you started, going in depth, and even we have a series on optimization itself. So you can follow that. And there are different several examples also available to download and learn yourself
OK, so the approach what Jacob used is, first of all, he used Driving Scenario Designer. So using Driving Scenario Designer, you can create your track. You can generate waypoints. Not optimized one, but a normal generic one. And you can-- yeah, OK, so it will take a bit of time to open.
OK, so this is the Driving Scenario Designer up. And using this, you can create your track. You can generate waypoints. And if you're on the autonomous side, you can put cameras, LIDAR, radars, and you can generate synthetic data. I mean, a lot of things you can do, but here, in case, you can simply-- for example, you can just create a road like this.
And then the road features-- I mean, the road center and the road width and other information, you can export it as a MATLAB function. So this was the first step that Jacob took. And from there-- close this. Just give me a second.
And he generated this MATLAB function. So this MATLAB function, you can see that it is having the road centers and as well as the road width. So this is just a simple example of usage of Driving Scenario Designer, but you can do a lot of things. You can create waypoints. And as I mentioned that, you can also have different sensors to create synthetic data.
So once he was done with this, then he wrote one MATLAB script. Sorry, a MATLAB function, which is basically a discrete waypoint optimizer. So what he's doing is based on the route specifications-- that is, the road center and road width-- he wrote code for pattern search optimization, which optimized the track.
So you can see over here that the inputs is the waypoints she got from the Driving Scenario Designer. And there are certain different other parameters, which is defining the optimization. And this is the whole code available over here. So we don't need to go through one by one. OK, but this code is readily available. You can have a look into that. We'll share the link as well.
And what this function is doing-- based on the road-- I mean, the track and track width, it is giving you the optimized path. So once this optimized path got, then the next target was to get the velocity profile. So for that, again, you have this velocity profiler. Now, this is, I would say, a very simple approach because it is based on point-mass simulation, which is, of course-- a lot of us do. And it also based on validation, which also give good kind of results.
So this is what Jacob also used. And he's also shared the link of the paper, which he referred to. And what this is doing is that it is taking the input of the optimized path, and then canceling the mass, then the tangential force, and the normal force. It is giving you the velocity profile. And also, he has certain code setting also to get the best lap out of this.
So these are the two functions. Now, these two functions-- so this is all MATLAB script. Now, to get more interactive, you also have Live Script. If you're not aware of that, don't worry. I mean, I'll give you one intro to this.
So Live Script-- using Live Script, you can write code. You can write equations. You can add images. And simultaneously, you can also visualize the result. And then you can also convert in different format like PDF. And some cool part is that you can insert different sliders, controls. And all over here, you can see dropdown menus and all.
OK, so this is his final script. Well, here you can see that what he's doing is he's having this text-- and there are certain initial commands just to set the whole code. And then he has put one dropdown menu to get the function in place. For example, he has function for oblong. And we also tested for fsgTrack as well, then kidney bean.
And so this is the first step setting up the track. And then there are certain bound extraction. And then, finally, this is his function, which he's calling, which he created. So you can see over here this is the same discrete-- OK, so this is a new functionality in 21B that you can zoom in and zoom out.
So this is the function, what he's using. You can see that for this, he has defined certain number of maximum iterations and other buffer size and other parameters as well. So this is giving him the optimized path.
And later, this is the velocity profile generation. So you see that using Live Script, you can also add some kind of dropdown menus, and then you can also have edit field. Like here, it's defining this ftMax and fnMax. And then, from here, he's calculating the velocity profile, yeah.
So I won't run it currently. It is already showing the result. Otherwise, optimization will take some time because it is set to 100 optimizations.
So now, if you come to the results-- so what you can see over here is that we have the center line, which is the dashed gray color line. And then we have this colorful final best lap what is here-- what is obtained from his code. So as you can see, when it is getting the straight path, it is taking the advantage of the maximum velocity. And at the turns, it is reducing the velocity, which is fair enough. I mean, I would say fair enough the results are.
However, you can take the motivation from this one and add more. For example, you can add high fidelity vehicle model to this so that you can get more realistic results depending upon your vehicle, whichever competition you're participating in. So this is just one example to show how MATLAB can be used.
Now, as a summary, it's very simple that you take the track information with width and center line, you then run an optimization by dividing this into different sections. And then you find the optimized path. And then you run the velocity profile on that based on your point-mass simulation.
So this is one solution. And what we have done over here is that we have also linked the resources. So yeah, so there are two solutions until now what we have obtained.
Now, this is one from Jacob. And then we also have one from Arthur. So going back to that GitHub repository-- so he has done a lot. I mean, more than optimization path-- it is also having the tracking control. And the good part is it is having a mid-fidelity vehicle model, where he's using a dugoff tire model as well. So this also can be used as a reference for your work.
Now, you can have a look into this. Again, we have provided the link to the GitHub repository. And now the question comes, like where this is all coming from? So just coming back to the-- OK, so meanwhile taking questions.
So oblong-- so it's just a type of track there, like kidney bean, OK, oblong. And this is just different kind of tracks, OK. So if you're working in formula student, you can have different tracks-- FSG track or FSUK track and on.
So yeah, so these are the solutions. And this is basically coming from this project, which is a part of the MathWorks Excellence and Innovation Program. And if you want to register and submit your solution, feel free to do that. This is a link, which we are-- again, we'll share that link in the chat section, OK?
And what is this? So basically, in the MathWorks Excellence and Innovation Program, we have multiple projects, which are research-oriented and industry-oriented projects ranging from automotive, robotics, aerospace, AI. You can have-- I mean, you can see there are a lot of projects over here. And based on your interest, you can register for this. And there's no time limit. Once your solution is ready, you can submit to us. We'll review the solution.
And then you'll get a certification-- certificate from MathWorks that you completed this project. And even one of the most important thing, which I count always-- that is, a LinkedIn recommendation from our MathWorks team. And there are others-- I mean, other benefits also. Once you register for the project, you'll get an email what else-- I mean, what other benefits are there.
Now, along with that, you also have-- I mean, one which I really enjoy is the discussion forum. For example, this race line optimization project, we have a discussion. So you can see there's a huge amount of discussion going on. And even though if you don't get the direct solution to your problem, but you can see that over here you can get a good amount of repositories and even research articles and certain YouTube videos. It's going on and on, yeah.
So this is just a introduction to what it is. You can go through the web page. And you can explore more, OK.
OK, so that's a good question. So meanwhile, we can also take some questions. Does this tool consider the characteristic of the car while optimizing the race line. For example, a car with more longitudinal acceleration will have a different racing line than one-- yes. I would say this one. I mean, if you are looking for that kind of high fidelity model, you should check out Arthur's submission.
And also, just to mention a few more, if you go to the project over here, we have also added a good amount of references from where you can-- so this is a good example of that. This is one more reference what we have added to the project. So you can also have a look to this. And of course, it considers all those effects which you are talking about. OK.
So with this, what we'll do is we'll move to the next part. OK. So we shared all the resources what we are talking about. And now, moving to the block diagram modeling or block diagram environment.
So now-- I mean, in the previous section what we saw is we have certain equations. And then based on those equations, we are writing a code either using the built-in functions what MATLAB has or you are building your own function like what Jacob did. Now, another approach is a block diagram environment, which is called Simulink, where you can model your dynamic systems.
So a dynamic system like time-dependent systems, like automotive, aerospace, aircraft, or robots. So having a set of equations and using a certain set of blocks, you can model the whole system in a block diagram environment. And what you can do, you can model, you can simulate, you can optimize, you can analyze multi-domain systems because all your vehicles, all your aircrafts, all your robot-- these are all multi-domain system consisting of thermal system, mechanical system, electrical system, pneumatic system, and many more.
And then what you can do, you can do communication stuff. You can do the control part, single processing video, and image processing. And of course, it is a platform for model-based design. So in short, you have equations. And using certain blocks which are there in Simulink, you can model your system.
Now, giving an example-- so this is one example of a very simple-- this is for people who are getting started with Simulink. If you are very much familiar with this, it's totally fine. Good for you. After this, we'll move to a more advanced section or example.
So this is just one free body diagram of a vehicle kept on an inclined surface with different forces, like tractive force, rolling resistance, and the track force. So based on this free body diagram, so this is the equation what we get, OK? And then further, this whole equation can be converted into a model so that you can run the model and you can do the component sizing and selection based on these equations, the model that you have built.
So with this, what I'll do is I'll give it to Sudhakar to demonstrate you a demo built in Simulink. That is the vehicle model. And then I'll come back and I'll talk about a little bit more advanced stuff with the vehicle model with longitudinal, lateral vehicle dynamics and also how we are putting the driver to that so that it can properly move around, considering that it is having a double bicycle model.
So giving it to Sudhakar. Sudhakar, let me make you as presenter.
Thank you, Veer. Thank you for catching up on the concepts of Simulink. And primarily, we consider model based design in Simulink. So of course, in Simulink, model presented a very important tool by which we can visualize any model. And then we can find out its various issues or parameters.
So I would like to use those concepts in the upcoming demonstration. And so just for our viewers, I am Sudhakar. I am an application support engineer at Matchbox India. And in this demonstration, what you will see is basically how to create a vehicle system in Simulink.
Due to crunch of time, I cannot create from scratch. We have a model. We have a model, which we have built it. So I will just use that model to explain various concepts. And I have already saved the various files on my desktop. I have already saved all these files.
So in this case, like we talked about-- battery we were talking, an electric vehicle model. So primarily, we talk about battery electric vehicle model. And in short, we will call it the battery electric vehicle model. So first, let me launch Simulink. And then I will try to show you the various models, which we have designed for the battery electric vehicle.
So I will launch Simulink. And just give me a second while it appears. Simulink is now-- it is getting loaded. And just me a second.
So while it is getting loaded, I will just-- I will start with a full blown model. But then I will talk about it. And then I will switch on to a simple model and then follow to switching back to that full blown model. Just give me a second.
Yeah, so I have this Simulink open now. I will first open the BEV model first. And then we will go on talking about the other aspects of this model. So go to this.
It might take a while to get loaded, so give me a few seconds. And once it appears, then we will continue with the explanation of this model. So I hope now you are able to see my screen and you are able to see a model in front of you. So give me one second.
There was some issue. Now I have fixed it, OK. So yeah, I will just maximize it. So I think now you are able to see a battery electric vehicle model. And this is a battery electric vehicle model as I have talked about it so many times now.
See, a model like this like the one which I am showing right now on your screen can give us a lot of detailed information, like about motor, about battery operation since, in this case, we are talking about a car. So we have motor and battery. Depending upon your model, you can have various other components.
And here, we can see that, in this case, we have a driver, we have motor, battery, glider. We are having various components depending upon the need of the model. And in this case, we are having driver. So basically, this driver is having a reference input.
And like in any control problem, we know that we have a reference input. And then we take the plant output and we compare these two. Based on that, we find out the error. And we generate the controller for it. This is the basic working of any controller for that matter.
So in this case, for the reference point, what we are doing is that we are not taking any constant input. Instead, we are using a standard called EPA. That is that stands for Environmental Protection Agency. And that is not like a normal constant. Instead, they have set their own reference point. So we are using that reference for our model and like we saw USDO6 and this EPA.
So now what we can do-- what I will do is that, of course, I will run this model. And I will show all these things too. But in this model, as we see that, we can show various parameters. Or we can expose the other parameters so that we can visualize how the model is doing.
So in this case, we can see now I will plan this model. And just to show the various plots, have which we can visualize-- so let me just run it. It is taking-- so just give me a few seconds and the plots should be up any minute now.
And yeah, so these are various plots. I will explain all these plots once I revisit this model. But as of now, you can see that this is a plot and-- yeah, OK, this is a plot of comprehension of reference point and the plant output we can see. Then we will be having some more plots, which are about to appear.
And OK, yeah, I will have to drag it here. So these are the various torque, envelop, all these things we are having. So as of now, I will close these models. And I will start building a simple model first, like just having a glider and a driver. And then we will see how we can expand that model to include various other components, which we have just shown here.
Let me close these plots for a while. I am just closing all these plots. And I will lose this model as well. And then I will open a simple model. A relatively simple model, I should say.
So I will go to this folder. And I will open a model which consists only of the driver and the glider. So OK, so I think it's up now. So give me a second. I will do that.
So as you can see that in this model, we are just having a driver and a glider for the sake of simplicity. Of course, an actual model will not look like this. There will have a lot of component that we saw before. But in this case, just for the sake of simplicity, we can see that there are only two components-- the driver and the glider.
Now, if we have a look-- so we are just having a controller like just having a driver. But if we click on the subsystem and if I have a look at it, I will say that this is just a controller. And OK, so you can see that this is just a pad controller.
So it is like taking some reference points some inputs from the plant and then they give the controller for it. This is just a controller. So in this case, we can see that we have controller followed by the glider. These two teams we are having now.
Now, the driver system, as we saw before, that this is taking the EPA as the reference and the plant output as the comprehension point. So this is like calculating the error and then give the controller for it. These things are happening here.
Now, what I will do is that I will just open this subsystem to show the various equations, which we have used to model this particular block. So now you can see a lot of equations are there. But just to briefly touch upon the equations, like we thrust it upon those points. So in this case, we can see that there are various force involved, as in aerodynamic drag, the inertial force, the grade force, rolling resistance, and so on.
So now, the tractive force that will basically drive the car, that has to overcome all these force. So you can see this is just a balancing equation, like tractive force is balancing all of these forces. Now, if you have a look at the diagram here-- so we can see that, in this case, we having a tractive force. And then, this is equal to all of the other forces.
Now, if you divide this force by mass, you will get acceleration-- force equal to mass multiplied by acceleration-- followed by if we integrate the acceleration once, we will get velocity. Again integrated, we will get the displacement. So depending upon now, this is just a very high level overview of the glider subsystem, which we have used.
So now, we will go back to the main model. Let me click here, and I am back. Again, I am back to the main model. And as far as like-- we have already seen that we are just having a control and the glider car. So I think this is the very basic model of which can be used to visualize the car we can see, the electric vehicle model.
Now I will run it to show the performance of the model. In this case, I will just compare how the model is behaving with respect to the EPA standard. If I maximize the plot, you will see that there are two different colors in this plot, two lines-- the yellow line and the blue line. I hope it's visible.
And if you look closely, those two lines are superimposed, completely superimposed. So in the case of control study, we can say that it's tracking the reference point very closely. It means our model is doing damn good. So like yellow and blue, yellow is the reference point, which we provided, and blue is the response of my model. So our model is doing good. This we can conclude from this particular plot.
I will close this plot for a while. And we saw that model is doing good. Now I will talk about another concept called power loss model. Power loss model will be our basis of our next model, the battery electric vehicle model, where we will be having motor, battery, and so on.
So power loss model basically deals with three parameters, like the name indicates power loss. So power input, power output, and the power loss. So now we will use those three parameters to model the equations in the next model, like model as in this model and the next model, we'll be having the power loss equations.
So without talking, like without much ado, I will close this model. And I will relaunch the BEV model. I will relaunch it. And I am not looking at the chat, but yeah, we will look upon a few questions towards the end of this demonstration.
If I open the BEV model-- I think you have already seen this before. But now, I will touch upon the various blocks here. I hope it's visible to you. I will just maximize it, and it's here. It's here.
So now, apart from the driver and the glider, we have various components like motor, battery, and so on. We are also having a braking system, drive line. These are the things which are crucial to drive a car, to drive electric vehicle for that matter.
Now, in this case, we can see that if you go onto motor block-- like we talked that-- now we are talking about power loss model. So in this case, we are having power loss as in power input, power output, and power loss. So we are now relying on these equations to model the motor block.
So you can see that we are having APP-- that stands for the accelerator pedal position-- and the motor speed. And based on these parameters, we are calculating the torque and so on. So similarly, we have modeled the other blocks in this particular demonstration.
So now I will again go back to the main model. I will go back to the main model. And as you can see, there is battery component also. And the motor is connected to battery. Then there are motors connected to the drive line and so on.
So the reason why motor and battery are connected is because the power input to the motor is actually the power output to the battery. So this is just the things which are driving our glider. You can say that.
Another driver block, we have already seen this. But in case you have not noticed it before, like I did not open the PID block, I will do it at this time. So if we have a look at PID block, we are just using a PID controller form. I will click it once here.
So if you have a look at it, the path is zero. We are using a PID controller for controlling this battery electric vehicle model. So I have it linked.
So now we have touched up on the, I should say, major blocks of this particular model. And I will leave it to you to explore the other blocks. All these files will be made available to you.
And I will run this model to show the other visualizations. Like we saw the comprehensive response and the reference. Now we will talk about the torque, state of charge, and so on. So this is the-- you saw it beforehand so that the comparison of response and the reference.
And same goes for we are having other plots, like state of charge versus time, like the battery was at 95%, then at the end of the drive cycle, it's at 65%. Then we have other envelops, as in battery power envelop-- like battery power envelop. Then we have motor, torque, and so on.
But depending upon our need or our visualization, we can add several plots to this model. And that is the beauty of Simulink-- you can visualize on the go. And then accordingly, you can tweak your parameters to a better design of your model or to come up with a better response. So I think that's all for this model. I will stop sharing the screen now.
OK, perfect. I mean, so Sudhakar covered that concept. And again, as we mentioned-- and if you're not new to MATLAB and Simulink-- a lot of you a lot of you have already watched this video from Ed and Christoph, such as Vehicle Modeling Using Simulink.
So again, we'll provide the link, I think, in the chat. And then you can have a look and learn more. And all the files which we just showed for the Simulink, which Sudhakar showed, those are all available on the file exchange and GitHub as well.
So moving ahead-- now, there was a question talking about that, how the xy coordinates of a track are incorporated for doing a closed loop simulation. So this is what we are going to answer. So to answer that, now the plant has to-- I mean, the plant, which, in the previous case, was the longitude vehicle dynamics, now you have to also include the lateral vehicle dynamics.
Now, again, if you want-- and a lot of students have done that. If you want, you can, again, use the same approach-- having equations. For example, a main equation of bicycle model or 6DOF model. These are readily available everywhere on the internet, different research papers. You can use those equations and you can model this longitudinal and lateral vehicle dynamics.
What we are providing is that we are providing you a certain set of blocks. What type of blocks? Like which is already solving or which is already having the built up model for 3D of longitudinal model or single track model or dual track model or even 6DOF model.
What you need to do is that for certain inputs, maybe like wheel steering angle, longitudinal velocity, these are very simple model, I would say. This can be good for initial learning. But further, you'll be incorporating the tire forces as well, which is the longitudinal and lateral forces on wheels, yeah. So such that you can get the vehicle motion in longitudinal, lateral in here provided other information also, like the tire forces, the longitudinal and lateral forces and all.
So how to solve or utilize these blocks? So for this, we have something called a vehicle dynamics blockset. The most important part on the slide is on the left side-- that is, library of blocks. So this vehicle dynamics blockset gives you access to a lot of different library of blocks, like powertrain, wheels and tires, then vehicle body, which we are going to talk about today.
I just saw a question. Do we have a tire model? Yes, we do have a tire model. We'll talk about our tire model implementation in multibody as well. | then we have vehicle scenarios and many other blocks and suspension as well.
In the middle, what you see is the pre-built scenes, which is-- I would say it is more relevant to the autonomous driving, which we are not going to talk about. But definitely, you can check their other resources as well. And you can also check the fully assembled reference applications, wherein you have different applications.
For example, you have constant radius, a reference application. You have breaking reference application, wherein you have a ready-to-use block-- I mean, ready-to-use model. The only thing is that you need to change the parameters as per your requirements, yeah.
So we'll be focusing on the vehicle body blocks, which are having-- I mean, these are the ones you can say vehicle body 1DOF, 3DOF, then 3DOF single track, dual track, and even 6DOF. Now, it has certain input parameters and it has certain output parameters.
The only thing is what you need to make sure is that when you're using these blocks, the parameters are correct, which you have to feed in the block, and as well as the connections are proper. If the connection is requiring a vector, you need to provide a main signal as a vector. If it is having some kind of constant, you have to provide that.
OK, so with this, let me move to the software demonstration and also let you know that how you can find these blocks. So to find this, again, we'll move to Simulink. And it will open the Start Up page. And let's open this blank model so that we can go to the library.
OK, it is taking a little bit of time. But no problem. I mean, the blank canvas is over here. And then in the library browser when you go-- OK, so over here, when you scroll down, you have this vehicle dynamics blockset.
And then over here, you can see that you have various powertrains, sensors, steering, suspension, utilities, vehicle body. Now, when you go inside this vehicle body, we have recently also added a motorcycle longitudinal model. If you are working on these two wheelers, you can have a look into that. Then we have this-- these are the blocks which are there.
Now, from here, you can find these blocks. And we also have different models for tires. For example, a very basic longitudinal wheel disc brake model. Then we have a 2DOF tire model.
Then we have a combined slip wheel 2DOF model. So there are different tire models as well. Depending upon your usage and fidelity of model what you are looking into, you can use these. So we will see that, how we are using the tire models in these examples.
OK, so with this, let's move to a very basic, simple model. Just move to this model, that's just a simple steering and with a proper certain connections. And just, I mean, to visualize the longitudinal and lateral vehicle dynamics in this, yeah.
So yeah, so this is the model, what you see, OK. This model is very basic just for the understanding. What it is doing, it is having this block. So this is a 3DOF dual track block. And what it is doing, all these blocks, what you can also do is you can just go to the Help. And from here, you can grasp or learn what equations we are using and what are these input and output parameters.
For example, if I go to the port-- OK, so for the port over here, you need to understand that, OK, it's the vector, how you have to feed that, what type of array it is for dual. If you're selecting single, this input port will be a scalar. So all this information can be read through the documentation.
So now, what we are doing over here is that we are using a kinematic steering. Then we are using a subsystem just to make it a array of input signals, which are the wheel angles. And then we have a steering angle over here. And we are just-- if I side by side--
And here, one more important thing, which is we keep on getting the queries. You will see a visualization plot now running along with the simulation. So this is not a part of vehicle dynamics blockset. This we have built using certain reference applications.
However, if you want to access this, this is available. You can just go through the reference applications. Or there are other repositories also for vehicle part tracking applications, where we have added this block. So you can copy from there and just paste in your model and it will work. Yeah, so let me keep this side by side.
It is compiling because I restarted my MATLAB. And it is taking a little bit of time. OK, yeah, so it is over here. So you can see over here that it is giving you one based on your steering angle. You can see that what's the vehicle motion, right? Yeah.
So don't worry. I mean, slowly, slowly, we'll move to a high fidelity model. This is just a basic model without any tire dynamics.
OK, so now let's stop over here. And let's go to a more-- I mean, the model which is having the tire. So what I will do is we'll move to the next model.
I mean, just a quick answer to one of the questions is, are all of these features available under the academic use license? Yes, these are all available in academic use license.
OK, now you can see that there are some more added stuff. It has steering, same steering. It has a vehicle body and very simplified powertrain, which is based on certain equations. And then we have our tire model, wherein we are just using the longitudinal wheel tire model, which is, again, a very low fidelity kind of model.
And that's why if you get into this block, you can see over here that it has certain extra parameters, which are FWF and FWR, which is just taking the external longitudinal forces. OK, so again, this also does the same thing for a given steering and acceleration/deceleration. We are just-- I mean, you can visualize how the vehicle is moving in different directions, OK.
So this is one addition to this model. Now what we'll do is we will answer one of the questions which was asked, a good question, that how these tracks parameters can be fed to a closed loop simulation model, where we have the driver. So what we'll do is now we'll use the same block. However, we'll have a more high fidelity tire model. And in that, we'll place a driver.
So before that, just a quick intro to what kind of driver model we are using or showing you over here as coming from-- it's a, I would say, lateral driver, or you can see geometric driver, which is called Stanley controller. You must-- I mean, they are different. There's a few of us with a Stanley. Then you have MPC also. A lot of people are using MPC as well.
So we are just focusing on this driver implementation, which is called Stanley controller. And it was first introduced in the DARPA challenge by the Stanford racing team. And to learn more about this, we have provided the link to this. You can learn. And however, the important thing is how we're implementing that in the Simulink model, OK?
So what it does-- basically, it computes the wheel steering angle, which is the major concern when you need to control the track. You need to track a certain path or trajectory. So this is what it is doing based on certain equations, which are these equations. Or you can say that based on the cross track error, it is giving you the steering angle.
So again, we are not going in depth to this. We having the nice, good papers available. But the summary is that having a vehicle model and having a reference track, we are implementing one driver, which is based on Stanley controller, which is giving you the steering angle based on cross track error, OK?
So let's see the model. And this is quite interesting because this model has a lot of additional visualizations, which are relevant to a lot of automotive competitions. So let me open this.
OK, there are questions asking regarding that where can we get the models and the file exchange reference examples. See, whatever we are showing today, these all models are available. Each and every model is available, so don't worry. We'll share the link to-- once the session is over, within four to five business days, you'll get an email with all the resources. So just be relaxed, OK? Yeah.
So now, this is the model. And now, you can see that this is having a driver. This is having an oval track reference over here, which is actually, again, xy, which is the answer to one of the queries. And then it is having an environment and a passenger vehicle.
OK, now if I get into this, it's the same thing again. However, now instead of selecting the option for external longitudinal forces, we have option for external forces. Means front and rear, both Fx and Fy forces we are considering. From where it will come? So it will come from the tire model.
Now, getting back to the tire model. And over here, you can see that this is the tire model. And now, we are having a detailed tire model. So this is how we implement it. OK, so we are using this block based on this block. We are having certain outputs-- Fx, Fy, and movements, which we are not using currently because it's a 3DOF vehicle model. Had it been 6DOF, you would have used this movements.
And then we are further having a driver. Now, I think, everyone understood what additional things we have added to this model. OK, and then further, we have this driver model. OK, so this driver model what it has is that-- again, this, you can-- this is available in the vehicle dynamics blockset.
And you have different drivers. For example, if I click on this block, you can see over here that it has longitudinal controller type. You can select based on predictive or PI-- for example, what was shown earlier in the longitudinal vehicle model, where we were using PI. Or you can also use a predictive driver.
And then for the lateral control, basically for the steering control, what we are doing is we are having the Stanley controller. And what it needs, it needs all these parameters. Those are certain control parameters which you need to define. And from the vehicle parameters, you need to define all these, like mass and distance from your forward location of tire, and rearward location of tires and all.
I hope this is now clear how we are making a full closed loop model. And then this is the block subsystem, where we are defining the reference points. Of course, this is not the optimal one. But you can consider it to be like we're providing the xy. We are providing the post to this. We have the xy and 3DOF as well.
So now let me run this. And one interesting thing we show you. I think that's really, I think, interesting for a lot of competition teams who are participating and former students.
Meanwhile, it is running, there's a question-- nice question again. Is it useful for robotics design? Not exactly. This is very high fidelity. In robotics, we don't move the vehicle at very high velocity.
So that's why we are not concerned about the tire effects and all. Rather, you can use the robotic system toolbox, where we have provided a simple bicycle model. However, from here, if you want to use, you can use the 3DOF single track block model. You can use that, yeah.
Can this block be used for mobile robot simulation? Yeah, those vehicle block definitely it can be used for-- it depends what kind of robot you are making. If it is just a mobile robot with a normal-- not crossing more than-- what do you say? Like 10 meters per second, I think there's no sense of making it very high fidelity model.
So over here, you can see that. What you can visualize in the plot is velocity, engine optimum gear, and as well as the GG plotter over here. So we have also added a GG plotter with relation plot over here. So if you're modeling it, you can also leverage these kind of visualizations to visualize the GG plot. And this is very much, I think, studied in Formula student competitions.
So this is how-- and you can see that the driver is perfectly tracking it. It's tracking each of the waypoints. And if we zoom it a bit-- so this is the one. But of course, there's one-- I won't say limitation, but relating to the optimized path, this is not taking the optimized path.
But of course, we can leverage that code and find the optimized path. And that we can feed as xy and 3DOF values or define the post. And then we can run the simulation.
So this is all about, I would say, Simulink and using it based on equations. And again, resources, we have a complete tutorial on this. And we have models linked to this. Not the first one, but the second one, we have the models linked where you can download it.
And then you can also get the access to a lot of blocks, which we have made using reference applications. So you can have a look into this. So we'll share this resources again in the chat and when we are sending the email with all the resources.
So now what we saw until now is all equations and Simulink, which is where we were using all the one directional signals and where we needed equations. And even like what we saw in the vehicle dynamics blockset, once you go inside-- inside each of the blocks, you can see that all those equations are converted into a block and made a whole system for particular tires of vehicle body.
Now there are a lot of other engineers or other student teams, those who consider to do multibody vehicle simulation. So now we'll move to that, going into the multibody aspect. Like if you have to perform these kind of multibody simulation for complete vehicle types or high fidelity vehicle dynamics model, then how do you do that.
So taking an example-- so moving ahead, let me-- one second. Just give me a second. I think it's stuck somewhere, OK. Yeah, OK.
So giving an example is that this is a suspension system, where this is having hard points shown in red colors. And then you have this upper arm, lower arm, a cylinder piston mechanism. Now, to model this using multibody-- in general, you need to follow certain steps.
First of all, this is-- I mean, since this is not only modeling. It is basically dynamic simulation, which is taking physics into account. So definitely for example, if you have to measure that how far the vehicle moves from certain frame of reference-- so that's why it is over here very important that how you define the location or position and orientation of any of these bodies.
So just to give an example, what we'll do is we will define how to define this using the tool what we are going to discuss, just to give an example of defining hard point coordinates. Then how to build bodies and then define motion because motion is important, how you define motion.
And the most important thing is that, OK, you built something, some multibody, but one option is that you just give certain force. And based on the mechanism, you can give torque. And then you simulate it and calculate the velocity, acceleration, angular velocity, and other physical parameters.
However, if you want to add more and more physics and make your model more of high fidelity-- for example, the suspension when you're making the piston cylinder, you can add the forces and make this piston move. But how about that taking real physics into consideration, where the mastering damper is model using this damper and spring? This also we'll cover today.
So moving ahead with this, so how we model this is using something called as tool called Simscape Multibody, wherein you can build 3D mechanical systems using bodies, joints, constraints. And also, if you have CAD assemblies, that also you can import and model it. Or if you have CAD parts, like SGL file, that also you can leverage provided that you have a proper parameters like mass and inertia and all these parameters.
Then you can do that also. For example, here, this is just an example of piston cylinder mechanism. So in short, again, what we will do is we'll see how using solid blocks, how using different blocks which can define the rotation and translation and even constraints and forces, we can model a multibody system. So as an example, the suspension system.
So as an example again, if I-- OK, I closed the Simulink library browser. OK, not a problem. Where can you find all this is in the library browser when you go. You can go to the Simscape Multibody over here.
And in the multibody, you will see that there are different sections, bells and cables, which are not required for you. And maybe you can go to joints because when you're defining the motion between two bodies, you need to see that what kind of joints is giving, maybe like prismatic joint, maybe revolute for rotation, or maybe spherical joint. So you can find it over here.
And then you can have girth and couplings over here like this. And then you also can take advantage of the body elements. For example, there are different bodies. If you want to create cylindrical solid, you can create brick body. And I think the most useful is the file solid because you might be having certain kind of parts which you want to import or include in the model. So for that, you can use this file solid when you open this.
OK, so I think I opened something. Just give me a second. Yeah. So similarly, there are other blocks as well. Now, as we move to see the model, you will understand what we're talking about. So let's go to the model.
So after this, what we'll do is once we have given an overview of suspension system, then we'll move to how to make a tire contact with the surface, with the road surface in multibody. So yeah, I was talking about defining the coordinates. OK, I mean, like where are the hard points placed with respect to a world or fixed reference.
So consider this to be a fixed reference, maybe world frame of reference. And then this is one of the hard points, which are just denoted for the visualization with red colors. And we are not defining any inertia or density over here. You can see if you have kept it zero.
How do we define that? For that, we have something called as rigid transform. So that is what we are using.
So if I click on this, the rigid transform, and this is the block. And if you double-click on this, you can see that what it requires, it requires the rotation. Like, maybe you can define it based on aligned axis, standard axis. Or the best way is that if you define the rotation matrix.
And the translation again, you can define in different ways. For example, standard access, you can define in Cartesian. For example, how far is this hard point for a fixed frame of reference? So that, you can define. And orientation doesn't matter in this application, but yeah, you can also define that.
So this all block what you see is that these mostly, all these-- these are basically making sure that where we want to place the hard points, they are placed as per the dimension. So this is what we are making sure. OK, so we just answered that how you can define the coordinate systems.
Moving ahead, defining the body. For example, if you go to the upper arm, what you need to do is very simple. You just need to bring the cylindrical block over here. And you need to define the radius and the length, and along with that, inertia. I mean, here, we are defining the mass. So you define the bodies like this.
However, you can also define a part. For example, I was talking about this part. Let me open body elements. And you can see over here that, for example, this file solid-- OK, so over here, you can import from file each kind of file, STL or something like that. You can just put it over here and make sure that it's in the current directory, and it will keep that file.
Then once that-- now, defining the motion. Now if I run this simulation-- and even earlier in the slides also, you saw that we have motion between-- linear kind of motion between the piston and cylinder. Or maybe if I could just focus on one image. So you can see over here, this one. OK.
Now, how to define this motion? For this, here comes the play of all those joints, which we just saw in the library browser. So for example, in the shock absorber, if you go inside, these two blocks are ensuring that with the solid bodies, we have defined, we have built the cylinder and piston. And how we defined the motion using this prismatic joint. Over here, you can see that the input is force and output is velocity. I'll come back to this like what it is all about, yeah.
So we have defined the coordinates. We have defined the bodies or built the bodies. And we have also defined the motion. Now the next step is that-- for example, in here the option could be you remove all these connections. And you can simply put a constant or signal just to feed the forces.
However, we have not done that. We have added more physics to that, wherein we have defined this using a one dimensional physics-based model, which is built using Simscape. So now what is Simscape and a lot of things we'll also cover in detail with respect to the powertrain modeling in the next session.
But just to give an overview-- so Simscape enables you to build physical systems. Now what are these physical systems? For example, your thermal system, your electrical system, your mechanical system, your fluid system. These are all physical systems. And if you combine all this, it would become your multi-domain system. And something that you can see, what you can feel, those are all your physical system based on physics.
Now, how do you model that in Simscape? As I mentioned that, it enables you to build physical system. So you have certain blocks, where equations are already defined. And you need to replicate the physical network. Or you can see the physical block diagram of any like system-- for example, in here, you can see the motor, which can be defined in terms of different elements like resistor, inductors, and electromechanical converter. And then you have this mass and inertia.
OK, so this can be replicated in this form using some physical blocks, which are connected by physical signals, which are carrying physics. That's why since it is based on completely physics, these are all bidirectional schemes. These are not you need actual Simulink what you saw.
So there are a lot of things available. Touch more base and get into deep more when we move to the-- when we go to the next session, which is scheduled on third of November. But just giving an idea that you can make a physical-- model physical system and model and simulate physical systems.
So that's what we have done. What we have done is we have utilized that. And in here, we have connected this block to a physical network, which you can see is defined by the spring and a damper. So over here, you can see if you go inside this.
So this is defined by spring. You can see these springs. These are all Simscape signals. We'll talk about more in the upcoming webinar. And then we have this damper again, which is a physical system, which is, again, built using Simscape.
And one change-- you will also see that this is not showing any arrows because this is all based on physics. And these are all carrying some kind of energy. There's energy transfer going on. OK, so that's why these are all bidirectional signals, yeah.
So this is how we have built the whole model. We started with defining the coordinates. We defined the bodies. We defined the motion. And then we connected this to a physical network.
So this is how the model looks like. I mean, we just played the model. Again, these are all available. You can have a look into that. We'll share the resources again.
And you can-- this is just a quarter car model. You can build a whole vehicle model using this suspension. Yeah. And then you can also study all those output forces, which are needed for optimizing your suspension system.
Now, talking about this, moving to the next interesting topic, which is how to make or how to do vehicle simulation, vehicle dynamics simulation, considering the tire parameter. So for that, 21B with 21B, we have released one tire block, which makes sure that it is having-- which you'll be using in the multibody, wherein there are two ports. F will take care of-- which is to follow a frame, which will take care of connection to tire. And the B, the base frame, which will take care of the contact with the infinite plane.
So if you want to use this, you have to install 21B because this is a recent addition to the toolbox. So again, you can see a lot of information over here. But the main summary of this is that using this block, you can implement the tire model in your multibody simulation.
And one requirement, which is coming from the industry requirement, is that you need to have the tire file in TIR format. So for example, if you're having some kind of raw data, raw tire data, which I think the tire consortium gives to the formula student teams, you need to convert that into TIR format. And there are different tools for that as well, which you can use.
And then that TIR format can be fed into this block. And then you can run the simulation. For example, just quickly going through that-- can we-- OK, so over here, you can see that this is the vehicle model.
Now, instead of only the suspension system, it is also having a tire model. So let me run this. And you should be able to see this in this view. Yeah.
So how we made the connections over here? So you can see here that if you just go to this tire block, this is the tire block. This is connected to the tire geometry. And this is connected to the surface, which we have defined as an infinite plane.
And if I double-click on this, these are the certain parameters which you need to define. So here, we have defined we have this tire that's called param. However, make sure that for realistic results when you're performing these kind of simulations, you have proper tire data.
So with this, we have covered all the important topics. And I just wanted to let you know that if you're looking for very high fidelity models for reference applications using multibody, go check out this resource, Simscape Vehicle Template. It has also certain models for formula student car as well with that suspension, which we coordinated, which the team worked with one of the student teams. So you can have a look into that. And we also took the quarter car model from the Simscape vehicle template.
So again, the resources are there. You can copy, make it as a bookmark, or don't worry. We'll be sending out all.
Yeah, so with this, what we'll do is-- there are certain-- I think since we have only a few minutes remaining, better we'll start the Q&A session. And these are certain resources. For you, the most relevant one will be physical modeling over here because if you're new to Simscape, it starts from scratch. I mean, from Simscape moving to Simscape multibody. This is a good starting point if you want to have a look into this.
And then to get more motivated how the teams are using in automotive and robotics and aerospace, you can have a look into this inner circle page. We $recently I think we also added the German winning team, Esslingen, who won in the combustion category. So if you go to the page, you can see how the teams are using the tool for this application.
OK, it's not opening. Maybe I could try once more. OK, you can see that we are featuring these winning teams over here.
And then we have a big community based on automotive, which is called racing launch. And then we also have a community, which is based on robotics. So if you want to join and want to get access to a recent or latest or even relevant resources, videos, tutorials, articles, feel free to join this group. And we also already mentioned that we have a good amount of video tutorials to guide you. And we also have a student lounge blog, where we publish technical articles from MathWorkers as well as the-- we are also collaborating with different team members, faculties, or students, those who have worked in this field and want to share their work to the whole community.
So this is our contact address. If you have queries regarding anything, reach out to us at racinglounge@mathworks.com. And we have also provided links to the student videos and videos.
And going to the next session, do join us because we'll be showing some exciting realistic models, full vehicle, high fidelity models consisting of vehicle dynamics, then your powertrain, then your driver. Everything will be there in this model, where Krishna will be presenting this content. and this is again the Simulink which we have provided. If you haven't registered for the upcoming sessions
And we'll have a live demo on one simple electric vehicle model with thermal cooling. That also, we'll touch base on the next session. And yeah, this is a survey, which we want you to fill up. I mean, do fill this form because this gives us a good idea that where the teams are focusing or what kind of videos we want to make. So this will help us as well as the whole community to answer a lot of questions which we haven't answered yet on our video channels and blog pages.