Method and device for deploying FMU model to real-time target machine for real-time parameter calibration and data acquisition through XCP protocol, and readable storage medium thereof

Through cross-compilation, the memory header address of the FMU variable array is obtained and the A2L file is generated, which solves the compatibility problem between FMU and XCP protocol, and realizes parameter calibration and data acquisition on the target machine in real time, improving engineering practicality and efficiency.

CN120409051AActive Publication Date: 2025-08-01杭州瞬迦科技有限公司
View PDF 11 Cites 0 Cited by

Patent Information

Application Number
CN202510899760.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-01
Publication Date
2025-08-01
Estimated Expiration
2045-07-01

AI Technical Summary

Technical Problem

In the prior art, the standardized API access method of FMU cannot support address-level variable operations, and the XCP protocol cannot adapt to the dynamic memory allocation mechanism of FMU, making it difficult for FMU and XCP protocol to combine for parameter calibration and data acquisition of real-time target machines.

Method used

By cross-compiling the FMU source code with the real-time target machine source code, the memory header address of the FMU variable array is obtained, and the A2L memory map file is generated in combination with the model description file, real-time parameter calibration and data acquisition of the FMU model deployed on the real-time target machine based on the XCP protocol.

Benefits of technology

It realizes the integrated application of FMU and XCP protocols, supports scenarios such as ECU calibration that require address-level access, and realizes real-time and efficient parameter adjustment and data acquisition.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120409051A_ABST
    Figure CN120409051A_ABST
Patent Text Reader

Abstract

The invention provides a method and device for deploying an FMU model to a real-time target machine through an XCP protocol for real-time parameter calibration and data collection and a readable storage medium thereof. The method comprises the steps that FMU source codes and target machine codes are subjected to cross compiling to generate an executable file; performing pilot run to obtain a dynamic memory base address; the model description file is analyzed to calculate an actual address of a variable; and generating an A2L file to support memory-level access of the XCP protocol to the FMU variable on the target machine. The limitation that a traditional XCP is only suitable for static compiling codes is broken through, the plug-and-play calibration function of the FMU model on a real-time target machine is achieved, and the method can be applied to scenes such as real-time simulation of an automobile ECU control algorithm verification power electronic system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of real-time simulation technology, and particularly to the deployment, real-time parameter calibration, and data acquisition of an FMU model on a real-time target machine by using the XCP protocol. Background Art

[0002] As a standardized model exchange format, the Functional Mock-up Unit (FMU) is widely used in control system modeling and co-simulation. However, its variables and parameters need to be accessed through standardized APIs (such as fmi2GetReal / fmi2SetReal, etc.), which cannot meet the requirement of "address-level access" to variables in engineering scenarios such as ECU calibration. The XCP (Universal Measurement and Calibration Protocol) describes the variable memory mapping through an A2L file and can directly access the system memory to achieve parameter reading and writing. However, it is only applicable to statically compiled model codes and cannot handle the situation where variables are stored through dynamic memory allocation (such as malloc) during the FMU runtime.

[0003] Therefore, in the prior art, there is a lack of a method, device, and readable storage medium for integrating the FMU with the XCP protocol to achieve real-time calibration and data acquisition of the FMU on a real-time target machine through XCP. Summary of the Invention

[0004] Embodiments of the present invention provide a method, device, and readable storage medium for deploying an FMU model to a real-time target machine through the XCP protocol for real-time parameter calibration and data acquisition. Aiming at the problems in the current technology that the standardized API access method of the FMU cannot support address-level variable operations, and the XCP protocol cannot adapt to the dynamic memory allocation mechanism of the FMU, resulting in difficulties in combining the two for parameter calibration and data acquisition of a real-time target machine.

[0005] The core technology of the present invention mainly cross-compiles the FMU source code with the real-time target machine source code to obtain the memory start address of the FMU variable array, and generates an A2L memory mapping file in combination with the model description file, so as to achieve real-time parameter calibration and data acquisition of the FMU model deployed on the real-time target machine based on the XCP protocol.

[0006] In a first aspect, the present invention provides a method for deploying an FMU model to a real-time target machine through the XCP protocol for real-time parameter calibration and data acquisition. The method includes the following steps: Cross-compile the FMU source code with the target machine runtime environment code to generate an executable file; Execute the initialization program of the executable file on the target machine to obtain the start address of the dynamically allocated target variables and parameters in memory; Generate an A2L file containing address mapping information based on the FMU model description file and the start address; Based on the A2L file and the XCP protocol, the master device performs real-time parameter calibration and data acquisition on the FMU model running on the target machine.

