Bus data interaction method and device, equipment and medium

By creating target service function blocks in programmable logic devices under the IEC61499 standard, parsing and matching data frames of custom CAN bus protocols, the communication problem between custom CAN protocol devices and PLCs of different manufacturers is solved, and efficient and stable data interaction and processing is achieved.

CN119945827APending Publication Date: 2025-05-06HNAC TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510073577.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-17
Publication Date
2025-05-06

AI Technical Summary

Technical Problem

Under the IEC61499 standard, there is a lack of a general method to access data using custom CAN bus protocols from different manufacturers into the programmable control logic of the PLC, making communication between the programmable logic device and the custom CAN protocol device difficult to achieve.

Method used

By creating target service function blocks in programmable logic devices, creating communication threads using preset configuration files to listen to bus events, parsing the CANID field in the custom bus protocol, determining the application frame format and matching the target application function, storing data frames to the corresponding buffer area and generating reported events.

Benefits of technology

The communication between programmable logic devices and custom CAN protocol devices is realized, which improves the operating efficiency and fault tolerance of the system, reduces CPU consumption, and improves communication and logic processing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119945827A_ABST
    Figure CN119945827A_ABST
Patent Text Reader

Abstract

The invention discloses a bus data interaction method and device, equipment and a medium, relates to the technical field of communication, is applied to a target service function block in programmable logic equipment, the target service function block is packaged based on the IEC61499 standard, and the method comprises the following steps: creating a communication thread to monitor an event on a bus after local configuration is successful based on a preset configuration file, if the data frame sent by any bus device is monitored, analyzing a CANID field in the data frame based on a user-defined bus protocol of any bus device to obtain a domain division result of the target extension frame; traversing an application frame format in a preset configuration file to determine a target application function matched with each domain field attribute in the domain division result; and storing the data frame to a pre-created cache region corresponding to the target application function, and generating a report event to a programmable logic program, so that the programmable logic program executes a data processing operation corresponding to the target application function based on data in the cache region.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of communication technology, and in particular to a bus data interaction method, device, equipment and medium. Background Art

[0002] With the development of the industrial control field, the devices are diversified and the communication protocols are different. There is an urgent need for a method that can be compatible with multiple custom CAN (Controller Area Network) protocols and achieve efficient data interaction.

[0003] At present, the traditional programmable logic devices based on the IEC61131-3 standard mainly realize CAN bus data interaction, and use the CANOpen protocol as the standard. Although it has the advantage of universality, it also has the following shortcomings: 1. Non-standard CAN protocols are difficult to access: Since the application layer protocol of the CAN bus has not been standardized, considering the development cost, development cycle, and high requirements for equipment performance of the complete implementation of the standard CANOpen protocol, a large number of manufacturers have developed equipment such as sensors, protection controllers, and IO devices, which all use simplified and proprietary CAN protocols for data transmission. Therefore, unless the PLC (Programmable Controller, Programmable Logic Controller) manufacturer develops a protocol specifically for non-standard equipment, it is difficult for the customized CAN bus protocol to be connected to the IEC61131-3 standard PLC. 2. As the IEC61499 standard becomes a new standard widely used in the field of distributed industrial control, it can fully replace the IEC61131 standard. Under the IEC61499 open standard, there is a lack of a universal method to access data using customized CAN bus protocols of different manufacturers to the programmable control logic of the PLC.

[0004] In summary, under the IEC61499 standard, how to achieve communication between programmable logic devices and custom CAN protocol devices is a problem that needs to be solved. Summary of the invention

[0005] In view of this, the purpose of the present invention is to provide a bus data interaction method, device, equipment and medium, which can realize the communication between a programmable logic device and a custom CAN protocol device under the IEC61499 standard. The specific scheme is as follows:

[0006] In a first aspect, the present application discloses a bus data interaction method, which is applied to a target service function block in a programmable logic device, wherein the target service function block is a function block encapsulated based on the IEC61499 standard, and the method comprises:

[0007] After the local configuration is successfully performed based on the preset configuration file, a communication thread is created to monitor events on the bus. If a data frame sent by any bus device is detected based on the communication thread, the CANID field in the data frame is parsed based on the custom bus protocol of any bus device to obtain the domain division result of the target extended frame;

[0008] Determine the application frame format in the preset configuration file, and traverse the application frame format to determine the target application function that matches the attribute of each domain field in the domain division result; wherein the application frame format records the attribute parameters corresponding to different application functions;

[0009] The data frame is stored in a pre-created cache area corresponding to the target application function, and a target reporting event is generated to a programmable logic program so that the programmable logic program performs a data processing operation corresponding to the target application function based on the data in the cache area.

[0010] Optionally, the preset configuration file includes first configuration information of the programmable logic device, second configuration information of each bus device, third configuration information of a coupler used to connect the programmable logic device and each bus device, and fourth configuration information for dividing the CANID field; wherein the programmable logic device is connected to at least one of the couplers, and the coupler is connected to at least one bus device.

[0011] Optionally, the cache area corresponding to the target application function is a read cache area or a write cache area;

[0012] Correspondingly, after the local configuration is performed based on the preset configuration file, it also includes:

[0013] Determine an object array constructed based on the device object corresponding to each bus device, and traverse the preset configuration file to determine all data objects corresponding to each device object in the object array; wherein each of the data objects is used to characterize each application function of the device object, and the application frame format is constructed based on all of the data objects;

[0014] A read buffer area and a write buffer area corresponding to each device object are allocated based on the data size and read / write type of each data object.

[0015] Optionally, the attribute parameters of the target field corresponding to the data object in the preset configuration file include a field name attribute, a data type attribute, a data length attribute, a bus cycle count attribute, a data direction attribute and event type data; wherein the attribute value of the data direction attribute includes a first attribute value for characterizing a received frame and a second attribute value for characterizing a sent frame;

[0016] Accordingly, the read buffer area and the write buffer area corresponding to each device object are allocated based on the data size and read / write type of each data object, including:

[0017] For each of the data objects, the corresponding data size is calculated based on the byte width of the data type attribute and the data length attribute, and the corresponding read / write type is determined based on the attribute value of the data direction attribute; wherein, if the attribute value of the data direction attribute is the first attribute value, the corresponding read / write type is the read type, and if the attribute value of the data direction attribute is the second attribute value, the corresponding read / write type is the write type;

