Industrial automation process export and reconstruction method and electronic equipment

By embedding process configuration files and canvas resource data into pictures, efficient export and reconstruction of industrial automation processes is achieved, and the problems of low export efficiency and poor compatibility in the existing technology are solved, and flexible migration and sharing of processes are achieved.

CN120029669AActive Publication Date: 2025-05-23SUZHOU GRANI VISION TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202510521514.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-24
Publication Date
2025-05-23
Estimated Expiration
2045-04-24

AI Technical Summary

Technical Problem

The prior art has problems of inefficiency and poor compatibility in the export and reuse of industrial automation processes, especially when dealing with complex flow charts, manual copying and pasting can easily lead to omissions or logical errors, and the compatibility of special plug-ins is poor, limiting the sharing and migration of processes.

Method used

By embedding process configuration files and canvas resource data into the picture, an integrated encapsulation of process logic structure and visual layout is realized. The method includes obtaining a unique identifier of the process object, generating a process configuration file, a canvas resource file, and a process layout image, and embedding these files into the image to form a picture file containing process object metadata.

Benefits of technology

This method avoids the tedious operation of manual copy and paste, improves the efficiency of process export and reconstruction, has strong compatibility, supports the commonality of processes between different platforms and versions, and simplifies the migration and sharing of processes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120029669A_ABST
    Figure CN120029669A_ABST
Patent Text Reader

Abstract

The invention discloses an industrial automation process exporting and reconstructing method and electronic equipment, and belongs to the technical field of software development. The method comprises the steps of obtaining a process object needing to be exported on a canvas, and generating a unique identifier of the process object; generating a process configuration file, a canvas resource file and a process layout image of the process object based on the unique identifier; and embedding the process configuration file and the canvas resource file into the process layout image to form a picture file containing the process object metadata. According to the industrial automation process exporting and rebuilding method and the electronic equipment, the process configuration file and the canvas resource data are embedded into the picture, integrated packaging of a process logic structure and a visual layout is achieved, the picture file supports importing and automatic rebuilding, and the process configuration file and the canvas resource data are integrated. The limitation that traditional manual copying and pasting are tedious and special plug-ins are poor in compatibility is overcome, and process migration and sharing operation are greatly simplified.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of software development, and in particular relates to an industrial automation process export and reconstruction method and electronic equipment. Background Art

[0002] With the continuous development of industrial automation systems, the application of zero-code platforms in scenarios such as process control, task scheduling, and data flow management is becoming more and more widespread. Through a graphical interface and drag-and-drop logic configuration method, the zero-code platform lowers the technical threshold for process modeling and adjustment in industrial applications, allowing non-programmers to complete complex process logic construction. However, in actual use, the need for reuse, migration, and sharing of industrial processes is becoming more and more frequent, which puts higher requirements on the ability to export and reuse processes.

[0003] In the existing technology, zero-code platforms usually only support migrating processes from one project to another by manual copying and pasting. This method is acceptable when dealing with simple processes, but for large industrial flowcharts containing multiple nodes, complex connection relationships, and nested sub-processes, manual copying is not only inefficient, but also prone to omissions or logical errors. In addition, some platforms also support the use of dedicated plug-ins or auxiliary tools to export processes, but these plug-ins often rely on specific environment configurations or software versions, have poor compatibility, and are difficult to use across different platforms or versions, limiting the efficiency of process sharing within the team and across projects.

[0004] Therefore, it is necessary to provide a new solution to the above technical problems. Summary of the invention

[0005] The purpose of the present invention is to provide an industrial automation process export and reconstruction method and electronic device, which can export process objects in the form of pictures, avoiding the tedious operations of manual copying and pasting, and has strong compatibility.

[0006] To achieve the above purpose, the technical solution provided by the present invention is as follows: In a first aspect, the present invention provides a method for exporting an industrial automation process into a picture, comprising: Obtain the process object that needs to be exported on the canvas and generate a unique identifier for the process object; based on the unique identifier, generate a process configuration file, a canvas resource file and a process layout image for the process object; embed the process configuration file and the canvas resource file into the process layout image to form a picture file containing metadata of the process object.

[0007] In one or more embodiments, generating a process configuration file of the process object specifically includes: creating a structured data format document, recording the name of the process object and the operator configuration information in the process object, and saving the structured data format document as a process configuration file; wherein the operator configuration information is obtained by traversing the tree structure of the process object, each tree node in the tree structure represents an operator, and the configuration information corresponding to each operator in the process object is stored in the structured data format document in the form of a node.

[0008] In one or more embodiments, generating a canvas resource file for the process object specifically includes: obtaining serialized data of the layout information of the process object in the canvas; creating a memory stream object, and storing the serialized data of the layout information in the memory stream object; passing the memory stream object to a compression stream object, and writing the serialized data of the layout information into the compression stream object; exporting the serialized data in the compression stream object as a byte array, and saving it as a canvas resource file through a file writing method.

[0009] In one or more embodiments, the serialized data of the layout information is written into the compressed stream object, specifically including: converting the scaling ratio and the number of operators of the canvas into serialized data, and writing the data into the compressed stream object; looping through the operators in the canvas, obtaining the operator configuration information through the data saving method of each operator, the operator configuration information including the operator ID, the coordinate position in the canvas, the size, width and height, the breakpoint status, the lock status, the enable status and the configuration status, and writing the operator configuration information into the compressed stream object in the serialized data format; looping through the input interface and the output interface in the operator, and writing the unique identifier of each interface into the compressed stream object in the serialized data format; looping through the line logical structure in the canvas, converting the connection relationship between the operators into the serialized data format, and writing the data into the compressed stream object.

