Teaching Model-Based Design at Politecnico di Torino
By Massimo Violante, Politecnico di Torino
In the region around Turin, Italy, there is strong demand for engineers with the skills and knowledge required to develop complex, high-integrity embedded software. The need is particularly acute among automotive companies, but it affects avionics and other industries, as well. Companies seek engineers who can deliver sophisticated software in compliance with safety standards such as ISO 26262 and DO-178B while adhering to stringent quality requirements and tight production deadlines.
To meet this demand, Politecnico di Torino has introduced Model-Based Software Design, a course for fifth-year students that combines lectures and practical exercises with seminars conducted by local industry experts. Using MATLAB®, Simulink®, Stateflow®, and Embedded Coder®, students learn how to manage the growing complexity of today’s embedded systems by designing and simulating an executable model; rigorously validating, testing, and debugging it; and generating code for an embedded target. By fostering collaboration and knowledge-sharing between academia and industry, the course is helping prepare the students for the engineering challenges they will face in their future jobs.
Course Goals
The course was introduced a year ago to cover topics not fully addressed by the computer, electronic, and mechatronic engineering curricula, and to better prepare students for engineering careers in local industries, primarily the automotive industry.
In my research and collaboration with companies in and around Turin, I heard repeatedly that there is a shortage of skilled engineers who can apply Model-Based Design to embedded systems development. Companies see the value in using this approach, but have limited time and resources to train engineers in-house. In developing the course, my goal was thus to prepare students to step into these in-demand roles and be productive immediately. Because the course would clearly benefit local area industries, many companies agreed to support the course by sending engineers to conduct seminars and presentations on their work.
The first time it was offered, Model-Based Software Design became the most popular of the 14 elective courses open to computer, electrical, and mechatronics students in their final year at Politecnico di Torino. Of approximately 200 engineering students 73 enrolled, reflecting a strong motivation among the students to develop expertise in this discipline. To date, 107 students have already enrolled in the second session of the course. The 46% increase in enrollment year-over-year is a further indicator of the strong interest the course has generated.
Teaching Modeling, Simulation, and Code Generation
I begin the course with a series of lectures on using modeling and simulation as the core of a development process for embedded software. I explain the factors motivating companies to take this approach, including rapid growth in the complexity of the systems under development, time-to-market pressures, and the high cost of defects found late in development.
Next, I describe how Model-Based Design with MATLAB and Simulink enables engineers to model complete systems, validate the system specification and functionality via simulation, and automatically generate test cases and embedded code.
Most students have used MATLAB and Simulink in earlier controls classes or other coursework, so they come up to speed quickly on the practical exercises.
In one exercise, the students use Model-Based Design to build a parking assist system. The system includes a proximity sensor, control software running on a Cypress programmable system on a chip (PSoC® 5, donated to Politecnico di Torino by the Cypress University Alliance), and an array of LEDs that light up when the proximity sensor approaches an obstacle.
The control software is developed entirely in Simulink and Stateflow using state charts and a truth table (Figure 1).
After simulating and verifying their designs, the students use Embedded Coder to generate code for the Cypress PSoC target. We then cover verification and validation, which provides a natural lead-in to a series of lectures on ISO 26262.
Working with ISO 26262, AUTOSAR, and Other Standards
Many automotive companies must adhere to ISO 26262, the functional safety standard for road vehicle software systems. Despite its prevalence in the industry, ISO 26262 is a new concept for the students, who have never had to follow rules governing how they design and build software. Over the course of several lectures, and with the support of my colleague Professor Maurizio Morisio, I provide an introduction to real-world safety standards, including ISO 26262, IEC 61508, and DO-178. Students learn that developing to these standards requires additional work, but that automation and available resources, such as qualification kits, can help reduce the effort required. For example, I introduce them to DO Qualification Kit (for DO-178) and IEC Certification Kit (for ISO 26262 and IEC 61508), and show how these products can streamline the certification process within Model-Based Design.
Like ISO 26262, the AUTOSAR architecture is a concept that is both new to and immediately useful for many students upon graduation. Students learn that with a layered structure, software functionality can be decoupled from the hardware used to implement it. They readily grasp that models enable them to capture and simulate the behavior of an AUTOSAR software component and to generate code for AUTOSAR environments.
Seminars by Industry Experts
Students sometimes view a topic covered in lecture as an academic exercise. When that topic is presented by a professional engineer, however, they can immediately see its practical relevance.
Throughout the course, speakers from various industries provide additional motivation and insights via in-class seminars on a variety of subjects. This year, speakers from two local automotive companies presented their experiences of applying Model-Based Design. These sessions were followed by a seminar on DO-178 presented by an avionics engineer. Our speaker on ISO 26262 discussed gap analysis—understanding what is needed to make an existing development process compliant with the functional safety standard—using the largest carmaker in Italy as a case study. Lastly, an embedded system designer who develops powertrain ECU software gave a presentation on MISRA® coding guidelines.
In addition to these industry experts, I received extensive support from MathWorks engineers in Italy, who demonstrated how MATLAB and Simulink enable Model-Based Design.
Advancing to Graduate Study
Several of the students who completed the course are now working on master’s theses on a range of topics involving Model-Based Design. Because Model-Based Design is the de facto industry standard in automotive, avionic, and industrial applications, the students often have the opportunity to work in cooperation with industry partners. Two students are working with a local automotive company on best practices for modeling control algorithms and for verification and validation. Two more are developing a control system for an industrial vehicle using Model-Based Design, and three others are working on an electric vehicle for a competition. Finally, two students are working on a master’s thesis to develop an open-source AUTOSAR stack that students who take the course next year will be able to use in the lab.
Next year’s course will include additional hands-on lab exercises, enabling students to see more of the systems they design and develop in Simulink running on embedded systems.
I would like to acknowledge the contribution of Iman Wali, one of my students, to the preparation of the images for this article.
Published 2012 - 92072v00