[0018] The read cache area is constructed based on the data size of all data objects whose read / write type is the read type, and the write cache area is constructed based on the data size of all data objects whose read / write type is the write type.

[0019] Optionally, traversing the application frame format to determine a target application function that matches the attributes of each domain field in the domain division result includes:

[0020] Determine a target device object corresponding to any one of the bus devices in the preset configuration file, and determine a target area corresponding to the target device object in the application frame format;

[0021] All data objects in the target area are traversed to determine a target data object that matches the attributes of each domain field in the domain division result, and an application function represented by the target data object is used as a target application function corresponding to the data frame.

[0022] Optionally, after allocating the read cache area and the write cache area corresponding to each device object based on the data size and the read / write type of each data object, the method further includes:

[0023] Record the first pointer information and offset information of the buffer area corresponding to each device object;

[0024] Accordingly, storing the data frame into a pre-created buffer area corresponding to the target application function includes:

[0025] Determine a target first pointer corresponding to any bus device, and determine a target offset corresponding to the data frame;

[0026] A cache area corresponding to the target application function is determined based on the target first pointer and the target offset, and the data frame is stored in the cache area corresponding to the target application function.

[0027] Optionally, the bus data interaction method further includes:

[0028] If a system downtime event is detected based on the communication thread, a preset resource cleanup operation is performed; wherein the resource cleanup operation includes shutting down each bus device, reclaiming memory resources, and shutting down the thread.

[0029] In a second aspect, the present application discloses a bus data interaction device, which is applied to a target service function block in a programmable logic device, wherein the target service function block is a function block encapsulated based on the IEC61499 standard, and the device comprises:

[0030] A parsing module, used for creating a communication thread after the local configuration is successfully performed based on the preset configuration file to monitor the events on the bus. If a data frame sent by any bus device is monitored based on the communication thread, the CANID field in the data frame is parsed based on the custom bus protocol of any bus device to obtain the domain division result of the target extended frame;

[0031] a function determination module, used to determine the application frame format in the preset configuration file, and traverse the application frame format to determine the target application function that matches the attribute of each domain field in the domain division result; wherein the application frame format records the attribute parameters corresponding to different application functions;

[0032] A reporting module is used to store the data frame in a pre-created cache area corresponding to the target application function, and generate a target reporting event to the programmable logic program so that the programmable logic program performs a data processing operation corresponding to the target application function based on the data in the cache area.

[0033] In a third aspect, the present application discloses an electronic device, comprising:

[0034] Memory, used to store computer programs;

[0035] The processor is used to execute the computer program to implement the steps of the aforementioned disclosed bus data interaction method.

[0036] In a fourth aspect, the present application discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, the steps of the aforementioned disclosed bus data interaction method are implemented.

[0037] It can be seen that the present application discloses a bus data interaction method for a target service function block in a programmable logic device, wherein the target service function block is a function block encapsulated based on the IEC61499 standard. After the local configuration is successfully performed based on the preset configuration file, the target service function block creates a communication thread to monitor events on the bus. If a data frame sent by any bus device is detected based on the communication thread, the CANID field in the data frame is parsed based on the custom bus protocol of any bus device to obtain the domain division result of the target extended frame; the application frame format in the preset configuration file is determined, and the application frame format is traversed to determine the target application function that matches the attributes of each domain field in the domain division result; wherein the application frame format records attribute parameters corresponding to different application functions; the data frame is stored in a pre-created cache area corresponding to the target application function, and a target reporting event is generated to the programmable logic program, so that the programmable logic program performs data processing operations corresponding to the target application function based on the data in the cache area.

[0038] Beneficial effect: The present application discloses a bus data interaction method for a target service function block in a programmable logic device, wherein the target service function block is specifically a function block encapsulated based on the IEC61499 standard. Specifically, after the local configuration is successfully performed based on the preset configuration file, a communication thread needs to be created to use the communication thread to monitor events on the bus. By creating an independent communication thread, CAN communication and programmable logic processing can be performed concurrently. In the process of monitoring events on the bus, the execution of other program logics will not be blocked, thereby improving the overall operating efficiency of the system. That is, mutual interference with programmable logic processing is avoided, the stability and reliability of communication are improved, and at the same time, it is also conducive to separate processing of communication errors and abnormal situations, and enhancing the fault tolerance of the system. Further, bus devices of different manufacturers can encapsulate the collected data into data frames according to their custom bus protocols and send them to the bus, which specifically includes the division of target extension frames. Therefore, if a data frame sent by any bus device is monitored based on the communication thread, the target service function block needs to decapsulate the CANID field in the data frame according to the custom bus protocol of the bus device to obtain the domain division result of the target extension frame. Then, this application also needs to match based on the application frame format in the preset configuration file. The application frame format records the attribute parameters corresponding to different application functions. This application mainly traverses the application frame format to determine the target application function that matches the attributes of each domain field in the domain division result, that is, to determine the functional type of the data frame, so that the programmable logic program can perform targeted data processing later. After the match is successful, the data frame is stored in a pre-created cache area corresponding to the target application function, and a target reporting event is generated to the programmable logic program, so that the programmable logic program performs data processing operations corresponding to the target application function based on the data in the cache area. That is, the target service function block uses multi-threading to separate CAN communication and programmable logic. After the data copy is completed, it is necessary to actively generate a target reporting event to the programmable logic program. At this time, the programmable logic starts to execute the relevant data processing logic, which reduces CPU consumption and improves communication and logic processing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.

[0040] Figure 1 A flow chart of a bus data interaction method disclosed in this application;

[0041] Figure 2A schematic diagram of a topological relationship disclosed in this application;

[0042] Figure 3 A specific bus data interaction method flow chart disclosed in this application;

[0043] Figure 4 A schematic diagram of a bus data interaction process disclosed in this application;

[0044] Figure 5 A schematic diagram of a read buffer area disclosed in this application;

[0045] Figure 6 This is a schematic diagram of the structure of a bus data interaction device disclosed in this application;

[0046] Figure 7 This is a structural diagram of an electronic device disclosed in this application. DETAILED DESCRIPTION

[0047] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present invention, not 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.