[0010] In one or more implementations, generating a process layout image of the process object specifically includes: rendering the canvas where the process object is currently located into a picture that can embed metadata through an image rendering method, and saving it to a specified path.

[0011] In one or more embodiments, the process configuration file and the canvas resource file are embedded into the process layout image, specifically including: reading the process layout image, the process configuration file and the canvas resource file as a serialized data array; generating a serialized data form of a first tag and a second tag for separating the serialized data of the process layout image, the serialized data of the process configuration file and the serialized data of the canvas resource file; creating a memory stream object, and writing the serialized data of the process layout image, the serialized data of the first tag, the serialized data of the process configuration file, the serialized data of the second tag and the serialized data of the canvas resource file in sequence; and writing the data in the memory stream object into the final output path of the image.

[0012] In a second aspect, the present invention provides a method for importing images to reconstruct an industrial automation process, comprising: Obtain an image file containing process object metadata obtained by the aforementioned method of exporting the industrial automation process as an image; parse the process configuration information and canvas resource data of the process object from the image file; and rebuild the process object in the canvas of the zero-code platform based on the process configuration information and canvas resource data.

[0013] In one or more embodiments, the process configuration information and canvas resource data of the process object are parsed from the image file, including: reading the serialized data of the image file through a parsing method, and locating the positions of the first tag and the second tag using a character encoding method; based on the positions of the first tag and the second tag, dividing the serialized data of the image file into process layout image serialized data, process configuration file serialized data, and canvas resource file serialized data through an array copy method.

[0014] In one or more embodiments, the process object is rebuilt in the canvas of the zero-code platform according to the process configuration information and canvas resource data, including: converting the process configuration file serialization data into a structured data format string, constructing the operator of the process object based on the structured data format string, and loading the process configuration information of the process object; passing the canvas resource file serialization data into a memory stream object, and using a compression stream object to decompress the canvas resource file serialization data, reading the layout information of the process object in the canvas from the decompressed canvas resource file serialization data, and writing it into the operator of the process object.

[0015] In a third aspect, the present invention provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the aforementioned method when executing the program.

[0016] Compared with the prior art, the industrial automation process export and reconstruction method and electronic device provided by the present invention realize the integrated encapsulation of the process logic structure and visual layout by embedding the process configuration file and canvas resource data into the picture. The picture file not only has the visual display function of the standard image, but can also be parsed and restored to a complete process object, supporting import and automatic reconstruction, overcoming the tediousness of traditional manual copy and paste and the limitations of poor compatibility of special plug-ins, and greatly simplifying the process migration and sharing operations. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present invention, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0018] Figure 1 A flowchart of a method for exporting an industrial automation process into a picture in one embodiment of the present invention; Figure 2 This is a schematic diagram of an operation interface when exporting a process as a picture in one embodiment of the present invention; Figure 3 A flowchart of a method for importing images to reconstruct an industrial automation process in one embodiment of the present invention; Figure 4 This is a schematic diagram of an operation interface when importing a picture reconstruction process in one embodiment of the present invention; Figure 5 FIG. 4 is a schematic diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0019] In order to enable those skilled in the art to better understand the technical solutions in the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0020] In the design and development of industrial automation processes, zero-code platforms are widely used for the rapid construction of various complex processes due to their graphical and visual characteristics. However, with the expansion of process scale and the increase in interactions between systems, users have put forward higher requirements for the migration, reuse and sharing of process assets. Existing zero-code platforms still rely mainly on manual copy and paste for process export, or use specific plug-ins to transfer structures. This is not only cumbersome and inefficient, but also has compatibility barriers between different systems, which seriously restricts the flexible use of process models in multiple scenarios. In addition, existing technologies often cannot achieve the synchronous preservation of process logic and its graphical layout, resulting in the problem of logic loss or interface reconstruction when the exported process is imported and rebuilt.

[0021] Based on the analysis of the shortcomings of the prior art, the inventors realized that the process is not only a collection of logical structures, but also contains multi-dimensional information such as graphical layout, operator configuration, connection relationship, etc. Only by uniformly encapsulating this information can the complete migration and reconstruction of the process be realized. To this end, the present invention proposes a process export method for image encapsulation. The core idea is to use a universal image format as an information carrier, combined with the encoding method of the process metadata structure and layout information, to realize the transformation of the process from a data structure to a visual image. At the same time, the key configuration data and image content are integrated into the same file through an embedding mechanism, so that the exported image can not only be read by people, but also be recognized and restored by the system.

[0022] Through the above technical ideas, the present invention reconstructs the export mechanism of industrial automation processes from the perspective of information encapsulation, realizes the unified expression of logic and visualization, enhances the portability, reusability and engineering management capabilities of process models, and provides a more efficient and universal technical support path for the flow of process assets of zero-code platforms in industrial-level scenarios.

[0023] Please refer to Figure 1 As shown, it is a flow chart of a method for exporting an industrial automation process into a picture in one embodiment of the present invention. The method for exporting an industrial automation process into a picture specifically comprises the following steps: S101: Acquire a process object to be exported on the canvas, and generate a unique identifier for the process object.

