Vehicle software code generation method and system based on large model
Through the vehicle software code generation method based on a large model, the semantic features of the vehicle control demand text are analyzed, multimodal vectors are generated, and reference code information is determined, which solves the problem of difficult to meet the vehicle functional safety and real-time requirements in the prior art, and realizes high-quality software code generation.
Patent Information
- Application Number
- CN202510300395.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-14
- Publication Date
- 2025-06-27
AI Technical Summary
Existing vehicle software code generation tools are difficult to meet the needs of functional safety and real-time, and lack the joint optimization capabilities of multimodal constraints, resulting in poor code quality.
The vehicle software code generation method based on the big model is adopted. By obtaining the vehicle control requirements text, analyzing its functional safety semantic features and task cycle semantic features, querying the code knowledge base, generating multimodal vectors, determining reference code information, generating model prompts, and generating candidate codes through the big model, and determining the target code after final verification.
It improves the quality of software code, meets the functional safety and real-time requirements of the vehicle, and improves the efficiency of code generation.
Smart Images

Figure CN120215925A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and particularly to a method and system for generating vehicle software code based on a large model. Background Art
[0002] With the increasing complexity of vehicle electronic architectures, traditional code development models have problems such as long development cycles, insufficient safety verification, and low hardware adaptation efficiency.
[0003] Existing code generation tools are mostly based on rule libraries or simple templates, making it difficult to meet core requirements such as vehicle functional safety and real-time performance, and lacking the ability to jointly optimize multi-modal constraints, resulting in poor quality of vehicle software code. Summary of the Invention
[0004] The technical problem to be solved by this application is to provide a method and system for generating vehicle software code based on a large model, which can improve the quality of software code and meet vehicle requirements. The specific solutions are as follows:
[0005] A method for generating vehicle software code based on a large model, the method includes:
[0006] Obtain the control requirement text of the vehicle;
[0007] Parse the control requirement text to obtain the functional safety semantic features and task cycle semantic features of the control requirement text;
[0008] Query the vehicle code knowledge base according to the functional safety semantic features and task cycle semantic features to obtain a preliminary code screening result, and the preliminary code screening result includes multiple vehicle software code information;
[0009] Determine reference code information in each vehicle software code information of the preliminary code screening result according to the multi-modal vector corresponding to the control requirement text;
[0010] Generate a model prompt according to the control requirement text and the reference code information;
[0011] Input the model prompt into the vehicle software code large model to obtain candidate codes output by the vehicle software code large model;
[0012] If the candidate code passes the verification, determine the candidate code as the target code corresponding to the control requirement text.
[0013] In the above method, optionally, the determining reference code information in each vehicle software code information of the preliminary code screening result according to the multi-modal vector corresponding to the control requirement text includes:
[0014] Extract the timing keyword, safety level keyword, and hardware parameter keyword from the control requirement text;
[0015] Generate a multi-modal vector corresponding to the control requirement text according to the electronic architecture meta-model of the vehicle, the timing keyword, the safety level keyword, and the hardware parameter keyword; the multi-modal vector includes a timing constraint vector, a safety vector, and a hardware adaptation vector;
[0016] Determine the reference code information from each vehicle software code information in the initial code screening result according to the timing constraint vector, the safety vector, and the hardware adaptation vector.
[0017] For the above method, optionally, the determining the reference code information from each vehicle software code information in the initial code screening result according to the timing constraint vector, the safety vector, and the hardware adaptation vector includes:
[0018] Detect each vehicle software code information in the initial code screening result to obtain the detection result of each vehicle software code information, and the detection result includes a timing constraint detection result, a safety detection result, and a hardware adaptation detection result;
[0019] For each vehicle software code information, when the detection result of the vehicle software code information matches successfully with the timing constraint vector, the safety vector, and the hardware adaptation vector, determine the vehicle software code information as the reference code information.
[0020] For the above method, optionally, the generating a model prompt according to the control requirement text and the reference code information includes:
[0021] Obtain a preset model prompt template, and the model prompt template includes a safety constraint injection layer, a real-time guarantee layer, and a diagnosis integration layer;
[0022] Generate a model prompt according to the control requirement text, the reference code information, and the model prompt template.
[0023] For the above method, optionally, the process of verifying the candidate code includes:
[0024] Perform a timing logic test, an ECU hardware fault tolerance test, and a network security penetration test on the candidate code to obtain a test result;
[0025] When the test result indicates that the candidate code passes the test, determine that the candidate code is verified.
[0026] A vehicle software code generation system based on a large model includes:
[0027] An acquisition unit for acquiring the control requirement text of a vehicle;
[0028] An analysis unit for analyzing the control requirement text to obtain the functional safety semantic features and task cycle semantic features of the control requirement text;
[0029] A query unit for querying a vehicle code knowledge base according to the functional safety semantic features and task cycle semantic features to obtain a preliminary code screening result, where the preliminary code screening result includes multiple vehicle software code information;
[0030] A determination unit for determining reference code information from each vehicle software code information in the preliminary code screening result according to the multimodal vector corresponding to the control requirement text;
[0031] A generation unit for generating a model prompt according to the control requirement text and the reference code information;
[0032] A first execution unit for inputting the model prompt into a vehicle software code large model to obtain candidate codes output by the vehicle software code large model;
[0033] A second execution unit for, when the candidate codes pass the verification, determining the candidate codes as the target codes corresponding to the control requirement text.
[0034] For the above system, optionally, the determination unit includes:
[0035] An extraction subunit for extracting timing keyword, safety level keyword, and hardware parameter keyword from the control requirement text;
[0036] A first generation subunit for generating a multimodal vector corresponding to the control requirement text according to the electronic architecture meta-model of the vehicle, the timing keyword, the safety level keyword, and the hardware parameter keyword; the multimodal vector includes a timing constraint vector, a safety vector, and a hardware adaptation vector;
[0037] A determination subunit for determining reference code information from each vehicle software code information in the preliminary code screening result according to the timing constraint vector, the safety vector, and the hardware adaptation vector.
[0038] For the above system, optionally, the determination subunit includes:
[0039] A detection module for detecting each vehicle software code information in the preliminary code screening result to obtain a detection result for each vehicle software code information, where the detection result includes a timing constraint detection result, a safety detection result, and a hardware adaptation detection result;
[0040] A determination module, configured to determine, for each piece of the vehicle software code information, the vehicle software code information as reference code information when the detection result of the vehicle software code information matches successfully with the timing constraint vector, the safety vector, and the hardware adaptation vector.
[0041] For the above system, optionally, the generating unit includes:
[0042] An obtaining subunit, configured to obtain a preset model hint template, where the model hint template includes a safety constraint injection layer, a real-time guarantee layer, and a diagnosis integration layer;
[0043] A second generating subunit, configured to generate a model hint according to the control requirement text, the reference code information, and the model hint template.
[0044] For the above system, optionally, the second execution unit includes:
[0045] A testing subunit, configured to perform a timing logic test, a fault tolerance ability test for ECU hardware faults, and a network security penetration test on the candidate code to obtain a test result;
[0046] An execution subunit, configured to determine that the candidate code passes the verification when the test result indicates that the candidate code passes the test.
[0047] Based on the vehicle software code generation method and system based on a large model provided in the embodiments of the present application, a control requirement text of a vehicle can be obtained; the control requirement text is parsed to obtain the functional safety semantic feature and the task cycle semantic feature of the control requirement text; a vehicle code knowledge base is queried according to the functional safety semantic feature and the task cycle semantic feature to obtain a code pre-screening result, where the code pre-screening result includes multiple pieces of vehicle software code information; reference code information is determined from each piece of vehicle software code information in the code pre-screening result according to a multi-modal vector corresponding to the control requirement text; a model hint is generated according to the control requirement text and the reference code information; the model hint is input into a vehicle software code large model to obtain a candidate code output by the vehicle software code large model; and when the candidate code passes the verification, the candidate code is determined as the target code corresponding to the control requirement text. By applying the method provided in the embodiments of the present application, the efficiency of code generation can be improved, and the code requirements in different scenarios can be met. Description of the Drawings
[0048] To more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the accompanying drawings required for the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only the embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other accompanying drawings can also be obtained based on the provided drawings.
[0049] Figure 1 It is a flowchart of a method for generating vehicle software code based on a large model provided by the present application;
[0050] Figure 2 It is a flowchart of a process for determining reference code information provided by the present application;
[0051] Figure 3 It is a flowchart of a process for generating model prompts provided by the present application;
[0052] Figure 4 It is a schematic structural diagram of a vehicle software code generation system based on a large model provided by the present application. Detailed implementation manners
[0053] The following will clearly and completely describe the technical solutions in the embodiments of the present application with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments of the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the scope of protection of the present application.
[0054] In the present application, the term "including", "comprising" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed, or further includes elements inherent to such process, method, article or device. Without further limitations, the element defined by the statement "including one..." does not exclude the existence of another identical element in the process, method, article or device including the said element.
[0055] An embodiment of the present invention provides a method for generating vehicle software code based on a large model, which is applied to an electronic device. The flowchart of the method is as Figure 1 shown and specifically includes:
[0056] S101: Obtain the control requirement text of the vehicle.
[0057] In this embodiment, the control requirement text input by the user can be obtained.
[0058] Optionally, the control requirement text may include software function requirements, execution cycles, safety level information, operating environment, etc.
[0059] Optionally, the software function module may be various control systems of the vehicle, such as a braking system or a thermal management system, etc.
[0060] For example, the control requirement text may include "develop the main control algorithm for battery thermal management, requirements: ASIL-C safety level; execute in a 10ms cycle; support temperature sensor fault diagnosis; run in the S32K344 chip environment".
[0061] S102: Parse the control requirement text to obtain the functional safety semantic features and task cycle semantic features of the control requirement text.
[0062] In this embodiment, a machine learning model may be used to parse the control requirement text to identify the functional safety semantic features and task cycle semantic features in the control requirement text.
[0063] Optionally, a domain pre-training model based on Transformer is used to perform lexical analysis and dependency parsing on the input text, combined with a domain knowledge graph constructed by a preset standard term library and AUTOSAR meta-model, and functional safety key elements (such as ASIL level, fault tolerance mechanism) and real-time constraint features (such as task cycle, deadline) are identified through a multi-level attention mechanism.
[0064] For the functional safety semantic features, safety standard keywords (such as "single point of failure", "diagnostic coverage") are matched through regular expressions, and the logical relevance of safety elements in the text is analyzed using a graph neural network, and finally mapped to safety semantic features including safety mechanism requirements (such as dual-core lockstep, ECC check).
[0065] For the task cycle features, explicit time parameters (such as "10ms cycle") are extracted through a temporal logic parser, combined with the AUTOSAR temporal extension model to implicitly deduce context-related temporal constraints (such as task chain delay limit), and finally a temporal feature matrix including dimensions such as worst-case execution time tolerance and jitter range is generated, that is, real-time constraint features.
[0066] In some embodiments, the functional safety semantic features and task cycle semantic features may also be connected to the vehicle's failure mode and effects analysis database for semantic verification, so that the parsing result meets the historical failure mode protection requirements, and the feature extraction accuracy is optimized through a dynamic weight adjustment mechanism (such as when the text appears "emergency braking", automatically increasing the detection sensitivity of the deadline violation risk in the temporal features).
[0067] S103: Query the vehicle code knowledge base according to the functional safety semantic features and task cycle semantic features to obtain a preliminary code screening result, where the preliminary code screening result includes multiple vehicle software code information.
[0068] In this embodiment, the functional safety semantic features and task cycle semantics can be mapped to the vehicle code knowledge base, and optimized screening can be performed through a hierarchical retrieval strategy. The specific process is as follows:
[0069] In the first layer, Boolean filtering based on Elasticsearch (such as setting the ASIL level not lower than C and the task cycle not exceeding 10 milliseconds) is used to quickly narrow down the candidate range and obtain a candidate result set; in the second layer, vector similarity calculation (such as using cosine similarity to compare the task cycle feature vector with the WCET analysis data of the code) is performed, and weighted scoring is combined with the metadata of the code segments of the vehicle software code in the candidate result set (such as AUTOSAR component type, MISRA compliance label); in the third layer, a static analysis tool (such as Polyspace) is used to perform real-time compliance checks on the candidate vehicle software code information in the candidate result set, and codes containing vehicle specification-disabled modes such as dynamic memory allocation and non-atomic operations are eliminated. Finally, a preliminary code screening result is generated based on the comprehensive matching degree (safety weight 40% + real-time weight 30% + hardware adaptation weight 30%).
[0070] Optionally, after obtaining the preliminary code screening result, the historical verification data of each code can be associated and displayed, including the HIL test pass rate and the number of FMEA-related defects.
[0071] S104: Determine the reference code information among the various vehicle software code information in the preliminary code screening result according to the multi-modal vector corresponding to the control requirement text.
[0072] In this embodiment, the multi-modal vector corresponding to the control requirement text may include a timing constraint vector, a safety vector, and a hardware adaptation vector.
[0073] Optionally, the reference code information can be determined based on the matching degree between each vehicle software code information and the multi-modal vector.
[0074] S105: Generate a model prompt according to the control requirement text and the reference code information.
[0075] In this embodiment, a model prompt can be generated according to the model prompt template, the control requirement text, and the reference code information. The model prompt is used to instruct the large model to generate candidate codes.
[0076] S106: Input the model prompt into the vehicle software code large model to obtain the candidate codes output by the vehicle software code large model.
[0077] S107: In the case where the candidate code passes the verification, determine the candidate code as the target code corresponding to the control requirement text.
[0078] In this embodiment, the process of verifying the candidate code includes:
[0079] Conduct a timing logic test, a fault tolerance ability test for ECU hardware faults, and a network security penetration test on the candidate code to obtain test results;
[0080] In the case where the test results indicate that the candidate code passes the test, determine that the candidate code passes the verification.
[0081] In this embodiment, a model checking tool (such as NuSMV) can be used to verify whether the timing logic specification is met to complete the timing logic test, and a fault injection test can be performed on a hardware-in-the-loop (HIL) test bench to complete the fault tolerance ability test for ECU hardware faults; a network security penetration test is performed based on a set standard to obtain test results.
[0082] Applying the method provided in the embodiments of the present application can improve the efficiency of code generation and meet the code requirements in different scenarios.
[0083] In an embodiment provided by the present application, based on the above solution, optionally, the process of determining the reference code information from each vehicle software code information in the code pre-screening result according to the multi-modal vector corresponding to the control requirement text is as Figure 2 shown and includes:
[0084] S201: Extract the timing keyword, security level keyword, and hardware parameter keyword from the control requirement text.
[0085] S202: Generate a multi-modal vector corresponding to the control requirement text according to the electronic architecture meta-model of the vehicle, the timing keyword, the security level keyword, and the hardware parameter keyword; the multi-modal vector includes a timing constraint vector, a security vector, and a hardware adaptation vector;
[0086] In this embodiment, the timing constraint vector can represent the ECU task scheduling period and deadline requirements.
[0087] Optionally, the security vector can represent the fault tolerance requirements.
[0088] Optionally, the hardware adaptation vector can characterize the computing resources and communication width limitations of the target ECU.
[0089] S203: Determine reference code information from each vehicle software code information in the initial code screening result according to the timing constraint vector, the security vector, and the hardware adaptation vector.
[0090] In this embodiment, the time matching degree between the timing constraint vector and each vehicle software code information in the initial code screening result can be calculated, the security matching degree between the security vector and each vehicle software code information in the initial code screening result can be calculated, and the hardware matching degree between the hardware adaptation vector and each vehicle software code information in the initial code screening result can be calculated. Then, for each vehicle software code information, a weighted sum can be performed according to the time matching degree, the security matching degree, and the hardware matching degree of the vehicle software code information to obtain the comprehensive score of the vehicle software code information. Finally, at least one reference code information can be selected in the order of the comprehensive scores of the vehicle software code information from large to small, or the vehicle software code information with a comprehensive score greater than the score threshold can be determined as the reference code information.
[0091] In this embodiment, the calculation methods of the time matching degree, the security matching degree, and the hardware matching degree can be different. For example, the time matching degree between the timing constraint vector and each vehicle software code information in the initial code screening result can be calculated by using a normalization method; the security matching degree between the security vector and each vehicle software code information in the initial code screening result can be calculated by using a Hamming distance algorithm; the hardware matching degree between the hardware adaptation vector and each vehicle software code information in the initial code screening result can be calculated by using a Manhattan distance algorithm.
[0092] Optionally, the weights corresponding to the time matching degree, the security matching degree, and the hardware matching degree can be determined based on the application mode.
[0093] For example, in the security-dominated mode, the weight of the time matching degree is set to 0.2, the weight of the security matching is set to 0.6, and the weight of the hardware matching degree is set to 0.2. In the real-time priority mode, the weight of the time matching degree is set to 0.5, the weight of the security matching is set to 0.3, and the weight of the hardware matching degree is set to 0.2. In the resource-sensitive mode, the weight of the time matching degree is set to 0.2, the weight of the security matching is set to 0.3, and the weight of the hardware matching degree is set to 0.5.
[0094] In an embodiment provided by the present application, based on the above solution, optionally, the determining reference code information from each vehicle software code information in the initial code screening result according to the timing constraint vector, the security vector, and the hardware adaptation vector includes:
[0095] Detect each vehicle software code information in the initial code screening result to obtain the detection result of each vehicle software code information, where the detection result includes a timing constraint detection result, a security detection result, and a hardware adaptation detection result;
[0096] For each of the vehicle software code information, when the detection result of the vehicle software code information matches successfully with the timing constraint vector, the safety vector, and the hardware adaptation vector, the vehicle software code information is determined as the reference code information.
[0097] In this embodiment, a static timing analysis tool (such as aiT) can be used to parse the code control flow graph, calculate the worst-case execution time and task chain delay of each vehicle software code information, and obtain the timing constraint detection result. The worst-case execution time in each timing constraint detection result is normalized according to the timing constraint vector to obtain the matching degree between the timing constraint vector and each vehicle software code information.
[0098] In this embodiment, the vehicle software code information can be scanned by a rule checker to obtain the safety detection result, determine the Hamming distance between the safety detection result of each vehicle software code information and the safety vector, and obtain the matching degree between the safety vector and each vehicle software code information.
[0099] In this embodiment, a MAP file of each vehicle software code information can be generated through a compiler tool chain, the MAP file can be extracted to obtain memory metrics, and a peripheral interface feature matrix can be established to obtain the hardware adaptation detection result. According to the Manhattan distance between the hardware adaptation detection result of each vehicle software code information and the safety vector, the matching degree between each vehicle software code information and the safety vector is determined.
[0100] For each vehicle software code information, the time matching degree, safety matching degree, and hardware matching degree of the vehicle software code information can be weighted and summed to obtain the comprehensive score of the vehicle software code information. If the comprehensive score is greater than the score threshold, the vehicle software code information is determined as the reference code information.
[0101] In an embodiment provided by the present application, based on the above solution, optionally, the process of generating a model prompt according to the control requirement text and the reference code information, as Figure 3 shown, includes:
[0102] S301: Obtain a preset model prompt template, where the model prompt template includes a safety constraint injection layer, a real-time guarantee layer, and a diagnosis integration layer.
[0103] In this embodiment, the safety constraint injection layer can be used to automatically insert memory protection instructions and watchdog mechanisms, the real-time guarantee layer can be used to generate task priority annotations according to the ECU operating system. The diagnosis integration layer can be used to embed a diagnostic service code framework that conforms to the UDS protocol.
[0104] S302: Generate a model prompt according to the control requirement text, the reference code information, and the model prompt template.
[0105] In this embodiment, the control requirement text can be parsed first to extract multimodal semantic features such as functional safety (ASIL level, safety mechanism) and real-time performance (task cycle, WCET threshold); candidate codes are initially screened from the code library based on the similarity of feature vectors, and a structured prompt template including a safety constraint injection layer, a real-time performance guarantee layer, and a diagnostic integration layer is constructed in combination with the diagnostic integration requirements (fault detection, recovery mechanism); the output of the large model is constrained by injecting the optimization strategy of the reference code (such as dual-core lockstep implementation, interrupt latency optimization).
[0106] See Figure 4 , which is a schematic structural diagram of a vehicle software code generation method and system based on a large model provided by an embodiment of the present application. The system includes:
[0107] An acquisition unit 401, configured to acquire the control requirement text of the vehicle;
[0108] An analysis unit 402, configured to analyze the control requirement text to obtain the functional safety semantic feature and the task cycle semantic feature of the control requirement text;
[0109] A query unit 403, configured to query the vehicle code knowledge base according to the functional safety semantic feature and the task cycle semantic feature to obtain a preliminary code screening result, where the preliminary code screening result includes multiple pieces of vehicle software code information;
[0110] A determination unit 404, configured to determine reference code information in each piece of vehicle software code information in the preliminary code screening result according to the multimodal vector corresponding to the control requirement text;
[0111] A generation unit 405, configured to generate a model prompt according to the control requirement text and the reference code information;
[0112] A first execution unit 406, configured to input the model prompt into the vehicle software code large model to obtain candidate codes output by the vehicle software code large model;
[0113] A second execution unit 407, configured to determine the candidate code as the target code corresponding to the control requirement text when the candidate code passes the verification.
[0114] In an embodiment provided by the present application, based on the above solution, optionally, the determination unit 404 includes:
[0115] An extraction subunit, configured to extract the timing keyword, the safety level keyword, and the hardware parameter keyword in the control requirement text;
[0116] A first generation subunit, configured to generate a multi-modal vector corresponding to the control requirement text according to the electronic architecture meta-model of the vehicle, the timing keyword, the safety level keyword, and the hardware parameter keyword; the multi-modal vector includes a timing constraint vector, a safety vector, and a hardware adaptation vector.
[0117] A determination subunit, configured to determine reference code information from each vehicle software code information in the initial code screening result according to the timing constraint vector, the safety vector, and the hardware adaptation vector.
[0118] In an embodiment provided by the present application, based on the above solution, optionally, the determination subunit includes:
[0119] A detection module, configured to detect each vehicle software code information in the initial code screening result to obtain a detection result of each vehicle software code information, where the detection result includes a timing constraint detection result, a safety detection result, and a hardware adaptation detection result;
[0120] A determination module, configured to determine the vehicle software code information as reference code information when the detection result of the vehicle software code information matches the timing constraint vector, the safety vector, and the hardware adaptation vector.
[0121] In an embodiment provided by the present application, based on the above solution, optionally, the generation unit 405 includes:
[0122] An acquisition subunit, configured to acquire a preset model prompt template, where the model prompt template includes a safety constraint injection layer, a real-time guarantee layer, and a diagnostic integration layer;
[0123] A second generation subunit, configured to generate a model prompt according to the control requirement text, the reference code information, and the model prompt template.
[0124] In an embodiment provided by the present application, based on the above solution, optionally, the second execution unit 407 includes:
[0125] A test subunit, configured to perform a timing logic test, a fault tolerance test for ECU hardware failures, and a network security penetration test on the candidate code to obtain a test result;
[0126] An execution subunit, configured to determine that the candidate code passes the verification when the test result indicates that the candidate code passes the test.
[0127] It should be noted that the embodiments in this specification are all described in a progressive manner. Each embodiment focuses on the differences from other embodiments. For the same or similar parts among the embodiments, reference can be made to each other.
[0128] Finally, it should also be noted that in this article, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations.
[0129] For the convenience of description, when describing the above system, it is divided into various units according to functions for separate description. Of course, when implementing the present application, the functions of each unit can be realized in the same or multiple software and / or hardware.
[0130] From the description of the above embodiments, those skilled in the art can clearly understand that the present application can be implemented by means of software plus a necessary general hardware platform. Based on such an understanding, the technical solution of the present application, in essence, or the part that makes a contribution to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a storage medium, such as ROM / RAM, magnetic disk, optical disc, etc., and includes several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in various embodiments or some parts of the embodiments of the present application.
[0131] The above has introduced in detail a method for generating vehicle software code based on a large model provided by the present application. Specific examples are used in this article to elaborate on the principle and implementation manner of the present application. The description of the above embodiments is only used to help understand the method and its core idea of the present application; at the same time, for those of ordinary skill in the art, according to the idea of the present application, there will be changes in the specific implementation manner and application scope. In summary, the content of this specification should not be construed as a limitation to the present application.
Claims
1. A vehicle software code generation method based on a large model, characterized in that: include: Obtain the vehicle's control requirement text; Parsing the control requirement text to obtain functional safety semantic features and task cycle semantic features of the control requirement text; Querying a vehicle code knowledge base according to the functional safety semantic features and the task cycle semantic features to obtain a code preliminary screening result, wherein the code preliminary screening result includes a plurality of vehicle software code information; Determining reference code information in each vehicle software code information of the code preliminary screening result according to the multimodal vector corresponding to the control requirement text; Generate a model prompt according to the control requirement text and the reference code information; Inputting the model prompt into a vehicle software code big model to obtain a candidate code output by the vehicle software code big model; When the candidate code is verified to be successful, the candidate code is determined as the target code corresponding to the control requirement text.
2. The method according to claim 1, characterized in that: Determining reference code information in each vehicle software code information of the code preliminary screening result according to the multimodal vector corresponding to the control requirement text includes: Extracting timing keywords, security level keywords and hardware parameter keywords from the control requirement text; Generate a multimodal vector corresponding to the control requirement text according to the electronic architecture metamodel of the vehicle, the timing keyword, the safety level keyword and the hardware parameter keyword; the multimodal vector includes a timing constraint vector, a safety vector and a hardware adaptation vector; According to the timing constraint vector, the safety vector and the hardware adaptation vector, reference code information is determined in each vehicle software code information of the code preliminary screening result.
3. The method according to claim 2, characterized in that The determining of reference code information in each vehicle software code information of the code preliminary screening result according to the timing constraint vector, the safety vector and the hardware adaptation vector includes: Detecting each vehicle software code information in the code preliminary screening result to obtain a detection result of each vehicle software code information, wherein the detection result includes a timing constraint detection result, a safety detection result, and a hardware adaptation detection result; For each of the vehicle software code information, when the detection result of the vehicle software code information successfully matches the timing constraint vector, the security vector and the hardware adaptation vector, the vehicle software code information is determined as reference code information.
4. The method according to claim 1, characterized in that The generating a model prompt according to the control requirement text and the reference code information includes: Obtaining a preset model prompt template, wherein the model prompt template includes a safety constraint injection layer, a real-time assurance layer, and a diagnosis integration layer; A model prompt is generated according to the control requirement text, the reference code information and the model prompt template.
5. The method according to claim 1, characterized in that The process of verifying the candidate code includes: Performing a sequential logic test, an ECU hardware fault tolerance test, and a network security penetration test on the candidate code to obtain test results; When the test result indicates that the candidate code has passed the test, it is determined that the candidate code has passed the verification.
6. A vehicle software code generation system based on a large model, characterized in that: include: An acquisition unit, used for acquiring a control requirement text of a vehicle; A parsing unit, used to parse the control requirement text to obtain functional safety semantic features and task cycle semantic features of the control requirement text; A query unit, configured to query a vehicle code knowledge base according to the functional safety semantic features and the task cycle semantic features to obtain a code preliminary screening result, wherein the code preliminary screening result includes a plurality of vehicle software code information; A determination unit, configured to determine reference code information in each vehicle software code information of the code preliminary screening result according to the multimodal vector corresponding to the control requirement text; A generating unit, configured to generate a model prompt according to the control requirement text and the reference code information; A first execution unit, configured to input the model prompt into a vehicle software code large model, and obtain a candidate code output by the vehicle software code large model; The second execution unit is used to determine the candidate code as the target code corresponding to the control requirement text when the candidate code is verified.
7. The system according to claim 6, characterized in that The determining unit comprises: An extraction subunit, used to extract timing keywords, security level keywords and hardware parameter keywords from the control requirement text; A first generating subunit, configured to generate a multimodal vector corresponding to the control requirement text according to the electronic architecture metamodel of the vehicle, the timing keyword, the safety level keyword, and the hardware parameter keyword; the multimodal vector includes a timing constraint vector, a safety vector, and a hardware adaptation vector; A determination subunit is used to determine reference code information in each vehicle software code information of the code preliminary screening result according to the timing constraint vector, the safety vector and the hardware adaptation vector.
8. The system according to claim 7, characterized in that The determining subunit comprises: A detection module, used to detect each vehicle software code information in the code preliminary screening result, and obtain a detection result of each vehicle software code information, wherein the detection result includes a timing constraint detection result, a safety detection result, and a hardware adaptation detection result; A determination module is used to determine the reference code information of each vehicle software code information when the detection result of the vehicle software code information successfully matches the timing constraint vector, the safety vector and the hardware adaptation vector.
9. The system according to claim 6, characterized in that The generating unit comprises: An acquisition subunit is used to acquire a preset model prompt template, wherein the model prompt template includes a safety constraint injection layer, a real-time assurance layer, and a diagnosis integration layer; The second generating subunit is used to generate a model prompt according to the control requirement text, the reference code information and the model prompt template.
10. The system according to claim 6, characterized in that The second execution unit includes: A test subunit, used to perform a sequential logic test, a fault tolerance test of ECU hardware failure, and a network security penetration test on the candidate code to obtain a test result; The execution subunit is used to determine that the candidate code has passed the verification if the test result indicates that the candidate code has passed the test.
Citation Information
Cited By
Heating ventilation and air conditioning system control code automatic generation method based on large language model
CN121277068A
Vehicle-mounted component generation and deployment system and method based on multi-stage assembly line
CN122331926A
Vehicle component generation deployment system and method based on multi-stage pipeline
CN122331926B