Integrated Simulation and Production Code Generation for Early Control Testing
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing model-based development and testing methods for control programs in the automotive sector, such as those used in ECUs, fail to adequately simulate interactions with external components and cover hardware-dependent effects early in the development process, leading to incomplete testing and potential side effects from parallel execution.
Innovation Solution
Assigning simulation code blocks to model elements, allowing for the generation of both production and simulation code from a single model run, with simulation code being separable from production code using preprocessor instructions, enabling early and comprehensive testing of control programs interacting with external software and hardware components.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If production code is generated directly from the model without simulation code blocks, then the code generation process is simple and fast, but early testing with external components is not possible and hardware-dependent effects cannot be simulated
Solution Approach 1:
The code generation process is segmented into simulation code blocks and production code blocks based on model element attributes. This allows the generated code to be divided into testable simulation portions and final production portions, enabling early testing while maintaining a structured generation process
Solution Approach 2:
The code generator is designed to perform multiple functions: it can generate both simulation code and production code from the same model, and it can selectively include or exclude simulation code blocks based on preprocessor instructions. This multi-functionality enables early testing without requiring separate generation processes
2Reliability
If simulation code blocks are integrated into the model for early testing, then comprehensive testing with external components becomes possible, but the generated source code becomes more complex and requires separation mechanisms
Solution Approach 1:
Simulation code blocks are extracted from the production code using preprocessor instructions during code generation. This extraction mechanism allows simulation code to be separated from production code in the generated source code, enabling comprehensive testing while keeping the final production code clean and free of simulation artifacts
Solution Approach 2:
Preprocessor instructions serve as an intermediary mechanism between simulation code blocks and production code. These instructions control the inclusion or exclusion of simulation code during compilation, acting as a mediator that manages the complexity of having both simulation and production code in the same source file
3Reliability
If external components are simulated using stubs, then early testing of interactions becomes possible, but the model requires additional configuration and simulation-specific blocks
Solution Approach 1:
Stub functions for external components are prepared and integrated into the model during the modeling phase, before actual external components are available. This preliminary action enables early testing of interactions and hardware-dependent effects without requiring the actual external components to be present
Data Source
Figure 1
Figure 2
Figure 3A~3B
AI summary
According to the invention, simulation code and production code are generated as source code from a model. The model comprises one or more blocks that specify the desired behavior of a program, in particular a control program. At least one of the blocks is marked with a simulation code attribute. Simulation code is generated for those blocks that include a simulation code attribute. Production code is generated for all other blocks. The generated source code comprises both simulation code components and production code components. The simulation code components are contained within the source code in a way that allows them to be separated from the production code components.