Why the Transition from Code Based Development to Model Based Development is a Necessary Paradigm Shift in Automotive
Model-based development or design is a software development methodology that is focussed on creating mathematical models to represent the behaviour of a system. These models in turn generate code for the system. This approach is becoming increasingly popular in the automotive industry for the development of software for vehicles as it reduces time-to-market and ensures early detection of errors.
The need to shift to Model Based Development primarily stems from the inherent complexity that manual coding process brings about during the development.
And when we say complexity, it is not just the size of the code. The direct usage of the code also makes it quite difficult to maintain the function structure of the overall system software.
In manual coding, the software developer is more focused on the code rather than the function. Furthermore, large code bases are also very difficult to port to other microcontrollers, if need for hardware platform migration arises.
Electronics has been the major differentiator among the automotive OEMs across the globe, but it has also made the software codes very complex.
Here’s a little food for thought!
“A car with basic control units has approximately 20 Million Source Line of Codes (SLOC). It can go up to 100 million if you include advanced features like ADAS and infotainment etc.”
Imagine the time and effort that would be required if all of the code had to be written and maintained manually. Add to it the fatigue of the developers and chances of errors in the codes.
This is the just the tip of the iceberg. We will discuss more about the need for Model based development in the subsequent sections.
Delivering Futuristic Automotive Products at Reduced Time-to-Market and Costs is the Secret Sauce for Success
In the fierce race of capturing automotive market, OEMs frequently introduce new features for enhanced comfort, safety and luxury of the end-users.
The quest is to become the first to introduce a feature so that they can ‘cash in’ the new features before others get them too.
Developing these unique features however, requires designing of complex algorithms, rigorous testing and verifications. If not done efficiently, this obviously leads to increased cost and time-to-market.
Hence, the biggest challenge before software engineers while working on these complex systems is to shorten development cycles and reduce development & testing time.
With the conventional way of software development, achieving this challenge is something like expecting to stop an angry INCREDIBLE HULK by mere hands.
On a serious note, the coding methods really need a paradigm shift. And this shift is from code based development to model-driven development or model based development (MBD) methodology.
A model-based approach shifts the emphasis on the function based rather than code-based automotive software development.
This allows the software developers and the testers to find maximum possible errors in early phases of product design and development. Whereas in conventional coding, the errors are found in testing phase, when it is ideally very late and costly to go back & make necessary corrections.
What Difference does Model Based Design Approach Bring In?
To understand the difference, we will first try to briefly explain how model based approach works.
Model based development is based on V-shaped model of Software Development Lifecycle (SDLC).
The first step is usually the requirement gathering/analysis where maximum possible design issues are identified during h/w and s/w requirement analysis by introducing requirement maturation phase.
Then comes the model development, the process that sets this approach apart from manual C language coding.
MBD techniques allows user to autogenerate code from the model without any hassle.The most important point here is that testing is performed at every step. This iterative approach ensures that the bugs are identified and resolved before moving on to the next step.
We will dig a little deeper now!
Once the initial segment of code has been shown to work successfully, the process can be extended to a system-level simulation by incorporating the code into the rest of the application.
With a system-level simulation, it is possible to perform system integration virtually and get an early perspective of how the hardware and embedded software will behave.
This is especially valuable if the hardware is still in development phase and it is expensive to create prototypes.
Once the initial model-based development trial is successfully completed, the models can be extended to other areas of the project.
Even without a full-scale model of the environment or algorithm, simulation allows tests to be conducted under various extreme operating conditions.
Based on these tests, basic parameters can be derived for inclusion into the hardware design activity. Moreover, these models can be stored for later use to solve different design problems in future development projects.
The block diagram shows the model based approach in action:
Diagram depicting the stages in model based development paradigm
The Model Based Design Approach and its Striking Benefits
There are certain advantages associated with model-based development approach when pitted against manual coding.
- Efficiency in development: MBD enables the engineers to develop automotive software faster and more in a more efficient manner. It does so by automating the process of generating code from models, which reduces the time and resources required for manual coding.
- Enhanced Quality: MBD enables the use of formal verification and validation techniques to ensure that the generated code is correct and meets the desired requirements. This can result in higher-quality software that is less prone to errors and has fewer bugs. On the other hand, manual coding can lead to errors and bugs if not done correctly.
- Code Reuse and Standardization: While following the MBD approach, the models and model components can be reused. This leads to more consistent and standardized software development across different vehicle platforms and variants. Such advantage is missing in manual coding methodology.
- Flexibility: Change management is a huge task and sometimes an overhead in the development of automotive solution. MBD allows for more flexibility in the design process, as changes to the model can be made easily and the code can be regenerated automatically.
- Traceability: Traceability is a ubiquitous concept followed very strictly in almost all automotive development standards and process models such as ISO 26262, cybersecurity and ASPICE. Model based design approach gives traceability the importance that it deserves. As the models used to generate the code can be traced back to the original requirements, it is easier to understand how the software was developed and how it behaves.
Most importantly, the MBD workflow saves time and money, while improving the reliability and adaptability of the end product.
This enables organizations to introduce new features in a shorter period of time without compromising on the quality.
With Model based development:
- High-quality code can be created without manual coding
- The code can be created that matches the behavior of the model
- A model can be simulated to weed out the bugs in the algorithm
- Rapid control prototyping can be done skipping the software-in-loop (SIL) and hardware in loop (HIL) testing
- Apart from model development, using MATLAB and Simulink tools, memory optimization is also taken care of
Model-based design facilitates effective testing of the functionality, identification of defects, and verification of software performance despite constrained development schedules and budgets.
This is only possible because all external interactions and internal operations of an embedded system are represented using a model in this method of product development.
Model-Based Design allows you to improve efficiency by:
- Using a common design environment across project teams
- Linking designs directly to the requirements
- Integrating testing with design to continuously identify and correct errors
- Refining algorithms through multi-domain simulation
- Automated generation of embedded software code
- Development and reuse of test suites
- Generation of documentation
- Reuse of designs to deploy systems across multiple processors and hardware targets
Did You Know?
Software bugs cost a lot (e.g. 1200$ per line of code due to recall of cars after an unintended acceleration problem)
A model-based approach (model + code-generation) is 30% faster and has 50% less errors than manual code written by a top programmer.
Downsides of MBD
Model Based Development also comes with its own costs. Training of the engineering team on process & tools incur high cost.
However, over the long run, such costs nullify the delay and overheads that may occur using conventional approach.
Model-based development of complex systems in the automotive domain is being widely adopted by the main players in the automotive industry.
As of now 16% of the SLOC (no. of lines of codes) in a car are generated from models. This number is showing rapid increase as OEMs are racing against one another to introduce new features.
In the blog, we have tried to give you a high-level overview of model based development of automotive software. In the coming blogs, we will explore the inner workings of MBD in finer details. Keep reading!