[0007] Further, obtaining the starting memory addresses of the dynamically allocated target variables and parameters in memory includes: During the trial operation stage of the target machine, call the memory allocation function in the FMU initialization program and obtain the starting memory address of the variable and parameter arrays through pointer access as the starting address.

[0008] Further, generating the A2L file includes: Parse the model description file to extract the identifiers and data types of the variables and parameters; Determine the indexes of the variables and parameters in the array according to the identifiers; Based on the starting memory address, the number of bytes occupied by the data type, and the index, calculate the actual memory addresses of the variables and parameters; Write the names and actual memory addresses of the variables and parameters in the A2L file format.

[0009] Further, the calculation of the actual memory addresses should be formulated according to the address mapping rules of the modeling software for generating the FMU; for a class of modeling software including OpenModelica, the calculation formula is: address = initAddress + index * size where initAddress is the starting memory address, index is the array index, and size is the number of bytes occupied by the data type.

[0010] Further, run the executable file on the target machine, in which the XCP Slave program is embedded; Based on the A2L file, the master device uses the XCP Master software on the master device to perform real-time parameter calibration and data acquisition on the FMU model.

[0011] Further, the XCP Master software includes Vector, Simulink, or custom-developed software that supports the XCP protocol.

[0012] Further, the FMU source code is generated by modeling software that supports the FMU format, including any one of Matlab / Simulink, OpenModelica, MWORKS, or PSCAD.

[0013] In a second aspect, the present invention provides a device for deploying an FMU model to a real-time target machine through the XCP protocol for real-time parameter calibration and data acquisition, including: A master device configured to execute the above method; A real-time target machine, having an executable file running environment and an XCP slave device module; A communication link connecting the master control device and the real-time target machine.

[0014] In a third aspect, the present invention provides an electronic device, including a memory and a processor. A computer program is stored in the memory, and the processor is configured to run the computer program to execute the method of deploying the FMU model to the real-time target machine through the XCP protocol for real-time parameter calibration and data acquisition as described above.

[0015] In a fourth aspect, the present invention provides a readable storage medium. A computer program is stored in the readable storage medium. The computer program includes program codes for controlling a process to execute the process, and the process includes the method of deploying the FMU model to the real-time target machine through the XCP protocol for real-time parameter calibration and data acquisition as described above.

[0016] The main contributions and innovations of the present invention are as follows: 1. Breaking through the protocol compatibility barrier: By obtaining the dynamic memory start address and generating the A2L file, the incompatibility problem between the FMU dynamic memory allocation and the XCP static address mapping is solved, and the integrated application of the two is realized.

[0017] 2. Without modifying the FMU model: Through the cross-compilation and target machine trial operation mechanism, the original dynamic memory management method of the FMU is directly adapted to maintain the model independence.

[0018] 3. Improving the engineering practicality: Supporting scenarios such as ECU calibration that require address-level access, realizing real-time and efficient parameter adjustment and data acquisition, such as performing real-time waveform measurement on a three-phase induction motor drive model through the XCP protocol.

[0019] 4. Strong versatility: Compatible with various FMU generation tools such as Matlab / Simulink and OpenModelica, and XCP Master software such as Vector and Simulink, with a wide range of applications.

[0020] Details of one or more embodiments of the present invention are set forth in the following drawings and description to make other features, objects, and advantages of the present invention more concise and understandable. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] The drawings described herein are used to provide a further understanding of the present invention, and constitute a part of the present invention. The illustrative embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings: Figure 1 is a flowchart of the method of deploying the FMU model to the real-time target machine through the XCP protocol for real-time parameter calibration and data acquisition; Figure 2 The model of a three - phase induction motor drive is established through the OpenModelica Connection Editor software; Figure 3 A screenshot of real - time data acquisition for the FMU model running on the RTScale real - time target machine through the InScope software.

[0022] Figure 4 It is a schematic diagram of the hardware structure of an electronic device according to an embodiment of the present invention. Detailed implementation manners

[0023] Here, the exemplary embodiments will be described in detail, and the examples are shown in the drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementation manners described in the following exemplary embodiments do not represent all implementation manners consistent with one or more embodiments of this specification. On the contrary, they are only examples of devices and methods that are consistent with some aspects of one or more embodiments of this specification as detailed in the appended claims.

