Industrial automation process export, reconstruction method and electronic device

By embedding process configuration files and canvas resource data into pictures, efficient export and reconstruction of industrial automation processes is achieved, and the problem of poor compatibility between manual copy and paste and plug-in in the existing technology is solved, and the process reuse, migration and sharing efficiency is improved.

CN120029669BActive Publication Date: 2025-07-01SUZHOU GRANI VISION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

The prior art has cumbersome operations of manual copy-paste and poor compatibility of special plug-ins during the export and reconstruction of industrial automation processes, which limits the efficiency of process reuse, migration and sharing.

Method used

By embedding process configuration files and canvas resource data into pictures, an integrated encapsulation of process logic structure and visual layout is realized, supporting exporting to pictures and automatically rebuilding the process in the zero-code platform.

Benefits of technology

This method avoids the tedious operation of manual copy and paste, improves the efficiency of process export and reconstruction, overcomes the problem of poor compatibility of dedicated plug-ins, and simplifies process migration and sharing operations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120029669B_ABST
    Figure CN120029669B_ABST
Patent Text Reader

Abstract

The present invention discloses an industrial automation process export and reconstruction method and an electronic device, belonging to the technical field of software development. The method includes: obtaining process objects to be exported on a canvas and generating unique identifiers for the process objects; generating process configuration files, canvas resource files and process layout images for the process objects based on the unique identifiers; embedding the process configuration files and canvas resource files into the process layout images to form picture files containing metadata of the process objects. The industrial automation process export and reconstruction method and the electronic device provided by the present invention realize the integrated encapsulation of the process logic structure and the visual layout by embedding the process configuration files and canvas resource data into pictures. The picture files support import and automatic reconstruction, overcome the cumbersome traditional manual copying and pasting and the limitation of poor compatibility of dedicated plug-ins, and greatly simplify the process migration and sharing operations.
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 particularly relates to a method for exporting and reconstructing industrial automation processes and an electronic device. Background Art

[0002] With the continuous development of industrial automation systems, zero-code platforms are increasingly widely used in scenarios such as process control, task scheduling, and data flow management. The zero-code platform reduces the technical threshold of process modeling and adjustment in industrial applications through a graphical interface and a drag-and-drop logic configuration method, enabling non-programmers to complete the construction of complex process logics. However, in actual use, the requirements for the reuse, migration, and sharing of industrial processes are becoming increasingly frequent, which poses higher requirements for the export and reuse capabilities of processes.

[0003] In the prior art, zero-code platforms usually only support migrating processes from one project to another by manual copy and paste. This method is acceptable for simple processes, but for large industrial flowcharts with 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 using dedicated plugins or auxiliary tools for process export, but these plugins often rely on specific environment configurations or software versions, have poor compatibility, and are difficult to be universal among different platforms or different versions, restricting the sharing efficiency of processes within the team and across projects.

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

[0005] The purpose of the present invention is to provide a method for exporting and reconstructing industrial automation processes and an electronic device, which can export process objects in the form of pictures, avoiding the cumbersome operation of manual copy and paste and having strong compatibility.

[0006] To achieve the above purpose, the technical solution provided by the present invention is as follows:

[0007] In a first aspect, the present invention provides a method for exporting an industrial automation process as a picture, which includes:

[0008] Obtaining the process objects to be exported on the canvas and generating unique identifiers for the process objects; based on the unique identifiers, generating process configuration files, canvas resource files, and process layout images for the process objects; and embedding the process configuration files and canvas resource files into the process layout images to form picture files containing the metadata of the process objects.

[0009] In one or more embodiments, generating a process configuration file for 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 node form.

[0010] 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, 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.

[0011] In one or more embodiments, writing the serialized data of the layout information into the compression stream object specifically includes: converting the zoom ratio of the canvas and the number of operators into serialized data and writing it into the compression stream object; looping through the operators in the canvas, obtaining operator configuration information through the data saving method of each operator, the operator configuration information includes operator ID, coordinate position in the canvas, width and height of the size, breakpoint state, lock state, enable state, and configuration state, and writing the operator configuration information into the compression stream object in serialized data format; looping through the input interfaces and output interfaces in the operator, writing the unique identifiers of each interface into the compression stream object in serialized data format; looping through the line logic structure in the canvas, converting the connection relationship between operators into serialized data format and writing it into the compression stream object.

