File generation method and device, electronic equipment and storage medium
By analyzing, processing and integrating EtherCAT network configuration files in the file conversion device, the problem of poor compatibility of ENI files generated by different network configuration software is solved, and the network configuration file generation is realized to adapt to the target device, improving configuration flexibility and device integration.
Patent Information
- Application Number
- CN202411685172.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-22
- Publication Date
- 2025-03-21
- Estimated Expiration
- 2044-11-22
AI Technical Summary
The diversified features of EtherCAT network configuration software lead to significant differences in the ENI files of the same type of slave devices, which in turn exacerbates the compatibility challenges in the network configuration process.
By constructing a file conversion device, the device includes a parsing module, an algorithm module, a storage module and a creation module, imports the first network configuration file generated by the network configuration software, performs analysis, algorithm processing and storage, integrates contents according to the network configuration instructions of the target device, and creates a second network configuration file suitable for the target device.
Through the mutual cooperation of file conversion devices, the imported network configuration files are parsed, algorithmically processed, stored and created, and another network configuration file is built to build a target device, saving time and cost of generating network configurations, and improving the flexibility of network configuration and the integration and interoperability of the device.
Smart Images

Figure CN119676072A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of file processing technology, and in particular to a file generation method, a file generation device, an electronic device and a computer-readable storage medium. Background Art
[0002] As a high-speed real-time network communication protocol in the field of industrial automation, EtherCAT (EtherCAT Control and Automation Technology) has significant advantages such as high-speed communication, flexibility and scalability, which makes it very popular in the field of industrial robots and machine tools. Among them, ENI files (EtherCAT Network Interface) play a core role in the generation, management and maintenance of EtherCAT files, ensuring that the network configuration, management and operation of industrial robots and machine tools can be carried out efficiently and reliably. However, due to the diverse characteristics of EtherCAT network configuration software, for the same type of slave devices, it is easy for the ENI files generated by different EtherCAT network configuration software to have significant differences, which exacerbates the compatibility challenges in the network configuration process. Summary of the invention
[0003] The embodiments of the present invention provide a method and device for generating a file, an electronic device and a computer-readable storage medium, so as to solve or partially solve the problem of poor compatibility in the network configuration process of the device.
[0004] The embodiment of the present invention discloses a method for generating a file, which is applied to a file conversion device, wherein the file conversion device at least includes a parsing module, an algorithm module connected to the parsing module, a storage module connected to the algorithm module, and a creation module connected to the storage module. The method includes:
[0005] Importing a first network configuration file generated by a network configuration software, wherein the first network configuration file includes information of a plurality of nodes;
[0006] Calling the parsing module to parse the node information, obtaining parsed content corresponding to the node information, and importing the parsed content into the algorithm module;
[0007] Calling the algorithm module to perform algorithm processing on the parsed content, obtaining the algorithm processing content corresponding to the node information, and storing the parsed content and the algorithm processing content in the storage module;
[0008] The creation module is called in response to a network configuration instruction for a target device, the parsed content and the algorithm processing content are integrated according to the network configuration instruction, and a second network configuration file for the target device is created, wherein the second network configuration file is different from the first network configuration file in file format, and the target device performs network configuration according to the second network configuration file.
[0009] In some feasible embodiments, the node information includes a plurality of node sets, and the parsing of the node information to obtain parsed content corresponding to the node information includes:
[0010] Obtaining the node path corresponding to each of the node sets, and obtaining the corresponding node content from each of the node paths;
[0011] A structure for the node content is obtained, and the node content is added to the structure to obtain parsed content corresponding to the node information.
[0012] In some feasible embodiments, the node set includes at least a Master node set, a Slave node set, a Cyclic node set, and a ProcessImage node set, and obtaining the node path corresponding to each of the node sets includes:
[0013] Obtain a first node path corresponding to the Master node set, a second node path corresponding to the Slave node set, a third node path corresponding to the Cyclic node set, and a fourth node path corresponding to the ProcessImage node set.
[0014] In some feasible embodiments, the obtaining corresponding node content from each of the node paths includes:
[0015] Obtain the first node content of the Master node set through the first node path;
[0016] Acquire the second node content of the Slave node set through the second node path;
[0017] Acquire the third node content of the Cyclic node set through the third node path;
[0018] The fourth node content of the ProcessImage node set is obtained through the fourth node path.
[0019] In some feasible embodiments, the parsing module is configured with a parsing function, and the adding of the node content to the structure to obtain the parsing content corresponding to the node information includes:
[0020] Add the first node content to a preset structure through the parsing function to obtain a first target structure corresponding to the Master node set;
[0021] Adding the second node content to a preset structure through the parsing function to obtain a second target structure corresponding to the Slave node set;
[0022] Adding the third node content to a preset structure through the parsing function to obtain a third target structure corresponding to the Cyclic node set;
[0023] The fourth node content is added to a preset structure through the parsing function to obtain a fourth target structure corresponding to the ProcessImage node set.
[0024] In some feasible embodiments, performing algorithm processing on the parsed content to obtain algorithm processing content corresponding to the node information includes:
[0025] Identifying a specific node in the first network configuration file from the node information, and extracting associated nodes that have a corresponding relationship with the specific node, wherein data corresponding to the specific node is different in different network configuration files;
[0026] Obtaining a fifth node path corresponding to the specific node, extracting a fifth node content corresponding to the specific node from the fifth node path, adding the fifth node content to a preset structure, and obtaining a fifth target structure corresponding to the specific node;
[0027] A sixth node path corresponding to the associated node is obtained, a sixth node content corresponding to the associated node is extracted from the sixth node path, the sixth node content is added to a preset structure, and a sixth target structure corresponding to the associated node is obtained.
[0028] In some feasible embodiments, the parsed content includes at least a first target structure, a second target structure, a third target structure, and a fourth target structure, the algorithm processing content includes at least a fifth target structure and a sixth target structure, the creation module is configured with a creation function, and in response to a network configuration instruction for a target device, the parsed content and the algorithm processing content are integrated according to the network configuration instruction to create a second network configuration file for the target device, including:
[0029] In response to a network configuration instruction for a target device, obtaining a file format applicable to the target device and determining a file structure corresponding to the file format, the file structure including element bits;
[0030] Obtain the sequence corresponding to the creation function, and extract corresponding elements from the first target structure, the second target structure, the third target structure, the fourth target structure, the fifth target structure, and the sixth target structure in the sequence, and add the elements to the element positions to create a second network configuration file for the target device.
[0031] In some feasible embodiments, the first network configuration file includes setting information, and the method further includes:
[0032] If it is detected through the pointer that the setting information exists in the first network configuration file, calling the parsing module to parse the first network configuration file to obtain the setting information;
[0033] Add the setting information to a preset structure to obtain a corresponding seventh target structure;
[0034] The setting information includes at least whether to set a DC mode, a communication cycle, and an initialization configuration.
[0035] The embodiment of the present invention further discloses a file conversion device, which comprises at least a parsing module, an algorithm module connected to the parsing module, a storage module connected to the algorithm module, and a creation module connected to the storage module, wherein:
[0036] The parsing module is used to import a first network configuration file generated by the network configuration software, wherein the first network configuration file includes a plurality of node information; and parse the node information to obtain parsed content corresponding to the node information, and import the parsed content into the algorithm module;
[0037] The algorithm module is used to perform algorithm processing on the parsed content, obtain algorithm processing content corresponding to the node information, and store the parsed content and the algorithm processing content in the storage module;
[0038] The creation module is used to respond to a network configuration instruction for a target device, integrate the parsed content with the algorithm processing content according to the network configuration instruction, and create a second network configuration file for the target device, the file format of the second network configuration file is different from that of the first network configuration file, and the target device performs network configuration according to the second network configuration file.
[0039] In some feasible embodiments, the node information includes several node sets, and the parsing module is specifically used to:
[0040] Obtaining the node path corresponding to each of the node sets, and obtaining the corresponding node content from each of the node paths;
[0041] A structure for the node content is obtained, and the node content is added to the structure to obtain parsed content corresponding to the node information.
[0042] In some feasible embodiments, the node set includes at least a Master node set, a Slave node set, a Cyclic node set, and a ProcessImage node set, and the parsing module is specifically used for:
[0043] Obtain a first node path corresponding to the Master node set, a second node path corresponding to the Slave node set, a third node path corresponding to the Cyclic node set, and a fourth node path corresponding to the ProcessImage node set.
[0044] In some feasible embodiments, the parsing module is specifically used for:
[0045] Obtain the first node content of the Master node set through the first node path;
[0046] Acquire the second node content of the Slave node set through the second node path;
[0047] Acquire the third node content of the Cyclic node set through the third node path;
[0048] The fourth node content of the ProcessImage node set is obtained through the fourth node path.
[0049] In some feasible embodiments, the parsing module is configured with a parsing function, and the parsing module is specifically used to:
[0050] Add the first node content to a preset structure through the parsing function to obtain a first target structure corresponding to the Master node set;
[0051] Adding the second node content to a preset structure through the parsing function to obtain a second target structure corresponding to the Slave node set;
[0052] Adding the third node content to a preset structure through the parsing function to obtain a third target structure corresponding to the Cyclic node set;
[0053] The fourth node content is added to a preset structure through the parsing function to obtain a fourth target structure corresponding to the ProcessImage node set.
[0054] In some feasible embodiments, the algorithm processing module is used to:
[0055] Identifying a specific node in the first network configuration file from the node information, and extracting associated nodes that have a corresponding relationship with the specific node, wherein data corresponding to the specific node is different in different network configuration files;
[0056] Obtaining a fifth node path corresponding to the specific node, extracting a fifth node content corresponding to the specific node from the fifth node path, adding the fifth node content to a preset structure, and obtaining a fifth target structure corresponding to the specific node;
[0057] A sixth node path corresponding to the associated node is obtained, a sixth node content corresponding to the associated node is extracted from the sixth node path, the sixth node content is added to a preset structure, and a sixth target structure corresponding to the associated node is obtained.
[0058] In some feasible embodiments, the parsing content includes at least a first target structure, a second target structure, a third target structure and a fourth target structure, the algorithm processing content includes at least a fifth target structure and a sixth target structure, and a creation function is configured in the creation module, and the creation module is specifically used for:
[0059] In response to a network configuration instruction for a target device, obtaining a file format applicable to the target device and determining a file structure corresponding to the file format, the file structure including element bits;
[0060] Obtain the sequence corresponding to the creation function, and extract corresponding elements from the first target structure, the second target structure, the third target structure, the fourth target structure, the fifth target structure, and the sixth target structure in the sequence, and add the elements to the element positions to create a second network configuration file for the target device.
[0061] In some feasible embodiments, the first network configuration file includes setting information; wherein,
[0062] The parsing module is further configured to call the parsing module to parse the first network configuration file to obtain the setting information if the setting information is detected in the first network configuration file through the pointer;
[0063] The creation module is further used to add the setting information to a preset structure to obtain a corresponding seventh target structure;
[0064] The setting information includes at least whether to set a DC mode, a communication cycle, and an initialization configuration.
[0065] The embodiment of the present invention further discloses an electronic device, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;
[0066] The memory is used to store computer programs;
[0067] The processor is used to implement the method described in the embodiment of the present invention when executing the program stored in the memory.
[0068] The embodiment of the present invention further discloses a computer-readable storage medium having instructions stored thereon, which, when executed by one or more processors, enables the processors to execute the method described in the embodiment of the present invention.
[0069] The embodiments of the present invention include the following advantages:
[0070] In an embodiment of the present invention, the file conversion device is applied to a file conversion device, which may include a parsing module, an algorithm module connected to the parsing module, a storage module connected to the algorithm module, and a creation module connected to the storage module. Then, a first network configuration file generated by a network configuration software may be imported, wherein the first network configuration file includes a plurality of node information; the parsing module is called to parse the node information to obtain parsed content corresponding to the node information, and the parsed content is imported into the algorithm module; the algorithm module is called to perform algorithm processing on the parsed content to obtain algorithm processing content corresponding to the node information, and the parsed content and the algorithm processing content are stored in the storage module; the creation module is called in response to a network configuration instruction for a target device, and the parsed content is processed according to the network configuration instruction. The content is integrated with the algorithm processing content to create a second network configuration file for the target device. The file format of the second network configuration file is different from that of the first network configuration file. The target device performs network configuration according to the second network configuration file, so that the imported network configuration file is parsed, algorithmically processed, stored and created through the mutual cooperation among the parsing module, the algorithm module, the storage module and the creation module in the file conversion device, so that another network configuration file adapted to the target device can be constructed, which greatly saves the time and cost of generating the network configuration file. At the same time, since the generated network configuration file is suitable for the corresponding target device, based on this, not only the configuration flexibility of the network can be improved, but also the integration and interoperability of the equipment can be promoted. BRIEF DESCRIPTION OF THE DRAWINGS
[0071] Figure 1 is a flowchart of a method for generating a file provided in an embodiment of the present invention;
[0072] Figure 2 is a schematic diagram of the structure of a file conversion device provided in an embodiment of the present invention;
[0073] Figure 3 Schematic diagram of the architecture of the EtherCAT ENI file provided in an embodiment of the present invention;
[0074] Figure 4 It is a flowchart of ENI file parsing and creation provided in an embodiment of the present invention;
[0075] Figure 5 is a structural block diagram of a file generation device provided in an embodiment of the present invention;
[0076] Figure 6 It is a block diagram of an electronic device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0077] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0078] As an example, due to the diverse nature of EtherCAT network configuration software, for the same type of slave devices, it is easy for the ENI (Environment INI) files generated by different EtherCAT network configuration software to have significant differences, which exacerbates the compatibility challenges in the network configuration process.
[0079] In this regard, in the present invention, a corresponding file conversion device is constructed, and the network configuration file generated by the network configuration software is converted through the file conversion device to obtain a new network configuration file adapted to the target device. Specifically, the file conversion device may include a parsing module, an algorithm module connected to the parsing module, a storage module connected to the algorithm module, and a creation module connected to the storage module. Then, the first network configuration file generated by the network configuration software can be imported, and the first network configuration file includes a number of node information; the parsing module is called to parse the node information to obtain the parsed content corresponding to the node information, and the parsed content is imported into the algorithm module; the algorithm module is called to perform algorithmic processing on the parsed content to obtain the algorithmic processing content corresponding to the node information, and the parsed content and the algorithmic processing content are stored in the storage module; the creation module is called In response to a network configuration instruction for a target device, the parsed content and the algorithm processing content are integrated according to the network configuration instruction to create a second network configuration file for the target device. The second network configuration file is different from the first network configuration file in file format, and the target device performs network configuration according to the second network configuration file. Thus, through the cooperation among the parsing module, the algorithm module, the storage module and the creation module in the file conversion device, the imported network configuration file is parsed, algorithmically processed, stored and created, and another network configuration file adapted to the target device can be constructed, which greatly saves the time and cost of generating the network configuration file. At the same time, since the generated network configuration file is suitable for the corresponding target device, based on this, not only the configuration flexibility of the network can be improved, but also the integration and interoperability of the device can be promoted.
[0080] It should be noted that the embodiments of the present invention can be applied to the fields of industrial robots and machine tools. In these fields, the diverse characteristics of the EtherCAT network configuration software result in significant differences in parameter combination and structural layout of the ENI files generated by different EtherCAT network configuration software for the same type of slave drivers.
[0081] In some exemplary application scenarios, for equipment integration and debugging, during the integration process of industrial robots and machine tools, different equipment suppliers may use different EtherCAT network configuration software. For example, one supplier uses TwinCAT software, and another supplier uses Automation Studio software. Different software can generate ENI files in different file formats. As a result, since the ENI files generated by different software have differences in parameter combination and structural layout, integration engineers need to spend extra time and energy to understand and parse these files to ensure that all devices can be correctly configured and communicate.
[0082] For network configuration and maintenance, network administrators may need to deal with ENI files from different suppliers during the network configuration and maintenance process. For example, a factory may use equipment from multiple suppliers at the same time. The ENI file format provided by each supplier is different. Therefore, network administrators need to have knowledge of multiple EtherCAT network configuration software in order to correctly parse and configure these files. In addition, ENI files may need to be updated regularly during the maintenance process to ensure the consistency and compatibility of network configuration.
[0083] For system upgrades and expansions, it may be necessary to add new devices or update the configuration of existing devices during the system upgrade and expansion process. For example, a machine tool manufacturer may need to upgrade the control system and add new sensors or actuators. Since the ENI file formats generated by different software are different, the network may need to be reconfigured during the system upgrade and expansion process to ensure that the new device is compatible with the existing network. This may involve manually adjusting the ENI file or using automated tools for format conversion.
[0084] For cross-platform compatibility, in cross-platform applications, it may be necessary to switch between different control systems and network configuration software. For example, a company may switch from one control system to another, or share equipment between different factories. Since the ENI file formats generated by different software are different, cross-platform compatibility becomes an important issue. Compatibility tools need to be developed and used to ensure that ENI files can be correctly parsed and configured between different platforms.
[0085] Reference Figure 1 , shows a flowchart of the steps of a method for generating a file provided in an embodiment of the present invention, which is applied to a file conversion device, the file conversion device at least includes a parsing module, an algorithm module connected to the parsing module, a storage module connected to the algorithm module, and a creation module connected to the storage module, and specifically may include the following steps:
[0086] Step 101, importing a first network configuration file generated by a network configuration software, wherein the first network configuration file includes information of a plurality of nodes;
[0087] In an embodiment of the present invention, the file conversion device may be a tool designed by a user for converting TwinCAT ENI files, which may be an application, plug-in, script, etc. running on an electronic terminal. Through the file conversion device, the ENI file (i.e., network configuration file, in the following embodiment, the ENI file refers to the network configuration file) generated by the EtherCAT network configuration software may be converted into an ENI file of another file format adapted to the target device.
[0088] The ENI file can be used to describe the automation system configuration and communication configuration. The ENI file can describe the hardware configuration, software configuration, network configuration, and device communication parameters of the corresponding device during operation. Optionally, the ENI file can be in XML (eXtensible Markup Language) format, containing configuration information of hardware, software, and communication nodes, which plays a key role in industrial automation systems and can ensure the accuracy and consistency of system configuration.
[0089] In one example, referring to Figure 2 , shows a schematic diagram of the structure of the file conversion device provided in an embodiment of the present invention, which may include a parsing module, an algorithm module, a storage module and a creation module. Among them, the parsing module can be used to parse the ENI file and store the parsed content in the storage module; the algorithm module can be used to perform algorithm processing on some nodes in the ENI file and store the processed content in the storage module; the creation module can be used to create an ENI file in a self-required format according to the content stored in the storage module, that is, to convert the ENI file in the first file format into the ENI file in the second file format. For the file conversion device, by importing the TwinCAT ENI file, after being processed by four units such as the parsing module, the algorithm module, the storage module and the creation module, the ENI file in the self-required format can be exported.
[0090] In a specific implementation, a first network configuration file to be converted may be determined first, and the first network configuration file may include a plurality of node information, and different node information may include different parameters. The node information may include a Master node set, a Slave node set, a Cyclic node set, and a ProcessImage node set.
[0091] In one example, referring to Figure 3 , shows a schematic diagram of the architecture of the EtherCAT ENI file provided in an embodiment of the present invention, which may include, for a Master node set:
[0092] Info (node set): contains the basic information of the master, such as the name, version number, configuration parameters, etc. This information is used to identify and manage the master.
[0093] InitCmds (node set): Contains the initialization commands of the master station, which are used to perform specific initialization operations when the network starts, such as configuring network parameters, starting communication, etc.
[0094] For the Slave node set, it can include:
[0095] Info (node set): contains basic information of the slave, such as the name, type, physical address, etc. This information is used to identify and manage the slave.
[0096] ProcessData (node set): contains the real-time data processing information of the slave, such as data mapping, data transmission cycle, etc. This information is used to ensure that the slave can efficiently process and transmit real-time data.
[0097] Mailbox (node set): Contains the mailbox communication information of the slave station, which is used to handle non-real-time data transmission and control commands. Mailbox communication is usually used to configure the slave station, send control commands, etc.
[0098] InitCmds (node set): contains the initialization commands of the slave, which are used to perform specific initialization operations when the slave is started, such as configuring slave parameters, starting communication, etc.
[0099] For Cyclic node sets, it can include:
[0100] Cmd (node set): contains loop command information, which is used to periodically perform specific operations, such as data collection, status update, etc.
[0101] Irpuls (node set): contains pulse signal information and is used to process periodic pulse signals, such as timers, counters, etc.
[0102] For a ProcessImage node set, it can include:
[0103] Outputs (node set): contains output data information, which is used to define the output data mapping of the slave station, such as control signals, status signals, etc.
[0104] Step 102, calling the parsing module to parse the node information, obtaining parsed content corresponding to the node information, and importing the parsed content into the algorithm module;
[0105] After the first network configuration file is imported into the file conversion device, the file conversion device can call the parsing module to parse the node information, obtain the parsed content corresponding to the node information, import the parsed content into the algorithm module, and store the parsed content in the storage module.
[0106] Among them, as in the above embodiment, the node information includes several node sets, and the parsing module can first obtain the node path corresponding to each node set, obtain the corresponding node content from each node path, and then obtain the structure for the node content, and add the node content to the structure to obtain the parsed content corresponding to the node information.
[0107] In a specific implementation, for the Master node set, the Slave node set, the Cyclic node set and the ProcessImage node set, the parsing module can first obtain the first node path corresponding to the Master node set, the second node path corresponding to the Slave node set, the third node path corresponding to the Cyclic node set and the fourth node path corresponding to the ProcessImage node set. Then, the first node content of the Master node set is obtained through the first node path; the second node content of the Slave node set is obtained through the second node path; the third node content of the Cyclic node set is obtained through the third node path; and the fourth node content of the ProcessImage node set is obtained through the fourth node path. Then, the parsing module is configured with a corresponding parsing function, and the parsing module can add the first node content to the preset structure through the parsing function to obtain the first target structure corresponding to the Master node set, add the second node content to the preset structure to obtain the second target structure corresponding to the Slave node set, add the third node content to the preset structure to obtain the third target structure corresponding to the Cyclic node set, add the fourth node content to the preset structure to obtain the fourth target structure corresponding to the ProcessImage node set.
[0108] It should be noted that the structure can be a file structure of a pre-designed parameter combination and structural layout. During the parsing process, the parsing functions corresponding to each node set are the same, but the parsing paths are different. By inputting the node path corresponding to the corresponding node into the parsing function, the parsing function calls the content acquisition function through the path to obtain the node content corresponding to the node, and then assigns the node content to the defined structure to obtain the corresponding target structure, and stores the target structure in the storage module for use in subsequent module creation.
[0109] Step 103, calling the algorithm module to perform algorithm processing on the parsed content, obtaining the algorithm processing content corresponding to the node information, and storing the parsed content and the algorithm processing content in the storage module;
[0110] In the process of processing the first network configuration file, some nodes in the file need to be processed by algorithm. The algorithm module can be called to perform algorithm processing on the parsed content, obtain the algorithm processing content corresponding to the node information, and store the parsed content and the algorithm processing content in the storage module.
[0111] In a specific implementation, a specific node in the first network configuration file can be identified from the node information, and an associated node that has a corresponding relationship with the specific node can be extracted. The data corresponding to the specific node is different in different network configuration files. Then, the fifth node path corresponding to the specific node is obtained, and the fifth node content corresponding to the specific node is extracted from the fifth node path. The fifth node content is added to the preset structure to obtain the fifth target structure corresponding to the specific node. The sixth node path corresponding to the associated node is obtained, and the sixth node content corresponding to the associated node is extracted from the sixth node path. The sixth node content is added to the preset structure to obtain the sixth target structure corresponding to the associated node.
[0112] It should be noted that in the process of parsing TwinCAT ENI files, the algorithm processing step is responsible for processing certain special nodes in the ENI file. The data of these special nodes may be different in different ENI files, but they have a corresponding relationship with other nodes. By applying specific algorithms, new or improved data can be generated to meet the needs of subsequent creation of self-format ENI files.
[0113] In one example, suppose that the ENI file describes the network configuration of an industrial automation system, and the algorithm module needs to identify specific nodes (such as the "EthernetConfig" node) from these files and extract the associated nodes (such as the "IPAddress" node) that have a corresponding relationship with them. Then, the relevant content is extracted according to the specific node path and added to the preset structure. For example, an exemplary ENI file fragment can be:
[0114] <enifile>
[0115] <networkconfig>
[0116] <ethernetconfig>
[0117] <interface> eth0< / interface>
[0118] <speed> 100Mbps< / speed>
[0119] < / ethernetconfig>
[0120] <ipaddress>
[0121] <address>192.168.1.100< / address>
[0122] <subnetmask> 255.255.255.0< / subnetmask>
[0123] < / ipaddress>
[0124] <gateway>
[0125] <address>192.168.1.1< / address>
[0126] < / gateway>
[0127] < / networkconfig>
[0128] < / enifile>
[0129] For the above file fragments, the algorithm module can perform the following corresponding processes:
[0130] 1. Identify specific nodes and related nodes
[0131] Identify the "EthernetConfig" node from the node information.
[0132] Assume that the "EthernetConfig" node is the specific node we need to deal with.
[0133] Identify the associated node "IPAddress" that has a corresponding relationship with the "EthernetConfig" node.
[0134] The associated node "IPAddress" contains the network configuration information related to the "EthernetConfig" node.
[0135] 2. Extract the path and content of specific nodes and related nodes
[0136] 1) Get the fifth node path of a specific node:
[0137] Assume that the fifth node path of the "EthernetConfig" node is: " / ENIFile / NetworkConfig / EthernetConfig / Speed".
[0138] 2) Extract the fifth node content of a specific node:
[0139] The fifth node content “100Mbps” of the “EthernetConfig” node is extracted from the fifth node path.
[0140] 3) Add the fifth node content to the preset structure:
[0141] Add "100Mbps" to the preset structure to obtain a fifth target structure corresponding to the specific node.
[0142] 4) Get the sixth node path of the associated node:
[0143] Assume that the sixth node path of the "IPAddress" node is " / ENIFile / NetworkConfig / IPAddress / Address".
[0144] 5) Extract the sixth node content of the associated node:
[0145] The sixth node content "192.168.1.100" of the "IPAddress" node is extracted from the sixth node path.
[0146] 6) Add the sixth node content to the preset structure:
[0147] Add "192.168.1.100" to the preset structure to obtain the sixth target structure corresponding to the associated node.
[0148] Assume the preset structure to store the extracted content:
[0149]
[0150] Then for the assignment of structure:
[0151] ①Assignment of the fifth node content:
[0152] networkConfig.ethernetSpeed=strdup("100Mbps");
[0153] ②Assignment of the sixth node content:
[0154] networkConfig.ipAddress=strdup("192.168.1.100");
[0155] Through the above steps, the algorithm module can identify and extract the relevant content of the "EthernetConfig" node and the "IPAddress" node, and assign these contents to the preset structure. Finally, a structure containing network configuration information is obtained:
[0156] NetworkConfigStructnetworkConfig={
[0157] .ethernetSpeed="100Mbps",
[0158] .ipAddress="192.168.1.100"};
[0159] Through the above process, we can identify specific nodes and related nodes, extract their paths and contents, and add these contents to the preset structure. We have successfully extracted the required network configuration information from the network configuration file. This method ensures the accuracy and consistency of the data, which facilitates the subsequent network configuration management.
[0160] Step 104, calling the creation module in response to the network configuration instruction for the target device, integrating the parsed content and the algorithm processing content according to the network configuration instruction, and creating a second network configuration file for the target device, wherein the file format of the second network configuration file is different from that of the first network configuration file, and the target device performs network configuration according to the second network configuration file.
[0161] In an embodiment of the present invention, after the parsing module has parsed the parsing content corresponding to the node information, and the algorithm module has performed algorithmic processing on the specific node to obtain the corresponding algorithmic processing content, the creation module can be further called to respond to the network configuration instruction for the target device, and the parsing content and the algorithmic processing content stored in the storage module are integrated according to the network configuration instruction to create a second network configuration file for the target device. Thus, through the mutual cooperation between the parsing module, the algorithm module, the storage module and the creation module in the file conversion device, the imported network configuration file is parsed, algorithmically processed, stored and created, and another network configuration file adapted to the target device can be constructed, which greatly saves the time and cost of generating the network configuration file. At the same time, since the generated network configuration file is suitable for the corresponding target device, based on this, not only the configuration flexibility of the network can be improved, but also the integration and interoperability of the device can be promoted.
[0162] For the above embodiment, the parsed content includes at least the first target structure, the second target structure, the third target structure and the fourth target structure, the algorithm processing content includes at least the fifth target structure and the sixth target structure, and the creation module is configured with a creation function. The creation module can respond to the network configuration instruction for the target device, obtain the file format suitable for the target device, and determine the file structure corresponding to the file format. The file structure includes element bits, and obtains the sequence corresponding to the creation function, and extracts the corresponding elements from the first target structure, the second target structure, the third target structure, the fourth target structure, the fifth target structure and the sixth target structure in sequence, and adds the elements to the element bits to create a second network configuration file for the target device.
[0163] It should be noted that when the creation function is called during the creation process, if the elements contained in different node sets are different, the corresponding elements can be added to the corresponding element positions in the file structure by defining the creation function. Specifically, the parsed content and algorithm processing content can be filled by the order of the creation function, and the present invention does not limit this. It can be understood that the structure is a structure in C language defined according to the node set contained in the ENI file, which contains the corresponding elements in the structure.
[0164] In addition, the impact of different TwinCAT software settings on ENI files also needs to be considered during the file conversion process. Different settings will affect the number of related nodes and the content contained in the nodes, thereby affecting the parsing, processing and creation of related content.
[0165] In a specific implementation, the first network configuration file includes setting information. If the pointer detects that there is setting information in the first network configuration file, the parsing module is called to parse the first network configuration file to obtain the setting information, and then the setting information is added to the preset structure to obtain the corresponding seventh target structure, so as to add the content contained in the seventh target structure to the file structure to ensure the integrity of the file content. The setting information includes at least one of whether to set the DC mode, the communication cycle, and the initialization configuration.
[0166] It should be noted that TwinCAT software has settings such as DC mode, communication cycle, initialization configuration, etc. The ENI files generated by selecting these configurations will also be different. For example, if you select the DC (Distributed Clock Mode) mode, there will be an additional corresponding DC node set in the ENI file containing some DC parameters. Similar to the settings of the communication cycle and initialization in TwinCAT software, there will be more or fewer corresponding nodes. Changing the DC mode, communication cycle, and initialization values will also change the corresponding DC, communication cycle, and initialization node values. During the parsing process, the node paths corresponding to the DC mode, communication cycle, and initialization configuration will be added. If there are corresponding nodes during the parsing process, the parsing function can obtain the corresponding node content and assign it to the corresponding structure. If there is no corresponding node, the parsing function cannot obtain the node, and an empty node will be displayed and the node creation will be skipped.
[0167] It should be noted that the embodiments of the present invention include but are not limited to the above examples. It is understandable that those skilled in the art can also make settings according to actual needs under the guidance of the ideas of the embodiments of the present invention, and the present invention is not limited to this.
[0168] In an embodiment of the present invention, the file conversion device is applied to a file conversion device, which may include a parsing module, an algorithm module connected to the parsing module, a storage module connected to the algorithm module, and a creation module connected to the storage module. Then, a first network configuration file generated by a network configuration software may be imported, wherein the first network configuration file includes a plurality of node information; the parsing module is called to parse the node information to obtain parsed content corresponding to the node information, and the parsed content is imported into the algorithm module; the algorithm module is called to perform algorithm processing on the parsed content to obtain algorithm processing content corresponding to the node information, and the parsed content and the algorithm processing content are stored in the storage module; the creation module is called in response to a network configuration instruction for a target device, and the parsed content is processed according to the network configuration instruction. The content is integrated with the algorithm processing content to create a second network configuration file for the target device. The file format of the second network configuration file is different from that of the first network configuration file. The target device performs network configuration according to the second network configuration file, so that the imported network configuration file is parsed, algorithmically processed, stored and created through the mutual cooperation among the parsing module, the algorithm module, the storage module and the creation module in the file conversion device, so that another network configuration file adapted to the target device can be constructed, which greatly saves the time and cost of generating the network configuration file. At the same time, since the generated network configuration file is suitable for the corresponding target device, based on this, not only the configuration flexibility of the network can be improved, but also the integration and interoperability of the equipment can be promoted.
[0169] In order to enable those skilled in the art to better understand the technical solutions in the embodiments of the present invention, the following examples are used for exemplary description:
[0170] As an example, the present invention automatically parses TwinCAT ENI files to generate self-demand format ENI files. For each EtherCAT ENI file, it can include four node sets, namely Master, Slave, Cyclic, ProcessImage, etc., and the parsing module and the creation module can be divided into four parts. Through the automatic parsing creation process, the present invention can be divided into four modules, namely, a parsing module, an algorithm module, a storage module, and a creation module. After the TwinCAT ENI file is imported and processed by the four modules, it can be created according to the ENI file of the self-demand format.
[0171] In the process of converting files, Figure 4The figure shows the ENI file parsing creation flow chart. The automatic parsing creation of TwinCAT ENI files can be divided into four processes: ① Import and parse TwinCAT ENI files. First, import the TwinCAT ENI files to be parsed into the system, and parse each node in the TwinCAT ENI file by calling the parsing function through the parsing module; ② For some nodes in the TwinCAT ENI file, algorithm processing is required. The parsed content of the corresponding nodes is placed in the algorithm module, and the algorithm module processes this part of the content through some algorithms; ③ The previously parsed and algorithm-processed node content is stored in the storage module; ④ In the creation process, the creation function is called by the creation module to create an ENI file in a self-required format. For example, the node set structure in the ENI file includes three parts: A, B, and C. Through the creation module, it can be created according to the self-required ENI file format, including B, A, C structure, C, B, A structure, A, C, B structure, etc., and the corresponding content is filled into the corresponding structure.
[0172] In addition, the impact of different TwinCAT software settings on ENI files also needs to be considered, such as whether to set DC mode, communication cycle, initialization configuration, etc. Different settings will affect the number of related nodes and the content contained in each node. The pointer is used to determine whether there is a corresponding setting, so as to parse, process and create related content.
[0173] Through the present invention, users can download TwinCAT software by themselves, scan the corresponding ENI file through TwinCAT software, and then automatically parse and create the required ENI file format, which is adapted to the different settings of TwinCAT software for parsing and creation and adapted to the corresponding driver. The present invention provides a highly reliable, flexible, efficient and safe EtherCAT network configuration management solution, and also greatly saves the time and cost of generating ENI files.
[0174] It should be noted that, for the sake of simplicity, the method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.
[0175] Reference Figure 5 , shows a structural block diagram of a file generation device provided in an embodiment of the present invention, the file conversion device at least includes a parsing module, an algorithm module connected to the parsing module, a storage module connected to the algorithm module, and a creation module connected to the storage module, wherein,
[0176] The parsing module is used to import a first network configuration file generated by the network configuration software, wherein the first network configuration file includes a plurality of node information; and parse the node information to obtain parsed content corresponding to the node information, and import the parsed content into the algorithm module;
[0177] The algorithm module is used to perform algorithm processing on the parsed content, obtain algorithm processing content corresponding to the node information, and store the parsed content and the algorithm processing content in the storage module;
[0178] The creation module is used to respond to a network configuration instruction for a target device, integrate the parsed content with the algorithm processing content according to the network configuration instruction, and create a second network configuration file for the target device, the file format of the second network configuration file is different from that of the first network configuration file, and the target device performs network configuration according to the second network configuration file.
[0179] In some feasible embodiments, the node information includes several node sets, and the parsing module is specifically used to:
[0180] Obtaining the node path corresponding to each of the node sets, and obtaining the corresponding node content from each of the node paths;
[0181] A structure for the node content is obtained, and the node content is added to the structure to obtain parsed content corresponding to the node information.
[0182] In some feasible embodiments, the node set includes at least a Master node set, a Slave node set, a Cyclic node set, and a ProcessImage node set, and the parsing module is specifically used for:
[0183] Obtain a first node path corresponding to the Master node set, a second node path corresponding to the Slave node set, a third node path corresponding to the Cyclic node set, and a fourth node path corresponding to the ProcessImage node set.
[0184] In some feasible embodiments, the parsing module is specifically used for:
[0185] Obtain the first node content of the Master node set through the first node path;
[0186] Acquire the second node content of the Slave node set through the second node path;
[0187] Acquire the third node content of the Cyclic node set through the third node path;
[0188] The fourth node content of the ProcessImage node set is obtained through the fourth node path.
[0189] In some feasible embodiments, the parsing module is configured with a parsing function, and the parsing module is specifically used to:
[0190] Add the first node content to a preset structure through the parsing function to obtain a first target structure corresponding to the Master node set;
[0191] Adding the second node content to a preset structure through the parsing function to obtain a second target structure corresponding to the Slave node set;
[0192] Adding the third node content to a preset structure through the parsing function to obtain a third target structure corresponding to the Cyclic node set;
[0193] The fourth node content is added to a preset structure through the parsing function to obtain a fourth target structure corresponding to the ProcessImage node set.
[0194] In some feasible embodiments, the algorithm processing module is used to:
[0195] Identifying a specific node in the first network configuration file from the node information, and extracting associated nodes that have a corresponding relationship with the specific node, wherein data corresponding to the specific node is different in different network configuration files;
[0196] Obtaining a fifth node path corresponding to the specific node, extracting a fifth node content corresponding to the specific node from the fifth node path, adding the fifth node content to a preset structure, and obtaining a fifth target structure corresponding to the specific node;
[0197] A sixth node path corresponding to the associated node is obtained, a sixth node content corresponding to the associated node is extracted from the sixth node path, the sixth node content is added to a preset structure, and a sixth target structure corresponding to the associated node is obtained.
[0198] In some feasible embodiments, the parsing content includes at least a first target structure, a second target structure, a third target structure and a fourth target structure, the algorithm processing content includes at least a fifth target structure and a sixth target structure, and a creation function is configured in the creation module, and the creation module is specifically used for:
[0199] In response to a network configuration instruction for a target device, obtaining a file format applicable to the target device and determining a file structure corresponding to the file format, the file structure including element bits;
[0200] Obtain the sequence corresponding to the creation function, and extract corresponding elements from the first target structure, the second target structure, the third target structure, the fourth target structure, the fifth target structure, and the sixth target structure in the sequence, and add the elements to the element positions to create a second network configuration file for the target device.
[0201] In some feasible embodiments, the first network configuration file includes setting information; wherein,
[0202] The parsing module is further configured to call the parsing module to parse the first network configuration file to obtain the setting information if the setting information is detected in the first network configuration file through the pointer;
[0203] The creation module is further used to add the setting information to a preset structure to obtain a corresponding seventh target structure;
[0204] The setting information includes at least whether to set a DC mode, a communication cycle, and an initialization configuration.
[0205] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0206] In addition, an embodiment of the present invention further provides an electronic device, including: a processor, a memory, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, the various processes of the above-mentioned file generation method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be described here.
[0207] The embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, each process of the above-mentioned file generation method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it is not repeated here. The computer-readable storage medium is, for example, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0208] Figure 6A schematic diagram of the hardware structure of an electronic device for implementing various embodiments of the present invention.
[0209] The electronic device 600 includes but is not limited to: a radio frequency unit 601, a network module 602, an audio output unit 603, an input unit 604, a sensor 605, a display unit 606, a user input unit 607, an interface unit 608, a memory 609, a processor 610, and a power supply 611. Those skilled in the art will appreciate that the electronic device structure involved in the embodiments of the present invention does not constitute a limitation on the electronic device, and the electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange components differently. In the embodiments of the present invention, the electronic device includes but is not limited to a mobile phone, a tablet computer, a laptop computer, a PDA, a vehicle-mounted terminal, a wearable device, and a pedometer.
[0210] It should be understood that in the embodiment of the present invention, the radio frequency unit 601 can be used for receiving and sending signals during information transmission or communication. Specifically, after receiving downlink data from the base station, it is sent to the processor 610 for processing; in addition, uplink data is sent to the base station. Generally, the radio frequency unit 601 includes but is not limited to an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier, a duplexer, etc. In addition, the radio frequency unit 601 can also communicate with the network and other devices through a wireless communication system.
[0211] The electronic device provides users with wireless broadband Internet access through the network module 602, such as helping users to send and receive emails, browse web pages, and access streaming media.
[0212] The audio output unit 603 can convert the audio data received by the RF unit 601 or the network module 602 or stored in the memory 609 into an audio signal and output it as sound. Moreover, the audio output unit 603 can also provide audio output related to a specific function performed by the electronic device 600 (for example, a call signal reception sound, a message reception sound, etc.). The audio output unit 603 includes a speaker, a buzzer, a receiver, etc.
[0213] The input unit 604 is used to receive audio or video signals. The input unit 604 may include a graphics processor (GPU) 6041 and a microphone 6042, and the graphics processor 6041 processes the image data of a static picture or video obtained by an image capture device (such as a camera) in a video capture mode or an image capture mode. The processed image frame can be displayed on the display unit 606. The image frame processed by the graphics processor 6041 can be stored in the memory 609 (or other storage medium) or sent via the radio frequency unit 601 or the network module 602. The microphone 6042 can receive sound and can process such sound into audio data. The processed audio data can be converted into a format output that can be sent to a mobile communication base station via the radio frequency unit 601 in the case of a telephone call mode.
[0214] The electronic device 600 also includes at least one sensor 605, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor includes an ambient light sensor and a proximity sensor, wherein the ambient light sensor can adjust the brightness of the display panel 6061 according to the brightness of the ambient light, and the proximity sensor can turn off the display panel 6061 and / or the backlight when the electronic device 600 is moved to the ear. As a type of motion sensor, the accelerometer sensor can detect the magnitude of acceleration in each direction (generally three axes), and can detect the magnitude and direction of gravity when stationary, which can be used to identify the posture of the electronic device (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc.; the sensor 605 can also include a fingerprint sensor, a pressure sensor, an iris sensor, a molecular sensor, a gyroscope, a barometer, a hygrometer, a thermometer, an infrared sensor, etc., which will not be repeated here.
[0215] The display unit 606 is used to display information input by the user or information provided to the user. The display unit 606 may include a display panel 6061, which may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), or the like.
[0216] The user input unit 607 can be used to receive input digital or character information, and to generate key signal input related to user settings and function control of the electronic device. Specifically, the user input unit 607 includes a touch panel 6071 and other input devices 6072. The touch panel 6071, also known as a touch screen, can collect the user's touch operation on or near it (such as the user's operation on the touch panel 6071 or near the touch panel 6071 using any suitable object or accessory such as a finger, stylus, etc.). The touch panel 6071 may include two parts: a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch orientation, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into contact coordinates, and then sends it to the processor 610, receives the command sent by the processor 610 and executes it. In addition, the touch panel 6071 can be implemented in various types such as resistive, capacitive, infrared and surface acoustic waves. In addition to the touch panel 6071, the user input unit 607 may also include other input devices 6072. Specifically, other input devices 6072 may include but are not limited to a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick, which will not be described in detail here.
[0217] Further, the touch panel 6071 may be covered on the display panel 6061. When the touch panel 6071 detects a touch operation on or near it, it is transmitted to the processor 610 to determine the type of the touch event, and then the processor 610 provides a corresponding visual output on the display panel 6061 according to the type of the touch event. It can be understood that in one embodiment, the touch panel 6071 and the display panel 6061 are used as two independent components to implement the input and output functions of the electronic device, but in some embodiments, the touch panel 6071 and the display panel 6061 can be integrated to implement the input and output functions of the electronic device, which is not limited here.
[0218] The interface unit 608 is an interface for connecting an external device to the electronic device 600. For example, the external device may include a wired or wireless headset port, an external power supply (or battery charger) port, a wired or wireless data port, a memory card port, a port for connecting a device with an identification module, an audio input / output (I / O) port, a video I / O port, a headphone port, etc. The interface unit 608 may be used to receive input (e.g., data information, power, etc.) from an external device and transmit the received input to one or more elements within the electronic device 600 or may be used to transmit data between the electronic device 600 and an external device.
[0219] The memory 609 can be used to store software programs and various data. The memory 609 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data created according to the use of the mobile phone (such as audio data, a phone book, etc.), etc. In addition, the memory 609 can include a high-speed random access memory, and can also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0220] The processor 610 is the control center of the electronic device. It uses various interfaces and lines to connect various parts of the entire electronic device. By running or executing software programs and / or modules stored in the memory 609 and calling data stored in the memory 609, it performs various functions of the electronic device and processes data, thereby monitoring the electronic device as a whole. The processor 610 may include one or more processing units; preferably, the processor 610 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 610.
[0221] The electronic device 600 may also include a power supply 611 (such as a battery) for supplying power to each component. Preferably, the power supply 611 may be logically connected to the processor 610 through a power management system, thereby implementing functions such as charging, discharging, and power consumption management through the power management system.
[0222] In addition, the electronic device 600 includes some functional modules not shown, which will not be described in detail here.
[0223] 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 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 sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0224] 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 invention, 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, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present invention.
[0225] The embodiments of the present invention are described above in conjunction with the accompanying drawings, but the present invention is not limited to the above-mentioned specific implementation modes, which are merely illustrative rather than restrictive. Under the guidance of the present invention, ordinary technicians in this field can also make many forms without departing from the scope of protection of the present invention and the claims, all of which are within the protection of the present invention.
[0226] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed in the embodiments of the present invention can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can 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 the present invention.
[0227] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0228] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0229] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0230] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0231] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard disks, ROM, RAM, magnetic disks, or optical disks.
[0232] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
Claims
1. A method for generating a file, characterized in that: Applied to a file conversion device, the file conversion device at least comprises a parsing module, an algorithm module connected to the parsing module, a storage module connected to the algorithm module, and a creation module connected to the storage module, the method comprises: Importing a first network configuration file generated by a network configuration software, wherein the first network configuration file includes information of a plurality of nodes; Calling the parsing module to parse the node information, obtaining parsed content corresponding to the node information, and importing the parsed content into the algorithm module; Calling the algorithm module to perform algorithm processing on the parsed content, obtaining the algorithm processing content corresponding to the node information, and storing the parsed content and the algorithm processing content in the storage module; The creation module is called in response to a network configuration instruction for a target device, the parsed content and the algorithm processing content are integrated according to the network configuration instruction, and a second network configuration file for the target device is created, wherein the second network configuration file is different from the first network configuration file in file format, and the target device performs network configuration according to the second network configuration file.
2. The method according to claim 1, characterized in that The node information includes a plurality of node sets, and the step of parsing the node information to obtain parsed content corresponding to the node information includes: Obtaining the node path corresponding to each of the node sets, and obtaining the corresponding node content from each of the node paths; A structure for the node content is obtained, and the node content is added to the structure to obtain parsed content corresponding to the node information.
3. The method according to claim 2, characterized in that The node set includes at least a Master node set, a Slave node set, a Cyclic node set, and a ProcessImage node set, and obtaining the node path corresponding to each of the node sets includes: Obtain a first node path corresponding to the Master node set, a second node path corresponding to the Slave node set, a third node path corresponding to the Cyclic node set, and a fourth node path corresponding to the ProcessImage node set.
4. The method according to claim 3, characterized in that The obtaining corresponding node content from each of the node paths includes: Obtain the first node content of the Master node set through the first node path; Acquire the second node content of the Slave node set through the second node path; Acquire the third node content of the Cyclic node set through the third node path; The fourth node content of the ProcessImage node set is obtained through the fourth node path.
5. The method according to claim 4, characterized in that The parsing module is configured with a parsing function, and the node content is added to the structure to obtain the parsing content corresponding to the node information, including: Add the first node content to a preset structure through the parsing function to obtain a first target structure corresponding to the Master node set; Adding the second node content to a preset structure through the parsing function to obtain a second target structure corresponding to the Slave node set; Adding the third node content to a preset structure through the parsing function to obtain a third target structure corresponding to the Cyclic node set; The fourth node content is added to a preset structure through the parsing function to obtain a fourth target structure corresponding to the ProcessImage node set.
6. The method according to claim 1, characterized in that The performing algorithm processing on the parsed content to obtain algorithm processing content corresponding to the node information includes: Identifying a specific node in the first network configuration file from the node information, and extracting associated nodes that have a corresponding relationship with the specific node, wherein data corresponding to the specific node is different in different network configuration files; Obtaining a fifth node path corresponding to the specific node, extracting a fifth node content corresponding to the specific node from the fifth node path, adding the fifth node content to a preset structure, and obtaining a fifth target structure corresponding to the specific node; A sixth node path corresponding to the associated node is obtained, a sixth node content corresponding to the associated node is extracted from the sixth node path, the sixth node content is added to a preset structure, and a sixth target structure corresponding to the associated node is obtained.
7. The method according to claim 1, characterized in that The parsed content includes at least a first target structure, a second target structure, a third target structure, and a fourth target structure; the algorithm processing content includes at least a fifth target structure and a sixth target structure; the creation module is configured with a creation function; and in response to a network configuration instruction for a target device, the parsed content and the algorithm processing content are integrated according to the network configuration instruction to create a second network configuration file for the target device, including: In response to a network configuration instruction for a target device, obtaining a file format applicable to the target device and determining a file structure corresponding to the file format, the file structure including element bits; Obtain the sequence corresponding to the creation function, and extract corresponding elements from the first target structure, the second target structure, the third target structure, the fourth target structure, the fifth target structure, and the sixth target structure in the sequence, and add the elements to the element positions to create a second network configuration file for the target device.
8. The method according to claim 1, characterized in that The first network configuration file includes setting information, and the method further includes: If it is detected through the pointer that the setting information exists in the first network configuration file, calling the parsing module to parse the first network configuration file to obtain the setting information; Add the setting information to a preset structure to obtain a corresponding seventh target structure; The setting information includes at least whether to set a DC mode, a communication cycle, or an initialization configuration.
9. A file conversion device, characterized in that: The file conversion device at least comprises a parsing module, an algorithm module connected to the parsing module, a storage module connected to the algorithm module, and a creation module connected to the storage module, wherein: The parsing module is used to import a first network configuration file generated by the network configuration software, wherein the first network configuration file includes a plurality of node information; and parse the node information to obtain parsed content corresponding to the node information, and import the parsed content into the algorithm module; The algorithm module is used to perform algorithm processing on the parsed content, obtain algorithm processing content corresponding to the node information, and store the parsed content and the algorithm processing content in the storage module; The creation module is used to respond to a network configuration instruction for a target device, integrate the parsed content with the algorithm processing content according to the network configuration instruction, and create a second network configuration file for the target device, the file format of the second network configuration file is different from that of the first network configuration file, and the target device performs network configuration according to the second network configuration file.
10. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; The memory is used to store computer programs; The processor is used to implement the method according to any one of claims 1 to 8 when executing the program stored in the memory.
11. A computer-readable storage medium having instructions stored thereon, which, when executed by one or more processors, cause the processors to perform the method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Configuration file management method, device and equipment and storage medium
CN111651405A
Network configuration file compatibility method, electronic equipment and storage medium
CN112073218A
Charging pile automatic planning method and device based on CIM file, equipment and medium
CN116976592A
Configuration file generation method and system, storage medium and electronic equipment
CN118555195A
Configuration file conversion or processing method, electronic equipment and storage medium
CN118689557A