[0024] It should be noted that: In other embodiments, the steps of the corresponding methods are not necessarily executed in the order shown and described in this specification. In some other embodiments, the steps included in the method may be more or less than those described in this specification. In addition, a single step described in this specification may be decomposed into multiple steps for description in other embodiments; and multiple steps described in this specification may also be combined into a single step for description in other embodiments.

[0025] In the prior art, the standardized API access method of FMU cannot support address - level variable operations, and the XCP protocol cannot adapt to the dynamic memory allocation mechanism of FMU, resulting in difficulty in combining the two for parameter calibration and data acquisition of real - time target machines.

[0026] Based on this, the present invention solves the problems existing in the prior art by cross - compiling the FMU source code and the real - time target machine source code.

[0027] Taking the FMU generated by the OpenModelica software as an example, the method of the present invention will be specifically described below. The target machine uses the RTScale real - time target machine developed and manufactured by our company, and the XCP Master software uses the InScope software developed by our company. The InScope software and its usage instructions can be downloaded from our company's official website.

[0028] Embodiment 1 The present invention aims to propose a method for deploying an FMU model to a real-time target machine through the XCP protocol for real-time parameter calibration and data acquisition. Specifically, referring to Figure 1 , the method includes: Step 1: Cross-compile the FMU source code with the target machine running environment code.

[0029] In this embodiment, first, on the host, use OpenModelica Connection Editor (this software supports drag-and-drop connection, which can significantly reduce the modeling threshold) to build a model graphically. The FMU model can be either a control model (such as a PID controller, state machine, etc., for implementing logical control strategies) or a physical model (such as a motor, circuit, mechanical system, etc., which describes the dynamic characteristics of the object based on physical laws). In this embodiment, a physical model driven by a three-phase induction motor is selected for establishment, as shown in Figure 2 . After building the model, export it as an FMU format in OpenModelica. There are multiple versions of the FMU standard from 1.0 to 3.0. In this embodiment, the FMU2.0 version is adopted. After completing the modeling in OpenModelica, the model is encapsulated as an FMU format file (.fmu) through the built-in function of the software, such as InductionMachine.fmu.

[0030] In Figure 2 , ramp is a ramp generator, and its function is to generate a voltage / frequency command that changes linearly with time (such as the voltage ramp at startup). Its role is to simulate the soft start process of the motor and avoid the current impact caused by direct full-voltage startup. The duration below ramp is used to set "the duration for the ramp signal to change from the initial value to the target value".

[0031] vfControl... (V / F controller) implements "voltage-frequency control" (Voltage-Frequency Control), which is a common strategy for speed regulation of induction motors. The input is the ramp signal output by ramp; the output is the voltage command generated according to the V / F curve.

[0032] signalVol... (controlled voltage source) + ground / star (reference ground and star connection) functions to simulate the access of a three-phase power supply, converting the control signal output by vfControl… into a three-phase voltage that the motor can receive. The electrical connection star represents the star connection of the power winding (also known as the Y connection), and ground is the reference ground, forming a complete electrical circuit.

[0033] currentQ... (current measurement module) functions to monitor the stator current of the motor in real time.

[0034] In the aimc (Induction Motor) + aimcData (Induction Motor Parameter Configuration), the aimc module has built-in mathematical models of induction motors (such as T-type equivalent circuit, torque equation) to calculate physical quantities such as electromagnetic torque, speed, and magnetic flux; the aimcData module stores induction motor parameters (such as rated power, rated voltage, stator resistance, rotor resistance, moment of inertia, etc.).

[0035] In loadInertia (Load Moment of Inertia) + loadTorq... (Load Torque), loadInertia is the moment of inertia of the simulated load (parameter J = JLoad), which affects the dynamic response of the motor (such as acceleration and deceleration time); loadTorq... is the simulated load torque to test the load-carrying capacity of the motor.

[0036] Figure 2 The core logic of the model is as follows: Control side: ramp → vfControl… generates voltage / frequency commands; Electrical side: The voltage / frequency commands are converted into three-phase voltages through signalVol… to drive the aimc motor model; Mechanical side: The motor outputs electromagnetic torque to overcome the inertia of loadInertia and the resistance of loadTorq…, and finally manifests as the motor speed / load speed; Feedback side: currentQ… collects current, which can be used for feedback control.