[0048] At present, the traditional programmable logic devices based on the IEC61131-3 standard mainly realize CAN bus data interaction, and use the CANOpen protocol as the standard. Although it has the advantage of universality, it also has the following shortcomings: 1. Non-standard CAN protocols are difficult to access: Since the application layer protocol of the CAN bus has not been standardized, considering the development cost, development cycle, and high requirements for equipment performance to fully implement the standard CANOpen protocol, a large number of manufacturers have developed equipment such as sensors, protection controllers, and IO devices, which all use simplified and proprietary CAN protocols for data transmission. Therefore, unless the PLC manufacturer develops a protocol specifically for non-standard equipment, it is difficult for the customized CAN bus protocol to be connected to the IEC61131-3 standard PLC. 2. As the IEC61499 standard becomes a new standard widely used in the field of distributed industrial control, it can fully replace the IEC61131 standard. Under the IEC61499 open standard, there is a lack of a universal method to access data using customized CAN bus protocols from different manufacturers to the programmable control logic of the PLC.

[0049] To this end, the embodiments of the present application disclose a bus data interaction method, apparatus, device and medium, which can realize communication between a programmable logic device and a custom CAN protocol device under the IEC61499 standard.

[0050] See also Figure 1 As shown, an embodiment of the present application discloses a bus data interaction method, which is applied to a target service function block in a programmable logic device, wherein the target service function block is a function block encapsulated based on the IEC61499 standard, and the method comprises:

[0051] Step S11: After the local configuration is successfully completed based on the preset configuration file, a communication thread is created to monitor events on the bus. If a data frame sent by any bus device is monitored based on the communication thread, the CANID field in the data frame is parsed based on the custom bus protocol of any bus device to obtain the domain division result of the target extended frame.

[0052] In this embodiment, a function block is pre-encapsulated based on the IEC61499 standard, namely the target service function block, named BM_CANBUS. The IEC61499 standard stipulates that the header of the function block is the input and output event, and the bottom of the function block is the input and output data associated with the event. Once an event is triggered, the data associated with it becomes valid. Various algorithm logics are implemented inside the function block, which is triggered and called by the input event. After the algorithm logic is completed, the event and its associated data are output.

[0053] In addition, to facilitate the description of the implementation principle of the solution, the following article takes Schneider's IEC61499 development environment (IDE) EcoStruxure Automation Expert (hereinafter referred to as EAE) as an example. However, the implementation mechanism of this solution is not limited to EAE, as long as the development environment supports the IEC61499 standard. The EAE development environment provides a visual editing method to connect various function blocks of the IEC61499 standard into a function block network, that is, a PLC application program, by connecting event pins to event pins and data pins to data pins. The function block network is triggered based on events to realize programming logic control.

[0054] First, after the target service function block successfully configures the local configuration based on the preset configuration file, it needs to create a communication thread to use the communication thread to monitor the events on the bus. By creating an independent communication thread, CAN communication and programmable logic processing can be carried out concurrently. In the process of monitoring the events on the bus, the execution of other program logic will not be blocked, thereby improving the overall operation efficiency of the system. In other words, it avoids mutual interference with programmable logic processing, improves the stability and reliability of communication, and is also conducive to separate processing of communication errors and abnormal situations, enhancing the fault tolerance of the system. Furthermore, bus devices from different manufacturers can encapsulate the collected data into data frames according to their custom bus protocols and send them to the bus, specifically including the division of the target CAN extended frame ID. Therefore, if the data frame sent by any bus device is monitored based on the communication thread, the target service function block needs to decapsulate the CANID field in the data frame according to the custom bus protocol of the bus device to obtain the domain division result of the target extended frame.

[0055] In addition, the above method further includes: if a system downtime event is detected based on the communication thread, a preset resource cleanup operation is performed; wherein the resource cleanup operation includes shutting down each bus device, reclaiming memory resources, and shutting down threads. That is, if a system downtime event (INIT and QI=FALSE) is detected, system resources are cleaned up, including shutting down each bus device, reclaiming memory resources, shutting down threads, etc.

[0056] In a specific implementation, the preset configuration file includes the first configuration information of the programmable logic device, the second configuration information of each bus device, the third configuration information of the coupler for connecting the programmable logic device and each bus device, and the fourth configuration information for dividing the CANID field; wherein the programmable logic device is connected to at least one of the couplers, and the coupler is connected to at least one bus device. First of all, it should be pointed out that the preset configuration file in this embodiment is defined in XML format and named BM_CANBUS.xml, which mainly includes the configuration information of the programmable logic device, each bus device, and the coupler, as well as the configuration information of the CANID field division, and also includes the parameters of bus communication, frame format information, and topology information between the programmable logic device, each bus device and the coupler.

[0057] First, the topological relationship between programmable logic devices, bus devices and couplers is introduced: For any data bus, EAE defines three general bus function blocks, namely BusMaster, BusCoupler and BusDevice, and all three function blocks are service interface function blocks SFB. Similar to the master-slave structure concept of the physical bus, a master station (BusMaster) can communicate with multiple couplers (BusCoupler), and multiple IO slave devices (BusDevice) can be hung under a coupler. In this embodiment, the master station refers to the programmable logic device, and the slave station refers to the bus device, that is, a coupler uses a specific format of CAN protocol to communicate with different manufacturers' devices (BusDevice) that support this CAN protocol on the CAN bus. The above three SFBs are software simulations of three entities in the physical bus, and are only a concept borrowing, and do not strictly correspond to real physical devices. For example: multiple logical devices with different functions can be hung down to a virtual coupler BusCoupler, or a real physical device can be decomposed into multiple BusDevices according to logical functions. The topology diagram can be used to intuitively describe the relationship between the three functional blocks and the corresponding logical devices, such as Figure 2 as shown in . Figure 2 In the master station, N logical couplers are used to support N custom protocol formats to access slave devices. The total number of slave devices is determined by the application site, but cannot exceed the upper limit of CAN bus 110 devices. To implement CAN bus data access with custom protocols, the GenBusMaster base class must be inherited and implemented. This class is the base class of BusMaster SFB, so a new subclass needs to be defined to re-implement the initialization interface of GenBusMaster.

[0058] In addition, a complete preset configuration file format is as follows:

[0059] <?xml version="1.0" encoding="utf-8"?>

[0060] <busmaster xmlns:xsi="http: / / www.w3.org / 2001 / XMLSchema-instance"xmlns:xsd="http: / / www.w3.org / 2001 / XMLSchema" name="UAP_BM_CANBUS" mastertype="master" busId="UAP_BM_CANBUS" stationid="1" busCycle="80" interframeDelay="10">