[0024] Step S101 is the starting point of the process of exporting the entire process as an image. Its main task is to determine the scope of the export object and assign a unique identifier to this object to ensure that various subsequent generated configuration files and image files can be accurately matched and identified. Specifically, the system first identifies the process object selected or currently activated by the user on the zero-code platform canvas where the user is currently operating. This process object can be a complete flowchart, a sub-process, or a process fragment containing multiple operator nodes and connection relationships. For the subsequent organization and unified naming management of files, the system will automatically generate a globally unique identifier (GUID) for this process object and use this GUID as the basis for the subsequent generated file naming. For example, the generated configuration file is "GUID.gst", the resource file is "GUID.gsc", and the exported image file is "GUID.png".

[0025] As Figure 2 shown, the platform can provide a selection tool through the user interface. The user only needs to click or select the target process on the canvas to trigger the "export image" operation, and the system can automatically capture all its elements, including operators, interfaces, and line logic. The system can generate a globally unique identifier using a timestamp, a random number, or an incrementing sequence, such as "20250331-001" or "GUID-8f3e9d2a". Another possible implementation is to generate an identifier based on the attributes of the process object (such as name, creation time) combined with a hash algorithm to ensure uniqueness even in a multi-user collaboration environment.

[0026] For example, the user edits an industrial process named "Material Detection Process" on the canvas, which includes multiple operator nodes such as image recognition, data judgment, and alarm control. When the user triggers the "export image" operation, the system will obtain the "Material Detection Process" object and generate a unique identifier for it, such as "f3a9821d-6c47-4a33-911d-b8f6ed20a18b". Subsequently, all export files related to this process will be named based on this identifier. This can ensure that there are no naming conflicts for each export task in the file system and is also convenient for subsequent import, reconstruction, and file traceability management.

[0027] S102: Based on the unique identifier, generate the process configuration file, canvas resource file, and process layout image of the process object.

[0028] In step S102, the logical information, layout information and visual representation of the process object are extracted and three different outputs are generated respectively by using the unique identifier as an index: the process configuration file is used to record the logical structure and operator configuration of the process, the canvas resource file is used to save the spatial layout and connection relationship of the process on the canvas, and the process layout image is a visual representation of the process. Its purpose is to provide a data basis for subsequent metadata embedding and process reuse through hierarchical extraction and generation.

[0029] Specifically, the system can traverse all operator nodes according to the tree structure of the process object, call the configuration information export interface of each operator (such as ExportConfig method), extract the contents including operator type, parameter configuration, trigger conditions, etc., and construct a structured data document structure in XML, CSV or JSON format, and finally save it as a ".gst" process configuration file named with GUID. This file records the semantic information at the process logic level.

[0030] The system can obtain the graphical layout information of the process objects in the canvas, such as the coordinate position, size, whether it is locked, breakpoint status, input and output interface identifiers, and connection relationships between nodes of each operator. This information is encapsulated in serialized data forms such as binary, INI, Protocol Buffers, etc. by calling the GetCanvasData method inside the process, and generates a ".gsc" canvas resource file with the help of the GZip compression mechanism, thereby achieving complete preservation of the process graphic layout.

[0031] The system can render the current process canvas into standard PNG, TIFF, JPEG and other image formats that can embed metadata through image rendering methods such as DrawToBitmap, DrawToImage, GetCanvasImage, and save it as "GUID.png". This image file is not only convenient for users to visually identify and archive management, but also becomes the carrier for image-driven process reconstruction after the configuration information is embedded in the subsequent process.

[0032] For example, assuming that a user designs a "temperature control process" in the zero-code platform, the system will generate three types of files during export, such as "3ac2...a7b.gst" (process configuration), "3ac2...a7b.gsc" (canvas resource), and "3ac2...a7b.png" (visual image), to provide structured input for subsequent packaging.

[0033] In an exemplary embodiment, a method for generating a process configuration file of the process object specifically includes: creating a structured data format document, recording the name of the process object and the operator configuration information in the process object, and saving the structured data format document as a process configuration file; wherein, the operator configuration information is obtained by traversing the tree structure of the process object, each tree node in the tree structure represents an operator, and the configuration information corresponding to each operator in the process object is stored in the structured data format document in the form of a node.

[0034] Specifically, the system will first create a structured data format document object for the process object selected by the user. The document serves as a carrier of configuration data and is used to record the metadata information of the process. During the document initialization phase, the system will create a root node and add necessary process attributes to the node, such as process name, creation time, platform version number and other meta information, to facilitate subsequent management and identification. Subsequently, the system begins to build the operator node hierarchy structure within the process. This structure is derived from the internal organization of process objects in the platform and is usually expressed in a tree structure.

[0035] In the implementation of the zero-code platform, each process object corresponds to an operator tree (TreeView structure), in which each TreeNode node represents an operator unit. The system will traverse the tree structure in a depth-first or breadth-first manner, visit each TreeNode one by one, and bind it to the corresponding operator object, and then call the operator's configuration export interface (such as the ExportConfig() method) to obtain the configuration content of the operator. The configuration content includes the operator's unique identifier, type, input and output parameter settings, default values, whether to enable, trigger rules and other business logic-related information. The obtained configuration information will be converted into a node (such as XMLNode) and added as a child node to the structured data format document.