[0012] In one or more embodiments, 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.

[0013] In one or more embodiments, embedding the process profile and canvas resource file into the process layout image specifically includes: reading the process layout image, process profile, and canvas resource file as serialized data arrays; generating serialized data forms of a first tag and a second tag for separating the serialized data of the process layout image, the serialized data of the process profile, and the serialized data of the canvas resource file; creating a memory stream object and sequentially writing the serialized data of the process layout image, the serialized data of the first tag, the serialized data of the process profile, the serialized data of the second tag, and the serialized data of the canvas resource file; and writing the data in the memory stream object to the final output path of the picture.

[0014] In a second aspect, the present invention provides a method for importing a picture to reconstruct an industrial automation process, which includes:

[0015] Obtaining a picture file containing process object metadata obtained by the method for exporting an industrial automation process as a picture described above; parsing the process configuration information and canvas resource data of the process object from the picture file; and reconstructing the process object in the canvas of the zero-code platform according to the process configuration information and canvas resource data.

[0016] In one or more embodiments, parsing the process configuration information and canvas resource data of the process object from the picture file includes: reading the serialized data of the picture file through a parsing method and using a character encoding method to locate the positions of the first tag and the second tag; and based on the positions of the first tag and the second tag, splitting the serialized data of the picture file into serialized data of the process layout image, serialized data of the process profile, and serialized data of the canvas resource file through an array copying method.

[0017] In one or more embodiments, reconstructing the process object in the canvas of the zero-code platform according to the process configuration information and canvas resource data includes: converting the serialized data of the process profile 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, decompressing the serialized data of the canvas resource file using a compressed stream object, 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.

[0018] In a third aspect, the present invention provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, where the processor implements the method as described above when executing the program.

[0019] Compared with the prior art, the industrial automation process export and reconstruction method and electronic device provided by the present invention embed the process configuration file and canvas resource data into a picture, realizing the integrated encapsulation of the process logic structure and visual layout. This picture file not only has the visual display function of a standard image, but can also be parsed and restored into complete process objects, supporting import and automatic reconstruction, overcoming the limitations of the cumbersome traditional manual copying and pasting and the poor compatibility of dedicated plugins, and greatly simplifying the process migration and sharing operations. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only some embodiments recorded in the present invention, and those of ordinary skill in the art can also obtain other drawings based on these drawings without creative efforts.

[0021] Figure 1 It is a flowchart of the method for exporting an industrial automation process as a picture in an embodiment of the present invention;

[0022] Figure 2 It is a schematic diagram of the operation interface when exporting the process as a picture in an embodiment of the present invention;

[0023] Figure 3 It is a flowchart of the method for importing a picture to reconstruct an industrial automation process in an embodiment of the present invention;

[0024] Figure 4 It is a schematic diagram of the operation interface when importing a picture to reconstruct the process in an embodiment of the present invention;

[0025] Figure 5 It is a schematic diagram of an electronic device in an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0026] In order to enable those skilled in the art to better understand the technical solutions in the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.

[0027] In the design and development of industrial automation processes, zero-code platforms are widely used in 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 mainly rely on manual copy-pasting or use specific plugins for structural transfer in process export. This not only involves cumbersome operations and low efficiency but also has compatibility barriers between different systems, severely restricting the flexible use of process models in multiple scenarios. In addition, existing technologies often fail to synchronously save the process logic and its graphical layout, resulting in problems such as missing logic or interface reconstruction when the exported process is imported and reconstructed.