[0061] <buscoupler name="UAP_BC_HCFR" type="HCFRv2.0">

[0062] <canbus name="CAN0" port="CAN0" baudrate="125Kbps" standard="CAN-FD" / > <canid count="6">

[0063] <canidfield name="frameSN" length="4" match="false" / >

[0064] <canidfield name="group" length="3" match="true" / >

[0065] <canidfield name="extInfo" length="3" match="true" / >

[0066] <canidfield name="destID" length="7" match="false" / >

[0067] <canidfield name="srcID" length="7" match="false" / >

[0068] <canidfield name="funcCode" length="5" match="true" / >

[0069] < / canid>

[0070] <busdevice name="CAN_ACDC" stationid="4">

[0071] <busframe name="AnalogIn" funcCode="4" extInfo="0" group="0" dataType="INT" length="32" cyclecount="1" direct="recv" ioevent="cyclic" / >

[0072] <busframe name="DigtalIn" funcCode="3" extInfo="0" group="0" dataType="BOOL" length="64" cyclecount="1" direct="recv" ioevent="cyclic" / >

[0073] <busframe name="HeartBeat" funcCode="1" extInfo="0" group="0" dataType="NONE" length="0" cyclecount="1" direct="send" ioevent="cyclic" / >

[0074] <busframe name="PortVoltage" funcCode="5" extInfo="0" group="0" dataType="INT" length="1" cyclecount="1" direct="recv" ioevent="cyclic" / >

[0075] <busframe name="MainChanVoltage" funcCode="6" extInfo="0" group="0" dataType="REAL" length="1" cyclecount="1" direct="recv" ioevent="cyclic" / >

[0076] <busframe name="SetPortVoltage" funcCode="8" extInfo="0" group="0" dataType="REAL" length="1" cyclecount="1" direct="send" ioevent="requuest" / >

[0077] <busframe name="SetParameters" funcCode="9" extInfo="0" group="0" dataType="REAL" length="1" direct="send" ioevent="request" / >

[0078] < / busdevice>

[0079] <busdevice name="CAN_TEMP" stationid="3">

[0080] <busframe name="RunTempature" funcCode="3" extInfo="0" group="0" dataType="INT" length="4" cyclecount="1" direct="recv" ioevent="cyclic" / >

[0081] < / busdevice>

[0082] <busdevice name="CAN_TESTEQUIP" stationid="5">

[0083] <busframe name="CAN_STEP1" funcCode="3" extInfo="0" group="0" dataType="INT" length="4" cyclecount="1" direct="send" ioevent="requuest" / >

[0084] < / busdevice>

[0085] < / buscoupler>

[0086]

[0087] The meanings of its main fields and attributes are as follows:

[0088] <busmaster>The field represents the information of the master station. The main attributes include the master station number (stationid), bus identifier (busId), bus cycle (busCycle), interframe interval (interframeDelay), etc. All times are in ms. There can only be one busmaster node in a configuration file.

[0089] <buscoupler>The field is used to represent "coupler". The main attributes are name and coupler type. Multiple slave devices can be connected to the same coupler and use the same custom CAN protocol to communicate with the master. A busmaster can have multiple buscoupler nodes, that is, it supports substation access of multiple protocols. Each buscouper represents a protocol. All substations of the same protocol only need to be divided into the corresponding buscoupler.

[0090] <canbus>The field is used for CAN interface information. The main attributes are CAN interface name (name), port name (port), baud rate (baudrate) and CAN standard (CAN-FD). The number of CAN interfaces is consistent with the number of physical CAN interfaces on the PLC device. Generally, a group of devices with the same communication protocol use the same CAN bus interface to communicate.

[0091] <canid>The field is used to describe how the 29bit of the CAN2.0B extended frame is defined and allocated. The manufacturer's custom protocol will divide this segment into multiple segments to represent it. Therefore, this segment uses the count attribute and the domain field (canidField) to flexibly configure the division of CANID. As shown in the example, it is assumed that the protocol of manufacturer A divides the 29 bits of CANID into 6 domains, and the bits from low to high are: frame sequence number (frameSN) occupies 4 bits, array group number (group) occupies 3 bits, extended information (extInfo) occupies 3 bits, destination station address (destID), source station address (srcID) occupies 7 bits respectively, that is, the bus can support up to 127 stations to communicate. There is also a function code (funcCode) that occupies 5 bits. Through the combination of count and canidField (name and length), the arbitrary division of the manufacturer's custom protocol can be supported. The match attribute is used to indicate whether this field is used for matching, and is used to match and extract application data frames in the CAN protocol processing flow.

[0092] <busdevice>The field is a summary of the slave information. Each slave has its own name (name) and station address (stationid). The data collected by this device is often classified and described. This scheme is called <busframe>Corresponding to the data frame of the application protocol layer, in this embodiment, the data with the same function code is classified into one category. <busframe>A device has a series of data frames that completely represent all the data on the device. <busframe>The main attributes of the field are: field name (name), CANID domain matching information (composed of several domain fields defined in the canid domain, used for data frame matching), target data type (dataType), data length (length), bus cycle count (cyclecount), data direction (direct) and event type (ioevent). For ease of understanding, the configuration file fields correspond one-to-one to the objects in the software implementation, such as <busmaster>Corresponding to the implemented BusMaster class object, they are conceptually equivalent and will not be described in detail below.

[0093] The above configuration file describes the access of a manufacturer's custom protocol. If you want to access another manufacturer B's protocol under the master station, you only need to add another buscoupler node under the busmaster node. For example, manufacturer B divides the 29 bits of CANID into 4 domains, and the length of each domain is different. At this time, you only need to configure it as required. The protocol frame of the device under the buscoupler is also divided according to the specification of manufacturer B. The principle is similar. Through the above configuration, multiple manufacturers' devices can be unified into this communication framework for processing.

[0094] Step S12: Determine the application frame format in the preset configuration file, and traverse the application frame format to determine the target application function that matches the attributes of each domain field in the domain division result; wherein the application frame format records attribute parameters corresponding to different application functions.

[0095] In this embodiment, it is also necessary to match based on the application frame format in the preset configuration file. The application frame format records the attribute parameters corresponding to different application functions. This application mainly traverses the application frame format to determine the target application function that matches the attributes of each domain field in the domain division result, that is, to determine the functional type of the data frame, so that the programmable logic program can perform targeted data processing later.

