Building a Virtual Vehicle for Large-Scale Simulation Studies - MATLAB & Simulink
Video Player is loading.
Current Time 0:00
Duration 15:33
Loaded: 1.06%
Stream Type LIVE
Remaining Time 15:33
 
1x
  • Chapters
  • descriptions off, selected
  • en (Main), selected
    Video length is 15:33

    Building a Virtual Vehicle for Large-Scale Simulation Studies

    The importance of virtual vehicle simulation has only grown as the automotive industry shifts to a more electrified, autonomous, and connected world. Their impact across organizations, however, is limited by the challenge of building models that can answer engineering questions with acceptable accuracy and speed. Building the vehicle model is only the start, and the platform must support the need to scale up the simulation studies needed for engineering decision making. Discover recent developments at MathWorks that make the process of building a flexible, customizable simulation platform easier and more automated. See an example showing how the virtual vehicle models can be deployed to the cloud for large-scale simulation studies.

    Published: 31 May 2022

    Hi. So I'm Mike Sasena. And I'm here with my colleagues, Brad and Scott, to talk to you today about how we were building virtual vehicle models for large-scale simulation studies. So to begin, the key takeaways are that we're going to show you how a new Virtual Vehicle Composer app was used to quickly put together a vehicle model.

    And then the model that we put together could then be customized to create the specific use case we had in mind. And then we ran some desktop studies and then scaled that up to the cloud to perform a larger-scale study. So we'll break down each of these sessions as we go through today. But we're going to begin simply by setting the context.

    What is a virtual vehicle? Now there is no one single definition of "virtual vehicle." Each company may be using slightly different terms and using it in slightly different ways. But there's common trends. We're seeing that virtualization is being used more and more in the production side of things.

    And the physical prototyping is being used more often in the validation and confirmation stages. So it's kind of shifting the balance a bit. And we see this most often with powertrain, vehicle dynamics, and ADAS teams. Now there's, of course, challenges to getting there.

    There is lots of physical plant models and controller models to assemble, finding the right level fidelity for those models, and then getting them into the hands of people who may not be experts with these tools. Now, we talked to a lot of customers doing this. Here today, the focus is going to be more on the top left part of the V and the virtual prototyping example that we're showing. But it's also commonly used in virtual integration in virtual validation studies.

    So how are we helping customers to overcome these challenges? Well, for one, we help them to create the vehicle that you need to start with some kind of a vehicle model. So we have models out of the box you can use with different libraries and modeling guidelines to help you.

    We have the ability to integrate in other pieces, be it software from C or other tools using FMU integration and bringing in those other components so that you could then have a vehicle model you can test. You can author the scenarios in different ways using tools for MathWorks and then simulate these and use a wide range of flexible tools to review the results, analyze that data, and then lastly, deploy that simulation into other environments-- say, the cloud or running it on HIL.

    Now we have a lot of capabilities in this area. We have quite proven tools for modeling both the plant and the controller side of things and giving you those reference applications to help you start quickly. The models are scalable. They can be reused across platforms.

    And most importantly, the flexibility of this platform is what allows you to grow over time. Because you may not know all those use cases up-front, you need to have the flexibility to react as they evolve over time. So companies have been using our tools in a variety of ways. These are just three recent examples from the automotive conferences and from Expo.

    So you can see here how Ford, GM, and Bosch were using different kinds of virtual vehicle models to do different studies. But there was a common theme of automation. How do you automate the process of building that model or automate the process of running simulations and analyses? So there's links here in the PDF.

    You'll see you can go to these links and other links in these slides that you can follow along and get more information on these as you need. So how do we get to the virtual vehicle itself? How do you build that? How do you create the vehicle model, integrate in the software, and author the scenarios?

    So starting with the virtual vehicle models themselves, we have had, for a number of years now, vehicle reference applications that you can open up in two studies with right away. We also have libraries and a variety of tools to help you customize them and bring in the specific level of fidelity in the details that you're looking for. But one of the reactions from our customers are that the models are quite powerful.

    But there are also a lot of parameters to study. And they were looking for help in configuring those models. How can you make it easier for them to build them? So in R2022a we released the Virtual Vehicle Composer app as part of Powertrain Blockset and Vehicle Dynamics Blockset as a way to select those powertrain models, select the vehicle dynamics pieces that you needed, and generate a closed-loop model quickly.

    So I'm giving you a quick overview of how this works. So you start here in the MATLAB apps strip. And then you can see in the automotive portion, there's a Virtual Vehicle Composer button. When you click on that, that'll open up a new app. And you can start a new session.

    Or you can open up-- load a session from something else that's been saved in the past. That loads a MATLAB project with all the vehicle models we need. At that point, we can go back to the app and now select what kind of powertrain do I want. Do you want some kind of a P4 HEV?

    In our case, we want an electric vehicle. So we're going to start there. Now do you want pure longitudinal models? Or do you also want to include lateral dynamics? So we'll add those lateral dynamics here. And we can do things like change the vehicle mass.

    We can also look at components of pre-set data types. So we have a variety of different tire models we can select from. We can also look at plots of data we have. So here is a plot of the max torque curve. You can validate is that what you're looking for.

    There is an efficiency map for the motor there. Again, you can change these data right from the UI. You can also just look at them and validate that they are what you want. Now we can select the scenarios and tests we want to run. Here, I'm looking at a double lane change.

    I don't need the drive cycle in this case. But there are different drive cycles to select different maneuvers. And then I can confirm which signals do I want to log. There is a predefined set of them. Or you can go through the bus and select other signals you may want to log.

    I now click the Virtual Vehicle button to actually build a Simulink model. So at this point, I could just stay in Simulink if I wanted. I can see underneath the hood here if I look in the controllers. I've got my vehicle control unit. I've got an engine control unit.

    In this case, it's null because there is no engine in the EV. You have your brakes, your trans controllers. All those subsystems are there for you. Similarly in the plant model, you have different subsystems for the engine, the drive train, the electrical, the vehicle dynamics.

    And depending on what you select in the model, you'll have different subsystems put into those for you. Now I could work in Simulink. Or I could just go in that UI and click the Run Test Plan button. And now I can view the double lane change test that I'd set up here and go back into the Simulation Data Inspector to see how those results looked.

    OK, so that's just a quick overview of how that tool can be used to perform some kinds of studies. Now the whole purpose of this app is just to help you get to a good starting point quickly. And the model that we're generating from it can then be further customized. So you can add in your own plant, your own controllers, your own sensor models, and then add different test scenarios of interest.

    And at that point, you're in the Simulink platform. So you can leverage the strength of that platform to bring in other C code or FMUs to deploy it for large-scale studies, as we're going to do later here today, or bring it into other environments. Now at this point, the EV model that we generated, we want to use it in some kind of an autonomous emergency braking, or AEB, example. So Brad is going to show how we customized the model we did here in order to perform that study.

    OK. Thanks, Mike. If I can get it here-- all right. So first, let's do a quick overview of the autonomous emergency braking just so we know what that is. So at a high level, AEB, or autonomous emergency braking, is a active safety feature.

    And what it does is automatically apply the brakes with various levels of intensity based on how close your vehicle is to, potentially, an imminent collision. And you can see that in the diagram here in the upper right-hand portion of the slide, where we're showing three different levels of brake effort being applied so that the ego vehicle doesn't accidentally get the lead vehicle. Now to test an active safety feature like AEB, you can use tools from Automated Driving Toolbox.

    In particular, Driving Scenario Designer is useful. Because it can help you quickly create different traffic conditions that you can use to exercise your active safety algorithms. And another nice thing is, Automated Driving Toolbox has a lot of different demos. And some of these are very specific to developing AEB controls.

    So what we did was, we integrated content from one of those AEB demos into our EV model. And we did that because the EV model we started with, it didn't have the sensors and control algorithms we needed that were specific to the AEB testing that we wanted to run. So we started with the EV model that was generated from the Virtual Vehicle Composer app-- that was what Mike was just showing you.

    And then we opened up one of those AEB demo models. And we copied over the parts that we needed-- and I'm showing those highlighted there in blue, these big subsystem-- integrated those into our EV model. And then there was some additional data that was associated with this AEB demo model. And we brought that over as well. All right.

    So at this point, we've got a full closed-loop EV model that's fully capable of testing our AEB algorithms. So let's take a look at how we got started using it. All right. So what we're trying to understand with this study is, how well our algorithm is going to work for our EV application?

    So we're interested in knowing, well, look. Is the algorithm going to be robust to different test scenarios, or maybe different vehicle payload configurations, or things like that? Or is the controller tuned properly for what we're doing? All right. Now I mentioned scenarios. I've got an example of one here on the right side of the slide-- just wanted to give you a sense of what these look like.

    So here I have an ego vehicle. It's going to be driving down the road past these two parked cars. But there's a pedestrian here that's going to start walking across the road so let me just get this video started so you can see it.

    [VIDEO PLAYBACK]

    So here you see the vehicle driving. The pedestrian starts moving out into the flow of traffic. And the forward collision warning system identifies the pedestrian. And the AEB system takes over, fires the brakes, and brings the vehicle to a halt, so avoids a collision.

    Now we're going to want to run a lot of tests. So we used a very simple pass/fail criterion to help us interpret which tests are good or bad. So effectively, if the vehicle has a collision, that's a failed test. If the vehicle does not have a collision, that test is considered passed.

    Now as I mentioned just a second ago-- excuse me-- we want to run a lot of tests. And so we're going to need a way to automate the execution of these tests. So you can do that with scripting or with a tool called Simulink Test.

    Now the full factorial study that we have in mind is quite large. It's going to be way over a thousand different runs. Now you could do a study like that on your desktop. But it's going to take a while to get done. So a more practical approach would be, perhaps, to start with a smaller subset of your full-size test and then use that subset to just validate the test setup on your desktop.

    Make sure it's working correctly before you go and deploy the full-size test up on the cloud. Now what we ended up doing is, we took a 16-run subset of our big, full factorial study and ran it on our desktop. And the results we got back basically confirmed that yeah, things seem to be working correctly.

    For example, one of the tests-- I'm showing it here in this table in the bottom-- Nearside_10kph, that one was always failing in our ad hoc testing. And it continued to show failures when we were doing our automated testing. So that and some other factors gave us confidence that this test setup, it's working.

    It's OK to go to the cloud and run it. Now let's take a quick look at how we ended up scaling up to the full-size cloud execution. There's a lot of reasons you might want to use cloud computing.

    But some typical ones are things like, hey, I don't want to tie up my local PC resources to do these big studies. I want to offload that stuff somewhere else so that I can do my regular work. Or maybe I need special hardware to run my tests. And I only need that hardware once in a while.

    So maybe it's cheaper to rent it instead of purchasing it. And sometimes the data that you need is actually in the cloud already. So moving the computations-- in this case, the simulations-- to where the data is could make the study go much faster.

    Now a key value that MathWorks offers in these situations is that we make it easy to go from the desktop scenario to a cloud-based scenario for doing your computations. So for example, if you have scripting code, things like that that are working on your desktop, it's going to work on the cloud. You don't have to modify it.

    And we also have OS covered. We've got Windows and Linux both supported. So you shouldn't have any worries there. So let's take a quick look at how we use these capabilities to execute our cloud computing study.

    OK, so to set it up, we started with a MATLAB reference architecture. And we use that to instantiate our cloud computing resources that we needed to do our testing. So you can think of a reference architecture as basically a recipe that both defines and then ensures that the software you're going to need to run all your tests will be installed on these cloud-based systems that you instantiate.

    And then once you have those set up, you can connect to these cloud-based machines via basically a remote desktop connection like this. And if you have to load up any specialized testing files, you can do it that way. And then you're ready to go.

    Now you can use this approach with all the major cloud service providers-- Azure, AWS, or Google. So let me show you what happened when we ran this and the results we got back. All right. So we end up running an 11,200-sim study on a 128-core Linux cluster. And that took about an hour and a half to complete.

    Now contrast that with if I were to run that same study on my 4-core laptop, I'd estimated that would take about two days. So there's obviously a huge speed up there, so pretty clear advantage. Now when we looked at the data that we got back, it appeared that the AEB controller was pretty robust to the different parameter changes we were throwing at it, which is a good thing.

    But we did have some failures. So the next step we would do is to take those failed tests back to the desktop and analyze these things, try to figure out what's wrong, and what we could do to fix it. All right. So to wrap things up here, I just wanted to remind you of some of the key takeaways that Mike mentioned at the beginning.

    And we hope you retain these after the talk. So first, we have a new tool, the Virtual Vehicle Composer app, that you can use to quickly build your vehicle models. And once you do that, these models, you're going to find, are open.

    They're customizable. And you can adjust them, tweak them to suit any kind of use case that you have in mind. And you'll find that the models, you can use them to perform studies on your desktop and equally easily run them on the cloud to scale up to very large-scale types of scenarios or studies.

    Now we've just thrown a lot of capabilities at you. And if you find that maybe you feel like you don't have the time, resources, or perhaps even the expertise to do all this work on your own, MathWorks Consulting Services can help you out. They can provide expert guidance or assistance in creating these virtual vehicle models that you can use for your particular use cases.

    They can automate processes to help improve productivity. And you can even create custom UIs or even full-blown applications to meet your specific needs. OK, so that concludes our talk-- so appreciate your attention. And now we should have some time to take your questions.

    View more related videos