[0037] After decompressing the exported InductionMachine.fmu file, three folders can be seen: binaries, resources, and sources, as well as a file modelDescription.xml. Specifically as shown in Table 1 below: Table 1

[0038] Cross-compile the FMU source code inside the sources folder with the source code of the RTScale real-time target machine (such as driver programs, task scheduling, XCP Slave, and other model codes outside the FMU) (using a cross-compiler, such as the GCC cross-toolchain) to generate the InductionMachine.elf executable file, which can be uploaded to the RTScale target machine via the network for operation.

[0039] Step 2: Execute the initialization program of the executable file on the target machine to obtain the starting addresses of the dynamically allocated target variables and parameters in memory; In this embodiment, it is uploaded to the RTScale real-time target machine via http, and a trial run instruction is sent. After the InductionMachine.elf is trial-run on the RTScale, an address.txt file is generated and sent back to the host. For example: Variables and parameters with the data type of real (double-precision floating-point number) are stored in two arrays, realVars and realParameter. When the FMU is initialized, memory addresses are allocated through malloc. During the trial run, the RTScale executes the FMU initialization program and obtains the starting addresses of the two arrays, realVars and realParameter, through pointers, and writes them into the address.txt file: realVars = 0x20003400; realParameter = 0x20003500.

[0040] Step 3: Generate an A2L file containing address mapping information based on the FMU model description file and the starting address; In this embodiment, after the host obtains the address.txt file, it parses the modelDescription.xml file and calculates the actual memory addresses of each parameter and variable. For example, part of the modelDescription.xml file is intercepted as follows: <ScalarVariable name="aimc.idq_rr[1]" valueReference="0" description="Rotor space phasor current / rotor fixed frame" initial="exact"> <Real start="0.0" unit="A" / > <ScalarVariable name="aimc.idq_rr[2]" valueReference="1" description="Rotor space phasor current / rotor fixed frame" initial="exact"> <Real start="0.0" unit="A" / > It can be seen from this that the variables aimc.idq_rr[1] and aimc.idq_rr[2] are the dq-axis currents of the induction motor rotor respectively, and the corresponding valueReferences are 0 and 1 respectively. Thus, according to the formula: address = initAddress + index*size Among them, address represents the actual memory address of FMU variables and parameters, initAddress represents the starting memory address of the corresponding array, index is the corresponding array index, and size is the memory size occupied by the corresponding data type. The actual memory addresses of the two can be calculated as follows: &aimc.idq_rr[0] = 0x20003400 + 0*8 = 0x20003400; &aimc.idq_rr[1] = 0x20003400 + 1*8 = 0x20003408; Write these two variables and addresses into the A2L file: / begin MEASUREMENT / * Name* / aimc.idq_rr[0] / * Long identifier* / "" / * Data type* / FLOAT64_IEEE / * Conversion method* / fmu_CM_double / * Resolution (Not used)* / 0 / * Accuracy (Not used)* / 0 / * Lower limit* / -1.7E+308 / * Upper limit* / 1.7E+308 ECU_ADDRESS0x20003400 / end MEASUREMENT / begin MEASUREMENT / * Name* / aimc.idq_rr[1] / * Long identifier* / "" / * Data type* / FLOAT64_IEEE / * Conversion method* / fmu_CM_double / * Resolution (Not used)* / 0 / * Accuracy (Not used)* / 0 / * Lower limit* / -1.7E+308 / * Upper limit* / 1.7E+308 ECU_ADDRESS 0x20003408 / end MEASUREMENT In this way, an A2L file containing address mapping information is obtained.

[0041] Step 4: Use the XCP master device (XCP Master software) to perform real-time parameter calibration and data acquisition on the FMU model running on the target machine based on the A2L file.

[0042] In this embodiment, the InductionMachine.elf executable file is actually run on RTScale, and the InScope software is run on the host. Figure 3 The figure shows a screenshot of the InScope software running. The top of the software is the function buttons, which can realize functions such as loading, connecting, running, and adding waveforms of the FMU model. On the left side of the software, the parameters during the operation of the induction motor can be set by adding and deleting parameters. On the right side of the software are the waveforms of the three-phase current and the motor angle collected during operation. Using the XCP protocol, real-time calibration and measurement are performed on the three-phase induction motor FMU model running on RTScale. The specific calibration and measurement means are prior art and not the technical points protected by the present invention, so they will not be elaborated here.