[0028] Based on the analysis of the shortcomings of existing technologies, the inventors recognized that a process not only consists of a collection of logical structures but also includes multi-dimensional information such as graphical layout, operator configuration, and connection relationships. Only by uniformly encapsulating this information can the complete migration and reconstruction of the process be achieved. For this reason, the present invention proposes a process export method oriented to image encapsulation. The core idea is to use a common image format as the information carrier medium and combine the encoding methods of process metadata structures and layout information to realize the conversion of the process from a data structure to a visual image. At the same time, through an embedding mechanism, key configuration data and image content are integrated into the same file, making the exported image not only readable by humans but also recognizable and restorable by the system.

[0029] Through the above technical ideas, starting from the perspective of information encapsulation, the present invention reconstructs the export mechanism of industrial automation processes, 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 general technical support path for the transfer of process assets in zero-code platforms in industrial scenarios.

[0030] Please refer to Figure 1 As shown, it is a flowchart of the method for exporting an industrial automation process as a picture in an embodiment of the present invention. The method for exporting an industrial automation process as a picture specifically includes the following steps:

[0031] S101: Obtain the process objects to be exported on the canvas and generate unique identifiers for the process objects.

[0032] 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 recognized. 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".

[0033] 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.

[0034] 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.

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

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

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

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

[0039] The system can render the current process canvas into an image format such as standard PNG, TIFF, JPEG that can embed metadata through image rendering methods such as DrawToBitmap, DrawToImage, GetCanvasImage, etc., and save it as "GUID.png". This image file is not only convenient for users' visual recognition and archival management, but also will become the carrier for image-driven process reconstruction after subsequent configuration information is embedded.

[0040] For example, assume that the user designs a "temperature control process" in a zero-code platform. When the system exports, it will generate three types of files such as "3ac2…a7b.gst" (process configuration), "3ac2…a7b.gsc" (canvas resource), and "3ac2…a7b.png" (visual image), providing structured input for subsequent encapsulation.

[0041] In an exemplary embodiment, the method for generating the 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 the 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 nodes.

[0042] Specifically, the system first creates a structured data format document object for the process object selected by the user. This document serves as the carrier of configuration data and is used to record the metadata information of the process. In the document initialization stage, the system creates a root node and adds necessary process attributes to this node, such as metadata information like process name, creation time, platform version number, etc., for subsequent management and identification. Subsequently, the system starts to construct the hierarchical structure of operator nodes within the process. This structure originates from the internal organization method of process objects in the platform and is usually expressed in a tree structure.

[0043] In the implementation of the zero-code platform, each process object corresponds to an operator tree (TreeView structure), where each TreeNode node represents an operator unit. The system traverses this tree structure in a depth-first or breadth-first manner, visits each TreeNode one by one, binds it to the corresponding operator object, and then calls the configuration export interface of the operator (such as the ExportConfig() method) to obtain the configuration content of the operator. The configuration content includes information related to business logic such as the unique identifier, type, input and output parameter settings, default value, whether it is enabled, trigger rules, etc., of the operator. The obtained configuration information will be converted into a node (such as an XMLNode) and added as a child node to the structured data format document.

[0044] To support the branch structure, nested logic, or composite operators included in the process, the system also performs recursive processing on certain special types of operator nodes. That is, when a certain operator contains sub-operators inside, 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 finally generated structured data format document will be named with a unique identifier (such as "GUID.gst") and saved to the specified path for subsequent packaging or import use.

[0045] Convert the process object from the in-platform runtime structure to a standardized description form that can run independently of the system environment, so that the control logic of the process can be accurately stored, exported, and reconstructed. Structured data in formats such as XML or JSON has good readability and cross-platform parsing capabilities, and can meet the requirements of subsequent import, parsing, verification, and other operations.

[0046] In an exemplary embodiment, the method for generating the canvas resource file of the process object specifically includes: obtaining the 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 into 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.

[0047] Specifically, the system first obtains the data of the canvas layer from the process object. These data usually include attributes such as the coordinate position of each operator in the canvas, the width and height of the control, the interface scaling ratio, whether it is locked, whether a breakpoint is set, whether it is enabled, and whether the configuration is completed. At the same time, it also includes the unique identifier (GUID) of the input and output interfaces of each operator node and the logical relationship of the connection lines between different nodes. The above information is represented in the system in a serialized data format and encapsulated through a unified data structure for easy processing and transmission. 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[]).

