Simulink for Adaptive AUTOSAR
Adaptive AUTOSAR is a modern software framework intended for high-performance, on-board computers often used in autonomous systems. Based on POSIX and C++, it supports dynamic and updatable software as well as services-oriented communications and has extensions for safety and security.
In this talk, MathWorks introduces you to Adaptive AUTOSAR concepts and showcases how the Simulink® product family offers support for Adaptive AUTOSAR including:
- Modeling and simulation of Adaptive software components using service-oriented communications
- Support for AUTOSAR Adaptive schema 18-10
- C++ production code generation with Adaptive middleware interfaces (ara::com), and AUTOSAR XML export
Recorded: 11 Apr 2019
Yeah, good morning. So it gives me great pleasure to be here in Stuttgart, the birthplace of the car, maybe, to talk about Simulink for AUTOSAR Adaptive. So just before I start, could we just have a quick show of hands? So, who's using AUTOSAR in the audience? Quite a few. And who's using Adaptive AUTOSAR? So one or two. So hopefully there'll be a good mix in this talk.
OK, so this is what I'm going to cover. So first, I'm going to give you some background on how popular AUTOSAR is, and also some of the motivations for Adaptive, why they've introduced the Adaptive platform. Then we'll look at AUTOSAR support in Simulink. We'll do a deep dive on the Adaptive platform, and then I'll wrap it up with additional resources. So let's get started with some background on AUTOSAR and AUTOSAR Adaptive.
So AUTOSAR Classic is, as I'm sure you're aware, is very popular and it's already on the road. Here is some user stories and presentations by our customers. So BMW, they talk about model-based software development and AUTOSAR. FCA, they've got a nice article on model-based development and code generation, LG Chem model-based design and ISO 262262. And of course, you know, AUTOSAR is not just the preserve of automotive companies but also other kind of related industries, and John Deere has got a nice article on model-based development and the work that they've been doing.
OK, so this is AUTOSAR Classic. So-- you know, we've seen how AUTOSAR Classic is very popular. So that kind of begs the question, why introduce Adaptive platform? So there's really two words, automated driving.
So as I'm sure you're well aware, automated driving requires huge amounts of computational power and communication bandwidth, and it also needs to be easily updateable. So there's a lot going on with automated driving. So the AUTOSAR organization, they've introduced the Adaptive platform. So they've based it on POSIX operating system. So that's where you're going to get the computational power from.
They've introduced service-based communication. So this is where you're going to get the communication power, and if, of course they make it easily updated bill. So that's where you get the-- you know, you can easily update these things. So all of this is aimed at autonomous driving.
But automated driving systems, they only form some functionality of a modern automotive system. So a question we hear a lot from our customers is how does Adaptive platform play with the other platforms? So Classic and non-AUTOSAR platforms. So it's a question we hear a lot is, how's Adaptive going to play with Classic?
So it's not going to go away. They're going to co-exist together. And then the second thing is that Simulink offers a design environment where you can scale both from components to compositions and also across platforms as well. So that was a brief background to AUTOSAR Classic and Adaptive. So what I'm going to do now is just cover some of the practicalities of using AUTOSAR in Simulink before we go into-- before we do a deep dive on the Adaptive platform.
OK, so a large number of our customers are using Simulink to model the Classic applications. So what they do, what they predominantly do is model most, if not all, of the application software in Simulink. They also model some of the RTA and basic software and routine libraries in Simulink, depending on the kind of fidelity of the model. So let's have a look at how our customers get AUTOSAR, bring their AUTOSAR architectures into Simulink.
So this slide covers the main step for designing AUTOSAR software components. So I'm going to go through each of these main steps in turn. So if we look at the import step, so some users start from ARXML, so the software description. Then they're going to import that into Simulink. So that's just two lines of MATLAB code. You're going to get a Simulink model from that, and then they can elaborate the software component design further. So it's super easy to pull in your architecture into Simulink.
So now if we start with an existing Simulink model, so let's see how easy that is to configure for AUTOSAR. So you can use the AUTOSAR component quick start up and that's just going to ask you a few simple questions just to get you started with configuring that model for AUTOSAR. And then you're free to-- then you can elaborate your software component design, your implementation and generate codes. So again, super easy. OK, so here I'm going to show a video of that in action. So this is just an existing Simulink model.
I'm going to launch the quick start up, the AUTOSAR quick start up. That's going to ask one or two questions, such as just to name the component, the path, what type of component it is, and then how you want to set up the interfaces. So here you could import from ARXML, or you could just accept defaults from Simulink, and then that's it. So you see your models all set up now. You can generate code for your model.
So here, I'm just going to show the AUTOSAR dictionary. So if you want to fine tune a few things, you could go into the AUTOSAR dictionary. You see the ports, see the interfaces, and then we can go ahead and generate code. So it's very easy to get started with an existing simulation model for AUTOSAR.
So that's good. So let's have-- so I've shown how easy it is to get started. So let's look at some of the modeling. So some customer models look like this. Some customer models even look like this, very complex. And you're probably asking yourself some of these questions. So which blocks in the model need to be configured for AUTOSAR? It's not obvious, just looking at that. How do you change some of those AUTOSAR properties in the model, and how do you get more information and help?
So to answer these questions, we've introduced the AUTOSAR perspective to the Simulink model. So this perspective these are in-model UI components, there's three of them. I'm just going to go through each of these in turn. So there's a Help panel. So that's aimed at first-time users, if they wanted some help getting started.
There's also the code mapping spreadsheet. So every element in the Simulink model is going to be mapped to this, is going to be shown in this spreadsheet, and you can configure it that way. And then on the right hand side, you've got the Property Inspector. So if you want to do more advanced configuration, this is where you'd set some of those attributes up.
OK, so another thing we've learned from the Classic platform is-- and through talking to you, the customers. So it's important to do functional simulation of AUTOSAR basic software, when you're designing your application software components, and that's for kind of a number of reasons. So the application software is going to be calling a lot into basic software. So you're going to be using the basic software modules, and there's going to be lots of calls into the basic software modules.
Secondly, the basic software functionality is highly dynamic, so there's a lot of state in the-- so any upfront simulation that you can do against the basic software is just going to save you time, improve quality in the long run. OK, so customers kind of understand that. What they also remark is that the AUTOSAR specifications are pretty detailed. This is just one of them.
This is for the diagnostic event manager. As you can see that's 475 pages, that's pretty detailed. So what we've done is we've encapsulated the contents of those specs into the basic software library, and here you can just literally drag the blocks into your model and simulate a functional simulation of basic software.
So I'm just going to show you a little example of that. So here, what I'm modeling is we're doing some fault tolerant-- it's a fault tolerance position controller. So we've got two sensors, and the monitor is just going to choose the best, the sensor that it thinks is-- has not got any faults. So let's play that.
OK, so those are the two sensors, then we've got a monitor component. So we look in the sensor, so we're going to initialize some state using non-volatile memory. So here, I'll just drag that block in. There's a variety of operations you could choose. We're just reading the data from non-volatile memory.
Here we lock in the defaults to the diagnostic event manager. So again, there's a few operations that you could choose. These are all operations in the monitor caller interface. So that's the sensor, and then the monitor is just going to inspect to see which sensor is-- choose the best sensor. OK, so those are the components, and then to simulate you just simply drag these service component blocks into your integration model, and then you can immediately press play now and you get a functional simulation of basic software. so you don't have to read the specs, look at the interfaces.
And that's the functional simulation. You can also double click on the blocks and change the parameters away from defaults. OK, so another area that customers ask us about are library routines. So these are a set of mathematical routines for AUTOSAR Classic. Here. I'm showing the interpolation routines. So these five blocks represent 127 functions for AUTOSAR.
So the idea here is that you can drag the block into the model, and then you can change the various settings. But we're always going to ensure that you generate a function call for the Ifx library using those settings. I will even give you a hint which routine you've targeted there.
And then this is the generated code from this particular setup. So here we see the IFL interpolation. OK, so we've looked at workflows, components, basic software. So just very quickly, how does it all kind of fit together? So let's have a quick look at that.
So we've modeled our software components, we've got our basic software services. We can also put dials and gauges on there. And here, we've got a virtual easy use simulation of the system. OK, so we've looked at the building blocks that we've got in Simulink to support AUTOSAR.
So in this section, I'm going to do a deep dive on the Adaptive platform and pull out some of the key concepts from the Adaptive platform. So if we look at the layered software architecture. So at a very high level it's very similar to Classic it's the layered software architecture.
So you've got-- they're not called components, they're called applications for Adaptive. You've got a runtime environment. It's AUTOSAR runtime environment. You've got the AUTOSAR foundation libraries and AUTOSAR services, and then the hardware as well. So perhaps one of the biggest differences between Classic and Adaptive is that for Adaptive, the applications can call any of the public interfaces for the-- of either the AUTOSAR foundation or the AUTOSAR libraries. So the surface area of things that the applications can call is much greater than the Classic.
And then the other thing to note is that this isn't necessarily bare metal hardware. It could also be virtual, virtualized and running on servers as well for Adaptive. So that's the layered software architecture. So I'm going to go through some of the key concepts that we've kind of pulled out. So for key concept number one.
So everything in Adaptive is an OS process. So the OS provides multi-process capability, and then each Adaptive application is its own independent process. So compared to Classic, it was just one monolithic process. But for Adaptive you've got multiple inter-processing processes. And then each application, it's got its own main function, it's own memory space namespace, and it can be single or multi-threaded.
So if we look at some of the process management. So the OS provides process scheduling. The Execution Manager provides lifecycle management, and then the Communication Manager provides interprocess communication. So you can think of the execution manager and Communication Manager as equivalent to the RT84 for Classic. But those are things that the application calls directly.
So that's key concept number one. So key concept number two, so I'm going to talk about this service orientated interprocess communication. So first of all, let's just look at the interprocess communication. So for Adaptive, the IPC can be local or via the Communication Manager. Could be over a network, again, over the Communication Manager.
And now, if we look at the type of communication. So as I'm sure you're aware, Classic's got sender receiver and client server. Adaptive has got this notion of service interface, so it can contain three things. So you've got methods, so that's remote procedure calls over the network [INAUDIBLE]. Events, so I think of messages, and fields so I think of data. So this is the service interface and this is the service-orientated communication aspect for Adaptive.
So that's the second key concept. So the third key concept. So everything in Adaptive is C++. So all the modules all the applications all need to be written in C++. So I've covered, you know, three high level kind of key concepts for AUTOSAR Adaptive. So this is the AUTOSAR Adaptive roadmap.
So the AUTOSAR consortium have released three versions of the standard. Some of these customers are early adopters of Adaptive. They've all appeared at the 11th AUTOSAR often conference last November. And then I'm pleased to say that two weeks ago, we released in [? 19A, ?] our support for AUTOSAR Adaptive.
So it's interesting to look at some of the motivations for why we support AUTOSAR Adaptive in Simulink. So first and foremost, Simulink's heavily used by you guys for AUTOSAR and you've asked us to support AUTOSAR Adaptive. And then secondly from a kind of technology standpoint. So we've already been investing for a number of years in this notion of service-orientated communication. So first by Simulink functions and function callers, and also by Simulink messages. And then in terms of code generator. We already generate C code and C++ code. So it's quite a natural fit from a kind of technology standpoint.
And then thirdly, we participate on the Standards Committee where we both support Classic and Adaptive. So those are the kind of three high level motivations for the MathWorks support in AUTOSAR Adaptive. So over the next few slides, I'll take some of those concepts and then show you how it maps to Simulink. So in Adaptive application, it's got both required ports, provided ports. This is the service interface with events, methods, and fields that I kind of showed before. So let's map some of these concepts to Simulink.
So first of all, in Adaptive application that maps to a model in Simulink and then we look at the events they map to. Simulink messages in Simulink, and the blocks next to the I/O ports, these convert events to signals and we ship these as parts of the AUTOSAR block set, for any models that are predominantly kind of signal-based. We look at the other side. So the provided port. So again, an Adaptive application maps to a model and then the events here map to Simulink messages on the [? eight ?] ports.
So I'm going to kind of pull everything together now from this talk in a demo of our AUTOSAR Adaptive support. So let's configure this model for AUTOSAR Adaptive. So first of all, I'm going to set up the system target file to be AUTOSAR Adaptive TLC, and then launch the quick start for Adaptive.
Again, it's going to ask us a few questions, you know, what do we want to call the application of the package. And now we're done configuring the model. So these are all the message boards that have been mapped to AUTOSAR. And then if we look at the dictionary, you can see the required and provided reports of the application and then on the service interfaces, we've got events and you can set up namespaces for Adaptive.
Then the XML options. We've got some package configuration here. OK, so that model's now set up for AUTOSAR Adaptive. So let's generate code for the model. So here we see the model CPP file, and then we're going to look at some of the calls to the Communication Manager.
So we've got [INAUDIBLE], and then we send in the events here, and then the generated ARXML. So this is AUTOSAR Adaptive ARXML, and then we've got Adaptive application software component, and then the data types. And we also generate the main CPC. So can generate an execute-- you can create an executable for Adaptive.
OK, so this is a summary slide of our AUTOSAR Adaptive support. So you can generate production AUTOSAR Adaptive C++ code in Simulink. So the workflow is very simple and intuitive. You could take a Simulink model, configure it to generate AUTOSAR C++. You can go into the dictionary, you know, refine those settings. And then after you've configured your model, you can generate the Adaptive C++ code and ARXML.
OK so, I'd just like to complete this talk with some information about additional resources. So many thanks for listening, first of all. So if you'd like further information, please visit the website, the AUTOSAR blockset website, and also we've got a demo booth downstairs. So please talk to us at the demo booth. So thank you very much. Thank you.
[APPLAUSE]