Method, device and readable storage medium for deploying FMU model to real-time target machine for real-time parameter calibration and data acquisition through XCP protocol
By cross-compiling, the memory first address of the FMU variable array is obtained and an A2L file is generated. This solves the compatibility issue between the FMU and the XCP protocol, and realizes parameter calibration and data acquisition on the real-time target machine. It is suitable for ECU calibration and real-time waveform measurement of three-phase induction motor drive models.
Patent Information
- Application Number
- CN202510899760.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-01
- Publication Date
- 2025-09-12
- Estimated Expiration
- 2045-07-01
AI Technical Summary
In the existing technology, 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 FMU and XCP protocol for parameter calibration and data acquisition of real-time target machines.
By cross-compiling the FMU source code with the real-time target machine source code, the memory first address of the FMU variable array is obtained, and the A2L memory mapping 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 are achieved based on the XCP protocol.
It realizes the integrated application of FMU and XCP protocol, supports scenarios requiring address-level access such as ECU calibration, and realizes real-time and efficient parameter adjustment and data acquisition. It is suitable for real-time waveform measurement of three-phase induction motor drive models.
Smart Images

Figure CN120409051B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of real-time simulation technology, and in particular to utilizing the XCP protocol to implement deployment of an FMU model on a real-time target machine, real-time parameter calibration, and data acquisition. Background Art
[0002] Functional Mockup Units (FMUs), as a standardized model exchange format, are widely used in control system modeling and co-simulation. However, their variables and parameters must be accessed through standardized APIs (such as fmi2GetReal and fmi2SetReal), which cannot meet the "address-level access" requirements of variables in engineering scenarios such as ECU calibration. XCP (Common Measurement and Calibration Protocol) uses A2L files to describe variable memory mapping, allowing direct access to system memory for parameter reading and writing. However, it only works with statically compiled model code and cannot handle variable storage managed through dynamic memory allocation (such as malloc) during FMU runtime.
[0003] Therefore, the prior art lacks a method, device, and readable storage medium thereof for integrating the FMU with the XCP protocol to implement real-time calibration and data acquisition of the FMU on a real-time target machine through XCP. Summary of the Invention
[0004] The 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. This addresses the problems that the standardized API access method of the FMU in the current technology cannot support address-level variable operations, and the XCP protocol cannot adapt to the dynamic memory allocation mechanism of the FMU, resulting in the difficulty of combining the two for parameter calibration and data acquisition of the real-time target machine.
[0005] The core technology of this invention is mainly to cross-compile the FMU source code with the real-time target machine source code, obtain the memory first address of the FMU variable array, generate an A2L memory mapping file in combination with the model description file, and realize 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 for real-time parameter calibration and data acquisition through the XCP protocol, the method comprising the following steps:
[0007] Cross-compile the FMU source code with the target machine runtime environment code to generate an executable file;
[0008] Execute the initialization program of the executable file on the target machine to obtain the first address of the dynamically allocated target variables and parameters in the memory;
[0009] Generate an A2L file containing address mapping information based on the FMU model description file and the first address;
[0010] The host device performs real-time parameter calibration and data acquisition on the FMU model running on the target machine based on the A2L file and XCP protocol.
[0011] Furthermore, obtaining the first address of the dynamically allocated target variable and parameter in memory includes:
[0012] During the test run phase of the target machine, the memory allocation function in the FMU initialization program is called and the starting memory address of the variable and parameter array is obtained as the first address through pointer access.
[0013] Furthermore, generating the A2L file includes:
[0014] Parse the model description file and extract the identifiers and data types of variables and parameters;
[0015] Determine the index of variables and parameters in the array based on their identifiers;
[0016] Calculate the actual memory address of variables and parameters based on the memory first address, the number of bytes occupied by the data type and the index;
[0017] Write the names of variables and parameters and their actual memory addresses according to the A2L file format.
[0018] Furthermore, the calculation of the actual memory address should be based on the address mapping rules of the modeling software that generates the FMU; for modeling software such as OpenModelica, the calculation formula is:
[0019] address=initAddress+index*size
[0020] Where initAddress is the first address of the memory, index is the array index, and size is the number of bytes occupied by the data type.
[0021] Further, the executable file is run on the target machine, wherein the XCP Slave program is embedded;
[0022] Through the XCP Master software on the master device, real-time parameter calibration and data acquisition of the FMU model are performed based on the A2L file.
[0023] Furthermore, the XCP Master software includes Vector, Simulink, or custom-developed software supporting the XCP protocol.
[0024] Furthermore, the FMU source code is generated by modeling software that supports the FMU format, including any one of Matlab / Simulink, OpenModelica, MWORKS or PSCAD.
[0025] In a second aspect, the present invention provides a device for deploying an FMU model to a real-time target machine for real-time parameter calibration and data acquisition through the XCP protocol, comprising:
[0026] A main control device configured to execute the above method;
[0027] Real-time target machine with executable file running environment and XCP slave device module;
[0028] The communication link connecting the host control device and the real-time target machine.
[0029] In a third aspect, the present invention provides an electronic device comprising a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the above-mentioned method of deploying the FMU model to a real-time target machine through the XCP protocol for real-time parameter calibration and data acquisition.
[0030] In a fourth aspect, the present invention provides a readable storage medium, which stores a computer program. The computer program includes a program code for controlling a process to execute a process. The process includes deploying the FMU model to a real-time target machine through the XCP protocol according to the above-mentioned method for real-time parameter calibration and data acquisition.
[0031] The main contributions and innovations of the present invention are as follows:
[0032] 1. Breaking through protocol compatibility barriers: By obtaining the dynamic memory first address and generating A2L files, the incompatibility between FMU dynamic memory allocation and XCP static address mapping is resolved, enabling the integrated application of the two.
[0033] 2. No need to modify the FMU model: Through cross-compilation and target machine trial operation mechanism, the original dynamic memory management method of FMU is directly adapted to maintain model independence.
[0034] 3. Improve engineering practicality: Support scenarios requiring address-level access, such as ECU calibration, to achieve real-time and efficient parameter adjustment and data acquisition. For example, real-time waveform measurement of a three-phase induction motor drive model using the XCP protocol.
[0035] 4. Strong versatility: Compatible with various FMU generation tools such as Matlab / Simulink, OpenModelica, and XCP Master software such as Vector and Simulink, with a wide range of applications.
[0036] The details of one or more embodiments of the invention are set forth in the accompanying drawings and the description below so that other features, objects, and advantages of the invention are more readily apparent. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of the present invention. The exemplary 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:
[0038] Figure 1 It is a flow chart of 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;
[0039] Figure 2 The model of the three-phase induction motor drive is established using the OpenModelica Connection Editor software;
[0040] Figure 3 Screen capture of real-time data acquisition using InScope software on an FMU model running on an RTScale real-time target machine.
[0041] Figure 4 FIG. 4 is a schematic diagram of the hardware structure of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0042] Exemplary embodiments will be described in detail herein, with examples illustrated in the accompanying drawings. In the following description, when referring to the drawings, identical numerals in different figures represent identical or similar elements, unless otherwise indicated. The implementations described in the following exemplary embodiments are not intended to represent all implementations consistent with one or more embodiments of this specification. Rather, they are merely examples of apparatuses and methods consistent with certain aspects of one or more embodiments of this specification, as detailed in the appended claims.
[0043] It should be noted that in other embodiments, the steps of the corresponding method are not necessarily performed in the order shown and described in this specification. In some other embodiments, the method may include more or fewer steps than those described in this specification. In addition, a single step described in this specification may be broken down into multiple steps for description in other embodiments, and multiple steps described in this specification may be combined into a single step for description in other embodiments.
[0044] In the existing technology, 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 to combine the two for parameter calibration and data acquisition of real-time target machines.
[0045] Based on this, the present invention solves the problems existing in the prior art by cross-compiling the FMU source code with the real-time target machine source code.
[0046] The following uses an FMU generated with OpenModelica software as an example to illustrate the method of the present invention. The target machine used was the RTScale real-time target machine developed and manufactured by our company, and the XCP Master software used was InScope software developed by our company. InScope software and its instructions can be downloaded from our official website.
[0047] Example 1
[0048] The present invention aims to propose a method for deploying an FMU model to a real-time target machine for real-time parameter calibration and data acquisition through the XCP protocol. Figure 1 , the method comprising:
[0049] Step 1: Cross-compile the FMU source code with the target machine runtime environment code.
[0050] In this embodiment, the OpenModelica Connection Editor (which supports drag-and-drop connections, significantly reducing the modeling threshold) is first used on the host computer to graphically build a model. The FMU model can be either a control model (such as a PID controller, state machine, etc., used to implement 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 of a three-phase induction motor drive is selected, such as Figure 2 After building the model, export it to FMU format in OpenModelica. The FMU standard has multiple versions, ranging from 1.0 to 3.0. This example uses FMU 2.0. After completing the modeling in OpenModelica, use the software's built-in functionality to encapsulate the model into an FMU format file (.fmu), such as InductionMachine.fmu.
[0051] exist Figure 2 In the example, ramp is a ramp generator that generates a voltage / frequency command that varies linearly over time (such as a voltage ramp during startup). This is used to simulate a motor's soft start process and avoid current surges caused by a direct full-voltage start. The duration below ramp sets the duration of the ramp signal from the initial value to the target value.
[0052] vfControl... (V / F controller) implements "voltage-frequency control," a common strategy for induction motor speed regulation. The input is a ramp signal output by the ramp; the output is a voltage command generated according to the V / F curve.
[0053] The signalVol... (controlled voltage source) + ground / star (reference ground and star connection) function simulates a three-phase power supply and converts the control signal output by vfControl... into a three-phase voltage that the motor can receive. The electrical connection "star" represents the star connection (also known as the Y connection) of the power winding, and "ground" is the reference ground, completing the electrical circuit.
[0054] The function of currentQ... (current measurement module) is to monitor the motor stator current in real time.
[0055] The aimc module in aimc (induction motor) + aimcData (induction motor parameter configuration) has a built-in induction motor mathematical model (such as T-type equivalent circuit and 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.).
[0056] In the loadInertia (load moment of inertia) + loadTorq... (load torque) formula, loadInertia simulates the load moment of inertia (parameter J = JLoad), which affects the motor's dynamic response (such as acceleration and deceleration time); loadTorq... simulates the load torque and tests the motor's load capacity.
[0057] Figure 2 The core logic of the model is:
[0058] Control side: ramp→vfControl…generates voltage / frequency command;
[0059] Electrical side: The voltage / frequency command is converted into three-phase voltage via signalVol... to drive the aimc motor model;
[0060] Mechanical side: The motor outputs electromagnetic torque to overcome the loadInertia inertia and loadTorq resistance, which is ultimately reflected as motor speed / load speed;
[0061] Feedback side: currentQ... collects current and can be used for feedback control.
[0062] Unzip the exported InductionMachine.fmu file and you will see that it contains three folders: binaries, resources, and sources, as well as a file modelDescription.xml. The details are as follows: Table 1:
[0063] Table 1
[0064]
[0065] Cross-compile the FMU source code in the sources folder with the source code of the RTScale real-time target machine (such as the driver, task scheduler, 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 over the network for execution.
[0066] Step 2: Execute the initialization program of the executable file on the target machine to obtain the first address of the dynamically allocated target variables and parameters in the memory;
[0067] In this embodiment, the program 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:
[0068] Variables and parameters of data type real (double-precision floating point numbers) are stored in the realVars and realParameter arrays. These arrays are allocated memory addresses using malloc during FMU initialization. During a test run, RTScale executes the FMU initialization routine and obtains the first addresses of the realVars and realParameter arrays through pointers, writing them to the address.txt file:
[0069] realVars = 0x20003400; realParameter = 0x20003500.
[0070] Step 3: Generate an A2L file containing address mapping information based on the FMU model description file and the first address;
[0071] In this embodiment, after obtaining the address.txt file, the host parses the modelDescription.xml file and calculates the actual memory addresses of each parameter and variable. For example, a portion of the modelDescription.xml file is intercepted as follows:
[0072] <ScalarVariablename="aimc.idq_rr[1]"valueReference="0"description="Rotor space phasor current / rotor fixed frame"initial="exact">
[0073] <Realstart="0.0"unit="A" / >
[0074]
[0075] <ScalarVariablename="aimc.idq_rr[2]"valueReference="1"description="Rotor space phasor current / rotor fixed frame"initial="exact">
[0076] <Realstart="0.0"unit="A" / >
[0077]
[0078] It can be seen that the variables aimc.idq_rr[1] and aimc.idq_rr[2] are the dq axis currents of the induction motor rotor, and the corresponding valueReferences are 0 and 1 respectively. According to the formula:
[0079] address = initAddress + index*size
[0080] Where address represents the actual memory address of FMU variables and parameters, initAddress represents the first 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:
[0081] &aimc.idq_rr[0] = 0x20003400 + 0*8 = 0x20003400;
[0082] &aimc.idq_rr[1] = 0x20003400 + 1*8 = 0x20003408;
[0083] Write these two variables and addresses into the A2L file:
[0084] / begin MEASUREMENT
[0085] / * Name* / aimc.idq_rr[0]
[0086] / * Long identifier* / ""
[0087] / * Data type* / FLOAT64_IEEE
[0088] / * Conversion method* / fmu_CM_double
[0089] / * Resolution (Not used)* / 0
[0090] / * Accuracy (Not used)* / 0
[0091] / * Lower limit* / -1.7E+308
[0092] / * Upper limit* / 1.7E+308
[0093] ECU_ADDRESS0x20003400
[0094] / end MEASUREMENT
[0095] / begin MEASUREMENT
[0096] / * Name* / aimc.idq_rr[1]
[0097] / * Long identifier* / ""
[0098] / * Data type* / FLOAT64_IEEE
[0099] / * Conversion method* / fmu_CM_double
[0100] / * Resolution (Not used)* / 0
[0101] / * Accuracy (Not used)* / 0
[0102] / * Lower limit* / -1.7E+308
[0103] / * Upper limit* / 1.7E+308
[0104] ECU_ADDRESS0x20003408
[0105] / end MEASUREMENT
[0106] In this way, an A2L file containing address mapping information is obtained.
[0107] 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.
[0108] In this embodiment, the InductionMachine.elf executable file is actually run on the RTScale, and the InScope software is run on the host. Figure 3 The following screenshot shows the InScope software in action. The top of the software contains function buttons for loading, connecting, running, and adding waveforms to the FMU model. The left side of the software allows you to set the induction motor's operating parameters by adding and removing them. The right side of the software displays the three-phase current and motor angle waveforms 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 methods are prior art and are not the core technology of this invention, so they will not be detailed here.
[0109] Preferably, the FMU source code is generated by software that supports FMU, including but not limited to Matlab / Simulink, OpenModelica, MWORKS, PSCAD, etc. XCP Master software includes commercial software such as Vector and Simulink, as well as software developed by users and third parties that supports XCP Master.
[0110] For the convenience of understanding, the key professional terms of the present invention are supplemented with explanations:
[0111] 1. Functional Mock-Up Unit (FMU)
[0112] Definition: A model packaging format based on the Functional Mock-Up Interface (FMI) standard, used for model exchange and collaborative simulation between different simulation tools.
[0113] Technical features:
[0114] It can include control models, physical models, etc., and is generated by software such as Matlab / Simulink and OpenModelica.
[0115] Application of the present invention: FMU manages variable storage through dynamic memory allocation (such as malloc), which needs to be adapted to the static memory mapping mechanism of the XCP protocol.
[0116] 2. XCP Protocol (Universal Measurement and Calibration Protocol)
[0117] Definition: A standardized protocol for real-time measurement and calibration of electronic control units (ECUs), supporting high-speed data transmission and parameter modification.
[0118] Technical core:
[0119] The A2L file describes the memory address, data type and other information of the variable, enabling direct access to the ECU memory.
[0120] Includes Master / Slave architecture: the host runs XCP Master (such as Vector, InScope), and the target machine runs XCP Slave (XCP slave device).
[0121] Challenges in the present invention: Traditional XCP is only applicable to statically compiled code and cannot directly handle the dynamic memory allocation of FMU.
[0122] 3.A2L file
[0123] Definition: A text file that complies with the ASAP2 standard and is used to describe the memory mapping relationship of variables in the ECU or target machine.
[0124] In the present invention, the A2L file is generated by parsing the modelDescription.xml of the FMU and combining it with the memory first address, which is the core basis of the XCP protocol communication.
[0125] 4. Real-time Target Machine
[0126] Definition: A computer hardware device that executes a simulation model at a fixed cycle, ensuring strict determinism of the computational timing.
[0127] Technical features:
[0128] 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.
[0129] The present invention adopts RTScale target machine to run the executable file generated by FMU cross compilation.
[0130] 5. Cross Compilation
[0131] Definition: Compile on the host to generate code that can be run on the target machine. The hardware architecture or operating system of the target machine may be different from that of the host.
[0132] Effects of the present invention:
[0133] 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 of the FMU model with the target machine system.
[0134] 6. Dynamic Memory Allocation
[0135] Definition: A mechanism for dynamically allocating memory space through functions such as malloc and calloc when a program is running, as opposed to static memory allocated at compile time.
[0136] Impact of the present invention:
[0137] FMU manages the memory space occupied by variables and parameters through dynamic memory allocation, which causes the variable address to be determined at runtime. This is incompatible with the static memory address that XCP relies on, and needs to be resolved by obtaining the first address through a trial run.
[0138] 7. Identifier (valueReference)
[0139] Definition: An integer value used to uniquely identify a variable in the FMU model description file (modelDescription.xml), similar to the variable's "index".
[0140] Application of the present invention:
[0141] The position of the variable in the array is calculated through valueReference (such as valueReference=1 of aimc.idq_rr[1]), and the actual memory address (address=initAddress+index*size) is derived by combining the memory first address and the number of bytes of the data type.
[0142] 8.ECU Calibration
[0143] Definition: Adjust and optimize the parameters in the electronic control unit (ECU) to adapt to different operating conditions (such as engine ignition timing, injection parameters, etc.).
[0144] Technical requirements: It is necessary to access the variable addresses in the ECU memory in real time through the XCP protocol, but the FMU API access method cannot meet this requirement. The present invention extracts the memory first address of the FMU variable array through a trial run and generates the corresponding A2L file to meet this requirement.
[0145] 9. ELF file (Executable and Linkable Format)
[0146] Definition: A standard format for executable files and object files, containing information such as code, data, and memory layout.
[0147] Application of the present invention: The InductionMachine.elf executable file generated by cross-compilation can be directly loaded and run on the RTScale target machine.
[0148] 10.API (Application Programming Interface)
[0149] Definition: The interface between software components, which realizes functional interaction through function calls.
[0150] Application of the present invention: FMU accesses variables through standardized APIs (such as fmi2GetReal and fmi2SetReal), but this method cannot directly obtain memory addresses and needs to be converted into address-level access supported by XCP through the solution of the present invention.
[0151] 11. OpenModelica
[0152] Definition: Open-source multi-domain system modeling and simulation software that supports the equation-based modeling language (Modelica) and is compatible with the FMI standard.
[0153] Application of the present invention:
[0154] Use the graphical tool OpenModelica Connection Editor to build a three-phase induction motor model (such as Figure 2 );
[0155] When exporting FMU format files, C language source code (located in the sources folder) and modelDescription.xml description file are automatically generated.
[0156] 12. Vector Software
[0157] Positioning: Industrial-grade ECU development tools, including CANoe, CANape and other software, supporting the XCP protocol.
[0158] Compatibility of the present invention: "Vector" can be used as an alternative to InScope to calibrate the FMU model by importing the A2L file generated by the present invention.
[0159] Example 2
[0160] Based on the same concept, the present invention also proposes 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, comprising:
[0161] a host device configured to execute the method of embodiment 1;
[0162] Real-time target machine with executable file running environment and XCP slave device module;
[0163] A communication link connecting a host device and a real-time target machine.
[0164] Example 3
[0165] This embodiment also provides an electronic device, referring to Figure 4 , includes a memory 404 and a processor 402, wherein the memory 404 stores a computer program, and the processor 402 is configured to run the computer program to perform the steps in any of the above method embodiments.
[0166] Specifically, the processor 402 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits for implementing the embodiments of the present invention.
[0167] Memory 404 may include a large-capacity memory 404 for data or instructions. By way of example, and not limitation, memory 404 may include a hard disk drive (HDD), a floppy disk drive, a solid-state drive (SSD), 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. Where appropriate, memory 404 may include removable or non-removable (or fixed) media. Where appropriate, memory 404 may be internal or external to the data processing device. In certain embodiments, memory 404 is non-volatile memory. In certain embodiments, memory 404 includes read-only memory (ROM) and random access memory (RAM). Where appropriate, 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 (FLASH), or a combination of two or more of these. In appropriate circumstances, the RAM may be a static random access memory (SRAM) or a dynamic random access memory (DRAM), wherein the DRAM may be a fast page mode dynamic random access memory 404 (FPMDRAM), an extended data output dynamic random access memory (EDODRAM), a synchronous dynamic random access memory (SDRAM), etc.
[0168] The memory 404 may 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 .
[0169] The processor 402 reads and executes computer program instructions stored in the memory 404 to implement any one of the methods in the above embodiments for deploying the FMU model to a real-time target machine through the XCP protocol for real-time parameter calibration and data acquisition.
[0170] Optionally, the 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 .
[0171] Transmission device 406 can be used to receive or transmit data via a network. Specific examples of such networks may include wired or wireless networks provided by the electronic device's communications provider. In one embodiment, the transmission device includes a network interface controller (NIC), which can be connected to other network devices via a base station to enable communication with the Internet. In another embodiment, transmission device 406 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0172] The input / output device 408 is used to input or output information.
[0173] Example 4
[0174] This embodiment also provides a readable storage medium, which stores a computer program. The computer program includes program code for controlling a process to execute a process. The process includes 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 according to the first embodiment.
[0175] It should be noted that the specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementation modes, and this embodiment will not be repeated here.
[0176] In general, various embodiments may be implemented in hardware or dedicated circuitry, software, logic, or any combination thereof. Some aspects of the invention may be implemented in hardware, while other aspects may be implemented in firmware or software executed by a controller, microprocessor, or other computing device, but the invention is not limited thereto. Although various aspects of the invention may be shown and described as block diagrams, flow charts, or using some other graphical representation, it should be understood that, as non-limiting examples, the blocks, devices, systems, techniques, or methods described herein may be implemented in hardware, software, firmware, dedicated circuitry or logic, general-purpose hardware or a controller or other computing device, or some combination thereof.
[0177] The embodiments of the present invention may be implemented by computer software that 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. Computer software or programs (also referred to as program products) including software routines, applets and / or macros may be stored in any device-readable data storage medium, and they include program instructions for performing specific tasks. A computer program product may include one or more computer executable components that are configured to perform an embodiment when the program is run. One or more computer executable components may be at least one software code or a portion thereof. In addition, it should be noted at this point that, for example, Figure 1 Any block of the logic flow in the program may represent program steps, or interconnected logic circuits, blocks and functions, or a combination of program steps and logic circuits, blocks and functions. The software may be stored on physical media such as memory chips or memory 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, etc. Physical media are non-transitory media.
[0178] Those skilled in the art should understand that the technical features of the above embodiments can be combined arbitrarily. In order to make the description concise, 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, they should be considered to be within the scope of this specification.
[0179] The above embodiments merely illustrate several embodiments of the present invention, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that a person skilled in the art would be able to make various modifications and improvements without departing from the spirit of the present invention, all of which fall within the scope of the present invention. Therefore, the scope of the present invention shall be determined by 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: The following steps are involved: Cross-compile the FMU source code with the target machine runtime environment code to generate an executable file; Executing the initialization program of the executable file on the target machine, obtaining the first address of the dynamically allocated target variables and parameters in the memory by calling the memory allocation function in the FMU initialization program and accessing through the pointer; Generate an A2L file containing address mapping information based on the FMU model description file and the first address; The main control device performs real-time parameter calibration and data acquisition on the FMU model running on the target machine based on the A2L file and the XCP protocol.
2. The method according to claim 1, wherein Generating the A2L file includes: Parsing the model description file to extract identifiers and data types of variables and parameters; Determine the index of the variable and parameter in the array according to the identifier; Calculate the actual memory addresses of variables and parameters based on the memory first address, the number of bytes occupied by the data type and the index; Write the names of variables and parameters and their actual memory addresses according to the A2L file format.
3. The method according to claim 2, wherein The calculation of the actual memory address should be made according to the address mapping rules of the modeling software that generates the FMU; for a class of modeling software including OpenModelica, the calculation formula is: address=initAddress+index*size Where initAddress is the first address of the memory, index is the array index, and size is the number of bytes occupied by the data type.
4. The method according to claim 1, wherein Running the executable file on the target machine, wherein the XCP Slave program is embedded; The XCP Master software on the main control device is used to perform real-time parameter calibration and data acquisition on the FMU model based on the A2L file.
5. The method according to claim 4, wherein The XCP Master software includes Vector, Simulink or custom-developed software supporting the XCP protocol.
6. The method according to any one of claims 1 to 5, 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.
7. 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, characterized in that: include: A main control device configured to execute the method according to any one of claims 1 to 6; Real-time target machine with executable file running environment and XCP slave device module; A communication link connecting the main control device and the real-time target machine.
8. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to run the computer program to perform the method according to any one of claims 1 to 6.
9. A readable storage medium, characterized in that: The readable storage medium stores a computer program therein, wherein the computer program includes a program code for controlling a process to execute a process, wherein the process includes the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Vehicle control parameter calibration method and device, electronic equipment and storage medium
CN117519114A