[0043] Preferably, the FMU source code is generated by software supporting FMU, including but not limited to Matlab / Simulink, OpenModelica, MWORKS, PSCAD, etc. The XCP Master software includes commercial software such as Vector, Simulink, etc., and also includes software developed by users and third parties that support XCP Master.

[0044] For the convenience of understanding, supplementary explanations are given to the key professional terms of the present invention: 1. Functional Mock-Up Unit (FMU) Definition: A model encapsulation format based on the Functional Mock-Up Interface (FMI) standard, used for model exchange and co-simulation between different simulation tools.

[0045] Technical characteristics: It can include control models, physical models, etc., and is generated by software such as Matlab / Simulink and OpenModelica.

[0046] Application in the present invention: The FMU manages variable storage through dynamic memory allocation (such as malloc), and needs to be adapted to the static memory mapping mechanism of the XCP protocol.

[0047] 2. XCP protocol (Universal Measurement and Calibration Protocol) Definition: A standardized protocol for real-time measurement and calibration of electronic control units (ECUs), supporting high-speed data transmission and parameter modification.

[0048] Technical core: By describing information such as the memory address and data type of variables through an A2L file, direct access to the ECU memory is achieved.

[0049] It includes a Master / Slave architecture: The host runs XCP Master (such as Vector, InScope), and the target machine runs XCP Slave (XCP slave device).

[0050] Challenge in the present invention: Traditional XCP is only applicable to statically compiled code and cannot directly handle the dynamic memory allocation of the FMU.

[0051] 3. A2L file Definition: A text file conforming to the ASAP² standard, used to describe the memory mapping relationship of variables in the ECU or target machine.

[0052] In the present invention, an A2L file is generated by parsing the modelDescription.xml of the FMU and combining the memory start address, which is the core basis for XCP protocol communication.

[0053] 4. Real-time Target Machine Definition: A computer hardware device that can execute a simulation model at a fixed period to ensure strict determinism of the calculation timing.

[0054] Technical features: It supports high-speed data acquisition and real-time task scheduling, and is commonly used in scenarios such as hardware-in-the-loop (HIL) simulation and industrial control.

[0055] In the present invention, an RTScale target machine is adopted to run the executable file generated by cross-compiling the FMU.

[0056] 5. Cross Compilation Definition: Compile and generate code on the host that can run on the target. The hardware architecture or operating system of the target may be different from that of the host.

[0057] Function in the present invention: Combine the FMU source code (such as C language) with the target machine's underlying code to generate an ELF executable file that can run on the target machine, ensuring the compatibility between the FMU model and the target machine system.

[0058] 6. Dynamic Memory Allocation Definition: A mechanism for dynamically applying for memory space during program runtime through functions such as malloc and calloc, which is different from the static memory fixed allocation during compilation.

[0059] Influence in the present invention: The FMU manages the memory space occupied by variables and parameters through dynamic memory allocation, resulting in the variable addresses being determined during runtime, which is incompatible with the static memory addresses relied on by XCP. It is necessary to obtain the starting address through a trial run to solve this problem.

[0060] 7. Identifier (valueReference) Definition: An integer value used to uniquely identify a variable in the FMU model description file (modelDescription.xml), similar to the "index" of the variable.

[0061] Application in the present invention: Calculate the position of the variable in the array through valueReference (such as the valueReference of aimc.idq_rr[1] = 1), and combine the starting memory address and the number of bytes of the data type to deduce the actual memory address (address = initAddress + index * size).

[0062] 8. ECU Calibration Definition: Adjust and optimize the parameters in the electronic control unit (ECU) to adapt to different working conditions (such as engine ignition timing, fuel injection parameters, etc.).

[0063] Technical requirement: It is necessary to access the variable addresses in the ECU memory in real time through the XCP protocol, while the API access method of the FMU cannot meet this requirement. The present invention extracts the starting memory address of the FMU variable array through a trial run and generates the corresponding A2L file to meet this requirement.

[0064] 9. ELF File (Executable and Linkable Format) Definition: A standard format for executable files and object files, containing information such as code, data, and memory layout.

[0065] Application in the present invention: The generated InductionMachine.elf executable file through cross-compilation can be directly loaded and run on the RTScale target machine.

[0066] 10. API (Application Programming Interface) Definition: The interface between software components, realizing functional interaction through function calls.

[0067] Application in the present invention: The FMU accesses variables through standardized APIs (such as fmi2GetReal, fmi2SetReal), but this method cannot directly obtain the memory address and needs to be converted to the address-level access supported by XCP through the solution of the present invention.