[0036] In order to support the branch structure, nested logic or composite operators contained in the process, the system will also recursively process certain special types of operator nodes. That is, when an operator contains a sub-operator, the system will enter its internal structure and repeat the above traversal and recording process to ensure the integrity of the entire process structure and the accurate expression of the nested relationship. The final generated structured data format document will be named with a unique identifier (such as "GUID.gst") and saved to the specified path as a process configuration file for subsequent packaging or import.

[0037] The process objects are converted from the internal runtime structure of the platform into a standardized description form that can be separated from the system operating environment, so that the control logic of the process can be accurately saved, exported and reconstructed. Structured data such as XML or JSON format has good readability and cross-platform parsing capabilities, which can meet the needs of subsequent import, parsing, verification and other operations.

[0038] In an exemplary embodiment, the method of generating a canvas resource file of the process object specifically includes: obtaining serialized data of the layout information of the process object in the canvas; creating a memory stream object, and storing the serialized data of the layout information in the memory stream object; passing the memory stream object to a compression stream object, and writing the serialized data of the layout information into the compression stream object; exporting the serialized data in the compression stream object as a byte array, and saving it as a canvas resource file through a file writing method.

[0039] Specifically, the system first obtains the data of the canvas layer from the process object. These data usually include the coordinate position of each operator in the canvas, the width and height of the control, the scale of the interface, whether it is locked, whether a breakpoint is set, whether it is enabled, whether the configuration is complete, and other properties. At the same time, it also includes the unique identifier (GUID) of the input and output interface of each operator node and the logical relationship between the connecting lines of different nodes. The above information is represented in the system in a serialized data format and encapsulated in a unified data structure for easy processing and transmission. In order to save this information as structured data, the platform will call internal methods such as GetCanvasData() to convert the layout content of the entire process object in the canvas into a serialized data format, usually in the form of a byte array (such as byte[]).

[0040] After obtaining the preliminary layout serialized data, in order to improve data processing efficiency and storage compactness, the system uses the "memory stream + compressed stream" method to organize and compress data. First, the system creates a memory stream object (MemoryStream) as a carrier for storing temporary serialized data; then, the memory stream object is passed into the GZipStream compressed stream object as the basic stream, and various serialized data fields of the process layout are written into the compressed stream. These fields include the current zoom ratio of the canvas, the number of operators in the process, the location information and size attributes of each operator, the GUID of the input and output interface, and the topological information represented by the connection relationship between nodes. GZipStream is a standard stream compression mechanism that can efficiently compress the original data in memory to reduce storage space and speed up subsequent reading efficiency.

[0041] For example, the system can call the Write() method to continuously write data streams including canvas scale, operator number, operator position, and connection information into the compressed stream, and ensure its structural integrity. The data encoding conversion involved here, such as BitConverter.GetBytes(), is used to convert numeric information (such as coordinates and dimensions) into binary or INI format, while the connection logic (such as "node A output is connected to node B input") can be converted into binary or INI strings through the Encoding.UTF8.GetBytes() method.

[0042] For example, a flowchart contains three operator nodes, namely "temperature acquisition", "threshold judgment" and "alarm execution". The system will record the coordinate information of each node in the canvas, such as the "temperature acquisition" node is located at (100,200), width 150, height 60; at the same time, it marks whether it is currently enabled, locked, whether breakpoints are set, etc. For the input / output ports of these operators, the system will record their unique interface GUIDs and indicate the connection relationship between each interface in binary or INI format data, such as GUID-A output → GUID-B input. All the above information is finally written into the GZip stream to form a compressed layout data.

[0043] After the data is written, the system calls ToArray() or an equivalent method to export the data in the compressed stream into a standard byte array, and uses the File.WriteAllBytes() method to write the data to the local disk. The file name is based on the GUID of the process object and is saved as a canvas resource file in the ".gsc" format. This file becomes the persistent carrier of the canvas layer information of the flowchart.

[0044] Specifically, the method of writing the serialized data of the layout information into the compressed stream object specifically includes: converting the scaling ratio and the number of operators of the canvas into serialized data, and writing the data into the compressed stream object; looping through the operators in the canvas, obtaining the operator configuration information through the data saving method of each operator, the operator configuration information including the operator ID, the coordinate position in the canvas, the size, width and height, the breakpoint status, the lock status, the enable status and the configuration status, and writing the operator configuration information into the compressed stream object in the serialized data format; looping through the input interface and the output interface in the operator, and writing the unique identifier of each interface into the compressed stream object in the serialized data format; looping through the line logical structure in the canvas, converting the connection relationship between the operators into the serialized data format, and writing the data into the compressed stream object.

[0045] In the specific implementation, the system will first write the scaling ratio of the canvas and the number of operators contained in the canvas as the primary data. These two data are not only used to restore the visual scale of the canvas, but also the basis for subsequent traversal and parsing of operator data. The system converts the scaling ratio (usually a floating point number or integer) and the number of operators (integer) into a standard byte array through the BitConverter.GetBytes() method, and writes it to the compressed stream object through the GZipStream.Write() method. This step constitutes the basic header information of the canvas resource file, ensuring that the data structure can be quickly located during decompression.

