Julia function library fused with multiple programming languages and construction method of Julia function library
By designing a Julia function library that integrates multi-programming languages, the development complexity problem caused by tool and language heterogeneity in the AUTOSAR project is solved, cross-language integration and high-performance visualization operations are realized, and development efficiency and system scalability are improved. Promoted the construction of the AUTOSAR ecosystem.
Patent Information
- Application Number
- CN202411403266.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-09
- Publication Date
- 2025-01-03
AI Technical Summary
In the AUTOSAR project, traditional development methods are highly complex in development due to the heterogeneity of tools and languages, and lack a unified framework to coordinate and manage interactions at all levels, which is particularly prominent in the face of rapid updates.
A Julia function library that integrates multi-programming languages is designed, including data layer, business logic layer and interface layer. Through Python module, C++ module and third-party tool module, it realizes seamless integration and high-performance visualization operations across languages, providing A unified development framework.
It simplifies the complexity of cross-language integration, improves system flexibility and functionality, improves development efficiency and scalability, adapts to future functional expansion and technology upgrades, and promotes the construction and standard promotion of the AUTOSAR ecosystem.
Smart Images

Figure CN119248236A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a Julia function library integrating multiple programming languages and a construction method thereof, and belongs to the technical field of computer software. Background Art
[0002] In the development of modern automotive electronic systems, AUTOSAR (Automotive Open System Architecture), as a globally standardized automotive electronic software architecture, is widely used in the automotive manufacturing industry. With the increasing complexity of automotive electronic systems, developers are faced with huge challenges of cross-language and multi-tool integration. In the development process of AUTOSAR, it is usually necessary to process a large number of model files, ARXML files, and XML configuration files, which involve different programming languages and tool chains, and therefore often require complex data conversion and interface integration.
[0003] Traditional development methods usually rely on a variety of different programming languages and tools to complete these tasks and ultimately integrate the modules together. However, due to the heterogeneity of these tools and languages, developers have to write a lot of bridging code to achieve communication and data transfer between languages, which increases the complexity of development. In addition, traditional methods lack a unified framework to coordinate and manage the interactions between various layers, which is particularly prominent when facing the rapid update and evolution of the AUTOSAR standard. Summary of the invention
[0004] To solve the problems existing in the background technology, the present invention provides a Julia function library integrating multiple programming languages and a construction method thereof.
[0005] To achieve the above purpose, the present invention adopts the following technical solution: a Julia function library integrating multiple programming languages, including
[0006] Data layer: Located at the bottom layer, it contains the XML configuration files, ARXML files, and Modelica model files of the AUTOSAR project. It is responsible for providing support for file data and is the basis of the entire Julia function library.
[0007] Business logic layer: located in the middle layer, including Python modules, C++ modules and third-party tool modules, responsible for processing and executing the business logic of the Julia function library;
[0008] Interface layer: Located at the top layer, it provides users with a unified Julia function operation interface by calling the Python module and C++ module of the business logic layer to support scientific computing tasks;
[0009] The data layer, business logic layer and interface layer are modularly decoupled.
[0010] The XML configuration file is used to describe and configure the software architecture of the AUTOSAR project.
[0011] The Modelica model file is responsible for expressing the interaction relationship between the demand port, supply port, runnable entity, variables between runnable entities, state variables and model elements in the AUTOSAR project; the demand port has a sampling time parameter, and the variables between runnable entities have a source sampling time parameter and a target sampling time parameter.
[0012] The Python module is provided in the form of source code, and is responsible for the operation of the data layer files, and generates the intermediate results of the Modelica model solution by calling the third-party tool module and stores them on the computer; the operation of the data layer files includes adding, deleting, modifying, and checking the model elements of the AUTOSAR project in the ARXML file, XML configuration file and Modelica model file, as well as the conversion operations between the files.
[0013] The C++ module provides a visual display and visual operation interface based on the Qt framework, supports the creation and management of various graphical components, and provides an API calling interface for other programming languages to call, so as to realize cross-language GUI integration.
[0014] The third-party tool module includes a Modelica open source tool that is modified and packaged into an exe executable file to support the processing of Modelica model files.
[0015] A method for constructing a Julia function library integrating multiple programming languages of the present invention comprises the following steps:
[0016] S1: Design the layered architecture of the Julia function library, which consists of the data layer, business logic layer, and interface layer from bottom to top;
[0017] S2: implements the data layer of the Julia library;
[0018] S201: Build ARXML files according to the standard specifications of the AUTOSAR project;
[0019] S202: Build the corresponding XML configuration file structure and XSD schema definition document;
[0020] S203: Build a Modelica model file for expressing internal behavior information of the AUTOSAR project model.
[0021] S3: implements the business logic layer of the Julia function library;
[0022] The construction of the Python module and C++ module of the business logic layer described in S3 includes the following steps:
[0023] S301: Encapsulate third-party tool modules;
[0024] S302: Call the packaged third-party tool module to solve the Modelica model file.
[0025] S303: storing the intermediate result of the solved equation on a disk;
[0026] S304: Deserialize the XML configuration file, and represent each level of tags in the XML configuration file as a memory object in a Python module or a C++ module;
[0027] S305: Write a code module to implement logic based on the deserialized memory object and the intermediate result generated in S303;
[0028] For Python modules, the implementation includes adding, deleting, modifying and checking the contents of XML configuration files;
[0029] For C++ modules, the implementation includes visual operations on the contents of XML configuration files;
[0030] S306: Serialize the result obtained in S305 into an XML configuration file text for persistent storage.
[0031] S4: Interface layer that implements Julia functions.
[0032] S401: Define environment variables in Julia function code;
[0033] S402: Importing modules of the business logic layer;
[0034] S403: Write code for the Julia function interface layer.
[0035] Compared with the prior art, the present invention has the following beneficial effects:
[0036] 1. The present invention introduces Julia functions in the AUTOSAR project. As a high-performance programming language, Julia has excellent numerical calculation and data processing capabilities, and is particularly suitable for processing complex models and large-scale data operations in AUTOSAR projects. With its powerful multi-language interoperability, Julia functions can be seamlessly integrated with Python modules and C++ modules, thereby simplifying the complexity of cross-language integration. By using Python modules to process complex business logic, C++ modules combined with Qt to achieve high-performance visualization operations, and Julia exposed function libraries, the flexibility and functionality of the system are greatly improved, and convenient support is provided for subsequent scientific computing tasks.
[0037] 2. By introducing Julia functions into AUTOSAR projects, the present invention can also provide a unified and efficient development framework, enabling developers to flexibly expand functional modules, optimize system performance, and achieve rapid iteration in the face of changing requirements. This not only improves development efficiency, but also enhances the scalability and maintainability of the system, providing an innovative and feasible solution for the development of modern automotive electronic systems.
[0038] 3. The present invention adopts a layered design, which clarifies the division of responsibilities between the data layer, business logic layer and interface layer, making the system highly scalable and able to easily adapt to future functional expansion and technology upgrades.
[0039] 4. The present invention can effectively promote the construction of the AUTOSAR ecosystem, promote the promotion and application of standards, and enhance the synergy effect within the industry. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] Figure 1 A framework diagram of a Julia function library integrating multiple programming languages according to the present invention;
[0041] Figure 2 A flowchart of a method for constructing a Julia function library integrating multiple programming languages according to the present invention;
[0042] Figure 3 This is an example diagram of the content of an XML configuration file of the present invention, wherein (a) is the content of the XML configuration file, and (b) is the content of the schema definition XSD file corresponding to the XML configuration file;
[0043] Figure 4 This is an example diagram of the ARXML file of the present invention;
[0044] Figure 5is an example diagram of a Modelica file of the present invention, wherein (c) is a visual graphical expression of the Modelica model of this example, and (d) is a textual expression of the Modelica model of this example;
[0045] Figure 6 A code example diagram for defining a dynamic link library interface in a C++ module of the present invention;
[0046] Figure 7 This is an example diagram of the contents of an intermediate result file generated after the third-party tool module of the present invention solves the Modelica model;
[0047] Figure 8 A code example diagram for adding AUTOSAR model elements to an XML configuration file for the Python module of the present invention;
[0048] Fig. 9 This is a Julia code example diagram for calling a Python module during the Julia function library implementation process of the present invention;
[0049] Fig.10 This is a diagram showing an example of Julia code for calling a C++ module during the implementation of the Julia function library of the present invention. DETAILED DESCRIPTION
[0050] The technical solution of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0051] A Julia library that integrates multiple programming languages, built specifically for AUTOSAR projects, enabling seamless integration of multiple programming languages.
[0052] Data layer: Located at the bottom layer, it contains the XML configuration files, ARXML files, and Modelica model files of the AUTOSAR project. It is responsible for providing support for file data and is the basis of the entire Julia function library.
[0053] Business logic layer: located in the middle layer, including Python modules, C++ modules and third-party tool modules, responsible for processing and executing the business logic of the Julia function library;
[0054] Interface layer: Located at the top layer, the operation object is the data layer. It provides users with a unified Julia function operation interface by calling the Python module and C++ module of the business logic layer to support more complex scientific computing tasks;
[0055] The data layer, business logic layer and interface layer are modularly decoupled, and the lower layer provides basic services for the upper layer. Each module is interface-oriented. After the input and output interfaces of the module are determined, different implementation methods can be used and flexibly replaced as needed.
[0056] The XML configuration file is used to describe and configure the software architecture of the AUTOSAR project. It contains various configuration information about the automotive electronic system, including software components, communications, and automotive electronic controllers. It is an important part of the AUTOSAR project development process and is essential for achieving a modular, scalable, and reusable automotive software architecture. The difference between the XML configuration file and the ARXML file is that the structure of the XML configuration file is independently defined by the tools of the AUTOSAR project, and the information expression is more intuitive than that of the ARXML file. The structure of the XML configuration file can be different in different tools; while the ARXML file is defined in the standard of the AUTOSAR project, and the storage and exchange format is unified by the model of the AUTOSAR project.
[0057] like Figure 3 As shown in the figure, (a) is an example of an XML configuration file, where the AUTOSAR project component name is "autosar_swc" and contains a port interface named "In1_1s", and (b) is the schema definition document corresponding to the XML configuration file, which specifies the structure and content of the XML configuration file, such as the specified tag <autosar>Can contain any number of <autosar-dictionary>subtag to ensure that the format and content of the XML configuration file are as expected.
[0058] The Modelica model file is responsible for expressing the interaction relationship between the demand port, supply port, runnable entity, variables between runnable entities, state variables and model elements in the AUTOSAR project; among the model elements of the AUTOSAR project expressed by the Modelica model file, the demand port has a sampling time parameter, and the variables between runnable entities have a source sampling time parameter and a target sampling time parameter.
[0059] like Figure 5 The figure shows an example diagram of the Modelica model file of the present invention. In the figure, the component in the AUTOSAR project is named "autosar_swc", which includes an inter-runnable entity variable "irv1_1", two required ports "rport" and "rport1", two supplied ports "pport" and "pport1", and two runnable entities "runnableEntity" and "runnableEntity3". The above model elements are interconnected with each other.
[0060] The Python module is provided in the form of source code, and is responsible for the operation of the data layer files, and generates the intermediate results of the Modelica model solution by calling the third-party tool module and stores them on the computer; the operation of the data layer files includes adding, deleting, modifying, and checking the model elements of the AUTOSAR project in the ARXML file, XML configuration file and Modelica model file, as well as the conversion operations between the files.
[0061] The C++ module is distributed in the form of a dynamic link library dll file, providing a visual display and visual operation interface based on the Qt framework, supporting the creation and management of various graphical components, including windows, buttons and text boxes, and providing an API calling interface for other programming languages (Python, Julia) to call, so as to achieve cross-language GUI integration.
[0062] The event handling mechanism, drawing function and data binding function are implemented in the C++ module to ensure real-time response of user operations and efficient update of data visualization.
[0063] When developing a C++ module, you need to expose the API call interface provided by the C++ module in the style of C language, such as Figure 6 The figure shows a code example diagram for defining a dynamic link library interface in the C++ module of the present invention, in which the function declaration is modified with the "extern" keyword; when deploying the C++ module, in order to ensure that the dependency path of the C++ module is correct, the Qt5Core.dll, Qt5Gui.dll, Qt5Widgets.dll, and platforms / qwindows.dll files in the Qt framework need to be placed in the same directory as the dynamic link library obtained by compiling the C++ module.
[0064] The third-party tool module includes a Modelica open source tool that is modified and packaged into an exe executable file to support the processing of Modelica model files.
[0065] Modelica open source tool is an open source modeling and simulation environment based on the Modelica language. It is mainly used for modeling and simulation of physical systems and is suitable for multiple fields, including mechanics, electricity, heat, fluid mechanics, and multi-domain integrated systems.
[0066] The present invention modifies the Modelica open source tool so that it can receive the transmitted command line parameters and output the intermediate results after solving the Modelica model to the local disk of the computer. Then, it is recompiled into an executable file exe.
[0067] like Figure 7 The figure shows an example of the intermediate result content after solving the Modelica model provided by the present invention. The intermediate result is a set of equations with causal relationships. The encapsulated exe executable file can be called by Python modules and C++ modules to participate in subsequent task support.
[0068] A method for constructing a Julia function library integrating multiple programming languages of the present invention comprises the following steps:
[0069] S1: Design the layered architecture of the Julia function library, which consists of the data layer, business logic layer, and interface layer from bottom to top;
[0070] S2: implements the data layer of the Julia library;
[0071] S201: Build ARXML files in accordance with the standard specifications of the AUTOSAR project to ensure that the data can be correctly parsed and operated by the Python module to ensure data accuracy;
[0072] The ARXML file is a file format of the AUTOSAR project. It is an AUTOSAR model storage and exchange format specified by the AUTOSAR project standard. It is used to describe the configuration and behavior of automotive electronic control units and other related systems to facilitate interoperability between different development tools. ARXML files use XML format, which is structured and easy to parse. They are widely used in automotive software development and configuration management. In the AUTOSAR project architecture, ARXML files are used to define various parts of the system, including ECU configuration, signal and bus communication, software components, system architecture and configuration parameters, such as Figure 4 The figure shows an example diagram of the ARXML file of the present invention, wherein the component name in the AUTOSAR project is "test12", and the component includes a port interface named "In1_1s".
[0073] S202: Build the corresponding XML configuration file structure and XSD schema definition document;
[0074] S203: Build a Modelica model file for expressing internal behavior information of the AUTOSAR project model.
[0075] S3: implements the business logic layer of the Julia function library and provides a calling interface for the upper layer;
[0076] The construction of the Python module and C++ module of the business logic layer described in S3 includes the following steps:
[0077] S301: Encapsulate third-party tool modules;
[0078] S302: Call the packaged third-party tool module to solve the Modelica model file.
[0079] S303: storing the intermediate result of the solved equation on a disk;
[0080] S304: Deserialize the XML configuration file, and represent each level of tags in the XML configuration file as a memory object in a Python module or a C++ module;
[0081] S305: Write a code module to implement logic based on the deserialized memory object and the intermediate result generated in S303;
[0082] For Python modules, the implementation includes adding, deleting, modifying and checking the contents of XML configuration files;
[0083] For C++ modules, the implementation includes visual operations on the contents of XML configuration files;
[0084] S306: Serialize the result obtained in S305 into an XML configuration file text for persistent storage.
[0085] S4: Interface layer that implements Julia functions.
[0086] S401: Define environment variables in Julia function code:
[0087] Set the environment variable "ENV["PYTHON"]" to point to the Python module kernel of the business logic layer;
[0088] Set the environment variable "ENV["QT_PLUGIN_PATH"]" to point to the Qt framework environment kernel;
[0089] S402: Import the modules of the business logic layer.
[0090] Import Python modules into Julia function codes through the "PyCall" library to achieve the integration of Julia function codes and Python modules;
[0091] C++ modules are imported into Julia function codes through the "Libdl" library. C++ modules are distributed as dynamic link libraries to achieve the integration of Julia function codes and C++ modules.
[0092] S403: Write the code for the Julia function interface layer;
[0093] Call each module of the business logic layer, package the results returned by each module, and complete the implementation of the Julia function library. By calling the Python module, non-visual operations on the data layer files are realized; by calling the C++ module, visual operations on the data layer files are realized.
[0094] like Fig. 9 The figure shows an example diagram of Julia function code for calling a Python module in the Julia function library implementation of the present invention. When the "updateAUTOSARProperties" function is implemented, the interface corresponding to the Python module is called.
[0095] like Fig.10 The figure shows an example diagram of Julia code for calling a C++ module in the Julia function library implementation of the present invention. In the process of implementing the function "autosar_ui_launch", the "AUTOSARBlocksetPlugin.dll" dynamic link library is called to implement the function.
[0096] It will be apparent to those skilled in the art that the invention is not limited to the details of the exemplary embodiments described above and that the invention can be implemented in other forms without departing from the spirit or essential features of the invention. Therefore, the embodiments should be considered in all respects as exemplary and non-limiting, and the scope of the invention is defined by the appended claims rather than the foregoing description, and it is intended that all variations within the meaning and range of equivalents of the claims be included in the invention. Any reference numeral in a claim should not be considered as limiting the claim to which it relates.
[0097] In addition, it should be understood that although the present specification is described according to implementation modes, not every implementation mode contains only one independent technical solution. This description of the specification is only for the sake of clarity. Those skilled in the art should regard the specification as a whole. The technical solutions in each embodiment may also be appropriately combined to form other implementation modes that can be understood by those skilled in the art. < / autosar>
Claims
1. A Julia library that integrates multiple programming languages, characterized by: include Data layer: Located at the bottom layer, it contains the XML configuration files, ARXML files, and Modelica model files of the AUTOSAR project. It is responsible for providing support for file data and is the basis of the entire Julia function library. Business logic layer: located in the middle layer, including Python modules, C++ modules and third-party tool modules, responsible for processing and executing the business logic of the Julia function library; Interface layer: Located at the top layer, it provides users with a unified Julia function operation interface by calling the Python module and C++ module of the business logic layer to support scientific computing tasks; The data layer, business logic layer and interface layer are modularly decoupled.
2. The Julia function library integrating multiple programming languages according to claim 1, characterized in that: The XML configuration file is used to describe and configure the software architecture of the AUTOSAR project.
3. The Julia function library integrating multiple programming languages according to claim 2, characterized in that: The Modelica model file is responsible for expressing the interaction relationship between the required ports, supplied ports, runnable entities, variables between runnable entities, state variables and model elements in the AUTOSAR project; The demand port has a sampling time parameter quantity, and the inter-operable entity variable has a source sampling time parameter quantity and a target sampling time parameter quantity.
4. The Julia function library integrating multiple programming languages according to claim 3, characterized in that: The Python module is provided in the form of source code, and is responsible for the operation of the data layer files, and generates the intermediate results of the Modelica model solution by calling the third-party tool module and stores them on the computer; the operation of the data layer files includes adding, deleting, modifying, and checking the model elements of the AUTOSAR project in the ARXML file, XML configuration file and Modelica model file, as well as the conversion operations between the files.
5. The Julia function library integrating multiple programming languages according to claim 3, characterized in that: The C++ module provides a visual display and visual operation interface based on the Qt framework, supports the creation and management of various graphical components, and provides an API calling interface for other programming languages to call, so as to realize cross-language GUI integration.
6. The Julia function library integrating multiple programming languages according to claim 3, characterized in that: The third-party tool module includes a Modelica open source tool that is modified and packaged into an exe executable file to support the processing of Modelica model files.
7. A method for constructing a Julia function library integrating multiple programming languages according to any one of claims 1 to 6, characterized in that: The method comprises the following steps: S1: Design the layered architecture of the Julia function library, which consists of the data layer, business logic layer, and interface layer from bottom to top; S2: Implement the data layer of the Julia library; S3: implements the business logic layer of the Julia function library; S4: Interface layer that implements Julia functions.
8. The method according to claim 7, characterized in that: The S2 comprises the following steps: S201: Build ARXML files according to the standard specifications of the AUTOSAR project; S202: Build the corresponding XML configuration file structure and XSD schema definition document; S203: Build a Modelica model file for expressing internal behavior information of the AUTOSAR project model.
9. The method according to claim 7, characterized in that: The construction of the Python module and C++ module of the business logic layer described in S3 includes the following steps: S301: Encapsulate third-party tool modules; S302: Call the packaged third-party tool module to solve the Modelica model file. S303: storing the intermediate result of the solved equation on a disk; S304: Deserialize the XML configuration file, and represent each level of tags in the XML configuration file as a memory object in a Python module or a C++ module; S305: Write a code module to implement logic based on the deserialized memory object and the intermediate result generated in S303; For Python modules, the implementation includes adding, deleting, modifying and checking the contents of XML configuration files; For C++ modules, the implementation includes visual operations on the contents of XML configuration files; S306: Serialize the result obtained in S305 into an XML configuration file text for persistent storage.
10. The method according to claim 7, characterized in that: The S4 comprises the following steps: S401: Define environment variables in Julia function code; S402: Importing modules of the business logic layer; S403: Write code for the Julia function interface layer.
Citation Information
Cited By
Method for realizing deep fusion of artificial intelligence and scientific numerical calculation by Python-Fortran hybrid programming
CN121300760A