[0096] Step S13: storing the data frame into a pre-created cache area corresponding to the target application function, and generating a target reporting event to the programmable logic program so that the programmable logic program performs a data processing operation corresponding to the target application function based on the data in the cache area.

[0097] In this embodiment, after the match is successful, the data frame is stored in a pre-created buffer corresponding to the target application function, and a target reporting event is generated to the programmable logic program, so that the programmable logic program performs the data processing operation corresponding to the target application function based on the data in the buffer. That is, the target service function block uses multi-threading to separate CAN communication and programmable logic. After the data copy is completed, it is necessary to actively generate a target reporting event to the programmable logic program, at which time the programmable logic starts to execute the relevant data processing logic, reducing CPU consumption and improving communication and logic processing efficiency.

[0098] It can be seen that the present application discloses a bus data interaction method for a target service function block in a programmable logic device, and the target service function block is specifically a function block encapsulated based on the IEC61499 standard. Specifically, after the local configuration is successfully performed based on the preset configuration file, a communication thread needs to be created to use the communication thread to monitor the events on the bus. By creating an independent communication thread, CAN communication and programmable logic processing can be performed concurrently. In the process of monitoring the events on the bus, the execution of other program logics will not be blocked, thereby improving the overall operating efficiency of the system. That is, mutual interference with programmable logic processing is avoided, the stability and reliability of communication are improved, and at the same time, it is also conducive to separate processing of communication errors and abnormal situations, and enhancing the fault tolerance of the system. Further, bus devices of different manufacturers can encapsulate the collected data into data frames according to their custom bus protocols and send them to the bus, which specifically includes the division of the target extension frame. Therefore, if a data frame sent by any bus device is monitored based on the communication thread, the target service function block needs to decapsulate the CANID field in the data frame according to the custom bus protocol of the bus device to obtain the domain division result of the target extension frame. Then, this application also needs to match based on the application frame format in the preset configuration file. The application frame format records the attribute parameters corresponding to different application functions. This application mainly traverses the application frame format to determine the target application function that matches the attributes of each domain field in the domain division result, that is, to determine the functional type of the data frame, so that the programmable logic program can perform targeted data processing later. After the match is successful, the data frame is stored in a pre-created cache area corresponding to the target application function, and a target reporting event is generated to the programmable logic program, so that the programmable logic program performs data processing operations corresponding to the target application function based on the data in the cache area. That is, the target service function block uses multi-threading to separate CAN communication and programmable logic. After the data copy is completed, it is necessary to actively generate a target reporting event to the programmable logic program. At this time, the programmable logic starts to execute the relevant data processing logic, which reduces CPU consumption and improves communication and logic processing efficiency.

[0099] See also Figure 3 and Figure 4 As shown, the embodiment of the present application discloses a specific bus data interaction method. Compared with the previous embodiment, this embodiment further illustrates and optimizes the technical solution. Specifically, it includes:

[0100] Step S21: After the local configuration is successfully performed based on the preset configuration file, a communication thread is created to monitor events on the bus. If a data frame sent by any bus device is monitored based on the communication thread, the CANID field in the data frame is parsed based on the custom bus protocol of any bus device to obtain the domain division result of the target extended frame.

[0101] In this embodiment, when the programmable logic device is started, the INIT event (initialization event) is triggered and the associated input data QI is true. The target service function block performs initialization work under the INIT event, mainly completing the creation of class member objects, such as: CAN handle processing object, setting the bus BUS_ID, and outputting the INITO event after correct initialization and associating QO with true. If the initialization fails, the INITO event is output and associated with QO with false.

[0102] When all function block networks of the programmable logic device are initialized, the CONFIG event (configuration event) is triggered, and the target service function block completes the local configuration under the CONFIG event. The main tasks are: complete the reading of the XML format configuration file BM_CANBUS.xml, parse the master station CAN bus communication parameters including: CAN port name, baud rate, master station address, CAN bus standard, etc.; parse the extended frame header field (canidField) information; parse the slave station address; slave station device information and data frame format. If there is an error in the configuration file, print the error information, output the CONFIGO event and associate the error information.

[0103] Furthermore, after the local configuration is based on the preset configuration file, it also includes: determining an object array constructed based on the device object corresponding to each bus device, and traversing the preset configuration file to determine all data objects corresponding to each device object in the object array; wherein each of the data objects is used to characterize each application function of the device object, and the application frame format is constructed based on all of the data objects; and allocating a read buffer area and a write buffer area corresponding to each device object based on the data size and read-write type of each of the data objects. That is, the embodiment of the present application needs to allocate a continuous section of memory for data object storage. Specifically, it is necessary to allocate a corresponding buffer area for the slave device (ie, the bus device), and generally divide the virtual device objects of the slave according to different station addresses. Among them, the object initialization reference BM_CANBUS.xml file <busdevice>The BusDevice object contains a group of logically related data objects, such as analog input, digital input, control command output, etc. Each data object has a specific type and length information. <busframe>The fields correspond one to one.

[0104] First, determine the object array constructed based on the device object corresponding to each bus device. The array subscript is the number of the BusDevice object, starting from 0 for quick indexing. Traverse the preset configuration file to determine all data objects corresponding to each device object in the object array, that is, traverse each <busdevice>The following <busframe>; Each data object <busframe>The application frame format is constructed based on all data objects to characterize the application functions of the device object. Then, the read buffer area and write buffer area corresponding to each device object are allocated based on the data size and read / write type of each data object.

[0105] It should be noted that the attribute parameters of the target field corresponding to the data object in the above-mentioned preset configuration file include a field name attribute, a data type attribute, a data length attribute, a bus cycle count attribute, a data direction attribute and an event type data; wherein the attribute value of the data direction attribute includes a first attribute value for characterizing a received frame and a second attribute value for characterizing a sent frame; accordingly, the read buffer area and the write buffer area corresponding to each device object are allocated based on the data size and read-write type of each data object, including: for each data object, the corresponding data size is calculated based on the byte width of the data type attribute and the data length attribute, and the corresponding read-write type is determined based on the attribute value of the data direction attribute; wherein, if the attribute value of the data direction attribute is the first attribute value, the corresponding read-write type is a read type, and if the attribute value of the data direction attribute is the second attribute value, the corresponding read-write type is a write type; the read buffer area is constructed based on the data size of all data objects whose read-write type is a read type, and the write buffer area is constructed based on the data size of all data objects whose read-write type is a write type.