[0046] Next, the system enters the data writing phase at the operator level. Traverse each operator node in the canvas and obtain the layout and status information of the operator by calling the data saving interface provided by the operator itself (such as GetSaveData() or equivalent methods). It usually includes: the unique identifier (ID) of the operator, the coordinate position (X, Y) in the canvas, size information (Width, Height), whether to set breakpoints, whether it is locked, whether it is enabled, whether the configuration is completed, and other Boolean or integer fields. All these fields are encoded as serialized data and written to the compressed stream in a predefined order.

[0047] After writing the operator body, the system further processes its input and output interface information. Each interface has a unique identifier (GUID) in the platform, and these GUIDs are used to define the connection boundaries of the operator. The system will traverse all input and output interfaces of the current operator, convert the GUID of each interface into a byte array through the Encoding.UTF8.GetBytes() method, and write them into the compressed stream one by one to ensure the uniqueness and connectivity between interfaces.

[0048] Finally, the system needs to record the connection relationship between operators. This part of information reflects the logical connection in the flowchart. Each connection line usually represents an output interface connected to the input interface of another operator, and its structure is "GUID-A→GUID-B". The system will traverse the connection structure in the entire canvas, convert each connection relationship into a string description, and then convert it into byte data through UTF-8 encoding, and finally write it into a compressed stream. This not only retains the control logic of the flowchart, but also provides data support for subsequent visual connection restoration.

[0049] In an exemplary embodiment, the method of generating the process layout image of the process object specifically includes: rendering the canvas where the process object is currently located into a picture that can embed metadata through an image rendering method, and saving it to a specified path.

[0050] Specifically, it can be done by calling the DrawToBitmap method that comes with the graphic control, or it can be done by custom encapsulating and saving the image methods DrawToImage and GetCanvasImage. DrawToBitmap is a method commonly used in .NET graphical interface development, which can draw the visual content of the current control into a bitmap object. In the present invention, the process canvas itself is a visual control that carries multiple operator controls, connecting lines and background elements, and has complete drawing logic. Therefore, when the user triggers the export operation, the system first creates a Bitmap object, and specifies that its size usually matches the actual pixel size of the current canvas, such as 1200 pixels in width and 800 pixels in height. Then, the current canvas content is drawn into the Bitmap object through the DrawToBitmap method, and finally the bitmap object is saved as a PNG format file through the Bitmap.Save() method, and written to a specified path named after the GUID, such as "a1b2c3d4.png".

[0051] For example, a user edited a "warehouse entry process". The process canvas contains multiple operator nodes such as "code scanning and recognition", "cargo location matching", and "warehouse entry instruction issuance", and a complete control logic is formed through multiple connecting lines. Each operator has its position, size, icon and label, and the connecting lines are also presented as visible lines with arrows. When the user clicks "Export as Image", the system will draw all the graphic elements on the canvas at this time (including controls, backgrounds, connecting lines, etc.) into the Bitmap, and then generate the corresponding PNG image. The image can be opened in the image viewer and displays the current process structure and graphic layout, which is convenient for users to quickly identify the overall form of the process.

[0052] S103: Embed the process configuration file and the canvas resource file into the process layout image to form a picture file containing the process object metadata.

[0053] The goal of step S103 is to embed the process configuration file (including the logical structure) and the canvas resource file (including the visual layout information) generated in the previous step into the process layout image in the format of PNG or TIFF, so as to generate an image file that has both visual display function and complete process metadata.

[0054] At the implementation level, the system first reads the generated PNG or TIFF image file (such as the flowchart output by the DrawToBitmap method) and its corresponding ".gst" process configuration file and ".gsc" canvas resource file. All three are converted into binary data format, where the PNG or TIFF image data keeps its original image header and pixel content unchanged, while the process configuration and canvas resource data are written to the end of the image file in an appended manner as additional information.

[0055] To achieve accurate embedding and subsequent reliable parsing, the system introduces a specific delimiter mechanism, which can use the UTF-8 byte form of the two strings "XML" and "BIN" as data boundaries. The system uses the MemoryStream memory stream object to write the image data, tag 1 (XML), process configuration data, tag 2 (BIN), and canvas resource data into the same binary or INI stream in sequence, and finally writes them to the output file path to complete the encapsulation process.

[0056] For example, for an export task named "Temperature Alarm Process", the system may generate three files: "abcd1234.png" is the process layout image, "abcd1234.gst" is the process configuration file, and "abcd1234.gsc" is the canvas resource file. Through the embedding mechanism, the three are merged into one file "abcd1234.png", which is still a common process diagram when opened in an image viewer. In the platform import function, the embedded data can be automatically extracted by identifying the "XML" and "BIN" tags, completing the one-click reconstruction of the process logic and layout.

[0057] In an exemplary embodiment, the method of embedding the process configuration file and the canvas resource file into the process layout image specifically includes: reading the process layout image, the process configuration file and the canvas resource file to generate a serialized data form of a first tag and a second tag as a serialized data array, which is used to separate the serialized data of the process layout image, the serialized data of the process configuration file and the serialized data of the canvas resource file; creating a memory stream object, and writing the serialized data of the process layout image, the serialized data of the first tag, the serialized data of the process configuration file, the serialized data of the second tag and the serialized data of the canvas resource file in sequence; and writing the data in the memory stream object into the final output path of the image.

