Extension module adaptation method, device, terminal device and storage medium
By obtaining predefined object dictionary information from the extension module, the coupler is automatically adapted to the new development module, which solves the problems of low development efficiency and waste of memory space in the existing technology, and improves compatibility and efficiency.
Patent Information
- Application Number
- CN202211006480.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-22
- Publication Date
- 2024-09-17
- Estimated Expiration
- 2042-08-22
AI Technical Summary
In the existing technology, the coupler needs to be redeveloped when it is compatible with newly developed expansion modules, resulting in low development efficiency, and a large enough memory space needs to be predefined to be compatible with subsequent new modules, resulting in a waste of memory space.
By obtaining the predefined first object dictionary information from the expansion module, creating the corresponding object dictionary, and judging its matching when receiving the second object dictionary sent by the PLC host. If it matches, run the expansion module to realize the coupling function of the coupler. Automatic adaptation avoids module ID identification and repeated development.
It improves the coupler's development efficiency for newly developed expansion modules, saves memory space, and reduces development costs and complexity.
Smart Images

Figure CN115373335B
Abstract
Description
Technical Field
[0001] The present application relates to the field of electronic technology, and in particular to an expansion module adaptation method, apparatus, terminal equipment and storage medium. Background Art
[0002] When the functions on the PLC host cannot meet the needs, expansion modules are needed to increase the points or other functions.
[0003] At present, for newly developed expansion modules, the coupler needs to identify the module ID of the expansion module, and define the information related to the object dictionary in the coupler according to the identified module. In addition, it is also necessary to pre-define a large enough memory space in the coupler, including the memory space of the object dictionary of the subsequent newly added expansion module, so as to achieve compatibility with the newly added expansion module.
[0004] However, each time the module ID is identified, the coupler needs to be redeveloped, so that the developer needs to rewrite and test the code. That is, when the coupler is repeatedly developed, the workload is large, resulting in low development efficiency. Summary of the invention
[0005] The main purpose of the present application is to provide an expansion module adaptation method, apparatus, terminal device and storage medium, aiming to solve the problem of low development efficiency of coupler-compatible expansion modules.
[0006] To achieve the above object, the present application provides an extension module adaptation method, the extension module adaptation method comprising:
[0007] Obtaining first object dictionary information from the extension module, where the first object dictionary information is predefined in the extension module;
[0008] Creating a corresponding first object dictionary according to the first object dictionary information;
[0009] Upon receiving a second object dictionary sent by the PLC host, determining whether the first object dictionary matches the second object dictionary, the second object dictionary being created by the PLC host based on second object dictionary information, the second object dictionary information being predefined in the PLC host based on the expansion module;
[0010] If the first object dictionary matches the second object dictionary, the extension module is run to be compatible with the extension module.
[0011] Optionally, the step of obtaining the first object dictionary information from the extension module, wherein the first object dictionary information is obtained by being predefined in the extension module, comprises:
[0012] The first object dictionary information is obtained by communicating with the expansion module through a preset EtherCAT protocol, wherein the first object dictionary information includes at least one or more of the data type and the number of channels of the object dictionary.
[0013] Optionally, the coupler includes a motor control unit, and the step of creating a corresponding first object dictionary according to the first object dictionary information includes:
[0014] generating a corresponding memory space in the motor control unit according to the first object dictionary information;
[0015] Based on the memory space, the first object dictionary is created and initialized.
[0016] Optionally, when receiving the second object dictionary sent by the PLC host, determining whether the first object dictionary matches the second object dictionary, the second object dictionary is created by the PLC host based on second object dictionary information, and the second object dictionary information is pre-defined in the PLC host based on the expansion module, the step includes:
[0017] Determining whether the first object dictionary information is consistent with the second object dictionary information;
[0018] If the first object dictionary information is consistent with the second object dictionary information, it means that the first object dictionary matches the second object dictionary.
[0019] Optionally, the step of determining whether the first object dictionary information is consistent with the second object dictionary information includes:
[0020] Determine whether a format in the first object dictionary information is consistent with a format in the second object dictionary information;
[0021] If the format in the first object dictionary information is consistent with the format in the second object dictionary information, determining whether the parameters in the first object dictionary information are consistent with the parameters in the second object dictionary information;
[0022] If the parameters in the first object dictionary information are consistent with the parameters in the second object dictionary information, it means that the first object dictionary information is consistent with the second object dictionary information.
[0023] Optionally, upon receiving a second object dictionary sent by the PLC host, determining whether the first object dictionary matches the second object dictionary, the second object dictionary is created by the PLC host based on second object dictionary information, and the second object dictionary information is predefined in the PLC host based on the expansion module, after the step further includes:
[0024] If the first object dictionary does not match the second object dictionary, the first object dictionary and the second object dictionary are respectively detected according to a pre-created technical document to obtain a detection result;
[0025] The first object dictionary information and / or the second object dictionary information is modified according to the detection result and the technical document, wherein the technical document includes relevant information of the extension module.
[0026] Optionally, after the step of running the extension module if the first object dictionary matches the second object dictionary to make it compatible with the extension module, the method further includes:
[0027] Setting the parameters of the extension module according to the parameters transmitted by the second object dictionary; and / or
[0028] The parameters in the expansion module are transmitted to the PLC host through the first object dictionary.
[0029] The embodiment of the present application further provides an expansion module adapter device, the expansion module adapter device comprising:
[0030] An acquisition module, used for acquiring first object dictionary information from an extension module, wherein the first object dictionary information is obtained by being predefined in the extension module;
[0031] A creation module, used to create a corresponding first object dictionary according to the first object dictionary information;
[0032] A matching module, configured to determine whether the first object dictionary matches the second object dictionary upon receiving a second object dictionary sent by the PLC host, wherein the second object dictionary is created by the PLC host based on second object dictionary information, and the second object dictionary information is predefined in the PLC host based on the expansion module;
[0033] An operating module is used for operating the extension module if the first object dictionary matches the second object dictionary to make it compatible with the extension module.
[0034] An embodiment of the present application further proposes a terminal device, which includes a memory, a processor, and an expansion module adapter program stored in the memory and executable on the processor, wherein the expansion module adapter program implements the steps of the expansion module adaptation method described above when executed by the processor.
[0035] The embodiment of the present application further provides a computer-readable storage medium, on which an expansion module adaptation program is stored. When the expansion module adaptation program is executed by a processor, the steps of the expansion module adaptation method described above are implemented.
[0036] The expansion module adaptation method, device, terminal device and storage medium proposed in the embodiment of the present application obtain the first object dictionary information from the expansion module, which is obtained by pre-defining in the expansion module; create the corresponding first object dictionary according to the first object dictionary information; when receiving the second object dictionary sent by the PLC host, determine whether the first object dictionary matches the second object dictionary, which is created by the PLC host based on the second object dictionary information, and the second object dictionary information is pre-defined in the PLC host based on the expansion module; if the first object dictionary matches the second object dictionary, run the expansion module to make it compatible with the expansion module. The expansion module is directly scanned by the coupler to obtain the first object dictionary information, and the object dictionary is constructed according to the first object dictionary information, so that the coupler automatically adapts to the newly developed expansion module, which can solve the problem of low development efficiency of the coupler compatible expansion module. Based on the scheme of the present application, starting from the development efficiency of the coupler in the real world industrial control, a coupler that automatically adapts to the newly developed expansion module is designed, and the effectiveness of the expansion module adaptation method proposed in the present application is verified on the coupler, and finally the efficiency of the development of the method of the present application is significantly improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 This is a functional module diagram of the terminal device to which the expansion module adapter device of this application belongs;
[0038] Figure 2 A flowchart of a first exemplary embodiment of an expansion module adaptation method of the present application;
[0039] Figure 3 This is a schematic diagram of the object dictionary information in the extension module of the extension module adaptation method of this application;
[0040] Figure 4 A flowchart of a second exemplary embodiment of the expansion module adaptation method of the present application;
[0041] Figure 5A flowchart of a third exemplary embodiment of the expansion module adaptation method of the present application;
[0042] Figure 6 A flowchart of a fourth exemplary embodiment of the expansion module adaptation method of the present application;
[0043] Figure 7 A flowchart of a fifth exemplary embodiment of the expansion module adaptation method of the present application;
[0044] Figure 8 A flowchart of a sixth exemplary embodiment of the expansion module adaptation method of the present application;
[0045] Fig. 9 This is a flow chart of the expansion module adaptation method involved in this application;
[0046] Fig.10 This is a flowchart of the seventh exemplary embodiment of the expansion module adaptation method of the present application.
[0047] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0048] It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0049] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.
[0050] The main solution of the embodiment of the present application is: obtain the first object dictionary information from the extension module, the first object dictionary information is obtained by pre-defining in the extension module; create the corresponding first object dictionary according to the first object dictionary information; when receiving the second object dictionary sent by the PLC host, determine whether the first object dictionary matches the second object dictionary, the second object dictionary is created by the PLC host based on the second object dictionary information, and the second object dictionary information is pre-defined in the PLC host based on the extension module; if the first object dictionary matches the second object dictionary, run the extension module to make it compatible with the extension module. Scan the extension module directly through the coupler to obtain the first object dictionary information, build the object dictionary according to the first object dictionary information, realize the automatic adaptation of the coupler to the newly developed extension module, and solve the problem of low development efficiency of the coupler compatible extension module. Based on the scheme of the present application, starting from the development efficiency of the coupler in the real world industrial control, a coupler that automatically adapts to the newly developed extension module is designed, and the effectiveness of the extension module adaptation method proposed in the present application is verified on the coupler. Finally, the efficiency of the development of the present application method is significantly improved.
[0051] The embodiment of the present application takes into account that, currently, for a newly developed expansion module, the coupler needs to identify the module ID of the expansion module, and define information related to the object dictionary in the coupler according to the identified module. In addition, it is also necessary to pre-define a sufficiently large memory space in the coupler, including the memory space of the object dictionary of the subsequently added expansion module, so as to achieve compatibility with the newly added expansion module.
[0052] Therefore, the embodiment scheme of the present application starts from the problem of development efficiency of coupler compatibility with expansion modules in real-world industrial control, designs a coupler that automatically adapts to newly developed expansion modules, eliminating the need for module ID identification, and verifies the effectiveness of the expansion module adaptation method proposed in the present application on the coupler. Finally, the efficiency developed by the method of the present application is significantly improved.
[0053] Specifically, refer to Figure 1 , Figure 1 This is a functional module diagram of the terminal device to which the extension module adapter device of this application belongs. The extension module adapter device can be a device independent of the terminal device that can perform extension module scanning and object dictionary creation, and can be carried on the terminal device in the form of hardware or software. The terminal device can be a smart mobile terminal with data processing functions such as a mobile phone or a tablet computer, or a fixed terminal device or server with data processing functions.
[0054] In this embodiment, the terminal device to which the expansion module adapter device belongs includes at least an output module 110 , a processor 120 , a memory 130 and a communication module 140 .
[0055] The memory 130 stores an operating system and an expansion module adapter program. The expansion module adapter device can obtain the first object dictionary information from the expansion module, which is predefined in the expansion module; create a corresponding first object dictionary based on the first object dictionary information; when receiving the second object dictionary sent by the PLC host, determine whether the first object dictionary matches the second object dictionary, which is created by the PLC host based on the second object dictionary information, which is predefined in the PLC host based on the expansion module; if the first object dictionary matches the second object dictionary, the expansion module is run, so that the information such as compatibility with the expansion module is stored in the memory 130; the output module 110 can be a display screen, etc. The communication module 140 can include a WIFI module, a mobile communication module, a Bluetooth module, etc., and communicates with an external device or server through the communication module 140.
[0056] When the expansion module adapter program in the memory 130 is executed by the processor, the following steps are implemented:
[0057] Obtaining first object dictionary information from the extension module, where the first object dictionary information is predefined in the extension module;
[0058] Creating a corresponding first object dictionary according to the first object dictionary information;
[0059] Upon receiving a second object dictionary sent by the PLC host, determining whether the first object dictionary matches the second object dictionary, the second object dictionary being created by the PLC host based on second object dictionary information, the second object dictionary information being predefined in the PLC host based on the expansion module;
[0060] If the first object dictionary matches the second object dictionary, the extension module is run to be compatible with the extension module.
[0061] Furthermore, when the expansion module adapter program in the memory 130 is executed by the processor, the following steps are also implemented:
[0062] Communicate with the expansion module through a preset EtherCAT protocol to obtain the first object dictionary information, wherein the first object dictionary information at least includes the data type and channel of the object dictionary. Furthermore, when the expansion module adapter program in the memory 130 is executed by the processor, the following steps are also implemented:
[0063] generating a corresponding memory space in the motor control unit according to the first object dictionary information;
[0064] Based on the memory space, the first object dictionary is created and initialized.
[0065] Furthermore, when the expansion module adapter program in the memory 130 is executed by the processor, the following steps are also implemented:
[0066] Determining whether the first object dictionary information is consistent with the second object dictionary information;
[0067] If the first object dictionary information is consistent with the second object dictionary information, it means that the first object dictionary matches the second object dictionary.
[0068] Furthermore, when the expansion module adapter program in the memory 130 is executed by the processor, the following steps are also implemented:
[0069] Determine whether a format in the first object dictionary information is consistent with a format in the second object dictionary information;
[0070] If the format in the first object dictionary information is consistent with the format in the second object dictionary information, determining whether the parameters in the first object dictionary information are consistent with the parameters in the second object dictionary information;
[0071] If the parameters in the first object dictionary information are consistent with the parameters in the second object dictionary information, it means that the first object dictionary information is consistent with the second object dictionary information.
[0072] Furthermore, when the expansion module adapter program in the memory 130 is executed by the processor, the following steps are also implemented:
[0073] If the first object dictionary does not match the second object dictionary, the first object dictionary and the second object dictionary are respectively detected according to a pre-created technical document to obtain a detection result;
[0074] The first object dictionary information and / or the second object dictionary information is modified according to the detection result and the technical document, wherein the technical document includes relevant information of the extension module.
[0075] Furthermore, when the expansion module adapter program in the memory 130 is executed by the processor, the following steps are also implemented:
[0076] The parameters of the expansion module are set according to the parameters transmitted by the second object dictionary.
[0077] Furthermore, when the expansion module adapter program in the memory 130 is executed by the processor, the following steps are also implemented:
[0078] The parameters in the expansion module are transmitted to the PLC host through the first object dictionary.
[0079] This embodiment uses the above scheme, specifically by obtaining the first object dictionary information from the extension module, the first object dictionary information is obtained by pre-defining in the extension module; creating the corresponding first object dictionary according to the first object dictionary information; when receiving the second object dictionary sent by the PLC host, judging whether the first object dictionary matches the second object dictionary, the second object dictionary is created by the PLC host based on the second object dictionary information, and the second object dictionary information is pre-defined in the PLC host based on the extension module; if the first object dictionary matches the second object dictionary, the extension module is run to make it compatible with the extension module. The extension module is directly scanned by the coupler to obtain the first object dictionary information, and the object dictionary is constructed according to the first object dictionary information, so that the coupler automatically adapts to the newly developed extension module, which can solve the problem of low development efficiency of the coupler compatible extension module. Based on the scheme of this application, starting from the development efficiency of the coupler in the real world industrial control, a coupler that automatically adapts to the newly developed extension module is designed, and the effectiveness of the extension module adaptation method proposed in this application is verified on the coupler, and finally the efficiency of the development of the method of this application is significantly improved.
[0080] Based on the above terminal device architecture but not limited to the above architecture, an embodiment of the method of the present application is proposed.
[0081] Reference Figure 2 , Figure 2 This is a flow chart of the first exemplary embodiment of the expansion module adaptation method of the present application. The expansion module adaptation method comprises:
[0082] Step S210, obtaining first object dictionary information from the extension module, where the first object dictionary information is predefined in the extension module;
[0083] Specifically, when the functions on the PLC host cannot meet the needs, it is necessary to use expansion modules to increase the number of points or other functions. At present, for newly developed expansion modules, a coupler is required to identify the module ID of the expansion module, and define information related to the object dictionary in the coupler based on the identified module. However, each time the module ID is identified, the coupler needs to be redeveloped, so that the code needs to be rewritten and tested, etc. That is, when the coupler is repeatedly developed, the workload is large, resulting in low development efficiency.
[0084] Therefore, in this embodiment, the EtherCAT slave coupler is powered on normally, the motor control unit (MCU) in the EtherCAT slave coupler starts to run, and then the EtherCAT slave coupler starts to scan the expansion module and obtain the first object dictionary information about the object dictionary of the expansion module, such as PDO (process data object), SDO (service data object), diagnostic data type, and channel number information, wherein the first object dictionary information about the object dictionary of the expansion module is set when the expansion module is developed. For example, in the newly developed expansion module 4AD, the object dictionary information required by the module is defined, such as Figure 3 As shown, Figure 3 This is a schematic diagram of the object dictionary information in the extension module of the extension module adaptation method of the present application. The figure specifically shows the 4AD module, and the meaning of the first object dictionary information related to the object dictionary is: 0x04, 0x00 represents that the module is a 4-channel module, 0x03, 0x00 represents that the PDO data type of the 4AD module is int type, 0x00, 0x00 represents that the diagnostic data of the module is of the general type Uint, 0x03, 0x00 represents that the 4AD module contains 3 configuration parameters, 0x05, 0x05, 0x05 are configuration parameter types of USINT, USINT, USINT respectively, and 0x00, 0x00, 0x00, 0x00, 0x00 are reserved parameter types.
[0085] Step S220, creating a corresponding first object dictionary according to the first object dictionary information;
[0086] Specifically, since a sufficiently large array needs to be predefined in the coupler, it is necessary to reserve a sufficiently large memory space in advance to be compatible with the newly developed modules subsequently, resulting in serious waste of memory space in the motor control unit (MCU). Therefore, in the present embodiment, the EtherCAT slave coupler generates a memory space of corresponding size in the motor control unit according to the acquired expansion module about the data type and the number of channels of the object dictionary, and builds an object dictionary based on the generated memory space, and initializes the default value of the object dictionary. In this way, there is no need to predefine a sufficiently large array in the EtherCAT slave coupler, that is, there is no need to reserve a sufficiently large memory space in advance, so that the EtherCAT slave coupler does not need to reserve a sufficiently large memory space in advance to be compatible with the newly developed module memory space subsequently, but opens up space according to the size of the newly developed module, thereby saving the motor control unit (MCU) memory space. Wherein, the object dictionary includes but is not limited to: PDO object dictionary, SDO (configuration) object dictionary, and diagnostic object dictionary.
[0087] Step S230, upon receiving the second object dictionary sent by the PLC host, determining whether the first object dictionary matches the second object dictionary, the second object dictionary being created by the PLC host based on second object dictionary information, the second object dictionary information being predefined in the PLC host based on the expansion module;
[0088] Specifically, a device description file (XML) is stored in the PLC host, and the relevant content of the extension module object dictionary is defined in the device description file. The PLC host automatically indexes and adds the modules defined in the device description file by scanning the actual slave configuration module type, thereby forming a second object dictionary on the PLC host side. When the PLC host sends the relevant second object dictionary to the EtherCAT slave coupler, it is determined whether the first object dictionary matches the second object dictionary. Among them, taking the extension module as a 4AD module as an example, the first object dictionary information includes but is not limited to the PDO object dictionary of the 4AD module, the conversion mode configuration parameter object dictionary of the 4AD module, the filter time configuration parameter object dictionary of the 4AD module, the other configuration parameter object dictionary of the 4AD module, and the diagnostic data of the 4AD module.
[0089] More specifically, the EtherCAT slave coupler determines whether the first object dictionary information about the first object dictionary in the newly added module is consistent with the second object dictionary information defined in the device description file (XML). If the first object dictionary information about the object dictionary in the newly added module is completely consistent with the second object dictionary information defined in the device description file (XML), the expansion module operates normally. The specific judgment steps can be as follows: determine whether the second object dictionary information and the first object dictionary information match; if the second object dictionary information matches the first object dictionary information, run the expansion module; if the second object dictionary information does not match the first object dictionary information, modify the first object dictionary information according to the second object dictionary information. That is, the EtherCAT slave coupler determines whether the object dictionary information in the EtherCAT slave coupler is consistent with the object dictionary information defined in the XML in the PLC host, so that it can be determined whether the object dictionary in the coupler matches the object dictionary of the PLC host, so that the coupler is compatible with the expansion module. Otherwise, it cannot operate. At this time, the EtherCAT slave coupler determines whether the first object dictionary is wrong or the second object dictionary is wrong according to the technical document. At this time, it is possible that the first object dictionary is wrong. Then, the EtherCAT slave coupler modifies the first object dictionary information about the object dictionary in the extension module according to the pre-created technical document, so that the first object dictionary information is consistent with the object dictionary information related to the extension module defined in the technical document, that is, consistent with the second object dictionary information defined in the device description file (XML). In addition, it is also possible that the second object dictionary is wrong. Then, the EtherCAT slave coupler modifies the second object dictionary information defined in the device description file of the PLC host according to the pre-created technical document (it can also be modified manually). Among them, the technical document is created before setting the first object dictionary information in the extension module, and the technical document serves as the basis for setting the first object dictionary information and the second object dictionary information.
[0090] Step S240: If the first object dictionary matches the second object dictionary, the extension module is run to make it compatible with the extension module.
[0091] Specifically, when it is determined that the first object dictionary matches the second object, the EtherCAT slave coupler can be controlled in the PLC host through the PLC host, thereby controlling the input and output of the expansion module. More specifically, the object dictionary in the EtherCAT slave coupler is controlled by controlling the object dictionary in the host end, thereby controlling the input and output of the expansion module, reducing the difficulty of controlling the expansion module through the EtherCAT slave coupler. For example, the parameters of the newly developed 4AD module are configured, and the analog input value and the fault information of the 4AD module are obtained through the object dictionary in the PLC host.
[0092] This embodiment uses the above scheme, specifically by obtaining the first object dictionary information from the extension module, the first object dictionary information is obtained by pre-defining in the extension module; creating the corresponding first object dictionary according to the first object dictionary information; when receiving the second object dictionary sent by the PLC host, judging whether the first object dictionary matches the second object dictionary, the second object dictionary is created by the PLC host based on the second object dictionary information, and the second object dictionary information is pre-defined in the PLC host based on the extension module; if the first object dictionary matches the second object dictionary, the extension module is run to make it compatible with the extension module. The extension module is directly scanned by the coupler to obtain the first object dictionary information, and the object dictionary is constructed according to the first object dictionary information, so that the coupler automatically adapts to the newly developed extension module, which can solve the problem of low development efficiency of the coupler compatible extension module. Based on the scheme of this application, starting from the development efficiency of the coupler in the real world industrial control, a coupler that automatically adapts to the newly developed extension module is designed, and the effectiveness of the extension module adaptation method proposed in this application is verified on the coupler, and finally the efficiency of the development of the method of this application is significantly improved.
[0093] Reference Figure 4 , Figure 4 This is a flow chart of the second exemplary embodiment of the expansion module adaptation method of this application. Figure 2 In the illustrated embodiment, step S210, obtaining first object dictionary information from the extension module, wherein the first object dictionary information is obtained by pre-defining in the extension module, comprises:
[0094] Step S910, communicating with the expansion module through a preset EtherCAT protocol to obtain the first object dictionary information, where the first object dictionary information at least includes one or more of the data type and channel number information of the object dictionary.
[0095] Specifically, the EtherCAT slave coupler communicates with the expansion module through the EtherCAT protocol to exchange data, that is, by scanning the expansion module through the EtherCAT slave coupler, there is no need to identify the module ID, parse the specific type of the module, and perform secondary development, so that the EtherCAT slave coupler is automatically compatible with the newly developed expansion module, reducing the repeated development work of the EtherCAT slave coupler and improving the development efficiency. Among them, the first object dictionary information includes but is not limited to one or more of the data type and channel number information of the object dictionary.
[0096] In addition, the EtherCAT slave coupler can open up a new memory space in the motor control unit according to the data type and channel number information of the object dictionary, without having to define a sufficiently large memory space in advance in the EtherCAT slave coupler. Among them, the size of the memory space of the motor control unit in the EtherCAT slave coupler corresponds to the data type and channel number information of the object dictionary.
[0097] Through the above scheme, this embodiment specifically communicates with the expansion module through the preset EtherCAT protocol to obtain the first object dictionary information, which at least includes one or more of the data type and channel number information of the object dictionary; creates a corresponding first object dictionary according to the first object dictionary information; upon receiving the second object dictionary sent by the PLC host, determines whether the first object dictionary matches the second object dictionary, the second object dictionary is created by the PLC host based on the second object dictionary information, and the second object dictionary information is pre-defined in the PLC host based on the expansion module; if the first object dictionary matches the second object dictionary, the expansion module is run to make it compatible with the expansion module. Communicate with the expansion module through the coupler to obtain the first object dictionary information about the object dictionary in the expansion module, without the need to identify it through the expansion module ID, thereby improving the development efficiency of the expansion module.
[0098] Reference Figure 5 , Figure 5 This is a flow chart of the third exemplary embodiment of the expansion module adaptation method of this application. Figure 2 In the embodiment shown, the coupler includes a motor control unit, and step S220, the step of creating a corresponding first object dictionary according to the first object dictionary information includes:
[0099] Step S1010, generating a corresponding memory space in the motor control unit according to the first object dictionary information;
[0100] Specifically, on the one hand, each time the ID identification of the module is performed, the coupler needs to be redeveloped, so that the code is rewritten, tested, etc., that is, when the coupler is repeatedly developed, the workload is large, resulting in low development efficiency; on the other hand, since a sufficiently large array needs to be pre-defined in the coupler, a sufficiently large memory space needs to be reserved in advance to be compatible with the newly developed modules subsequently, resulting in serious waste of the memory space of the motor control unit (MCU). In this embodiment, the EtherCAT slave coupler generates a corresponding memory space in the motor control unit (MCU) according to the first object dictionary information, so that there is no need to pre-define a sufficiently large array in the EtherCAT slave coupler, that is, there is no need to reserve a sufficiently large memory space in advance, so that the EtherCAT slave coupler does not need to reserve a sufficiently large memory space in advance to be compatible with the memory space of the newly developed modules subsequently, but opens up space according to the size of the newly developed module, thereby saving the memory space of the motor control unit (MCU) and reducing the development cost and space memory cost of the EtherCAT slave coupler.
[0101] Step S1020: Create and initialize the first object dictionary based on the memory space.
[0102] Specifically, the EtherCAT slave coupler can open up a new memory space in the motor control unit according to the data type and channel number information of the object dictionary, without having to define a sufficiently large memory space in advance in the EtherCAT slave coupler. Based on the memory space, the EtherCAT slave coupler creates a corresponding object dictionary and initializes the default value of the object dictionary. Among them, the size of the memory space of the motor control unit in the EtherCAT slave coupler corresponds to the data type and channel number information of the object dictionary; the object dictionary includes but is not limited to: PDO object dictionary, SDO (configuration) object dictionary, and diagnostic object dictionary.
[0103] This embodiment adopts the above scheme, specifically by obtaining first object dictionary information from the expansion module, the first object dictionary information is pre-defined in the expansion module; according to the first object dictionary information, a corresponding memory space is generated in the motor control unit; based on the memory space, the first object dictionary is created and initialized; when receiving the second object dictionary sent by the PLC host, it is determined whether the first object dictionary matches the second object dictionary, the second object dictionary is created by the PLC host based on the second object dictionary information, and the second object dictionary information is pre-defined in the PLC host based on the expansion module; according to the size of the newly developed expansion module, space is opened up and an object dictionary is created, thereby saving the memory space of the motor control unit (MCU) of the coupler, and reducing the development cost and space memory cost of the EtherCAT slave coupler.
[0104] Reference Figure 6 , Figure 6 This is a flow chart of the fourth exemplary embodiment of the expansion module adaptation method of this application. Figure 2 In the embodiment shown, step S230, upon receiving a second object dictionary sent by the PLC host, determining whether the first object dictionary matches the second object dictionary, the second object dictionary being created by the PLC host based on second object dictionary information, the second object dictionary information being predefined in the PLC host based on the expansion module, comprises:
[0105] Step S1110, determining whether the first object dictionary information is consistent with the second object dictionary information;
[0106] Specifically, when the PLC host sends the relevant second object dictionary to the EtherCAT slave coupler, it is determined whether the first object dictionary matches the second object dictionary. The PLC host sends the relevant second object dictionary information, and the EtherCAT slave coupler determines whether the first object dictionary information about the object dictionary of the newly added module is consistent with the second object dictionary information defined in the device description file (XML). If the first object dictionary information about the object dictionary of the newly added module is completely consistent with the second object dictionary information defined in the device description file (XML), that is, the first object dictionary matches the second object dictionary, then the expansion module operates normally.
[0107] It should also be noted that if the first object dictionary information about the object dictionary of the newly added module is inconsistent with the second object dictionary information defined in the device description file (XML), it will not be able to run. The first object dictionary information about the object dictionary in the newly added module should be modified to make the first object dictionary information consistent with the second object dictionary information defined in the device description file (XML).
[0108] Step S1120: If the first object dictionary information is consistent with the second object dictionary information, it means that the first object dictionary matches the second object dictionary.
[0109] Specifically, if the second object dictionary information is consistent with the first object dictionary information, that is, the first object dictionary matches the second object dictionary, the extension module is run to achieve compatibility of the EtherCAT slave coupler with the newly developed module. It should be noted that the parameters in the EtherCAT slave coupler are obtained by receiving the parameters transmitted by the PLC host end using the second object dictionary. More specifically, the parameters of the EtherCAT slave coupler object dictionary are configured by an external user in the PLC host, and the parameters are transmitted to the EtherCAT slave coupler by the first object dictionary in the PLC host.
[0110] This embodiment uses the above solution to determine whether the first object dictionary information is consistent with the second object dictionary information; if the first object dictionary information is consistent with the second object dictionary information, it means that the first object dictionary matches the second object dictionary. The EtherCAT slave coupler matches the first object dictionary information about the object dictionary of the newly added module with the second object dictionary information defined in the device description file (XML), so that the EtherCAT slave coupler can be compatible with the newly developed module, thereby improving the convenience of using the expansion module.
[0111] Reference Figure 7 , Figure 7 This is a flowchart of the fifth exemplary embodiment of the expansion module adaptation method of this application. Figure 6 In the illustrated embodiment, step S1110, the step of determining whether the first object dictionary information is consistent with the second object dictionary information includes:
[0112] Step S1210, determining whether the format in the first object dictionary information is consistent with the format in the second object dictionary information;
[0113] Specifically, the PLC host sends relevant second object dictionary information, and the EtherCAT slave coupler determines whether the format of the first object dictionary information about the object dictionary of the newly added module is consistent with the format of the second object dictionary information defined in the device description file (XML). If the format of the first object dictionary information about the object dictionary of the newly added module is consistent with the format of the second object dictionary information defined in the device description file (XML), the EtherCAT slave coupler further determines whether the parameters in the second object dictionary information defined in the device description file (XML) are consistent with the parameters in the first object dictionary information about the object dictionary of the newly added module.
[0114] Step S1220: if the format in the first object dictionary information is consistent with the format in the second object dictionary information, determining whether the parameters in the first object dictionary information are consistent with the parameters in the second object dictionary information;
[0115] Specifically, if the format of the first object dictionary information about the object dictionary of the newly added module is consistent with the format of the second object dictionary information defined in the device description file (XML), the EtherCAT slave coupler further determines whether the parameters in the second object dictionary information defined in the device description file (XML) are consistent with the parameters in the first object dictionary information about the object dictionary of the newly added module.
[0116] Step S1230: If the parameters in the first object dictionary information are consistent with the parameters in the second object dictionary information, it means that the first object dictionary information is consistent with the second object dictionary information.
[0117] Specifically, if the parameters in the second object dictionary information defined in the device description file (XML) are consistent with the parameters in the first object dictionary information about the object dictionary of the newly added module, it means that the first object dictionary matches the second object dictionary, and the EtherCAT slave coupler runs the expansion module to achieve compatibility of the EtherCAT slave coupler with the newly developed module.
[0118] This embodiment uses the above scheme to determine whether the format in the first object dictionary information is consistent with the format in the second object dictionary information; if the format in the first object dictionary information is consistent with the format in the second object dictionary information, then determine whether the parameters in the first object dictionary information are consistent with the parameters in the second object dictionary information; if the parameters in the first object dictionary information are consistent with the parameters in the second object dictionary information, it means that the first object dictionary information is consistent with the second object dictionary information. By determining whether the format in the second object dictionary information is consistent with the first object dictionary information, and then determining whether the parameters in the second object dictionary information are consistent with the first object dictionary information, it can be determined whether the first object dictionary matches the second object dictionary, thereby achieving compatibility of the EtherCAT slave coupler with the newly developed expansion module and improving the accuracy of the adaptation of the EtherCAT slave coupler expansion module.
[0119] Reference Figure 8 , Figure 8 This is a flowchart of the sixth exemplary embodiment of the expansion module adaptation method of this application. Figure 2 In the embodiment shown, step S230, upon receiving a second object dictionary sent by the PLC host, determining whether the first object dictionary matches the second object dictionary, the second object dictionary being created by the PLC host based on second object dictionary information, the second object dictionary information being predefined in the PLC host based on the expansion module, further comprises:
[0120] Step S1310: if the first object dictionary does not match the second object dictionary, then according to a pre-created technical document, the first object dictionary and the second object dictionary are respectively detected to obtain a detection result;
[0121] Specifically, the technical document is created before the first object dictionary information in the extension module is set, and the technical document serves as the basis for setting the first object dictionary information and the second object dictionary information. When the PLC host sends the relevant second object dictionary information, the EtherCAT slave coupler determines whether the first object dictionary information about the object dictionary of the newly added module is consistent with the second object dictionary information defined in the device description file (XML). If the first object dictionary information about the object dictionary of the newly added module is inconsistent with the second object dictionary information defined in the device description file (XML), it indicates that the first object dictionary does not match the second object dictionary. At this time, the EtherCAT slave coupler determines whether it is a first object dictionary error or a second object dictionary error based on the technical document.
[0122] Step S1320: modify the first object dictionary information and / or the second object dictionary information according to the detection result and the technical document, wherein the technical document includes relevant information of the extension module.
[0123] Specifically, it is possible that the first object dictionary is wrong, then the EtherCAT slave coupler modifies the first object dictionary information about the object dictionary in the extension module according to the pre-created technical document, so that the first object dictionary information is consistent with the object dictionary information related to the extension module defined in the technical document, that is, consistent with the second object dictionary information defined in the device description file (XML). In addition, it is also possible that the second object dictionary is wrong, then the EtherCAT slave coupler modifies the second object dictionary information defined in the device description file of the PLC host according to the pre-created technical document (it can also be modified manually).
[0124] This embodiment adopts the above scheme, specifically, when receiving the second object dictionary sent by the PLC host, it is determined whether the first object dictionary matches the second object dictionary, the second object dictionary is created by the PLC host based on the second object dictionary information, and the second object dictionary information is pre-defined in the PLC host based on the expansion module; if the first object dictionary does not match the second object dictionary, the first object dictionary information and / or the second object dictionary information are modified according to the pre-created technical document, and the technical document includes the relevant information of the expansion module. By modifying the first object dictionary information in the expansion module through the EtherCAT slave coupler, the compatibility of the EtherCAT slave coupler with the newly developed expansion module is achieved, and the accuracy of the adaptation of the EtherCAT slave coupler expansion module is improved.
[0125] Reference Fig. 9 , Fig. 9This is a flow chart of the expansion module adaptation method involved in this application. As shown in the figure, after the EtherCAT slave coupler is powered on, the motor control unit (MCU) starts to run; then, the EtherCAT slave coupler scans the expansion module; then, the EtherCAT slave coupler obtains the first object dictionary information of the object dictionary required by the expansion module; then, the EtherCAT slave coupler creates the object dictionary and initializes the default value of the object dictionary; then, the second object dictionary information of the object dictionary related to the newly added expansion module is defined in the device description file (XML) in the PLC host; then, the PLC host runs and sends the second object dictionary information defined in the device description file (XML) to the EtherCAT slave coupler; then, the EtherCAT slave coupler determines whether the second object dictionary information defined in the device description file (XML) is consistent with the first object dictionary information; if they are consistent, it means that the first object dictionary matches the second object dictionary, then the EtherCAT slave coupler is compatible with the expansion module, and the expansion module runs normally; if they are inconsistent, the first object dictionary information in the newly added expansion module is modified by the EtherCAT slave coupler, and the execution step: the EtherCAT slave coupler scans the expansion module and the subsequent steps are returned.
[0126] Reference Fig.10 , Fig.10 This is a flow chart of the seventh exemplary embodiment of the expansion module adaptation method of this application. Figure 2 In the embodiment shown, step S230, upon receiving a second object dictionary sent by the PLC host, determining whether the first object dictionary matches the second object dictionary, the second object dictionary being created by the PLC host based on second object dictionary information, the second object dictionary information being predefined in the PLC host based on the expansion module, further comprises:
[0127] Step S1510, setting parameters of the extension module according to the parameters transmitted by the second object dictionary;
[0128] Specifically, if the first object dictionary is consistent with the second object dictionary, the expansion module operates normally, and the external user can operate the expansion module through the PLC host. That is, the external user operates the PLC host so that the EtherCAT slave coupler receives the parameters transmitted by the second object dictionary and sets the parameters in the expansion module according to the parameters transmitted by the second object dictionary, wherein the second object dictionary is in the PLC host. For example, the external user configures the parameters of the newly developed 4AD module through the PLC host.
[0129] And / or step S1520, transmitting the parameters in the expansion module to the PLC host through the first object dictionary.
[0130] Specifically, if the first object dictionary is consistent with the second object dictionary, the extension module operates normally, and the external user can read the module data of the extension module on the PLC host side, wherein the module data includes but is not limited to the interaction data, input / output data, and fault information of the extension module. That is, the EtherCAT slave coupler reads the parameters in the extension module and transmits the parameters to the PLC host through the first object dictionary in the EtherCAT slave coupler, so that the external user can view and control the parameters. Taking the 4AD module as an example, the analog input value and the fault information of the 4AD module can be obtained through the PLC host.
[0131] This embodiment adopts the above scheme, specifically by obtaining the first object dictionary information from the extension module, the first object dictionary information is obtained by pre-defining in the extension module; creating the corresponding first object dictionary according to the first object dictionary information; when receiving the second object dictionary sent by the PLC host, judging whether the first object dictionary matches the second object dictionary, the second object dictionary is created by the PLC host based on the second object dictionary information, the second object dictionary information is pre-defined in the PLC host based on the extension module; if the first object dictionary matches the second object dictionary, running the extension module to make it compatible with the extension module; setting the parameters of the extension module according to the parameters transmitted by the second object dictionary; and / or transmitting the parameters in the extension module to the PLC host through the first object dictionary. Through the interaction between the PLC host and the EtherCAT slave coupler, the EtherCAT slave coupler interacts with the extension module, so that the extension module is controlled by the PLC, the EtherCAT slave coupler can automatically adapt to the newly developed extension module without the need to identify the module ID, thereby improving the convenience of using the extension module.
[0132] In addition, an embodiment of the present application further provides an expansion module adapter device, the expansion module adapter device comprising:
[0133] An acquisition module, used for acquiring first object dictionary information from an extension module, wherein the first object dictionary information is obtained by being predefined in the extension module;
[0134] A creation module, used to create a corresponding first object dictionary according to the first object dictionary information;
[0135] A matching module, configured to determine whether the first object dictionary matches the second object dictionary upon receiving a second object dictionary sent by the PLC host, wherein the second object dictionary is created by the PLC host based on second object dictionary information, and the second object dictionary information is predefined in the PLC host based on the expansion module;
[0136] An operating module is used for operating the extension module if the first object dictionary matches the second object dictionary to make it compatible with the extension module.
[0137] For the principle and implementation process of implementing the expansion module adaptation in this embodiment, please refer to the above embodiments and will not be described in detail here.
[0138] In addition, an embodiment of the present application also proposes a terminal device, which includes a memory, a processor, and an expansion module adapter program stored in the memory and executable on the processor, wherein the expansion module adapter program implements the steps of the expansion module adaptation method described above when executed by the processor.
[0139] Since the expansion module adapter program adopts all the technical solutions of all the aforementioned embodiments when executed by the processor, it has at least all the beneficial effects brought by all the technical solutions of all the aforementioned embodiments, which will not be described one by one here.
[0140] In addition, an embodiment of the present application further proposes a computer-readable storage medium, on which an expansion module adapter program is stored. When the expansion module adapter program is executed by a processor, the steps of the expansion module adaptation method described above are implemented.
[0141] Since the expansion module adapter program adopts all the technical solutions of all the aforementioned embodiments when executed by the processor, it has at least all the beneficial effects brought by all the technical solutions of all the aforementioned embodiments, which will not be described one by one here.
[0142] Compared with the prior art, the expansion module adaptation method, device, terminal device and storage medium proposed in the embodiment of the present application obtain the first object dictionary information from the expansion module, which is predefined in the expansion module; create the corresponding first object dictionary according to the first object dictionary information; when receiving the second object dictionary sent by the PLC host, determine whether the first object dictionary matches the second object dictionary, which is created by the PLC host based on the second object dictionary information, and the second object dictionary information is predefined in the PLC host based on the expansion module; if the first object dictionary matches the second object dictionary, run the expansion module to make it compatible with the expansion module. The expansion module is directly scanned by the coupler to obtain the first object dictionary information, and the object dictionary is constructed according to the first object dictionary information, so that the coupler automatically adapts to the newly developed expansion module, which can solve the problem of low development efficiency of the coupler compatible expansion module. Based on the scheme of the present application, starting from the development efficiency of the coupler in the real world industrial control, a coupler that automatically adapts to the newly developed expansion module is designed, and the effectiveness of the expansion module adaptation method proposed in the present application is verified on the coupler, and finally the efficiency of the development of the method of the present application is significantly improved.
[0143] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system 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 system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.
[0144] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0145] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as above, and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, a controlled terminal, or a network device, etc.) to execute the method of each embodiment of the present application.
[0146] The above are only preferred embodiments of the present application, and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. An expansion module adaptation method, characterized in that: The expansion module adaptation method is applied to a coupler, the coupler interacts with a PLC host, and the expansion module adaptation method comprises the following steps: Obtaining first object dictionary information from the extension module, where the first object dictionary information is predefined in the extension module; Creating a corresponding first object dictionary according to the first object dictionary information; Upon receiving a second object dictionary sent by the PLC host, determining whether the first object dictionary matches the second object dictionary, the second object dictionary being created by the PLC host based on second object dictionary information, the second object dictionary information being predefined in the PLC host based on the expansion module; If the first object dictionary matches the second object dictionary, the expansion module is run to make it compatible with the expansion module, wherein the second object dictionary is used to be controlled by the PLC host to control the first object dictionary, thereby controlling the input and output of the expansion module.
2. The expansion module adaptation method according to claim 1, characterized in that: The step of obtaining first object dictionary information from the extension module, wherein the first object dictionary information is obtained by being predefined in the extension module, comprises: The first object dictionary information is obtained by communicating with the expansion module through a preset EtherCAT protocol, wherein the first object dictionary information includes at least one or more of the data type and the number of channels of the object dictionary.
3. The expansion module adaptation method according to claim 1, characterized in that: The coupler includes a motor control unit, and the step of creating a corresponding first object dictionary according to the first object dictionary information includes: generating a corresponding memory space in the motor control unit according to the first object dictionary information; Based on the memory space, the first object dictionary is created and initialized.
4. The expansion module adaptation method according to claim 1, characterized in that: The step of determining whether the first object dictionary matches the second object dictionary comprises: Determining whether the first object dictionary information is consistent with the second object dictionary information; If the first object dictionary information is consistent with the second object dictionary information, it means that the first object dictionary matches the second object dictionary.
5. The expansion module adaptation method according to claim 4, characterized in that: The step of determining whether the first object dictionary information is consistent with the second object dictionary information comprises: Determine whether a format in the first object dictionary information is consistent with a format in the second object dictionary information; If the format in the first object dictionary information is consistent with the format in the second object dictionary information, determining whether the parameters in the first object dictionary information are consistent with the parameters in the second object dictionary information; If the parameters in the first object dictionary information are consistent with the parameters in the second object dictionary information, it means that the first object dictionary information is consistent with the second object dictionary information.
6. The expansion module adaptation method according to claim 1, characterized in that: Upon receiving the second object dictionary sent by the PLC host, determining whether the first object dictionary matches the second object dictionary, the second object dictionary is created by the PLC host based on second object dictionary information, and the second object dictionary information is predefined in the PLC host based on the expansion module, after the step, further comprising: If the first object dictionary does not match the second object dictionary, the first object dictionary and the second object dictionary are respectively detected according to a pre-created technical document to obtain a detection result; The first object dictionary information and / or the second object dictionary information is modified according to the detection result and the technical document, wherein the technical document includes relevant information of the extension module.
7. The expansion module adaptation method according to claim 1, characterized in that: After the step of running the extension module to make it compatible with the extension module if the first object dictionary matches the second object dictionary, the method further includes: Setting the parameters of the extension module according to the parameters transmitted by the second object dictionary; and / or The parameters in the expansion module are transmitted to the PLC host through the first object dictionary.
8. An expansion module adapter device, characterized in that: The expansion module adapter device comprises: An acquisition module, used for acquiring first object dictionary information from an extension module, wherein the first object dictionary information is obtained by being predefined in the extension module; A creation module, used to create a corresponding first object dictionary according to the first object dictionary information; A matching module, configured to determine whether the first object dictionary matches the second object dictionary upon receiving a second object dictionary sent by the PLC host, wherein the second object dictionary is created by the PLC host based on second object dictionary information, and the second object dictionary information is predefined in the PLC host based on the expansion module; An operation module is used for running the expansion module if the first object dictionary matches the second object dictionary to make it compatible with the expansion module, wherein the second object dictionary is used to be controlled by the PLC host to control the first object dictionary, thereby controlling the input and output of the expansion module.
9. A terminal device, characterized in that: The terminal device comprises a memory, a processor and an expansion module adapter program stored in the memory and executable on the processor, wherein the expansion module adapter program implements the steps of the expansion module adaptation method according to any one of claims 1 to 7 when executed by the processor.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores an expansion module adaptation program, and when the expansion module adaptation program is executed by the processor, the steps of the expansion module adaptation method according to any one of claims 1 to 7 are implemented.