[0048] After obtaining the preliminary layout serialized data, in order to improve data processing efficiency and storage compactness, the system uses the method of "memory stream + compression stream" for data organization and compression processing. First, the system creates a memory stream object (MemoryStream) as the carrier for storing temporary serialized data; then, this memory stream object is passed as the base stream into the GZipStream compression stream object, and various serialized data fields of the process layout are written into the compression stream. These fields include the current scaling ratio of the canvas, the number of operators in the process, the position information and size attributes of each operator, the GUID of the input and output interfaces, 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.

[0049] For example, the system can call the Write() method to continuously write a data stream including fields such as the canvas scaling ratio, the number of operators, the operator positions, and the connection information into a compressed stream, and ensure its structural integrity. The data encoding conversions involved here, such as BitConverter.GetBytes() being used to convert numerical information (such as coordinates and dimensions) into binary or INI form, and the connection logic (such as "the output of node A is connected to the input of node B") can be converted into a binary or INI string through the Encoding.UTF8.GetBytes() method.

[0050] For example, a certain 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 being located at (100, 200), with a width of 150 and a height of 60; at the same time, mark status flags such as whether it is currently enabled, locked, or has a breakpoint set. For the input / output ports of these operators, the system will record their unique interface GUIDs and indicate the connection relationships between the interfaces in the 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.

[0051] After the data writing is completed, the system will call the ToArray() or an equivalent method to export the data in the compressed stream as a standard byte array, and use the File.WriteAllBytes() method to write this 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.

[0052] Specifically, the method of writing the serialized data of the layout information into the compressed stream object specifically includes: converting the scaling ratio of the canvas and the number of operators into serialized data and writing it 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 includes the operator ID, the coordinate position in the canvas, the width and height of the size, the breakpoint status, the locked status, the enabled 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 interfaces and output interfaces in the operator, writing the unique identifiers of each interface into the compressed stream object in the serialized data format; looping through the line logic structure in the canvas, converting the connection relationships between the operators into the serialized data format and writing it into the compressed stream object.

[0053] In terms of 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 pieces of data are not only used to restore the visual ratio of the canvas but also serve as the basis for subsequent traversal and parsing of operator data. The system converts the scaling ratio (usually a floating-point number or an integer) and the number of operators (an integer) into a standard byte array through the BitConverter.GetBytes() method and writes it into the compression 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.

[0054] Next, the system enters the stage of writing operator-level data. It traverses each operator node in the canvas and obtains the layout and status information of the operator by calling the data saving interface provided by the operator itself (such as GetSaveData() or an equivalent method). Usually, it includes: the unique identifier (ID) of the operator, the coordinate position (X, Y) in the canvas, the size information (Width, Height), whether a breakpoint is set, whether it is in a locked state, whether it is enabled, whether it has been configured, and many other boolean or integer fields. All these fields are encoded as serialized data and written into the compression stream in a predefined order.

[0055] After writing the operator body, the system further processes the 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 the input and output interfaces of the current operator, convert the GUIDs of each interface into a byte array through the Encoding.UTF8.GetBytes() method, and write them into the compression stream one by one to ensure the uniqueness and connectivity between the interfaces.

[0056] Finally, the system also needs to record the connection relationships between the operators. This part of the information reflects the logical connections in the flow chart. Each connection line usually represents an output interface connected to an 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 the compression stream. This not only preserves the control logic of the flow chart but also provides data support for subsequent visualization of the connection line restoration.

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

[0058] Specifically, it can be accomplished by calling the DrawToBitmap method provided by the graphic control, or by customizing and encapsulating the image saving methods DrawToImage and GetCanvasImage. DrawToBitmap is a method commonly used in.NET graphic 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, connection lines, and background elements, and has a complete drawing logic. Therefore, when the user triggers the export operation, the system first creates a Bitmap object, specifying its size to usually match the actual pixel size of the current canvas, for example, 1200 pixels in width and 800 pixels in height. Then, the content of the current canvas is drawn into this Bitmap object through the DrawToBitmap method. Finally, the bitmap object is saved as a PNG format file through the Bitmap.Save() method and written to a specified path named with a GUID, such as "a1b2c3d4.png".