[0058] Specifically, the system first reads three types of files, namely, the process layout image (such as PNG format), the process configuration file (such as .gst format), and the canvas resource file (such as .gsc format), and converts them into standard serialized data (such as binary) byte arrays. This step can be completed through the File.ReadAllBytes() method, and the data obtained is in the form of byte[] imageData, byte[] configData, and byte[] canvasData. These data correspond to image pixels and graphic content, process control logic structure, and control layout and connection information in structure.

[0059] In order to ensure that these data blocks can be accurately distinguished in subsequent parsing, a serialized data separation marker mechanism is introduced. You can use the Encoding.UTF8.GetBytes() method to convert keyword strings such as "XML" and "BIN" into unique byte sequences as the dividing line between process configuration data and canvas resource data. For example, "XML" (the first marker) is used to mark the beginning of the process configuration segment, and "BIN" (the second marker) is used to mark the beginning of the resource data segment. These markers do not affect the display effect of the PNG image itself, but they play a key role as parsing anchors within the system.

[0060] Next, a MemoryStream object is constructed for aggregate write operations. In the set order, the system writes to the memory stream in sequence: first the original image serialization data, then the "XML" tag, then the process configuration data, then the "BIN" tag, and finally the canvas resource data. The entire writing order is strictly defined, which is convenient for locating and disassembling the data structure through tags during subsequent import and parsing. After writing is completed, the final combined serialized data is obtained through MemoryStream.ToArray(), and then saved as an output file in PNG or TIFF format through the File.WriteAllBytes() method. The file name can be named with a unique GUID to ensure that there is no conflict in the system.

[0061] Through the above method, the problem of multiple files being easily lost and difficult to manage during process export is solved, and configuration and resources are highly aggregated into one; while retaining the visual display function, the image file has the data structure carrying capacity and becomes an executable data image; at the same time, the standard image format is used as the encapsulation basis. This method has good versatility and platform compatibility, and can be safely transferred between different operating systems and software versions.

[0062] Please refer to Figure 3The figure is a flow chart of a method for importing images to reconstruct an industrial automation process in an embodiment of the present invention. The method for importing images to reconstruct an industrial automation process specifically includes the following steps: S301: Acquire an image file containing process object metadata obtained by the aforementioned method of exporting an industrial automation process into an image.

[0063] In step S301, the system first obtains the image file provided by the user. The image file is generated by the previous export mechanism. It is not only a PNG flowchart that can be viewed, but also a special image file that encapsulates the process metadata (including logical structure and canvas layout information). The recognition of this file is usually completed by the import module preset by the platform. The user can import the image file into the platform interface by dragging, clicking the import button or pasting the path, and the system can automatically trigger the import recognition logic.

[0064] like Figure 4 As shown, users can manually upload image files through the graphical interface of the zero-code platform. The system provides a drag area or file selection dialog box. Users only need to drag the file in or browse the local path to complete the acquisition.

[0065] S302: Parsing process configuration information and canvas resource data of the process object from the image file.

[0066] Through parsing technology, the serialized data in the image file (usually in PNG format) containing the metadata of the process object can be split into two parts: the process configuration information reflects the logical structure of the process (such as operator functions and relationships), and the canvas resource data records the spatial layout of the process (such as operator positions and connecting lines). Its purpose is to provide a complete data foundation for subsequent reconstruction, so that the process object can be restored from a static image file to a dynamic and editable form, thereby realizing the reuse of the process.

[0067] In an exemplary embodiment, the method of parsing the process configuration information and canvas resource data of the process object from the image file specifically includes: reading the serialized data of the image file through a parsing method, and locating the positions of the first tag and the second tag using a character encoding method; based on the positions of the first tag and the second tag, dividing the serialized data of the image file into process layout image serialized data, process configuration file serialized data and canvas resource file serialized data through an array copy method.

[0068] Specifically, the system first loads the provided image file into memory in the form of a byte array by serializing data reading. This process can be completed using the File.ReadAllBytes() method to convert the entire image file from beginning to end into byte[] type data. At this point, the byte array contains not only the pixel data and image header information of the image body, but also the process configuration and canvas resource information embedded in the tail when the process is exported. This information is appended to the image data in sequence during the export phase, and is separated by two clear delimiters: one is the first tag "XML", which marks the beginning of the process configuration segment, and the other is the second tag "BIN", which marks the starting position of the canvas resource segment.

[0069] During the parsing process, the system uses the Encoding.UTF8.GetBytes() method to convert the two identifiers "XML" and "BIN" into corresponding byte sequences, and then searches for the starting position index of the two tags in the byte array of the entire image file. This search process can be completed through a custom serialized data (such as binary) search function to ensure accurate matching of the complete byte sequence rather than misjudging a single character.

[0070] After successfully finding the starting positions of the two tags, the system can divide the entire byte array into three logical sections based on these indexes: the first section is the main body data of the process layout image, from the beginning of the file to before the first tag (XML) appears; the second section is from the "XML" tag to the "BIN" tag, corresponding to the serialized data of the process configuration information; the third section is from after the "BIN" tag to the end of the file, corresponding to the serialized data compression data of the canvas resource.

[0071] The splitting process can be done by using the Array.Copy() method or Buffer.BlockCopy() method to copy the original byte array into multiple new sub-arrays and assign them to different data structure variables. For example: byte[] imageData = original data [0 ~ XML start position - 1]; byte[] configData = original data [XML start position + tag length ~ BIN start position - 1]; byte[] canvasData = original data [BIN start position + mark length ~ end].