[0106] According to the above-mentioned public configuration files, <busframe>The main attribute parameters of the field include field name, data type, data length, bus cycle count, data direction and event type, and the attribute value of the data direction attribute includes a first attribute value for characterizing the receiving frame, i.e., direct="recv", and a second attribute value for characterizing the sending frame, i.e., direct="send". Then, for each data read and write, the corresponding data size is calculated based on the byte width of its data type attribute and data length attribute, and the corresponding read and write type is determined based on the attribute value of the data direction attribute. Specifically, if the attribute value of the data direction attribute is the first attribute value, the corresponding read and write type is the read type, and if the attribute value of the data direction attribute is the second attribute value, the corresponding read and write type is the write type. Finally, a read buffer is constructed based on the data size of all data objects whose read and write type is the read type, and a write buffer is constructed based on the data size of all data objects whose read and write type is the write type. That is, taking BusDevice as a unit, direct="recv" is assigned to the receiving frame and is assigned to the read buffer; direct="send" is assigned to the sending frame and is assigned to the write buffer. The size is: data type (dataType) width * data length (length). For example, if the INT type occupies 4 bytes and the length is 32, the first unit is 128 bytes wide.

[0107] In a specific implementation, after allocating the read cache area and write cache area corresponding to each device object based on the data size and read / write type of each data object, the method further includes: recording the first pointer information and offset information of the cache area corresponding to each device object. That is, the units are closely arranged, and the read cache area of ​​the target service function block is as follows: Figure 5 as shown in . Figure 5 In the , each BusDevice retains a pointer to the first address of the data area, which is convenient for addressing when sending and receiving messages. The writing memory and reading memory processing methods are the same. That is, this application allocates a continuous memory for reading and writing, and arranges the read and write data of each device on the bus in a frame format, and records the first pointer and offset of each device, which is convenient for fast indexing of data.

[0108] After the memory is allocated, a communication thread is created. According to the CAN port and baud rate defined in the BM_CANBUS.xml file, the master device is defined, the bus device is turned on, and the communication thread is started to poll the CAN bus data events. The communication thread blocks the polling of CAN bus events and system shutdown events, waiting to receive data frames on the bus.