[0059] For example, the user edits a "warehouse inbound process", and the process canvas contains multiple operator nodes such as "scan and identify", "location matching", and "inbound order issuance", and a complete control logic is formed through multiple connection lines. Each operator has its position, size, icon, and label, and the connection lines also appear as visible lines with arrows. When the user clicks "export as image", the system will uniformly draw all the graphic elements (including controls, background, connection lines, etc.) on the canvas at this time into the Bitmap, and then generate the corresponding PNG image. This image can be opened in an image viewer and display the current process structure and graphic layout, facilitating the user to quickly identify the overall form of the process.

[0060] 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.

[0061] The goal of step S103 is to embed the process configuration file (containing the logical structure) and the canvas resource file (containing the visual layout information) generated in the previous step into the process layout image in formats such as PNG or TIFF, so as to generate a picture file that not only has a visual display function but also contains complete process metadata.

[0062] 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. Among them, the PNG or TIFF image data keeps its original image header and pixel content unchanged, while the process configuration and canvas resource data, as additional information, will be written to the end of the image file in an appended manner.

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

[0064] 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". When this file is opened in an image viewer, it is still an ordinary flowchart, while in the platform import function, the embedded data can be automatically extracted by recognizing the "XML" and "BIN" markers to complete the one-key reconstruction of the process logic and layout.

[0065] 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 as serialized data arrays to generate serialized data forms of a first marker and a second marker 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 marker, the serialized data of the process configuration file, the serialized data of the second marker, and the serialized data of the canvas resource file in sequence; writing the data in the memory stream object to the final output path of the picture.

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

[0067] To ensure that these data blocks can be accurately distinguished during subsequent parsing, a serialized data delimiter marker mechanism is introduced. The Encoding.UTF8.GetBytes() method can be used to convert keyword strings such as "XML" and "BIN" into unique byte sequences, which serve as the dividing line between process configuration data and canvas resource data. For example, "XML" (the first marker) is used to mark the start of the process configuration segment, and "BIN" (the second marker) is used to mark the start of the resource data segment. These markers do not affect the display effect of the PNG image itself, but play a crucial role as parsing anchors within the system.

[0068] Next, a MemoryStream memory stream object is constructed for aggregating write operations. In the set order, the system sequentially writes to this memory stream: first, the original image serialized data, second, the "XML" marker, then the process configuration data, then the "BIN" marker, and finally the canvas resource data. The entire write order is strictly defined to facilitate subsequent positioning and disassembling of the data structure through the markers during import parsing. After the write 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 no conflicts occur in the system.

[0069] Through the foregoing method, the problem of easy loss and difficult management caused by the separation of multiple files during the process export is solved, and the configuration and resources are highly aggregated into one; while retaining the visual display function, the image file has the ability to carry data structures and becomes an executable data image; at the same time, using the standard image format as the encapsulation basis, this method has good versatility and platform compatibility and can be safely transferred between different operating systems and software versions.

[0070] Please refer to Figure 3As shown in the figure, it is a flowchart of a method for importing a picture to reconstruct an industrial automation process in an embodiment of the present invention. The method for importing a picture to reconstruct an industrial automation process specifically includes the following steps:

[0071] S301: Obtain a picture file containing process object metadata obtained by the method of exporting as a picture through the aforementioned industrial automation process.

[0072] In step S301, the system first obtains a picture file provided by the user. This picture file is generated through the previous export mechanism and is not only a viewable PNG flowchart but also a special image file encapsulating process metadata (including logical structure and canvas layout information). The recognition of this file is usually completed by an import module preset by the platform. The user can introduce 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.

[0073] As Figure 4 shown, the user can manually upload a picture file through the graphical interface of the zero-code platform. The system provides a drag area or a file selection dialog box, and the user only needs to drag the file in or browse the local path to select to complete the acquisition.