[0072] S303: Rebuild the process object in the canvas of the zero-code platform according to the process configuration information and canvas resource data.

[0073] In step S303, the parsed process configuration information and canvas resource data are mapped and restored into an editable and executable flow chart object, and completely loaded into the visual process canvas of the zero-code platform.

[0074] In an exemplary embodiment, according to the process configuration information and canvas resource data, a method for reconstructing the process object in the canvas of a zero-code platform specifically includes: converting the serialized data of the process configuration file into a structured data format string, constructing an operator of the process object based on the structured data format string, and loading the process configuration information of the process object; passing the serialized data of the canvas resource file into a memory stream object, and using a compressed stream object to decompress the serialized data of the canvas resource file, reading the layout information of the process object in the canvas from the decompressed serialized data of the canvas resource file, and writing it into the operator of the process object.

[0075] Specifically, the system uses the part of the process configuration file parsed in the previous step (i.e., the data segment marked between "XML" and "BIN") as the input for configuration data processing. This data can exist in binary or INI format array form. The system can convert it into an XML format string through the Encoding.UTF8.GetString() method, and then use XmlDocument or a platform-defined XML parser to load the string and construct the main object structure of the process. During the construction process, the system parses each XMLNode node in the XML document. Each node corresponds to an operator or process element, and dynamically creates an operator object based on its attribute information (such as type, name, parameter configuration, input and output port definition, logical relationship, etc.). After each operator object is created, its internal ImportConfig() method will be called to automatically load the configuration information in the node, thereby completing the construction of the process structure hierarchy. This stage can be regarded as building a process skeleton.

[0076] For example, in an exported flowchart, the XML or JSON of the process configuration segment contains two nodes: one is the "image recognition unit" and the other is the "data processing unit", and there is a connection relationship. The system will create two operator objects in sequence during the reconstruction process and write their logical connection relationship into the structure tree of the process object to ensure that the control flow logic between operators is completely restored.

[0077] Next, we enter the canvas resource data processing stage. The canvas resource data is obtained from the serialized data array extracted from the end of the image file in the previous step. The array is the result of the original canvas layout after compression. The system first creates a MemoryStream memory stream object and writes the serialized data array into the stream. Then, the stream is passed into the GZipStream decompression object to restore the canvas layout data. After decompression, the system sequentially reads the decompressed data stream to extract the visual and interactive status information of each operator in the canvas, such as the X / Y coordinates, width, height, whether it is locked, whether it is enabled, and whether there are breakpoints, and writes this information one by one into the constructed operator object. For each operator's input and output interface, the system also reads its unique identifier and saves it in the interface properties of the operator object. Finally, the system parses the connection relationship between the interfaces (such as "interface A→interface B") and redraws the connection lines in the canvas through graphic controls or drawing engines (such as GDI+) to achieve visual connection reconstruction of the flowchart.

[0078] For example, in the above-mentioned "image recognition unit" and "data processing unit" processes, if the two operators in the original image are located at canvas coordinates (100,200) and (350,200) and are connected by a data stream, the system will draw the two nodes to the specified coordinates after decompressing the resource data, and automatically draw a line from the output port of the former to the input port of the latter. The final reconstructed flowchart is consistent with the original one in terms of both functional structure and graphic layout.

[0079] In summary, the industrial automation process export and reconstruction method provided by the present invention realizes the integrated encapsulation of the process logic structure and the visual layout by embedding the process configuration file and the canvas resource data into the picture. The picture file not only has the visual display function of the standard image, but can also be parsed and restored to a complete process object, supporting import and automatic reconstruction, overcoming the tediousness of traditional manual copy and paste and the limitations of poor compatibility of special plug-ins, and greatly simplifying the process migration and sharing operations.

[0080] Please refer to Figure 5 As shown, an embodiment of the present invention further provides an electronic device 500, which includes at least one processor 501, a memory 502 (such as a non-volatile memory), a memory 503, and a communication interface 504, and the at least one processor 501, the memory 502, the memory 503, and the communication interface 504 are connected together via an internal bus 505. At least one processor 501 is used to call at least one program instruction stored or encoded in the memory 502, so that the at least one processor 501 performs various operations and functions of the industrial automation process export and reconstruction method described in various embodiments of this specification.

[0081] In the embodiments of the present specification, the electronic device 500 may include, but is not limited to, personal computers, server computers, workstations, desktop computers, laptop computers, notebook computers, mobile electronic devices, smart phones, tablet computers, cellular phones, personal digital assistants (PDAs), handheld devices, messaging devices, wearable electronic devices, consumer electronic devices, and the like.

[0082] An embodiment of the present invention also provides a computer-readable medium, which carries computer execution instructions. When the computer execution instructions are executed by a processor, they can be used to implement various operations and functions of the industrial automation process export and reconstruction method described in various embodiments of this specification.

[0083] The computer-readable medium in the present invention can be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium can be, for example, but not limited to, a system, device or component of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples of computer-readable storage media can include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium can be any tangible medium containing or storing a program, which can be used by an instruction execution system, device or device or used in combination with it.

