Placeholder-Based Program Code Generation for AUTOSAR Flexibility
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing methods for generating program code for control systems lack flexibility in supporting different types of communication, particularly under the AUTOSAR framework, leading to inefficiencies in incremental code generation and reuse across various projects.
Innovation Solution
The method introduces three placeholders - a first placeholder representing a variable, a second placeholder before its use, and a third placeholder after its use - to enable flexible code generation, allowing for distinct phases of data object access and avoiding the need for complete code regeneration when adapting to different communication types.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Productivity
If program code is generated directly from graphical models using a program code generator, then code generation efficiency is improved, but flexibility in supporting different types of communication is lost
Solution Approach 1:
The patent segments the code generation process into multiple phases by introducing three distinct placeholders (first placeholder for variable representation, second placeholder for pre-use setup, third placeholder for post-use cleanup). This segmentation allows the code to be generated incrementally and adapted for different communication types without complete regeneration, thus improving both efficiency and flexibility.
Solution Approach 2:
The patent applies preliminary action by generating the first placeholder that represents a variable in advance during incremental code generation. This placeholder can later be replaced or configured for different communication types (such as AUTOSAR communication), allowing the code structure to be prepared beforehand while maintaining adaptability for various communication protocols.
2Productivity
If incremental code generation is used to improve efficiency, then code reuse is improved, but the ability to adapt to different communication types is worsened
Solution Approach 1:
The patent enables parameter changes by designing the placeholder system to be configurable. The first placeholder representing a variable can be replaced with different implementations depending on the communication type required (e.g., different AUTOSAR communication mechanisms). This allows incremental code generation to produce adaptable code that can be configured for various communication protocols without requiring complete code regeneration.
3Adaptability or versatility
If complete code regeneration is performed to adapt to different communication types, then adaptability is improved, but code generation time and testing requirements increase
Solution Approach 1:
The patent extracts the communication-type-specific code portions into replaceable placeholders. Instead of regenerating the entire codebase when adapting to different communication types, only the specific placeholder instances need to be replaced or configured. This extraction approach significantly reduces both code generation time and testing requirements while maintaining full adaptability to different communication protocols.
Data Source
Figure 1~2
Figure 3~4
Figure 5
AI summary
The invention relates to a computer-implemented method for generating program code (1), comprising generating (S1) a first placeholder (P1) representing a variable, which is used in a predetermined section (10) of the program code (1), generating (S2) a second placeholder (P2), which is placed before the beginning of the predetermined section (10) of the program code (1) that uses the first placeholder (P1), and generating (S3) a third placeholder (P3), which is placed after the end of the predetermined section (10) of the program code (1) that uses the first placeholder (P1). The invention further relates to a method for configuring a control unit. The present invention also relates to a computer program, a computer-readable data carrier, and a computer system.