[0074] S302: Parse the process configuration information and canvas resource data of the process object from the picture file.

[0075] Through parsing technology, the serialized data in the picture file containing process object metadata (usually in PNG format) 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 connection lines). The purpose is to provide a complete data basis for subsequent reconstruction, enabling the process object to be restored from a static picture file to a dynamic editable form, thereby realizing the reuse of the process.

[0076] In an exemplary embodiment, the method for parsing the process configuration information and canvas resource data of the process object from the picture file specifically includes: reading the serialized data of the picture file through a parsing method, using a character encoding method to locate the positions of the first marker and the second marker; based on the positions of the first marker and the second marker, splitting the serialized data of the picture file into process layout image serialized data, process configuration file serialized data, and canvas resource file serialized data through an array copying method.

[0077] Specifically, the system first loads the provided image file into memory in the form of a byte array through a serialized data reading method. This process can be completed using the File.ReadAllBytes() method, which converts the entire image file into byte[] type data from start to end. At this time, the byte array not only contains the pixel data of the image itself and the image header information, but also contains the process configuration and canvas resource information embedded at the end during the process export. These information are sequentially appended and written after the image data during the export phase, and two clear delimiter markers are used for separation: one is the first marker "XML", which identifies the start of the process configuration segment, and the other is the second marker "BIN", which identifies the starting position of the canvas resource segment.

[0078] During the parsing process, the system uses the Encoding.UTF8.GetBytes() method to convert the two identifiers "XML" and "BIN" into their corresponding byte sequences respectively, and then sequentially searches for the starting position indexes of these two markers 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 an accurate match of the complete byte sequence rather than a misjudgment of a single character.

[0079] After successfully finding the starting positions of the two markers, the system can divide the entire byte array into three logical paragraphs according to these indexes: the first paragraph is the ontology data of the process layout image, from the start of the file to before the first marker (XML) appears; the second paragraph is between the "XML" marker and the "BIN" marker, corresponding to the serialized data of the process configuration information; the third paragraph is from after the "BIN" marker until the end of the file, corresponding to the serialized data compressed data of the canvas resources.

[0080] This splitting process can be achieved by methods such as Array.Copy() or Buffer.BlockCopy(), which copy the original byte array into multiple new sub-arrays and assign them to different data structure variables. For example:

[0081] byte[] imageData = originalData[0 ~ XML start position - 1];

[0082] byte[] configData = originalData[XML start position + marker length ~ BIN start position - 1];

[0083] byte[] canvasData = originalData[BIN start position + marker length ~ end].

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

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

[0086] In an exemplary embodiment, the method for reconstructing the process object in the canvas of the zero-code platform according to the process configuration information and canvas resource data 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, decompressing the serialized data of the canvas resource file using a compressed stream object, 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.

[0087] Specifically, the system uses the part of the process configuration file parsed in the previous step (i.e., the data segment between "XML" and "BIN" marked) 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 an XML parser such as XmlDocument or a platform-customized 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 a process element, and an operator object is dynamically created based on its attribute information (such as type, name, parameter configuration, input / output port definition, logical relationship, etc.). After each operator object is created, it calls its internal ImportConfig() method to automatically load the configuration information in the node, thus completing the construction of the process structure hierarchy. This stage can be regarded as building the process skeleton.

[0088] For example, in an exported flowchart, the XML or JSON of the process configuration section contains two nodes: one is an "image recognition unit", and the other is a "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 the operators is fully restored.

[0089] Next, enter the processing stage of the canvas resource data. The canvas resource data is obtained from the serialized data array extracted from the end of the image file in the previous step. This array is the result of compressing the original canvas layout. The system first creates a MemoryStream object and writes the serialized data array into the stream. Then, by passing the stream into a GZipStream decompression object, the system restores the canvas layout data. After decompression, the system sequentially reads the decompressed data stream, extracts the visual and interaction status information such as the X / Y coordinates, width, height, whether it is locked, whether it is enabled, and whether there are breakpoints of each operator in the canvas, and writes this information into the constructed operator object one by one. For the input and output interfaces of each operator, the system also reads its unique identifier and saves it in the interface property of the operator object. Finally, the system parses the connection relationships between the interfaces (such as "interface A → interface B") and redraws the connection lines in the canvas through graphic controls or a drawing engine (such as GDI+), realizing the visual connection line reconstruction of the flowchart.