[0068] 11. OpenModelica Definition: An open-source multi-domain system modeling and simulation software, supporting the equation-based modeling language (Modelica) and being compatible with the FMI standard.

[0069] Application of the present invention: Building a three-phase induction motor model through the graphical tool OpenModelica Connection Editor (such as Figure 2 ) When exporting the FMU format file, automatically generating C language source code (located in the sources folder) and the modelDescription.xml description file.

[0070] 12. Vector software Positioning: An industrial-level ECU development tool, including software such as CANoe and CANape, supporting the XCP protocol.

[0071] Compatibility of the present invention: "Vector" can be used as an alternative to InScope, and by importing the A2L file generated by the present invention, the calibration of the FMU model can be realized.

[0072] Embodiment 2 Based on the same concept, the present invention also proposes a device for deploying the FMU model to a real-time target machine through the XCP protocol for real-time parameter calibration and data acquisition, including: A host device configured to execute the method of Embodiment 1; A real-time target machine having an executable file running environment and an XCP slave device module; A communication link connecting the host device and the real-time target machine.

[0073] Embodiment III This embodiment also provides an electronic device. Refer to Figure 4 , including a memory 404 and a processor 402. A computer program is stored in the memory 404, and the processor 402 is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0074] Specifically, the above-mentioned processor 402 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured as one or more integrated circuits for implementing the embodiments of the present invention.

[0075] Among them, the memory 404 may include a mass storage 404 for data or instructions. By way of example and not limitation, the memory 404 may include a hard disk drive (HDD), a floppy disk drive, a solid state drive (SSD), a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive, or a combination of two or more of these. In a suitable case, the memory 404 may include removable or non-removable (or fixed) media. In a suitable case, the memory 404 may be internal or external to the data processing device. In a specific embodiment, the memory 404 is a non-volatile memory. In a specific embodiment, the memory 404 includes a read-only memory (ROM) and a random access memory (RAM). In a suitable case, the ROM may be a mask-programmed ROM, a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable PROM (EEPROM), an electrically alterable ROM (EAROM), or a flash memory, or a combination of two or more of these. In a suitable case, the RAM may be a static random access memory (SRAM) or a dynamic random access memory (DRAM), where the DRAM may be a fast page mode dynamic random access memory (FPMDRAM), an extended date out dynamic random access memory (EDODRAM), a synchronous dynamic random access memory (SDRAM), etc.

[0076] The memory 404 can be used to store or cache various data files required for processing and / or communication, as well as possible computer program instructions executed by the processor 402.

[0077] By reading and executing the computer program instructions stored in the memory 404, the processor 402 implements any one of the methods in the above embodiments for deploying the FMU model to a real-time target machine via the XCP protocol for real-time parameter calibration and data acquisition.

[0078] Optionally, the above electronic device may further include a transmission device 406 and an input / output device 408, wherein the transmission device 406 is connected to the processor 402, and the input / output device 408 is connected to the processor 402.

[0079] The transmission device 406 can be used to receive or send data via a network. Specific examples of the above network may include a wired or wireless network provided by a communication provider of the electronic device. In one example, the transmission device includes a network adapter (Network Interface Controller, abbreviated as NIC), which can be connected to other network devices through a base station and thus communicate with the Internet. In one example, the transmission device 406 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0080] The input / output device 408 is used to input or output information.

[0081] Embodiment 4 This embodiment also provides a readable storage medium, in which a computer program is stored. The computer program includes program code for controlling a process to execute the process, and the process includes the method of deploying the FMU model to a real-time target machine via the XCP protocol for real-time parameter calibration and data acquisition according to Embodiment 1.

[0082] It should be noted that the specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementation manners, and will not be elaborated herein.

[0083] In general, various embodiments can be implemented in hardware or dedicated circuits, software, logic, or any combination thereof. Some aspects of the present invention can be implemented in hardware, while other aspects can be implemented by firmware or software executed by a controller, a microprocessor, or other computing devices, but the present invention is not limited thereto. Although aspects of the present invention may be shown and described as block diagrams, flowcharts, or using some other graphical representation, it should be understood that, by way of non-limiting example, the blocks, devices, systems, techniques, or methods described herein can be implemented in hardware, software, firmware, dedicated circuits or logic, general hardware or controllers or other computing devices, or some combination thereof.