[0109] It should be pointed out that the custom bus protocol divides the CAN protocol stack into two layers: the data link layer and the application layer. If the communication thread detects a CAN bus read event, the data link layer reads the CAN2.0B frame from the corresponding bus device, extracts the 29-bit frame ID, and defines the information name and offset (i.e. <canid>In the field <canidfield>The deconstruction is realized by shifting and bit operation. Taking the preset configuration file in the above example as an example, the structure is: frameSN, group, extInfo, destID, srcID and funcCode. That is, the domain division result of the 29-bit CAN2.0B extended frame is obtained.

[0110] Step S22: Determine the application frame format in the preset configuration file; wherein the application frame format records attribute parameters corresponding to different application functions.

[0111] In this embodiment, the application frame format in the preset configuration file is determined to facilitate the subsequent matching process of the application layer message frame.

[0112] Step S23: determining a target device object corresponding to any one of the bus devices in the preset configuration file, and determining a target area corresponding to the target device object in the application frame format.

[0113] In this embodiment, the target device object corresponding to any bus device in the preset configuration file is first determined, that is, the BusDevice object equal to the slave stationid is found according to the deconstructed source station information srcID, and the target area corresponding to the target device object in the application frame format is determined, that is, the target area composed of all BusFrames corresponding to the target device is determined.

[0114] Step S24: traverse all data objects in the target area to determine the target data object that matches the domain field attributes in the domain division result, and use the application function represented by the target data object as the target application function corresponding to the data frame.

[0115] In this embodiment, all BusFrames are traversed to determine the target data objects that match the attributes of each domain field in the domain division result. The matching rule is: <busframe>The domain name and value pairs defined by the field are matched with the values ​​of the corresponding domains in the domain partitioning results. By default, <busframe>The matching is completed when the values ​​of all attribute domains in are equal. In addition, in the actual application process, <canidfield>The match flag in the byte array determines whether to ignore the match of a certain field. Taking the "AnalogIn" busframe as an example, a successful match requires that: funcCode=4, extInfo=0, and group=0 are all met, because the match flags of these three fields are all true. Then the application function represented by the matched target data object is used as the target application function corresponding to the data frame.

[0116] Step S25: storing the data frame into a pre-created cache area corresponding to the target application function, and generating a target reporting event to the programmable logic program so that the programmable logic program performs a data processing operation corresponding to the target application function based on the data in the cache area.

[0117] In this embodiment, after a successful match, the data frame is stored in a pre-created cache area corresponding to the target application function. From the above content, it can be seen that the cache area corresponding to the target application function is a read cache area or a write cache area, that is, if the communication thread monitors a bus read event, the corresponding data frame is stored in the read cache area; if the communication thread monitors a bus write event, the corresponding data frame is stored in the write cache area.

[0118] In a specific implementation, the above-mentioned storing the data frame into a pre-created cache area corresponding to the target application function includes: determining the target first pointer corresponding to any bus device, and determining the target offset corresponding to the data frame; determining the cache area corresponding to the target application function based on the target first pointer and the target offset, and storing the data frame into the cache area corresponding to the target application function. That is, after a successful match, the offset of the data frame is found, and the read-write data area corresponding to the bus device is found using the first pointer and the offset of the data frame, and according to the size of the data area (i.e., the product of the length and the byte width of dataType), the data is copied from the data area of ​​the CAN message to the memory area of ​​the target service function block. Among them, if <busframe>If the defined application data frame exceeds the 8-byte size of the CAN frame, the application layer will automatically cache and merge CAN frames according to the frameSN count until the complete application data frame is received, that is, the received data is exactly equal to the configured data area size.

[0119] Furthermore, when the data message of the application layer is completely received, the application layer will generate a system reporting event to notify the upper-layer programmable logic program, and continue to trigger the following process, that is, the programmable logic processing of the IEC61499 function block network, thereby reducing CPU consumption. In other words, before the data is ready, unlike the scanning execution logic of IEC61131-3, the programming logic of IEC61499 will not be triggered.

[0120] In addition, when data needs to be written to the CAN device, the programmable logic will generally copy the data to be written to the write buffer of the BusDevice according to the different application functions, and specify the station number and current device. The application layer of the CANBUS protocol processing object looks up <busframe>Write the definition of the data frame, find the offset, determine the data area, and program the logic to actively trigger the REQ event to complete the data transmission. Similar to the data reading process, when the application data frame length is greater than the 8-byte CAN frame size, the data link layer automatically performs buffering and framing processing and sends the data to the CAN bus. After processing the sending and receiving operations, the communication thread is started again to poll the CAN bus data events, that is, the thread executes in a loop until the system shutdown event is received and the resource cleanup operation is performed. The system shutdown event is generally triggered by associating a QI=false with the INIT event.

[0121] It should also be noted that the function block programmable logic defined in EAE is associated with the memory area opened by BusDevice through variable links. After a variable is associated with a memory address through name and type, any programmable logic can access and read and write. EAE can encapsulate the above hardware devices using custom protocols into a composite automation class CAT, which can add C# scripts to process the automatic generation of XML configuration files. As a reusable device object, it can be directly dragged and copied in EAE to achieve access to multiple devices, which is convenient for use.

[0122] For more specific processing procedures of the above steps S21 and S22, reference may be made to the corresponding contents disclosed in the above embodiments, which will not be described in detail here.

[0123] It can be seen that this application uses a configuration file in XML format to describe the communication parameter information of the device, and according to the protocol types of different manufacturers, the domain of the CAN extended frame ID is freely defined and divided, and the matching rules of each application frame format are defined at the same time. When receiving and sending CAN messages, the matching rules are applied to interact the message with the device read and write memory. The service function block uses multi-threading to separate CAN communication and programmable logic. Only when the CAN data is sent and received, it actively notifies the programmable logic layer in an event manner, thereby reducing CPU overhead and improving communication and logic processing efficiency. That is, this application creates a method for PLC equipment (master station) to communicate with custom CAN protocol equipment (slave station) under the IEC61499 open standard. The solution is flexible in configuration, simple and efficient, and solves the problem of connecting devices from different manufacturers with custom CAN application layer protocols to the IEC61499 standard PLC, and it is a universal access solution.

[0124] See also Figure 6 As shown, the embodiment of the present application discloses a bus data interaction device, which is applied to a target service function block in a programmable logic device, wherein the target service function block is a function block encapsulated based on the IEC61499 standard, and the device comprises:

[0125] The parsing module 11 is used to create a communication thread after the local configuration is successfully performed based on the preset configuration file to monitor the events on the bus. If a data frame sent by any bus device is monitored based on the communication thread, the CANID field in the data frame is parsed based on the custom bus protocol of any bus device to obtain the domain division result of the target extended frame;

[0126] A function determination module 12 is used to determine the application frame format in the preset configuration file, and traverse the application frame format to determine the target application function that matches the attribute of each domain field in the domain division result; wherein the application frame format records the attribute parameters corresponding to different application functions;

[0127] The reporting module 13 is used to store the data frame into a pre-created cache area corresponding to the target application function, and generate a target reporting event to the programmable logic program so that the programmable logic program performs a data processing operation corresponding to the target application function based on the data in the cache area.

[0128] It can be seen that the present application discloses a bus data interaction method for a target service function block in a programmable logic device, and the target service function block is specifically a function block encapsulated based on the IEC61499 standard. Specifically, after the local configuration is successfully performed based on the preset configuration file, a communication thread needs to be created to use the communication thread to monitor the events on the bus. By creating an independent communication thread, CAN communication and programmable logic processing can be performed concurrently. In the process of monitoring the events on the bus, the execution of other program logics will not be blocked, thereby improving the overall operating efficiency of the system. That is, mutual interference with programmable logic processing is avoided, the stability and reliability of communication are improved, and at the same time, it is also conducive to separate processing of communication errors and abnormal situations, and enhancing the fault tolerance of the system. Further, bus devices of different manufacturers can encapsulate the collected data into data frames according to their custom bus protocols and send them to the bus, which specifically includes the division of the target extension frame. Therefore, if a data frame sent by any bus device is monitored based on the communication thread, the target service function block needs to decapsulate the CANID field in the data frame according to the custom bus protocol of the bus device to obtain the domain division result of the target extension frame. Then, this application also needs to match based on the application frame format in the preset configuration file. The application frame format records the attribute parameters corresponding to different application functions. This application mainly traverses the application frame format to determine the target application function that matches the attributes of each domain field in the domain division result, that is, to determine the functional type of the data frame, so that the programmable logic program can perform targeted data processing later. After the match is successful, the data frame is stored in a pre-created cache area corresponding to the target application function, and a target reporting event is generated to the programmable logic program, so that the programmable logic program performs data processing operations corresponding to the target application function based on the data in the cache area. That is, the target service function block uses multi-threading to separate CAN communication and programmable logic. After the data copy is completed, it is necessary to actively generate a target reporting event to the programmable logic program. At this time, the programmable logic starts to execute the relevant data processing logic, which reduces CPU consumption and improves communication and logic processing efficiency.

[0129] Since the embodiments of the device part correspond to the embodiments of the method part, the embodiments of the device part refer to the description of the embodiments of the method part, which will not be described here. In addition, the method has the same beneficial effects as the above-mentioned bus data interaction method.

[0130] Figure 7 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Specifically, it may include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the bus data interaction method performed by the electronic device disclosed in any of the aforementioned embodiments.

[0131] In this embodiment, the power supply 23 is used to provide working voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and the external device, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs and is not specifically limited here.

[0132] Among them, the processor 21 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 21 can be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 21 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 21 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 21 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.

[0133] In addition, the memory 22, as a carrier for storing resources, can be a read-only memory, a random access memory, a disk or an optical disk, etc. The resources stored thereon include an operating system 221, a computer program 222 and data 223, etc. The storage method can be temporary storage or permanent storage.

[0134] Among them, the operating system 221 is used to manage and control the hardware devices and computer programs 222 on the electronic device 20, so as to realize the operation and processing of the massive data 223 in the memory 22 by the processor 21, which can be Windows, Unix, Linux, etc. In addition to including a computer program that can be used to complete the bus data interaction method performed by the electronic device 20 disclosed in any of the aforementioned embodiments, the computer program 222 can further include a computer program that can be used to complete other specific tasks. In addition to data transmitted from an external device received by the electronic device, the data 223 can also include data collected by its own input and output interface 25, etc.

[0135] Furthermore, an embodiment of the present application also discloses a computer-readable storage medium, in which a computer program is stored. When the computer program is loaded and executed by a processor, the bus data interaction method steps disclosed in any of the aforementioned embodiments are implemented.

[0136] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

[0137] Those skilled in the art may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented with electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0138] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a compact disc read-only memory (CD-ROM), or any other form of storage medium known in the art.