[0090] For example, in the process of the above "image recognition unit" and "data processing unit", if these two operators in the original image are located at the canvas coordinates (100, 200) and (350, 200) and are connected by a data stream, after the system decompresses the resource data, it will draw these two nodes to the specified coordinates respectively and automatically draw a connection line from the output port of the former to the input port of the latter. The finally reconstructed flowchart is consistent with that before export both in terms of functional structure and graphic layout.

[0091] 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. This picture file not only has the visual display function of a standard image but can also be parsed and restored into a complete process object, supporting import and automatic reconstruction, overcoming the limitations of the cumbersome traditional manual copying and pasting and the poor compatibility of dedicated plugins, and greatly simplifying the process migration and sharing operations.

[0092] Please refer to Figure 5 As shown, the embodiment of the present invention also provides an electronic device 500. The electronic device 500 includes at least one processor 501, a memory 502 (such as a non-volatile memory), a memory 503, and a communication interface 504, and 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 at least one processor 501 performs various operations and functions of the industrial automation process export and reconstruction method described in each embodiment of this specification.

[0093] 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.

[0094] The embodiments of the present invention also provide a computer-readable medium having computer-executable instructions stored thereon. When the computer-executable instructions are executed by a processor, they can be used to implement various operations and functions of the industrial automation process export and reconstruction methods described in the embodiments of the present specification.

[0095] The computer-readable medium in the present invention may be a computer-readable signal medium, a computer-readable storage medium, or any combination of the two. A computer-readable storage medium may be, for example, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having 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 may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.

[0096] 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 computer-readable program code. Such a propagated data signal may take various 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 can send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on a computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical fiber, RF, etc., or any suitable combination of the above.

[0097] Those skilled in the art should understand that the embodiments of the present invention can be provided as a method, a system, or a computer program product. Therefore, the present invention can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present invention can 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.) that contain computer-usable program code.

[0098] The present invention is described with reference to the flowcharts and / or block diagrams of methods, apparatuses, systems, and computer program products according to the embodiments of the present invention. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, as well as the combination of flows and / or blocks in the flowcharts and / or block diagrams, can be realized by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing devices generate a device for realizing the functions specified in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.

[0099] For those skilled in the art, it is obvious that the present invention is not limited to the details of the above exemplary embodiments, and without departing from the spirit or basic characteristics of the present invention, the present invention can be implemented in other specific forms. Therefore, in any aspect, the embodiments should be regarded as exemplary and non-limiting. The scope of the present invention is defined by the appended claims rather than the above description. Therefore, all changes falling within the meaning and scope of the equivalent elements of the claims are intended to be included in the present invention. Any reference signs in the claims should not be regarded as limiting the claimed rights.

[0100] In addition, it should be understood that although this specification is described according to the implementation manners, not every implementation manner only contains an independent technical solution. This narrative manner of the specification is only for clarity. Those skilled in the art should regard the specification as a whole, and the technical solutions in each embodiment can also be appropriately combined to form other implementation manners 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; 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; The data in the memory stream object is written into the final output path of the image, so as to embed the process configuration file and the canvas resource file into the process layout image, and form an image file containing the metadata of the process object.

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. A method for importing images to reconstruct industrial automation processes, characterized in that: include: Obtaining an image file containing process object metadata obtained by the method described in claim 1; 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.

7. The method for reconstructing industrial automation process by importing pictures according to claim 6, 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.

8. The method for reconstructing industrial automation process by importing pictures according to claim 7, 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.

9. 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 8 is implemented.

Citation Information

Patent Citations

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

    CN103617505A

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

    CN119645358A