[0084] Embodiments of the present invention can be implemented by computer software, which is executable by a data processor of a mobile device, such as in a processor entity, or by hardware, or by a combination of software and hardware. The computer software or program (also referred to as a program product), including software routines, applets, and / or macros, can be stored in any device-readable data storage medium, and they include program instructions for performing specific tasks. The computer program product can include one or more computer-executable components configured to perform the embodiments when the program runs. One or more computer-executable components can be at least one software code or a part thereof. Additionally, in this regard, it should be noted that any box in the logical flow, as Figure 1 described, can represent a program step, or interconnected logic circuits, boxes, and functions, or a combination of program steps and logic circuits, boxes, and functions. The software can be stored on physical media such as memory chips or storage blocks implemented within the processor, magnetic media such as hard disks or floppy disks, and optical media such as, for example, DVDs and their data variants, CDs. The physical media are non-transitory media.

[0085] Those skilled in the art should understand that the technical features of the above embodiments can be combined arbitrarily. For the sake of brevity of description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as within the scope described in this specification.

[0086] The above embodiments merely represent several implementation manners of the present invention, and their descriptions are relatively specific and detailed, but they should not be construed as limiting the scope of the present invention. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present invention, several modifications and improvements can still be made, and these all belong to the protection scope of the present invention. Therefore, the protection scope of the present invention should be subject to the appended claims.

Claims

1. A method for deploying an FMU model to a real-time target machine through the XCP protocol for real-time parameter calibration and data acquisition, characterized in that It includes the following steps: Cross-compile the FMU source code with the target machine running environment code to generate an executable file; Execute the initialization program of the executable file on the target machine to obtain the starting addresses of the dynamically allocated target variables and parameters in memory; Generate an A2L file containing address mapping information based on the FMU model description file and the starting addresses; Based on the A2L file and the XCP protocol, the master device performs real-time parameter calibration and data acquisition on the FMU model running on the target machine.

2. The method according to claim 1, wherein The obtaining of the starting addresses of the dynamically allocated target variables and parameters in memory includes: During the trial run phase of the target machine, call the memory allocation function in the FMU initialization program and obtain the starting memory address of the variable and parameter arrays through pointer access as the starting address.

3. The method according to claim 1, wherein The generating of the A2L file includes: Parse the model description file to extract the identifiers and data types of the variables and parameters; Determine the indices of the variables and parameters in the array according to the identifiers; Based on the starting memory address, the number of bytes occupied by the data type, and the index, calculate the actual memory addresses of the variables and parameters; Write the names and actual memory addresses of the variables and parameters in the A2L file format.

4. The method according to claim 3, wherein The calculation of the actual memory addresses should be formulated according to the address mapping rules of the modeling software for generating the FMU; for a class of modeling software including OpenModelica, the calculation formula is: address = initAddress + index * size where initAddress is the starting memory address, index is the array index, and size is the number of bytes occupied by the data type.

5. The method according to claim 1, wherein Run the executable file on the target machine, which embeds the XCP Slave program; Based on the A2L file, the XCP Master software on the master device performs real-time parameter calibration and data acquisition on the FMU model.

6. The method according to claim 5, characterized in that, The XCP Master software includes Vector, Simulink, or custom-developed software that supports the XCP protocol.

7. The method according to any one of claims 1 to 6, characterized in that The FMU source code is generated by modeling software that supports the FMU format, including any one of Matlab / Simulink, OpenModelica, MWORKS, or PSCAD.

8. An apparatus for deploying an FMU model to a real-time target machine via the XCP protocol for real-time parameter calibration and data acquisition, characterized in that, It includes: A master device configured to execute the method according to any one of claims 1 to 7; A real-time target machine having an executable file running environment and an XCP slave device module; A communication link connecting the master device and the real-time target machine.

9. An electronic device, comprising a memory and a processor, characterized in that, A computer program is stored in the memory, and the processor is set to run the computer program to execute the method according to any one of claims 1 to 7.

10. A readable storage medium, characterized in that, A computer program is stored in the readable storage medium, and the computer program includes program code for controlling a process to execute the process, and the process includes the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • File loading processing method and device, computer storage medium and electronic equipment

    CN115700470A

  • Simulation system and method

    CN117130741A

  • Vehicle control parameter calibration method and device, electronic equipment and storage medium

    CN117519114A

  • Engine virtual bench calibration test system and method

    CN119310970A

  • Virtual compiling integration method, simulation device, computer equipment and storage medium

    CN119356685A