[0139] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the statement "comprises a..." does not exclude the presence of other identical elements in the process, method, article or device including the element.

[0140] The above is a detailed introduction to a bus data interaction method, device, equipment and storage medium provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for a person skilled in the art, according to the idea of ​​the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.< / busframe> < / busframe> < / canidfield> < / busframe> < / busframe> < / canidfield> < / canid> < / busframe> < / busframe> < / busframe> < / busdevice> < / busframe> < / busdevice> < / busmaster> < / busframe> < / busframe> < / busframe> < / busdevice> < / canid> < / canbus> < / buscoupler> < / busmaster>

Claims

1. A bus data interaction method, characterized in that: A target service function block applied to a programmable logic device, wherein the target service function block is a function block encapsulated based on the IEC61499 standard, and the method comprises: After the local configuration is successfully performed based on the preset configuration file, a communication thread is created to monitor events on the bus. If a data frame sent by any bus device is detected based on the communication thread, the CANID field in the data frame is parsed based on the custom bus protocol of any bus device to obtain the domain division result of the target extended frame; Determine the application frame format in the preset configuration file, and traverse the application frame format to determine the target application function that matches the attribute of each domain field in the domain division result; wherein the application frame format records the attribute parameters corresponding to different application functions; The data frame is stored in a pre-created cache area corresponding to the target application function, and a target reporting event is generated to a programmable logic program so that the programmable logic program performs a data processing operation corresponding to the target application function based on the data in the cache area.

2. The bus data interaction method according to claim 1, characterized in that: The preset configuration file includes first configuration information of the programmable logic device, second configuration information of each bus device, third configuration information of a coupler for connecting the programmable logic device and each bus device, and fourth configuration information for dividing the CANID field; wherein the programmable logic device is connected to at least one of the couplers, and the coupler is connected to at least one bus device.

3. The bus data interaction method according to claim 1, characterized in that: The cache area corresponding to the target application function is a read cache area or a write cache area; Accordingly, after the local configuration is performed based on the preset configuration file, it also includes: Determine an object array constructed based on the device object corresponding to each bus device, and traverse the preset configuration file to determine all data objects corresponding to each device object in the object array; wherein each of the data objects is used to characterize each application function of the device object, and the application frame format is constructed based on all of the data objects; A read buffer area and a write buffer area corresponding to each device object are allocated based on the data size and read / write type of each data object.

4. The bus data interaction method according to claim 3, characterized in that: The attribute parameters of the target field corresponding to the data object in the preset configuration file include a field name attribute, a data type attribute, a data length attribute, a bus cycle count attribute, a data direction attribute and event type data; wherein the attribute value of the data direction attribute includes a first attribute value for characterizing a received frame and a second attribute value for characterizing a sent frame; Accordingly, the read buffer area and the write buffer area corresponding to each device object are allocated based on the data size and read / write type of each data object, including: For each of the data objects, the corresponding data size is calculated based on the byte width of the data type attribute and the data length attribute, and the corresponding read / write type is determined based on the attribute value of the data direction attribute; wherein, if the attribute value of the data direction attribute is the first attribute value, the corresponding read / write type is the read type, and if the attribute value of the data direction attribute is the second attribute value, the corresponding read / write type is the write type; The read cache area is constructed based on the data size of all data objects whose read / write type is the read type, and the write cache area is constructed based on the data size of all data objects whose read / write type is the write type.

5. The bus data interaction method according to claim 3, characterized in that: The traversing the application frame format to determine a target application function that matches the attributes of each domain field in the domain division result includes: Determine a target device object corresponding to any one of the bus devices in the preset configuration file, and determine a target area corresponding to the target device object in the application frame format; All data objects in the target area are traversed to determine a target data object that matches the attributes of each domain field in the domain division result, and an application function represented by the target data object is used as a target application function corresponding to the data frame.

6. The bus data interaction method according to claim 3, characterized in that: After allocating the read buffer area and the write buffer area corresponding to each device object based on the data size and read / write type of each data object, the method further includes: Record the first pointer information and offset information of the buffer area corresponding to each device object; Accordingly, storing the data frame into a pre-created buffer area corresponding to the target application function includes: Determine a target first pointer corresponding to any bus device, and determine a target offset corresponding to the data frame; A cache area corresponding to the target application function is determined based on the target first pointer and the target offset, and the data frame is stored in the cache area corresponding to the target application function.

7. The bus data interaction method according to any one of claims 1 to 6, characterized in that: Also includes: If a system downtime event is detected based on the communication thread, a preset resource cleanup operation is performed; wherein the resource cleanup operation includes shutting down each bus device, reclaiming memory resources, and shutting down the thread.

8. A bus data interaction device, characterized in that: A target service function block applied to a programmable logic device, wherein the target service function block is a function block encapsulated based on the IEC61499 standard, and the device comprises: A parsing module, used for creating a communication thread after the local configuration is successfully performed based on the preset configuration file to monitor the events on the bus. If a data frame sent by any bus device is monitored based on the communication thread, the CANID field in the data frame is parsed based on the custom bus protocol of any bus device to obtain the domain division result of the target extended frame; a function determination module, used to determine the application frame format in the preset configuration file, and traverse the application frame format to determine the target application function that matches the attribute of each domain field in the domain division result; wherein the application frame format records the attribute parameters corresponding to different application functions; A reporting module is used to store the data frame in a pre-created cache area corresponding to the target application function, and generate a target reporting event to the programmable logic program so that the programmable logic program performs a data processing operation corresponding to the target application function based on the data in the cache area.

9. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor, configured to execute the computer program to implement the steps of the bus data interaction method as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: Used to store computer programs; wherein, when the computer program is executed by a processor, the steps of the bus data interaction method as described in any one of claims 1 to 7 are implemented.