Self-adaptive PLC code conversion method and device and electronic equipment
Through the adaptive PLC code conversion method, the preset PLC conversion database is used to identify and process the differential characteristics of the PLC system, realizing automatic conversion of PLC codes, improving conversion efficiency and compatibility, and solving the problem of low PLC code conversion efficiency between different systems. question.
Patent Information
- Application Number
- CN202410908180.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-08
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2044-07-08
AI Technical Summary
In the field of industrial automation, PLC codes of different brands and systems have significant differences in programming languages, instruction sets, data types and memory management, resulting in a cumbersome, time-consuming and low-efficiency PLC code conversion process.
The adaptive PLC code conversion method is adopted to obtain the code conversion characteristics of each PLC system through the preset PLC conversion database, identify the difference characteristics and automatically convert, to achieve the compatibility of cross-brand PLC systems.
It improves the efficiency of PLC code conversion, reduces manual errors, achieves compatibility of cross-brand PLC systems, and solves the problem of tedious and time-consuming manual conversion processes.
Smart Images

Figure CN118733035A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to an adaptive PLC code conversion method, device and electronic device. Background Art
[0002] In the field of industrial automation, the generation and conversion of Programmable Logic Controller (PLC) code is critical to equipment efficiency and productivity.
[0003] Since PLCs of different brands / systems use different programming languages and programming environments, when enterprises in the field of industrial automation carry out equipment upgrades, production line transformations, or cross-brand compatibility integration, they need to convert the PLC code of one system into the PLC code of another system, for example, converting the PLC code of Siemens into the PLC code of Rockwell Automation. At present, when PLC code conversion is required, it is usually performed manually by relevant developers. Since PLC codes of different brands / systems have significant differences in programming languages, instruction sets, data types, memory management, etc., manual conversion requires developers to have in-depth knowledge and experience of multi-brand PLC codes, that is, relevant developers need to check the PLC code line by line to ensure that each logic and function is correctly implemented in the converted system. Therefore, the manual conversion process is cumbersome and time-consuming. If only the above method is used, there is a problem of low efficiency in PLC code conversion between different systems.
[0004] Therefore, there is an urgent need for an adaptive PLC code conversion method, device and electronic equipment. Summary of the invention
[0005] The present application provides an adaptive PLC code conversion method, device and electronic device, which solves the problem that the manual conversion process is cumbersome and time-consuming, and the PLC code conversion efficiency between different systems is low.
[0006] In a first aspect of the present application, an adaptive PLC code conversion method is provided, the method comprising: in response to a user's PLC code conversion operation, obtaining a PLC code to be converted; obtaining a target PLC system corresponding to the PLC code to be converted, and obtaining a first PLC system in a preset PLC conversion database, the preset PLC conversion database being used to store a plurality of preset PLC systems, the first PLC system being any one of the plurality of preset PLC systems; if it is confirmed that the target PLC system is the first PLC system, obtaining a first code conversion feature corresponding to the first PLC system in the preset PLC conversion database, the preset PLC conversion database being used to store the first PLC system and the first code conversion feature A first correspondence between the features; obtaining a second PLC system, the second PLC system being any PLC system other than the first PLC system in a preset PLC conversion database; obtaining a second code conversion feature corresponding to the second PLC system in the preset PLC conversion database, the preset PLC conversion database being used to store a second correspondence between the second PLC system and the second code conversion feature; obtaining a difference feature between the first code conversion feature and the second code conversion feature, the difference feature being a different control logic feature between the first code conversion feature and the second code conversion feature; converting the PLC code to be converted into a target PLC code according to the difference feature, the target PLC code being the PLC code corresponding to the second PLC system.
[0007] By adopting the above technical solution, when the user performs a PLC code conversion operation, the PLC code to be converted is obtained, the target PLC system corresponding to the PLC code to be converted is obtained, and the first PLC system is obtained in the preset PLC conversion database, the preset PLC conversion database is used to store multiple preset PLC systems, the first PLC system is any one of the multiple preset PLC systems, if it is confirmed that the target PLC system is the first PLC system, then the first code conversion feature corresponding to the first PLC system is obtained in the preset PLC conversion database, the preset PLC conversion database is used to store the first correspondence between the first PLC system and the first code conversion feature, at this time, the second PLC system is obtained, the second PLC system is any PLC system in the preset PLC conversion database except the first PLC system, A second code conversion feature corresponding to the second PLC system is obtained from a preset PLC conversion database, and the preset PLC conversion database is used to store a second corresponding relationship between the second PLC system and the second code conversion feature, and obtain a difference feature between the first code conversion feature and the second code conversion feature, wherein the difference feature is a different control logic feature in the first code conversion feature and the second code conversion feature, so as to convert the PLC code to be converted into a target PLC code according to the difference feature, and the target PLC code is the PLC code corresponding to the second PLC system, thereby improving the PLC code conversion efficiency through automated analysis and conversion, which not only reduces the errors generated during manual conversion, but also achieves compatibility across brand PLC systems, thereby solving the problem that the manual conversion process is cumbersome and time-consuming, and there is a low efficiency in PLC code conversion between different systems.
[0008] Optionally, if it is confirmed that the target PLC system is the first PLC system, before obtaining the first code conversion feature corresponding to the first PLC system in the preset PLC conversion database, it is necessary to construct the preset PLC conversion database, specifically including: obtaining multiple preset PLC codes corresponding to multiple preset PLC systems, one preset PLC system corresponds to one or more preset PLC codes; performing preprocessing operations on the multiple preset PLC codes respectively, the preprocessing operations are used to obtain multiple preset code conversion features corresponding to the multiple preset PLC codes, the preset code conversion features include programming language features, instruction set features, variable naming rule features and function library features; constructing a correspondence between multiple preset PLC systems and multiple preset code conversion features, one preset PLC system corresponds to one or more preset code conversion features; storing the correspondence between multiple preset PLC systems and multiple preset code conversion features in the preset PLC conversion database.
[0009] By adopting the above technical solution, multiple preset PLC codes corresponding to multiple preset PLC systems are obtained, one preset PLC system corresponds to one or more preset PLC codes, and preprocessing operations are performed on the multiple preset PLC codes respectively, the preprocessing operation is used to obtain multiple preset code conversion features corresponding to the multiple preset PLC codes, the preset code conversion features include programming language features, instruction set features, variable naming rule features and function library features, and a correspondence between multiple preset PLC systems and multiple preset code conversion features is constructed, one preset PLC system corresponds to one or more preset code conversion features, and the correspondence between the multiple preset PLC systems and the multiple preset code conversion features is stored in a preset PLC conversion database, so that the code conversion features of the first PLC system and the second PLC system can be queried and matched through the correspondence stored in the preset PLC conversion database, so as to quickly realize the automatic conversion of PLC codes.
[0010] Optionally, if it is confirmed that the target PLC system is the first PLC system, before obtaining the first code conversion feature corresponding to the first PLC system in the preset PLC conversion database, the method also includes: if it is confirmed that the target PLC system is not the first PLC system, performing a preprocessing operation on the PLC code to be converted to obtain a third code conversion feature corresponding to the PLC code to be converted; and storing the correspondence between the first PLC system and the third code conversion feature in the preset PLC conversion database.
[0011] By adopting the above technical solution, if it is confirmed that the target PLC system is not the first PLC system, the PLC code to be converted is preprocessed to obtain the third code conversion feature corresponding to the PLC code to be converted, so as to store the correspondence between the first PLC system and the third code conversion feature in the preset PLC conversion database, thereby realizing the update of the preset PLC conversion database.
[0012] Optionally, the difference features include condition judgment difference features, control sequence difference features and loop structure difference features.
[0013] By adopting the above technical solution, by obtaining multiple difference features, including but not limited to conditional judgment difference features, control sequence difference features, and loop structure difference features, the differences between the PLC code to be converted and the target PLC code can be more comprehensively identified and processed, thereby increasing the accuracy and efficiency of converting the PLC code to be converted into the target PLC code.
[0014] Optionally, after converting the PLC code to be converted into the target PLC code according to the difference characteristics, the method also includes: obtaining the predicted data stream and the standard data stream corresponding to the target PLC code; obtaining the deviation data between the predicted data stream and the standard data stream, and calculating the target deviation value corresponding to the predicted data stream and the standard data stream based on the deviation data; judging whether the target deviation value is less than the preset deviation value; if the target deviation value is less than the preset deviation value, confirming that no conversion abnormality occurs in the PLC code conversion operation.
[0015] By adopting the above technical solution, the predicted data stream and standard data stream corresponding to the target PLC code are obtained, and the deviation data between the predicted data stream and the standard data stream is obtained, so that the target deviation value corresponding to the predicted data stream and the standard data stream can be calculated according to the deviation data, and it is determined whether the target deviation value is less than the preset deviation value. When the target deviation value is less than the preset deviation value, it is confirmed that there is no conversion abnormality in the PLC code conversion operation.
[0016] Optionally, after determining whether the target deviation value is less than the preset deviation value, the method also includes: if the target deviation value is greater than or equal to the preset deviation value, confirming that a conversion abnormality occurs in the PLC code conversion operation; obtaining the deviation type corresponding to the deviation data, and obtaining a deviation analysis report based on the deviation type; sending the deviation analysis report to the user, the deviation analysis report including the deviation type and a recommended modification plan corresponding to the deviation type.
[0017] By adopting the above technical solution, if the target deviation value is greater than or equal to the preset deviation value, it is confirmed that a conversion abnormality occurs in the PLC code conversion operation, and the deviation type corresponding to the deviation data is obtained, and a deviation analysis report is obtained according to the deviation type, and the deviation analysis report is sent to the user. The deviation analysis report includes the deviation type and the recommended modification plan corresponding to the deviation type, so that the user can promptly understand the problems in the code conversion operation, quickly locate and correct the target PLC code, and improve the accuracy and efficiency of the code conversion operation.
[0018] Optionally, the user performs a PLC code conversion operation through a user interface, and the user interface is also used to view a target PLC code and a deviation analysis report.
[0019] By adopting the above technical solution and setting a user interface, the user can perform PLC code conversion operations through the user interface and view the target PLC code and deviation analysis report.
[0020] In a second aspect of the present application, an adaptive PLC code conversion device is provided, the device comprising an acquisition module and a processing module, wherein: An acquisition module is used to acquire a PLC code to be converted in response to a user's PLC code conversion operation; acquire a target PLC system corresponding to the PLC code to be converted, and acquire a first PLC system in a preset PLC conversion database, the preset PLC conversion database is used to store multiple preset PLC systems, and the first PLC system is any one of the multiple preset PLC systems; if it is confirmed that the target PLC system is the first PLC system, acquire a first code conversion feature corresponding to the first PLC system in the preset PLC conversion database, the preset PLC conversion database is used to store a first correspondence between the first PLC system and the first code conversion feature; acquire a second PLC system, the second PLC system is any PLC system in the preset PLC conversion database except the first PLC system; acquire a second code conversion feature corresponding to the second PLC system in the preset PLC conversion database, the preset PLC conversion database is used to store a second correspondence between the second PLC system and the second code conversion feature; acquire a difference feature between the first code conversion feature and the second code conversion feature, the difference feature is a different control logic feature between the first code conversion feature and the second code conversion feature.
[0021] The processing module is used to convert the PLC code to be converted into a target PLC code according to the difference characteristics, and the target PLC code is the PLC code corresponding to the second PLC system.
[0022] In the third aspect of the present application, an electronic device is provided, including a processor, a memory, a user interface and a network interface, the memory is used to store instructions, the user interface and the network interface are used to communicate with other devices, and the processor is used to execute the instructions stored in the memory so that the electronic device executes any one of the methods described above.
[0023] In a fourth aspect of the present application, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and the computer program is executed by a processor to perform any of the above methods.
[0024] One or more technical solutions provided in the embodiments of the present application have at least the following technical effects or advantages: 1. When the user performs a PLC code conversion operation, the PLC code to be converted is obtained, the target PLC system corresponding to the PLC code to be converted is obtained, and the first PLC system is obtained in the preset PLC conversion database. The preset PLC conversion database is used to store multiple preset PLC systems. The first PLC system is any one of the multiple preset PLC systems. If it is confirmed that the target PLC system is the first PLC system, the first code conversion feature corresponding to the first PLC system is obtained in the preset PLC conversion database. The preset PLC conversion database is used to store a first correspondence between the first PLC system and the first code conversion feature. At this time, the second PLC system is obtained. The second PLC system is any PLC system other than the first PLC system in the preset PLC conversion database. In the preset PLC conversion database, the first PLC system is obtained. A second code conversion feature corresponding to the second PLC system is obtained from the conversion database. The preset PLC conversion database is used to store a second corresponding relationship between the second PLC system and the second code conversion feature, and a difference feature between the first code conversion feature and the second code conversion feature is obtained. The difference feature is a different control logic feature in the first code conversion feature and the second code conversion feature. According to the difference feature, the PLC code to be converted is converted into a target PLC code, and the target PLC code is the PLC code corresponding to the second PLC system. The efficiency of PLC code conversion is improved through automated analysis and conversion, which not only reduces errors generated during manual conversion, but also achieves compatibility across brand PLC systems, thereby solving the problem that the manual conversion process is cumbersome and time-consuming, and there is a low efficiency of PLC code conversion between different systems.
[0025] 2. Obtain multiple preset PLC codes corresponding to multiple preset PLC systems, one preset PLC system corresponds to one or more preset PLC codes, and perform preprocessing operations on the multiple preset PLC codes respectively, the preprocessing operations are used to obtain multiple preset code conversion features corresponding to the multiple preset PLC codes, the preset code conversion features include programming language features, instruction set features, variable naming rule features and function library features, and construct a correspondence between multiple preset PLC systems and multiple preset code conversion features, one preset PLC system corresponds to one or more preset code conversion features, and store the correspondence between the multiple preset PLC systems and the multiple preset code conversion features in a preset PLC conversion database, so as to query and match the code conversion features of the first PLC system and the second PLC system through the correspondence stored in the preset PLC conversion database, and quickly realize the automatic conversion of PLC codes.
[0026] 3. If it is confirmed that the target PLC system is not the first PLC system, a preprocessing operation is performed on the PLC code to be converted to obtain a third code conversion feature corresponding to the PLC code to be converted, so as to store the correspondence between the first PLC system and the third code conversion feature in a preset PLC conversion database, thereby realizing the update of the preset PLC conversion database. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] Figure 1 It is a flowchart of an adaptive PLC code conversion method provided by an embodiment of the present application; Figure 2 It is a module schematic diagram of an adaptive PLC code conversion device provided in an embodiment of the present application; Figure 3 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application.
[0028] Explanation of the reference numerals: 21, acquisition module; 22, processing module; 301, processor; 302, communication bus; 303, user interface; 304, network interface; 305, memory. DETAILED DESCRIPTION
[0029] In order to enable technicians in this field to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below in conjunction with the drawings in the embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this application, not all of the embodiments.
[0030] The terms used in the following embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to be used as limitations to the present application. As used in the specification of the present application, the singular expressions "one", "a kind of", "said", "above", "the" and "this" are intended to also include plural expressions, unless there is a clear indication to the contrary in the context. It should also be understood that the term "and / or" used in the present application refers to and includes any or all possible combinations of one or more listed items.
[0031] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as suggesting or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features, and in the description of the embodiments of the present application, unless otherwise specified, "plurality" means two or more.
[0032] In order to enable those skilled in the art to better understand the technical solution of the present invention, the present invention will be further described in detail below with reference to the accompanying drawings.
[0033] In the field of industrial automation, the generation and conversion of Programmable Logic Controller (PLC) code is critical to equipment efficiency and productivity.
[0034] Since PLCs of different brands / systems use different programming languages and programming environments, when enterprises in the field of industrial automation carry out equipment upgrades, production line transformations, or cross-brand compatibility integration, they need to convert the PLC code of one system into the PLC code of another system, for example, converting the PLC code of Siemens into the PLC code of Rockwell Automation. At present, when PLC code conversion is required, it is usually performed manually by relevant developers. Since PLC codes of different brands / systems have significant differences in programming languages, instruction sets, data types, memory management, etc., manual conversion requires developers to have in-depth knowledge and experience of multi-brand PLC codes, that is, relevant developers need to check the PLC code line by line to ensure that each logic and function is correctly implemented in the converted system. Therefore, the manual conversion process is cumbersome and time-consuming. If only the above method is used, there is a problem of low efficiency in PLC code conversion between different systems.
[0035] Therefore, there is an urgent need for an adaptive PLC code conversion method, device and electronic equipment.
[0036] Please refer to Figure 1 , which shows a flow chart of an adaptive PLC code conversion method provided in an embodiment of the present application. The method is applied to a PLC code conversion model. The flow chart mainly includes the following steps: S101 to S107.
[0037] Step S101, in response to a PLC code conversion operation by a user, obtaining a PLC code to be converted.
[0038] Specifically, when the user performs a PLC code conversion operation, the PLC code conversion model obtains the PLC code to be converted input by the user, and the PLC code to be converted is the PLC code specified by the user for PCL code conversion. The user can perform the PLC code conversion operation through a user interface, and the user interface can be a user interface on a variety of operation terminals, and the various operation terminals include but are not limited to: desktop computers, laptops, tablet computers, smart phones, etc. In this application, the scenarios in which users perform PLC code conversion are mainly divided into two types. First, when users are updating the PLC systems of a large number of devices, the user's company will face the task of updating the PLC systems of a large number of devices. When the PLC systems of a large number of devices need to be updated, manually converting the PLC code of each device is a time-consuming and labor-intensive task; second, when integrating the PLC system, the user's company needs to convert the PLC codes in different PLC systems to each other to achieve compatibility and collaboration between PLC systems. For example, multiple brands of PLC equipment are used in a production line, which need to communicate and coordinate with each other. PLC systems of different brands use different PCL codes. Manual conversion is not only complicated but also prone to compatibility issues. In addition, during the integration process, it is necessary to respond and deploy the PLC code quickly, that is, to quickly convert the PLC codes in different PLC systems to ensure the continuity of the production line.
[0039] Step S102, obtaining a target PLC system corresponding to the PLC code to be converted, and obtaining a first PLC system in a preset PLC conversion database, the preset PLC conversion database is used to store multiple preset PLC systems, and the first PLC system is any one of the multiple preset PLC systems.
[0040] Specifically, the PLC code conversion model obtains the target PLC system corresponding to the PLC code to be converted, and obtains the first PLC system in the preset PLC conversion database. The preset PLC conversion database is used to store all preset PLC systems in the user's enterprise, and the first PLC system is any one of the multiple preset PLC systems. The multiple preset PLC systems in the PLC conversion database are all PLC systems produced by different types of manufacturers. The PLC code conversion model constructs a unique corresponding identifier for each different preset PLC system in each preset PLC conversion database. By identifying different identifiers, the PLC code conversion model can identify different preset PLC systems. When judging whether the target PLC system corresponding to the converted PLC code is a preset PLC system in the database, the PLC code conversion model can obtain the identifier corresponding to the target PLC system, and judge whether the identifier corresponding to the target PLC system is the identifier stored in the preset PLC conversion database. If the identifier corresponding to the target PLC system is the identifier stored in the preset PLC conversion database, it is confirmed that the target PLC system corresponding to the converted PLC code is the preset PLC system in the database. The PLC code conversion model can confirm the preset PLC system corresponding to the target PLC system in the preset PLC conversion database based on the correspondence between different identifiers and different preset PLC systems. If the identifier corresponding to the target PLC system is the same identifier as the identifier corresponding to the first PLC system, it is confirmed that the target PLC system is the first PLC system.
[0041] Step S103: if it is confirmed that the target PLC system is the first PLC system, a first code conversion feature corresponding to the first PLC system is obtained from a preset PLC conversion database, where the preset PLC conversion database is used to store a first corresponding relationship between the first PLC system and the first code conversion feature.
[0042] Specifically, when the PLC code conversion model confirms that the target PLC system is the first PLC system, that is, when the PLC code conversion model confirms that the target PLC system has a corresponding preset PLC system in the preset PLC conversion database, the PLC code conversion model obtains the first code conversion feature corresponding to the first PLC system in the preset PLC conversion database, and the preset PLC conversion database is also used to store the first correspondence between the first PLC system and the first code conversion feature.
[0043] In a possible implementation, step S103 also includes: obtaining multiple preset PLC codes corresponding to multiple preset PLC systems, one preset PLC system corresponds to one or more preset PLC codes; performing preprocessing operations on the multiple preset PLC codes respectively, the preprocessing operations are used to obtain multiple preset code conversion features corresponding to the multiple preset PLC codes, the preset code conversion features include programming language features, instruction set features, variable naming rule features and function library features; constructing a correspondence between multiple preset PLC systems and multiple preset code conversion features, one preset PLC system corresponds to one or more preset code conversion features; storing the correspondence between multiple preset PLC systems and multiple preset code conversion features in a preset PLC conversion database.
[0044] Specifically, the preset PLC conversion database is a pre-built database. Before building the preset PLC conversion database, it is necessary to obtain all the preset PLC systems in the user's enterprise and one or more preset PLC codes corresponding to each preset PLC system, and perform preprocessing operations on each preset PLC code separately to obtain one or more preset code conversion features corresponding to each preset PLC code through the PLC code conversion model. The extractable preset code conversion features include but are not limited to: programming language features, instruction set features, variable naming rule features, and function library features, etc., build a correspondence between multiple preset PLC systems and multiple preset code conversion features, and store the correspondence between multiple preset PLC systems and multiple preset code conversion features in the preset PLC conversion database.
[0045] For example, assuming that the manufacturer where the user is located has PLC devices produced by manufacturer A, PLC devices produced by manufacturer B, and PLC devices produced by manufacturer C at the same time, then the multiple preset PLC systems obtained at this time are system A, system B, and system C, and the multiple preset PLC codes corresponding to system A, system B, and system C are obtained. Assume that the codes existing in system A, system B, and system C are: system A: A1 code, A2 code, A3 code; system B: B1 code, B2 code; system C: C1 code, C2 code, C3 code. Each preset PLC code is preprocessed, and each preset PLC code may correspond to one or more preset code conversion features. Programming language features: For example, system A uses ladder diagrams, system B uses structured text, and system C uses function block diagrams. Instruction set features: For example, system A uses a specific logic and arithmetic instruction set, system B uses a different instruction set, and system C may have its own unique instruction set. Variable naming rule feature: Each system may have its own unique variable naming rule. For example, the variable naming rule of system A is prefix plus type, system B may use all lowercase letters, and system C may use different rules. Function library feature: Different systems may use different function libraries to implement specific functions. If, through preprocessing, the correspondence between each preset PLC code extracted and one or more preset code conversion features is: A1 code: feature 1, feature 2; A2 code: feature 1, feature 3; A3 code: feature 2, feature 3; B1 code: feature 4, feature 5; B2 code: feature 6, feature 7; C1 code: feature 7, feature 8; C2 code: feature 8, feature 9; C3 code: feature 7, feature 9, then the correspondence between multiple preset PLC systems and multiple preset code conversion features is: A system: feature 1, feature 2, feature 3; B system: feature 4, feature 5, feature 6, feature 7; C system: feature 7, feature 8, feature 9. It should be noted that this embodiment does not limit the number of PLC systems of different manufacturers owned by the user's enterprise at the same time, the number of multiple preset PLC codes contained in multiple PLC systems, and the number of multiple preset code conversion features that can be extracted from multiple preset PLC codes. Among them, the number of preset code conversion features that can be extracted from a single preset PLC code is related to the richness of the preset PLC code itself and the performance of the PLC code conversion model. The richness of the preset PLC code determines the diversity of the programming language features, instruction set features, variable naming rule features, and function library features contained therein, and complex and rich codes usually contain more feature identifiers, so that the PLC code conversion model can extract more valuable conversion features.The PLC code conversion model is trained with a large amount of experimental data and can extract most of the preset code conversion features. At this time, the higher the richness of the preset PLC code, the more preset code conversion features the PLC code conversion model can extract from a single preset PLC code. The large amount of experimental data includes but is not limited to the following experimental data: 1. PLC codes of various brands and models, such as Siemens PLC code: including sample codes in different programming languages. Rockwell Automation PLC code: code examples covering different programming environments and instruction sets. Schneider Electric PLC code: code examples of different types of control logic and function libraries. Other brand PLC codes: such as Mitsubishi, Omron, ABB, etc. 2. PLC codes of different complexities, such as simple control logic: such as basic switch control, simple logical operations, timer and counter applications. Medium complexity logic: such as multi-input and multi-output control, sequential control, and state machine design. Complex control logic: such as PID control, complex algorithm implementation, multi-task scheduling, communication protocol implementation (such as Modbus, Ethernet / IP, etc.). 3. Actual industrial application cases, such as production line control system code: covering the control logic of different production lines, such as automobile manufacturing, food processing, packaging, etc. Process control system code: such as PLC code of process control systems such as chemical production, pharmaceutical technology, energy management, etc. Equipment automation code: such as the control logic of equipment such as robot control, machine tool control, and warehouse automation. 4. Code with detailed comments and documents, such as code comments: containing detailed instructions, explaining the function and logic of each section of code, helping the model understand the code structure. Technical documents: such as design specifications, control flow charts, system architecture diagrams, providing background information and design principles of the code. 5. Diversified variables and naming rules, such as variables with different naming conventions: such as code examples of various variable naming rules such as prefix plus type, all lowercase naming, camel case naming, etc. Diversity of variable types: such as the application of variables of different data types such as Boolean, integer, floating point, string, etc. 6. Rich examples of using the function library, such as standard library functions: such as basic mathematical operations, logical operations, timer and counter functions. Custom functions: user-defined complex functions and function blocks, showing how to expand and apply custom logic.
[0046] In a possible implementation, step S103 also includes: if it is confirmed that the target PLC system is not the first PLC system, performing a preprocessing operation on the PLC code to be converted, the preprocessing operation is used to obtain a third code conversion feature corresponding to the PLC code to be converted, and the third code conversion feature is not any code conversion feature in a preset PLC conversion database; and storing the correspondence between the first PLC system and the third code conversion feature in the preset PLC conversion database.
[0047] Specifically, if it is confirmed that the target PLC system is not the first PLC system, that is, when the PLC code conversion model confirms that the target PLC system does not exist in the preset PLC conversion database and there is a corresponding preset PLC system that can match it, the PLC code conversion model performs a preprocessing operation on the PLC code to be converted. The preprocessing operation is used to obtain the third code conversion feature corresponding to the PLC code to be converted, that is, the PLC code conversion model analyzes the content and features of the PLC code to be converted through the preprocessing operation, and attempts to automatically identify the target PLC system corresponding to the PLC code to be converted. The third code conversion features of the PLC code to be converted include but are not limited to programming language features, instruction set features, variable naming rule features, and function library features corresponding to the PLC code to be converted. In the above steps, if the target PLC system does not exist in the preset PLC conversion database and there is a corresponding preset PLC system that can match it, it can be divided into two situations: 1. There is no identifier of any PLC system in the PLC code to be converted. At this time, the PLC code conversion model sends a preset PLC conversion database update request to the user, and the user can manually add a new PLC system, an identifier corresponding to the new PLC system, and a third code conversion feature corresponding to the new PLC system; 2. The PLC system and the corresponding identifier existing in the PLC code to be converted are unknown identifiers corresponding to unknown PLC systems. The PLC code conversion model can automatically update the above-mentioned unknown PLC system, the identifier corresponding to the unknown PLC system, and the third code conversion feature corresponding to the unknown PLC system to the preset PLC conversion database.
[0048] Step S104, obtaining a second PLC system, where the second PLC system is any PLC system in a preset PLC conversion database except the first PLC system.
[0049] Specifically, a second PLC system is obtained, where the second PLC system is a PLC system specified by the user for conversion, and the user can select any PLC system other than the first PLC system in a preset PLC conversion database to perform code conversion operations on the PLC code to be converted.
[0050] Step S105: acquiring a second code conversion feature corresponding to the second PLC system from a preset PLC conversion database, where the preset PLC conversion database is used to store a second corresponding relationship between the second PLC system and the second code conversion feature.
[0051] Specifically, the second code conversion feature corresponding to the second PLC system is obtained in the preset PLC conversion database: the second PLC system can be any PLC system other than the first PLC system, which is stored in the preset PLC conversion database in advance according to the method in step S103, and the second code conversion feature corresponding to the second PLC system is obtained according to the corresponding relationship constructed in step S103.
[0052] Step S106, obtaining a difference feature between the first code conversion feature and the second code conversion feature, where the difference feature is a different control logic feature between the first code conversion feature and the second code conversion feature.
[0053] Specifically, the difference characteristics between the first code conversion characteristics and the second code conversion characteristics are obtained. The above difference characteristics are mainly reflected in different control logic characteristics, that is, the different characteristics between the two in condition judgment difference characteristics, control sequence difference characteristics, loop structure difference characteristics, etc. are identified.
[0054] Step S107: convert the PLC code to be converted into a target PLC code according to the difference characteristics, where the target PLC code is a PLC code corresponding to the second PLC system.
[0055] Specifically, a code conversion operation is performed according to the difference characteristics, and the PLC code to be converted is converted into a target PLC code, and the target PLC code is a PLC code corresponding to the second PLC system.
[0056] For example, assuming that the first PLC system is a Siemens system, and the first code conversion features include: Programming language features: Ladder Diagram Instruction set features: LD, A, O and other logical instructions, comparison instructions (==, >, <) Variable naming rule features: prefix plus type (such as I0.0 for input, Q0.0 for output) Function library features: timer and counter functions; assuming that the second PLC system is a Rockwell Automation system, the second code conversion features include: Programming language features: Structured text =Text) instruction set features: IF, AND, OR and other logical instructions, loop instructions (FOR, WHILE) variable naming rule features: all lowercase letters (such as input1, output1) function library features: string processing functions and mathematical operation functions; analyze and obtain difference features, that is, compare the first code conversion features and the second code conversion features corresponding to the Siemens system and the Rockwell system respectively, and identify the following difference features: programming language feature differences: Siemens uses ladder diagrams, and Rockwell uses structured text; instruction set differences: Siemens' instruction set contains logical instructions such as LD, A, O, and Rockwell's instruction set contains logical instructions such as IF, AND, OR; variable naming rule differences: Siemens system uses the variable naming rule of prefix plus type, and Rockwell system uses all lowercase letters; function library differences: Siemens system uses timer and counter functions, and Rockwell system uses string processing functions and mathematical operation functions. Afterwards, according to the identified difference features, adjust the code conversion logic to ensure that the converted second code conversion feature is correctly executed in the second PLC system. It should be noted that this embodiment does not limit the type of the first PLC system, the type of the second PLC system, and the type of the difference between the first code conversion feature and the second code conversion feature.
[0057] In a possible implementation, step S107 also includes: obtaining a predicted data stream and a standard data stream corresponding to the target PLC code; obtaining deviation data between the predicted data stream and the standard data stream, and calculating a target deviation value corresponding to the predicted data stream and the standard data stream based on the deviation data; determining whether the target deviation value is less than a preset deviation value; if the target deviation value is less than the preset deviation value, confirming that no conversion abnormality occurs in the PLC code conversion operation.
[0058] Specifically, the predicted data flow and standard data flow corresponding to the target PLC code are obtained. The predicted data flow is the data flow obtained by the target PLC code through the execution path simulation operation. The standard data flow is the data flow generated when the target PLC code is running under normal circumstances. The standard data flow is the data flow originally generated when the code to be converted is running. The historical operation data of the PLC code to be converted in the actual operation environment can be used as the standard data flow. That is, the PLC code conversion model constructs a simulated operation scene corresponding to the target PLC code. The scene can be simulated in a variety of ways, including but not limited to simulation through software simulation, simulation through a virtual debugging platform, etc., wherein simulation through software simulation: using PLC simulation software to simulate the actual PLC operation environment, executing the target PLC code, and generating a predicted data flow; virtual debugging platform: using a virtual debugging platform (such as digital twin technology) to create a virtual production environment, executing the target PLC code, to simulate the actual operation and obtain the predicted data flow. This embodiment does not limit the construction method of the simulated operation scene. And by executing the target PLC code in the simulated operation scene, the predicted data flow is obtained. Calculate the data deviation between the predicted data stream and the corresponding data stream in the standard data stream, and calculate the overall deviation degree based on the data deviation. For example, statistical methods such as mean square error (MSE) or mean absolute error (MAE) can be used to obtain the target deviation value between the predicted data stream and the standard data stream. If the target deviation value is less than the preset deviation value, it is confirmed that the PLC code conversion operation has no conversion abnormality, indicating that the converted code can work normally in actual operation.
[0059] In a possible implementation, step S107 also includes: if the target deviation value is greater than or equal to the preset deviation value, confirming that a conversion abnormality occurs in the PLC code conversion operation; obtaining a deviation type corresponding to the deviation data, and obtaining a deviation analysis report based on the deviation type; sending the deviation analysis report to the user, the deviation analysis report including the deviation type and a recommended modification plan corresponding to the deviation type.
[0060] Specifically, if the target deviation value is greater than or equal to the preset deviation value, it is confirmed that a conversion abnormality occurs in the PLC code conversion operation. At this time, the PLC code conversion model obtains the deviation type corresponding to the deviation data, obtains a deviation analysis report based on the deviation type, and sends the deviation analysis report to the user. The user can view the target PLC code and the deviation analysis report through the user interface in step S101. The deviation analysis report includes the deviation type and the recommended modification plan corresponding to the deviation type. The recommended modification plan needs to be constructed in advance according to the abnormalities that may occur in the conversion process of the PLC code to be converted. The problems that may occur in the conversion process of the PLC code to be converted include but are not limited to: code missing, instruction incompatibility, communication protocol mismatch, etc., among which, code missing: some code fragments are not correctly converted or lost during the conversion process; instruction incompatibility: some instructions in the first PLC system are not supported or behave differently in the second PLC system; communication protocol mismatch: the communication protocols used between the first system and the second system are different, resulting in data transmission problems. The recommended modification plans include but are not limited to code completion suggestions, logic adjustment suggestions, communication protocol configuration guidance, etc. Among them, code completion suggestions: provide completion plans or alternative methods for missing codes in the target PLC code for user reference; logic adjustment suggestions: provide examples of adjusted logic structures to ensure that the target PLC code implements the same control logic in the second system; communication protocol configuration guidance: provide detailed steps for configuring and using the corresponding communication protocol in the second system.
[0061] The present application adopts the above method. When the user performs a PLC code conversion operation, the PLC code to be converted is obtained, the target PLC system corresponding to the PLC code to be converted is obtained, and the first PLC system is obtained in the preset PLC conversion database. The preset PLC conversion database is used to store multiple preset PLC systems. The first PLC system is any one of the multiple preset PLC systems. If it is confirmed that the target PLC system is the first PLC system, the first code conversion feature corresponding to the first PLC system is obtained in the preset PLC conversion database. The preset PLC conversion database is used to store a first correspondence between the first PLC system and the first code conversion feature. At this time, the second PLC system is obtained. The second PLC system is any PLC system other than the first PLC system in the preset PLC conversion database. A second code conversion feature corresponding to the second PLC system is obtained from a preset PLC conversion database, and the preset PLC conversion database is used to store a second corresponding relationship between the second PLC system and the second code conversion feature, and obtain a difference feature between the first code conversion feature and the second code conversion feature, wherein the difference feature is a different control logic feature in the first code conversion feature and the second code conversion feature, so as to convert the PLC code to be converted into a target PLC code according to the difference feature, and the target PLC code is the PLC code corresponding to the second PLC system, thereby improving the PLC code conversion efficiency through automated analysis and conversion, which not only reduces the errors generated during manual conversion, but also achieves compatibility across brand PLC systems, thereby solving the problem that the manual conversion process is cumbersome and time-consuming, and there is a low efficiency in PLC code conversion between different systems.
[0062] Please refer to Figure 2 , which shows a module schematic diagram of an adaptive PLC code conversion device provided in an embodiment of the present application, the device is a PLC code conversion model, and the PLC code conversion model includes an acquisition module 21 and a processing module 22, wherein, The acquisition module 21 is used to obtain the PLC code to be converted in response to the user's PLC code conversion operation; obtain the target PLC system corresponding to the PLC code to be converted, and obtain the first PLC system in the preset PLC conversion database, the preset PLC conversion database is used to store multiple preset PLC systems, and the first PLC system is any one of the multiple preset PLC systems; if it is confirmed that the target PLC system is the first PLC system, obtain the first code conversion feature corresponding to the first PLC system in the preset PLC conversion database, and the preset PLC conversion database is used to store the first corresponding relationship between the first PLC system and the first code conversion feature; obtain the second PLC system, the second PLC system is any PLC system in the preset PLC conversion database except the first PLC system; obtain the second code conversion feature corresponding to the second PLC system in the preset PLC conversion database, and the preset PLC conversion database is used to store the second corresponding relationship between the second PLC system and the second code conversion feature; obtain the difference feature between the first code conversion feature and the second code conversion feature, and the difference feature is the different control logic feature between the first code conversion feature and the second code conversion feature.
[0063] The processing module 22 is used to convert the PLC code to be converted into a target PLC code according to the difference characteristics, and the target PLC code is the PLC code corresponding to the second PLC system.
[0064] In a possible implementation, if the target PLC system is confirmed to be the first PLC system, the acquisition module 21 is used to construct a preset PLC conversion database before obtaining the first code conversion feature corresponding to the first PLC system in the preset PLC conversion database, specifically including: obtaining multiple preset PLC codes corresponding to multiple preset PLC systems, one preset PLC system corresponds to one or more preset PLC codes; performing preprocessing operations on the multiple preset PLC codes respectively, the preprocessing operations are used to obtain multiple preset code conversion features corresponding to the multiple preset PLC codes, the preset code conversion features include programming language features, instruction set features, variable naming rule features and function library features; constructing a correspondence between multiple preset PLC systems and multiple preset code conversion features, one preset PLC system corresponds to one or more preset code conversion features; storing the correspondence between multiple preset PLC systems and multiple preset code conversion features in the preset PLC conversion database.
[0065] In a possible implementation, the acquisition module 21 is used to, if it is confirmed that the target PLC system is the first PLC system, before acquiring the first code conversion feature corresponding to the first PLC system in the preset PLC conversion database, the method also includes: if it is confirmed that the target PLC system is not the first PLC system, performing a preprocessing operation on the PLC code to be converted to obtain a third code conversion feature corresponding to the PLC code to be converted; and storing the correspondence between the first PLC system and the third code conversion feature in the preset PLC conversion database.
[0066] In a possible implementation, the difference features include condition judgment difference features, control sequence difference features, and loop structure difference features.
[0067] In one possible embodiment, the processing module 22 is used to convert the PLC code to be converted into the target PLC code according to the difference characteristics, and the method also includes: obtaining the predicted data stream and the standard data stream corresponding to the target PLC code; obtaining the deviation data between the predicted data stream and the standard data stream, and calculating the target deviation value corresponding to the predicted data stream and the standard data stream based on the deviation data; judging whether the target deviation value is less than the preset deviation value; if the target deviation value is less than the preset deviation value, confirming that no conversion abnormality occurs in the PLC code conversion operation.
[0068] In one possible implementation, the processing module 22 is used to determine whether the target deviation value is less than the preset deviation value, and the method also includes: if the target deviation value is greater than or equal to the preset deviation value, confirming that a conversion abnormality occurs in the PLC code conversion operation; obtaining the deviation type corresponding to the deviation data, and obtaining a deviation analysis report based on the deviation type; sending the deviation analysis report to the user, the deviation analysis report including the deviation type and a recommended modification plan corresponding to the deviation type.
[0069] In a possible implementation, the user performs a PLC code conversion operation through a user interface, and the user interface is also used to view a target PLC code and a deviation analysis report.
[0070] It should be noted that: when the device provided in the above embodiment realizes its function, only the division of the above functional modules is used as an example. In actual application, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the device and method embodiments provided in the above embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be repeated here.
[0071] The present application also provides an electronic device. Figure 3 , Figure 330 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. The electronic device may include: at least one processor 301, at least one communication bus 302, a user interface 303, at least one network interface 304, and a memory 305.
[0072] The communication bus 302 is used to realize the connection and communication between these components.
[0073] The user interface 303 may include a display screen (Display) and a camera (Camera). Optionally, the user interface 303 may also include a standard wired interface and a wireless interface.
[0074] The network interface 304 may optionally include a standard wired interface or a wireless interface (such as a WI-FI interface).
[0075] Among them, the processor 301 may include one or more processing cores. The processor 301 uses various interfaces and lines to connect the various parts of the entire PLC code conversion model, and executes various functions and processes data of the PLC code conversion model by running or executing instructions, programs, code sets or instruction sets stored in the memory 305, and calling data stored in the memory 305. Optionally, the processor 301 can be implemented in at least one hardware form of digital signal processing (Digital Signal Processing, DSP), field programmable gate array (Field-Programmable Gate Array, FPGA), and programmable logic array (Programmable Logic Array, PLA). The processor 301 can integrate one or a combination of a central processing unit (Central Processing Unit, CPU), a graphics processing unit (Graphics Processing Unit, GPU) and a modem. Among them, the CPU mainly processes the operating system, user interface and application programs; the GPU is responsible for rendering and drawing the content to be displayed on the display screen; the modem is used to process wireless communication. It can be understood that the above-mentioned modem may not be integrated into the processor 301, and it can be implemented separately through a chip.
[0076] Among them, the memory 305 may include a random access memory (Random Access Memory, RAM) and may also include a read-only memory (Read-Only Memory). Optionally, the memory 305 includes a non-transitory computer-readable storage medium. The memory 305 can be used to store instructions, programs, codes, code sets or instruction sets. The memory 305 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the above-mentioned various method embodiments, etc.; the data storage area may store data involved in the above-mentioned various method embodiments, etc. The memory 305 may optionally also be at least one storage device located away from the aforementioned processor 301. Refer to Figure 3 , the memory 305 as a computer storage medium may include an operating system, a network communication module, a user interface module and an adaptive PLC code conversion application.
[0077] exist Figure 3 In the electronic device shown, the user interface 303 is mainly used to provide an input interface for the user and obtain the data input by the user; and the processor 301 can be used to call the adaptive PLC code conversion application stored in the memory 305. When executed by one or more processors 301, the electronic device executes one or more of the methods described in the above embodiments. It should be noted that for the aforementioned method embodiments, for the sake of simple description, they are all expressed as a series of action combinations, but those skilled in the art should know that the present application is not limited to the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required for the present application.
[0078] The present application also provides a computer-readable storage medium, which stores instructions. When executed by one or more processors, the electronic device executes one or more of the methods described in the above embodiments.
[0079] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0080] In the several embodiments provided in this application, it should be understood that the disclosed devices can be implemented in other ways. For example, the device embodiments described above are only schematic, such as the division of units, which 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 service interfaces, and the indirect coupling or communication connection of devices or units can be electrical or other forms.
[0081] 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.
[0082] In addition, each functional unit in each embodiment of the present application 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. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0083] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a memory and includes several instructions for a computer device (which can be a personal computer, a PLC code conversion model or a network device, etc.) to perform all or part of the steps of the various embodiments of the present application. The aforementioned memory includes: various media that can store program codes, such as USB flash drives, mobile hard drives, magnetic disks or optical disks.
[0084] The above are only exemplary embodiments disclosed in this application, and the scope of the disclosure of this application cannot be limited by this. That is, any equivalent changes and modifications made according to the teachings disclosed in this application are still within the scope of the disclosure of this application. After considering the disclosure of the specification and the truth of practice, those skilled in the art will easily think of other implementation schemes disclosed in this application.
[0085] This application is intended to cover any modifications, uses or adaptive changes disclosed in this application, which follow the general principles disclosed in this application and include common knowledge or customary technical means in the technical field not recorded in this application.
Claims
1. An adaptive PLC code conversion method, characterized in that: Applied to the PLC code conversion model, the method includes: In response to a PLC code conversion operation by a user, obtaining a PLC code to be converted; Obtain a target PLC system corresponding to the PLC code to be converted, and obtain a first PLC system in a preset PLC conversion database, wherein the preset PLC conversion database is used to store a plurality of preset PLC systems, and the first PLC system is any one of the plurality of preset PLC systems; If it is confirmed that the target PLC system is the first PLC system, obtaining a first code conversion feature corresponding to the first PLC system in a preset PLC conversion database, wherein the preset PLC conversion database is used to store a first corresponding relationship between the first PLC system and the first code conversion feature; Acquire a second PLC system, where the second PLC system is any PLC system in the preset PLC conversion database except the first PLC system; Acquire a second code conversion feature corresponding to the second PLC system in the preset PLC conversion database, wherein the preset PLC conversion database is used to store a second corresponding relationship between the second PLC system and the second code conversion feature; Acquire a difference feature between the first code conversion feature and the second code conversion feature, where the difference feature is a different control logic feature between the first code conversion feature and the second code conversion feature; According to the difference feature, the PLC code to be converted is converted into a target PLC code, and the target PLC code is a PLC code corresponding to the second PLC system.
2. The method according to claim 1, characterized in that If it is confirmed that the target PLC system is the first PLC system, before obtaining the first code conversion feature corresponding to the first PLC system in the preset PLC conversion database, it is necessary to construct the preset PLC conversion database, specifically including: Acquire a plurality of preset PLC codes corresponding to a plurality of the preset PLC systems, wherein one preset PLC system corresponds to one or more preset PLC codes; Performing preprocessing operations on the plurality of preset PLC codes respectively, wherein the preprocessing operations are used to obtain a plurality of preset code conversion features corresponding to the plurality of preset PLC codes, wherein the preset code conversion features include programming language features, instruction set features, variable naming rule features, and function library features; Establishing a correspondence between a plurality of the preset PLC systems and a plurality of the preset code conversion features, wherein one of the preset PLC systems corresponds to one or more of the preset code conversion features; The correspondence between the plurality of the preset PLC systems and the plurality of the preset code conversion features is stored in the preset PLC conversion database.
3. The method according to claim 2, characterized in that If it is confirmed that the target PLC system is the first PLC system, before obtaining the first code conversion feature corresponding to the first PLC system in the preset PLC conversion database, the method further includes: If it is confirmed that the target PLC system is not the first PLC system, performing the preprocessing operation on the PLC code to be converted to obtain a third code conversion feature corresponding to the PLC code to be converted; The correspondence between the first PLC system and the third code conversion feature is stored in the preset PLC conversion database.
4. The method according to claim 1, characterized in that The difference features include condition judgment difference features, control sequence difference features and loop structure difference features.
5. The method according to claim 1, characterized in that After converting the to-be-converted PLC code into a target PLC code according to the difference feature, the method further includes: Obtaining a predicted data stream and a standard data stream corresponding to the target PLC code; Obtaining deviation data between the predicted data stream and the standard data stream, and calculating a target deviation value corresponding to the predicted data stream and the standard data stream according to the deviation data; Determining whether the target deviation value is less than a preset deviation value; If the target deviation value is less than the preset deviation value, it is confirmed that no conversion abnormality occurs in the PLC code conversion operation.
6. The method according to claim 5, characterized in that After determining whether the target deviation value is less than a preset deviation value, the method further includes: If the target deviation value is greater than or equal to the preset deviation value, it is confirmed that the conversion abnormality occurs in the PLC code conversion operation; Obtaining a deviation type corresponding to the deviation data, and obtaining a deviation analysis report according to the deviation type; The deviation analysis report is sent to the user, wherein the deviation analysis report includes the deviation type and a recommended modification plan corresponding to the deviation type.
7. The method according to claim 6, characterized in that The user performs the PLC code conversion operation through a user interface, and the user interface is also used to view the target PLC code and the deviation analysis report.
8. An adaptive PLC code conversion device, characterized in that: The device comprises an acquisition module (21) and a processing module (22), wherein: The acquisition module (21) is used to respond to a user's PLC code conversion operation to acquire a PLC code to be converted; acquire a target PLC system corresponding to the PLC code to be converted, and acquire a first PLC system in a preset PLC conversion database, the preset PLC conversion database being used to store a plurality of preset PLC systems, the first PLC system being any one of the plurality of preset PLC systems; if it is confirmed that the target PLC system is the first PLC system, acquire a first code conversion feature corresponding to the first PLC system in the preset PLC conversion database, the preset PLC conversion database being used to store a first corresponding relationship between the first PLC system and the first code conversion feature; acquire a second PLC system, the second PLC system being any PLC system other than the first PLC system in the preset PLC conversion database; acquire a second code conversion feature corresponding to the second PLC system in the preset PLC conversion database, the preset PLC conversion database being used to store a second corresponding relationship between the second PLC system and the second code conversion feature; acquire a difference feature between the first code conversion feature and the second code conversion feature, the difference feature being a different control logic feature between the first code conversion feature and the second code conversion feature; The processing module (22) is used to convert the PLC code to be converted into a target PLC code according to the difference feature, wherein the target PLC code is a PLC code corresponding to the second PLC system.
9. An electronic device, characterized in that: The electronic device comprises a processor (301), a communication bus (302), a user interface (303), a network interface (304) and a memory (305), wherein the memory (305) is used to store instructions, the user interface (303) and the network interface (304) are used to communicate with other devices, and the processor (301) is used to execute the instructions stored in the memory (305) so that the electronic device executes the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores instructions, and when the instructions are executed, the method according to any one of claims 1 to 7 is performed.
Citation Information
Patent Citations
Code conversion method and device used for numerical control system
CN101794140A
PLC application package generation method, PLC application execution method and related device and system
CN114706590A
Code conversion method and device, electronic equipment, storage medium and program product
CN117573128A
Programmable logic controller-oriented binary code semantic conversion method and system
CN118092877A
Code conversion system, code conversion apparatus, code conversion method and code conversion program
JP2011008388A