[0084] In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, device, or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0085] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0086] The present invention is described with reference to flowcharts and / or block diagrams of methods, apparatuses, systems, and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as a combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the process in the flowchart. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0087] It will be apparent to those skilled in the art that the invention is not limited to the details of the exemplary embodiments described above and that the invention can be implemented in other specific forms without departing from the spirit or essential features of the invention. Therefore, the embodiments should be considered exemplary and non-limiting in all respects, and the scope of the invention is defined by the appended claims rather than the foregoing description, and it is intended that all variations falling within the meaning and scope of the equivalent elements of the claims be included in the invention. Any reference numeral in a claim should not be considered as limiting the claim to which it relates.

[0088] In addition, it should be understood that although the present specification is described according to implementation modes, not every implementation mode contains only one independent technical solution. This description of the specification is only for the sake of clarity. Those skilled in the art should regard the specification as a whole. The technical solutions in each embodiment may also be appropriately combined to form other implementation modes that can be understood by those skilled in the art.

Claims

1. A method for exporting an industrial automation process into a picture, characterized in that: include: Obtain the process object to be exported on the canvas, and generate a unique identifier for the process object; Based on the unique identifier, generate a process configuration file, a canvas resource file and a process layout image of the process object; The process configuration file and the canvas resource file are embedded into the process layout image to form a picture file containing the process object metadata.

2. The method for exporting an industrial automation process into a picture according to claim 1, characterized in that: Generate a process configuration file for the process object, specifically including: Creating a structured data format document, recording the name of the process object and operator configuration information in the process object, and saving the structured data format document as a process configuration file; The operator configuration information is obtained by traversing the tree structure of the process object, each tree node in the tree structure represents an operator, and the configuration information corresponding to each operator in the process object is stored in the structured data format document in the form of a node.

3. The method for exporting an industrial automation process into a picture according to claim 1, characterized in that: Generate a canvas resource file for the process object, specifically including: Obtaining serialized data of layout information of the process object in the canvas; Create a memory stream object, and store the serialized data of the layout information in the memory stream object; Passing the memory stream object to the compression stream object, and writing the serialized data of the layout information into the compression stream object; The serialized data in the compressed stream object is exported as a byte array, and saved as a canvas resource file through a file writing method.

4. The method for exporting an industrial automation process into a picture according to claim 3, characterized in that: Writing the serialized data of the layout information into the compressed stream object specifically includes: Convert the scaling ratio of the canvas and the number of operators into serialized data and write the serialized data into the compressed stream object; Loop through the operators in the canvas, obtain operator configuration information through the data saving method of each operator, the operator configuration information includes the operator ID, coordinate position in the canvas, size width and height, breakpoint status, lock status, enable status and configuration status, and write the operator configuration information into the compression stream object in serialized data format; Loop through the input interface and output interface in the operator, and write the unique identifier of each interface into the compressed stream object in a serialized data format; The line logic structure in the canvas is traversed in a loop, the connection relationship between operators is converted into a serialized data format, and written into the compressed stream object.

5. The method for exporting an industrial automation process into a picture according to claim 1, characterized in that: Generating a process layout image of the process object specifically includes: The canvas where the process object is currently located is rendered into a picture that can be embedded with metadata through an image rendering method, and saved to a specified path.

6. The method for exporting an industrial automation process into a picture according to claim 1, characterized in that: Embedding the process configuration file and the canvas resource file into the process layout image specifically includes: Read the process layout image, process configuration file and canvas resource file as a serialized data array; Generate a serialized data form of a first tag and a second tag, which are used to separate the serialized data of the process layout image, the serialized data of the process configuration file, and the serialized data of the canvas resource file; Create a memory stream object, and write serialized data of the process layout image, serialized data of the first mark, serialized data of the process configuration file, serialized data of the second mark, and serialized data of the canvas resource file in sequence; Write the data in the memory stream object to the final output path of the image.

7. A method for importing images to reconstruct industrial automation processes, characterized in that: include: Acquire an image file containing process object metadata obtained by the method of claim 6; Parsing process configuration information and canvas resource data of the process object from the image file; The process object is rebuilt in the canvas of the zero-code platform according to the process configuration information and the canvas resource data.

8. The method for reconstructing industrial automation process by importing pictures according to claim 7, characterized in that: Parse the process configuration information and canvas resource data of the process object from the image file, including: Read the serialized data of the image file by a parsing method, and locate the positions of the first mark and the second mark by a character encoding method; Based on the positions of the first mark and the second mark, the serialized data of the picture file is divided into process layout image serialized data, process configuration file serialized data and canvas resource file serialized data through an array copy method.

9. The method for reconstructing industrial automation process by importing pictures according to claim 8, characterized in that: Rebuilding the process object in the canvas of the zero-code platform according to the process configuration information and the canvas resource data includes: Convert the process configuration file serialization data into a structured data format string, construct an operator of the process object based on the structured data format string, and load the process configuration information of the process object; The canvas resource file serialization data is passed into the memory stream object, and the canvas resource file serialization data is decompressed using the compression stream object, and the layout information of the process object in the canvas is read from the decompressed canvas resource file serialization data, and written into the operator of the process object.

10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the method according to any one of claims 1 to 9 is implemented.

Citation Information

Patent Citations

  • Dynamic analysis and display system and method for enterprise flow chart

    CN103617505A

  • Business execution process arrangement method and device

    CN119440517A

  • Zero code development platform, development method, electronic equipment and medium

    CN119473238A

  • Multi-person collaborative programming method and system, electronic equipment and medium

    CN119645358A

  • System and method of transforming legacy documents to XML formats

    US20240152683A1