A method and system for describing a PLC project

The PLC project description method using TOML format and KeyPath syntax solves the problem of poor cross-platform compatibility of PLC projects, realizes unified and standardized PLC project description, supports new function expansion, and improves the portability and maintainability of projects.

CN121300215BActive Publication Date: 2026-07-03SHANGHAI BAOSIGHT SOFTWARE CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SHANGHAI BAOSIGHT SOFTWARE CO LTD
Filing Date
2025-09-30
Publication Date
2026-07-03

AI Technical Summary

Technical Problem

Different PLC manufacturers or IDEs use their own proprietary formats to store PLC projects, resulting in poor cross-platform compatibility, difficulty in data interaction, and limited operational capabilities of traditional IDEs, lacking a unified ability to describe PLC project objects and making it difficult to support new feature expansions.

Method used

The PLC project is described in the development environment using the TOML markup language. The properties of the PLC project objects are defined through the metadata section and the object definition section, including fields that represent the operation mode, object path and type. The global variable set is updated using the KeyPath syntax to achieve a standardized description of the PLC project.

Benefits of technology

It achieves unified and standardized description of PLC projects, solves the problem of inconsistent data representation between different PLC systems and IDEs, and supports cross-platform data interaction and new function expansion, such as AI-assisted programming and advanced code analysis.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121300215B_ABST
    Figure CN121300215B_ABST
Patent Text Reader

Abstract

This invention belongs to the field of PLC automation technology, specifically relating to a PLC project description method and system. The method includes: describing a PLC project in a development environment based on the TOML markup language; creating corresponding program units, global variable sets, periodic tasks, and devices according to the description of the PLC project, and encapsulating them in the PLC project file, or modifying the attributes of program units, global variable sets, periodic tasks, or devices in the PLC project file according to the description of the PLC project; and exporting the PLC project file. The PLC project and its corresponding program units, global variable sets, periodic tasks, and devices are all edited and generated or modified according to the description format of metadata + object definition, and the object definition section at least defines fields representing the operation mode, fields representing the object path, and fields representing the object type.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of PLC automation technology, specifically relating to a PLC project description method and system. Background Technology

[0002] PLC (Programmable Logic Controller) projects typically contain various objects, such as program units (PUs), global variable sets (GVSs), periodic tasks, and devices. However, different PLC manufacturers or IDEs (Integrated Development Environments) use their own proprietary formats to store PLC projects, resulting in poor cross-platform compatibility and difficulty in achieving data interaction.

[0003] Meanwhile, the traditional IDE's representation of PLC projects is tightly coupled with the IDE itself, making it difficult to support new feature extensions, such as AI-assisted programming and advanced code analysis. Furthermore, its operational capabilities are limited, lacking a unified ability to describe object operations (such as creation, update, and deletion). Summary of the Invention

[0004] In view of the shortcomings of the prior art described above, the purpose of this invention is to provide a PLC project description method, which uses a unified and formatted text description method to represent various objects and their attribute relationships in a PLC project, thereby achieving a standardized description of the PLC project.

[0005] To achieve the above and other related objectives, this invention provides a PLC project description method, comprising: describing a PLC project in a development environment based on the TOML markup language; creating corresponding program units, global variable sets, periodic tasks, and devices according to the description content of the PLC project, and encapsulating them in the PLC project file, or modifying the attributes of program units, global variable sets, periodic tasks, or devices in the PLC project file according to the description content of the PLC project; exporting the PLC project file; wherein the PLC project and its corresponding program units, global variable sets, periodic tasks, and devices are all edited and generated or modified according to the description format of metadata part + object definition part, and the object definition part defines at least a field representing the operation mode, a field representing the object path, and a field representing the object type.

[0006] In one embodiment of the present invention, the metadata portion defines at least a field representing whether it is in strict mode and a field representing the protocol version.

[0007] In one embodiment of the present invention, the steps of editing, generating, or modifying the PLC project / program unit / global variable set / periodic task / device include: defining the values ​​of each field in the metadata part according to the attribute information of the development environment; defining the values ​​of each field in the object definition part according to the attribute information of the PLC project / program unit / global variable set / periodic task / device, including: defining the field value representing the operation mode as create, update, or delete; concatenating the root path of the metadata part with the relative path of the current object, and defining the field value representing the object path according to the concatenated path; and defining the field value representing the object type according to the description type of the PLC project / program unit / global variable set / periodic task / device.

[0008] In one embodiment of the present invention, the object definition portion further defines a field representing the operation range and a field representing the selected range.

[0009] In one embodiment of the present invention, the global variable set in the PLC project is updated using KeyPath syntax; wherein, different operation ranges are predefined using KeyPath syntax as field values ​​representing optional operation ranges; and different selection ranges are defined using KeyPath syntax as field values ​​representing optional selection ranges.

[0010] In one embodiment of the present invention, the step of updating the global variable set in the PLC project using KeyPath syntax includes: defining the values ​​of each field in the metadata section according to the attribute information of the development environment; defining the field value representing the operation mode as updated; defining the field value representing the object path according to the current location of the global variable set to be updated; defining the field value representing the object type according to the description type of the global variable set; obtaining the number of variables to be updated and the range adjustment information of each variable for the variables that need to be updated in the global variable set; defining the field value representing the operation range according to the predefined representation of the global variable set using KeyPath syntax; defining the field value representing the selected range according to the position of the updated variable in the global variable set and its predefined representation using KeyPath syntax; and defining the field value of the relevant field according to the corresponding range adjustment information for each variable.

[0011] In one embodiment of the present invention, the step of updating the global variable set in the PLC project using KeyPath syntax includes: defining the values ​​of each field in the metadata section according to the attribute information of the development environment; defining the field value representing the operation mode as updated; defining the field value representing the object path according to the current location of the global variable set to be updated; defining the field value representing the object type according to the description type of the global variable set; obtaining the corresponding range information for the variables that need to be added to the global variable set; defining the field value representing the operation range according to the predefined representation of the global variable set using KeyPath syntax; defining the field value representing the selected range according to the predefined representation of the added variable using KeyPath syntax; and defining the field values ​​of related fields according to the range information corresponding to the added variable.

[0012] In one embodiment of the present invention, the object definition portion further defines a field representing the object index.

[0013] This invention also provides a PLC project description method, which imports a PLC project file generated and exported by the aforementioned PLC project description method, including: obtaining the PLC project file and parsing the corresponding description content therefrom; reconstructing the PLC project in a development environment based on the description content of the PLC project using the TOML format markup language, and creating corresponding program units, global variable sets, periodic tasks, and devices, and encapsulating them in the reconstructed PLC project file; wherein the PLC project and its corresponding program units, global variable sets, periodic tasks, and devices are all edited and generated according to the description format of metadata part + object definition part, and the object definition part defines at least a field representing the operation mode, a field representing the object path, and a field representing the object type.

[0014] This invention also provides a PLC project description system, comprising: a file import module for importing a transmitted PLC project file and parsing corresponding description content therefrom; an editing module for describing a PLC project in a development environment based on the TOML markup language; and for creating corresponding program units, global variable sets, periodic tasks, and devices according to the description content of the PLC project, and encapsulating them in the PLC project file, or modifying the attributes of program units, global variable sets, periodic tasks, or devices in the PLC project file according to the description content of the PLC project; and a file export module for exporting the generated PLC project file; wherein the PLC project and its corresponding program units, global variable sets, periodic tasks, and devices are all edited and generated or modified according to the description format of metadata part + object definition part, and the object definition part defines at least a field representing the operation mode, a field representing the object path, and a field representing the object type.

[0015] The beneficial effects of this invention are as follows: This invention provides a unified and standardized method for describing PLC projects, which can fully describe various objects and their attribute relationships in PLC projects, and solves the problem of inconsistent data representation between different PLC systems and different IDEs. Attached Figure Description

[0016] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application. It is obvious that the drawings described below are merely some embodiments of this application, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort.

[0017] Figure 1 This is a flowchart illustrating a PLC project description method provided in one embodiment of the present invention;

[0018] Figure 2 This is a schematic diagram of a PLC project description method provided in another embodiment of the present invention;

[0019] Figure 3 This is a schematic diagram of the structure of a PLC project description system provided in one embodiment of the present invention. Detailed Implementation

[0020] To facilitate understanding of this application, a more complete description will be provided below with reference to the accompanying drawings, which illustrate embodiments of the present application. However, the present application can be implemented in many different forms and is not limited to the embodiments described herein. Rather, these embodiments are provided so that the disclosure of this application will be thorough and complete.

[0021] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application.

[0022] The following specific examples illustrate the implementation of the present invention. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that, unless otherwise specified, the following embodiments and features described therein can be combined with each other.

[0023] It should be noted that the illustrations provided in the following embodiments are only schematic representations of the basic concept of the present invention. Therefore, the drawings only show the components related to the present invention and are not drawn according to the actual number, shape and size of the components in the actual implementation. In the actual implementation, the form, quantity and proportion of each component can be arbitrarily changed, and the layout of the components may also be more complex.

[0024] In the following description, numerous details are explored to provide a more thorough explanation of embodiments of the invention. However, it will be apparent to those skilled in the art that embodiments of the invention may be practiced without these specific details. In other embodiments, well-known structures and devices are shown in block diagram form rather than in detail to avoid obscuring embodiments of the invention.

[0025] Example 1

[0026] Please see Figure 1 As shown, a PLC project description method includes:

[0027] Step S110: Describe a PLC project in the development environment using the TOML markup language.

[0028] Step S120: Create corresponding program units, global variable sets, periodic tasks, and devices according to the description of the PLC project, and encapsulate them in the file of the PLC project, or modify the attributes of program units, global variable sets, periodic tasks, or devices in the PLC project file according to the description of the PLC project.

[0029] Step S130: Export the PLC project file.

[0030] The PLC project and its corresponding program units, global variable sets, periodic tasks, and devices are all edited, generated, or modified according to the description format of metadata part + object definition part, and the object definition part defines at least a field representing the operation mode, a field representing the object path, and a field representing the object type.

[0031] Understandably, in order to unify and standardize the format of PLC project files, this embodiment uses BSML (Baosky Markup Language) markup language based on the TOML format as the basis, and realizes a complete description of PLC project objects through structured text. That is, in the IDE development environment, PLC projects and their related objects are edited, generated or modified according to this text description method.

[0032] Specifically, the description format is divided into a metadata section and an object definition section. The metadata section, as the basic configuration layer, defines globally common parameters to ensure the correct generation or modification of PLC project objects within the IDE, ultimately exporting the PLC project as a BSML format file. It also guarantees the consistency and accuracy of BSML file parsing across subsequent cross-system / platform IDEs. Accordingly, the metadata section should include at least the following fields:

[0033] `Strict` (a field indicating whether strict mode is used) is a boolean parameter that controls the mode. Its default value is `false` (non-strict mode). In non-strict mode, default parameters are allowed, reducing configuration complexity. Furthermore, if the `Strict` field value is `true`, all required parameters must be strictly matched, making it suitable for scenarios with extremely high data integrity requirements.

[0034] Version (a field representing the protocol version) serves as a protocol version identifier. It is a string type and uses the format "xx" (e.g., "1.0") to distinguish different versions of the BSML specification, ensuring compatibility between the file parser and the file format.

[0035] Uri (a field representing the root path) can be used as a reference for resolving relative paths to accurately locate the storage location of PLC project objects, which is especially necessary in cross-platform or multi-project collaboration scenarios.

[0036] The object definition section is represented as an array of objects, serving as the core configuration layer describing PLC project objects. Each element of the objects array corresponds to a PLC project object (such as a PLC project, a program unit within a project, a periodic task within a project, etc.), and each object definition follows a unified field structure, while also containing object-specific attribute configurations. Accordingly, the object definition section must contain at least the following fields:

[0037] The Method field (representing the operation mode) can specify the current operation mode. Its corresponding field values ​​include: update (default, updates the properties of the specified object), create (creates a new object), and delete (deletes the specified object), thereby enabling standardized operation control of the entire lifecycle of PLC project objects.

[0038] The URI (a field representing the object's path) serves as a unique path identifier for the current PLC project object. It is formed by concatenating the URI from the metadata section with the relative path of the current object, and can accurately locate the object's position within the PLC project.

[0039] The schema (a field representing the type of an object) serves as the type identifier for the current object. For example, "Project" can represent a PLC project, "Program-unit" can represent a program unit within a PLC project, "Task" can represent a periodic task within a PLC project, and so on. It can clearly define the category attributes of the object being operated on and is an important basis for editing, generating, and parsing files.

[0040] In addition to this, the following fields are also included:

[0041] The index (a field representing the object's index) can be used to locate the return value. In batch operations or multi-object interaction scenarios, the index can be used to quickly associate the operation result with the target object.

[0042] And special fields:

[0043] Context (a field representing the scope of operations) can be used to define the scope of operations. For example, when you need to operate on variables in a PLC project, you can define the value of the Context field as "Variables".

[0044] Fragment (a field representing the selected range) is used to further reduce the granularity of operations based on the scope of operations limited by Context. For example, "[0:2]" means to operate only on the first 3 elements within the scope limited by Context.

[0045] It should be noted that both Context and Fragment are described using KeyPath syntax. KeyPath syntax can define the scope of operation attributes through specific rules, and supports the scope limitation of various data types such as arrays, strings, and multi-line text. Correspondingly, different representations of operation scopes and different representations of selected scopes can be predefined through KeyPath syntax as optional field values ​​for Context and Fragment.

[0046] In one specific embodiment, the KeyPath syntax structure can be referred to as follows:

[0047] Basic components: A KeyPath is composed of Paths, and Paths can contain multiple Paths (separated by commas). A Path consists of "Key", "ArrayPath", sub-Paths connected by ",", and ".", and a StringPath.

[0048] The array range (ArrayPath) is represented in the format "[IndexPair]", while IndexPair is represented as "Index:Index" (Index is an integer, negative numbers are supported, and it is counted starting from 0).

[0049] The string range (StringPath) uses "<IndexPair | LineColumnPair> The format is "" and IndexPair represents a single-line long string, while LineColumnPair represents a multi-line long text.

[0050] For example, "abc" can represent the operation scope as the c attribute within the b sub-attributes of attribute a, thus precisely locating nested attributes; "a[0:9]" can represent the operation scope as the 0th to 8th items of attribute a; "a[1:3]" can represent the operation scope as the 1st to 2nd items of attribute a (array index starts from 0); "a<0:9>" can represent the operation scope as the 0th to 8th characters of attribute a (string); "a <l1c1:l99c99>" can indicate that the operation range is from the 1st row and 1st column of the 'a' attribute to the 99th row and 99th column, etc.

[0051] And some special keys, such as * for all keys ("*" selects all properties of the object), # for keys defined in the protocol (only selects inherent properties of the object), and & for keys defined in the protocol and only adds array elements (avoiding overwriting existing array elements).

[0052] The above examples are for reference only and do not restrict the way different operation ranges and selection ranges are represented.

[0053] It should also be noted that the PLC project object mentioned above does not only refer to the PLC project itself, but can also be the program units, global variable sets, periodic tasks, or devices required for its normal operation. The PLC project and its related program units, global variable sets, periodic tasks, and devices can all be edited, generated, or modified in the IDE according to the above-described format, and the final generated BSML file can be exported.

[0054] In one specific embodiment, assuming a new PLC project needs to be created, see the following:

[0055] Plain Text

[0056] version = "1.0"

[0057] strict = false

[0058] [[objects]]

[0059] method = "create"

[0060] uri = " / NewProject"

[0061] schema = "project"

[0062] name = "New Project"

[0063] author = "Zhang San"

[0064] type = "public"

[0065] description = "This is a newly created PLC project"

[0066] Understandably, the fields in the metadata section are defined according to the attribute information of the IDE development environment. Furthermore, since a new project is being created, the corresponding Method field value is defined as "create," and the Uri can specify a new path location, defined as "NewProject." The Schema field value is also defined as "project," indicating the type (project) of the current object itself. Specific information about the PLC project is then defined in various related fields, such as Name, Author, and Type, all used to describe detailed project information without restriction.

[0067] Accordingly, the IDE can edit and generate a new PLC project based on the above text description.

[0068] In addition, a PLC project is not just an empty shell. In order to maintain its normal operation, it is also necessary to create corresponding program units, global variable sets, periodic tasks, and devices.

[0069] In one specific embodiment, suppose we need to create a program unit named "Calculation". This program unit uses the ST language, is of type function block (FB), and contains input parameters Input and output parameters Output, as well as simple calculation logic, as shown below:

[0070] Plain Text

[0071] version = "1.0"

[0072] strict = false

[0073] [[objects]]

[0074] method = "create"

[0075] uri = " / PLC_1 / SOFTWARE / PROGRAMUNIT / STD.Calculation"

[0076] schema = "program-unit"

[0077] name = "Calculation"

[0078] namespace = "STD"

[0079] language = "ST"

[0080] type = "FB"

[0081] comment = "Calculation function block"

[0082] [objects.body]

[0083] content = "IF Input THEN\nOutput := Input * 2;\nEND_IF;"

[0084] [[objects.itf.input]]

[0085] name = "Input"

[0086] type = "DINT"

[0087] comment = "Enter value"

[0088] [[objects.itf.output]]

[0089] name = "Output"

[0090] type = "DINT"

[0091] comment = "Output value"

[0092] As is understandable, similar to creating a new PLC project, the Method field value is defined as "create", the Uri field value specifies the location within a PLC project, and the Schema field value corresponds to the type of the current object itself, "program-unit". Furthermore, since the program unit name is Calculation, a Name field is defined accordingly, and since ST language is used, a Language field is defined, and so on.

[0093] In addition, since the program unit needs to have simple calculation logic, [objects.body] is added, as well as [[objects.itf.input]] for "input" and [[objects.itf.output]] for "output". These will not be described in detail. The specific attribute information of this program unit can be defined in the corresponding fields.

[0094] In one specific implementation, assuming it is necessary to update the global variable set, the scope needs to be specified through the fields Context and Fragment, as shown below:

[0095] Plain Text

[0096] version = "1.0"

[0097] strict = false

[0098] [[objects]]

[0099] method = "update"

[0100] uri = " / PLC1 / SOFTWARE / GLOBALVARIABLESET / STD.GVS_1"

[0101] schema = "gvs"

[0102] context = "variables"

[0103] fragment = "[0:2]"

[0104] [[objects.variables]]

[0105] name = "Temperature"

[0106] type = "REAL"

[0107] value = "25.0"

[0108] comment = "Temperature value"

[0109] [[objects.variables]]

[0110] name = "Pressure"

[0111] type = "REAL"

[0112] value = "101.3"

[0113] comment = "Pressure value"

[0114] [[objects.variables]]

[0115] name = "FlowRate"

[0116] type = "REAL"

[0117] value = "10.5"

[0118] comment = "Flow rate value"

[0119] Understandably, this operation updates the existing global variable set. The corresponding Method field value is defined as "update", while the Uri field value specifically refers to the location of the original global variable set, which is defined according to the location of the global variable set to be updated. The Schema field value also corresponds to the type "gvs" (global variable set) of the current object itself.

[0120] Furthermore, the Context and Fragment can be defined based on the details of this operation, i.e., the variables array to be updated this time. Correspondingly, the field values ​​of the Context can be defined in advance using the representation defined by the KeyPath syntax. Here, we only use "variables". The number of variables to be updated this time is three, and the corresponding positions are the first three in the variables array. The field value of the Fragment is defined as [0:2], i.e., the representation defined in advance using the KeyPath syntax.

[0121] In addition, each related field is defined according to the range adjustment information of each variable. For example, the range of the temperature element is adjusted to 25, the range of the pressure element is adjusted to 101.3, and the range of the flow element is adjusted to 10.5. These are represented in the manner described in the text above, and will not be elaborated further.

[0122] It should be added that if a new variable is added, the field value of the corresponding Fragment can be defined as &, that is, a new variable is added at the end of the variables array, and the relevant fields are defined according to the specific range information of the new variable.

[0123] In one specific embodiment, suppose we need to create a periodic task named "Cycle_1", and the task type is a periodic loop task with a priority of 10, a periodic time of 20ms, and contains two program units PU_1 and PU_2, as shown below:

[0124] Plain Text

[0125] version = "1.0"

[0126] strict = false

[0127] [[objects]]

[0128] method = "create"

[0129] uri = " / PLC_1 / SOFTWARE / TASK / Cycle_1"

[0130] schema = "task"

[0131] name = "Cycle_1"

[0132] description = "Periodic Task"

[0133] type = 1

[0134] priority = "10"

[0135] cycleTime = "20"

[0136] watchdogTime = "40"

[0137] enableWatchdog = true

[0138] [[objects.prgList]]

[0139] prgName = "STD.PU_1"

[0140] enable = true

[0141] [[objects.prgList]]

[0142] prgName = "STD.PU_2"

[0143] enable = true

[0144] Based on the description provided in this embodiment, more new functions can be extended through the IDE, thereby enriching the content of the PLC project, such as AI-assisted programming and advanced code analysis.

[0145] In one specific embodiment, assuming that a PID control program needs to be automatically generated by a certain program unit, the following can be referred to:

[0146] Plain Text

[0147] version = "1.0"

[0148] strict = false

[0149] [[objects]]

[0150] method = "create"

[0151] uri = " / PLC_1 / SOFTWARE / PROGRAMUNIT / STD.AIPU_1"

[0152] schema = "program-unit"

[0153] name = "AIPU_1"

[0154] namespace = "STD"

[0155] language = "ST"

[0156] type = "PRG"

[0157] comment = "AI-generated control program"

[0158] [objects.body]

[0159] content = " / / AI-generated PID control logic\nError := SetPoint - ProcessValue;\nIntegral := Integral + Error * SampleTime;\nDerivative := (Error -PrevError) / SampleTime;\nOutput := Kp * Error + Ki * Integral + Kd *Derivative;\nPrevError := Error;"

[0160] [[objects.itf.var]]

[0161] name = "SetPoint"

[0162] type = "REAL"

[0163] comment = "Settings"

[0164] [[objects.itf.var]]

[0165] name = "ProcessValue"

[0166] type = "REAL"

[0167] comment = "Process Value"

[0168] [[objects.itf.var]]

[0169] name = "Output"

[0170] type = "REAL"

[0171] comment = "Control output"

[0172] [[objects.itf.temp]]

[0173] name = "Error"

[0174] type = "REAL"

[0175] [[objects.itf.temp]]

[0176] name = "Integral"

[0177] type = "REAL"

[0178] [[objects.itf.temp]]

[0179] name = "Derivative"

[0180] type = "REAL"

[0181] [[objects.itf.temp]]

[0182] name = "PrevError"

[0183] type = "REAL"

[0184] [[objects.itf.temp]]

[0185] name = "Kp"

[0186] type = "REAL"

[0187] value = "1.0"

[0188] [[objects.itf.temp]]

[0189] name = "Ki"

[0190] type = "REAL"

[0191] value = "\\(0.1\\)"

[0192] [[objects.itf.temp]]

[0193] name = "Kd" Note: In the translation, for the "value" field with a value like "0.1", it is more appropriate to write it as "\\(0.1\\)" in a more formal patent text context to clearly distinguish it as a specific value rather than just a simple number. If this is not in line with your specific requirements, please adjust according to the actual situation.

[0194] type = "REAL"

[0195] value = "0.01"

[0196] [[objects.itf.temp]]

[0197] name = "SampleTime"

[0198] type = "REAL"

[0199] value = "0.1"

[0200] Based on the description method described above, when adding a new PLC project, the corresponding program units, global variable sets, periodic tasks, and devices can be generated in the IDE and encapsulated within the PLC project file. Similarly, when modifying the attributes of a PLC project—such as adjusting the calculation logic of program units, adjusting variable ranges, or adding new variables—this method can also be used to edit and modify the PLC project. Finally, the IDE can export the PLC project file for storage, transmission, or version control.

[0201] Building upon this foundation, even in cross-system / platform scenarios—where data exchange between different PLC systems is based on this standardized and unified file format—it facilitates the parsing of PLC project files. This allows the PLC project to be reconstructed based on the object definitions and operation methods within. This approach enables PLC projects to be migrated between different IDEs or switched between different versions, significantly improving project portability and maintainability.

[0202] To address this, this embodiment also provides a PLC project description method, which imports a PLC project file generated and exported in the IDE using the above method to rebuild the PLC project across systems / platforms, such as... Figure 2 As shown, it includes:

[0203] Step S210: Obtain the PLC project file and parse the corresponding description content from it.

[0204] Step S220: Based on the description of the PLC project, rebuild the PLC project in the development environment using the TOML markup language, and create corresponding program units, global variable sets, periodic tasks, and devices, and encapsulate them in the rebuilt PLC project file.

[0205] The PLC project and its corresponding program units, global variable sets, periodic tasks, and devices are all edited and generated according to the description format of metadata part + object definition part, and the object definition part defines at least a field representing the operation mode, a field representing the object path, and a field representing the object type.

[0206] It is understood that the PLC project description method provided in this embodiment can unify and standardize the format of PLC project files, i.e., store or transmit them according to the BSML format. Therefore, even IDEs on different systems / platforms can correctly parse the PLC project file, and thus continue to rebuild the PLC project in the local IDE according to the description method described in the above embodiment; further details will not be provided here.

[0207] It should be noted that the steps of the various methods described above are only for clarity. In practice, they can be combined into one step or some steps can be split into multiple steps. As long as they contain the same logical relationship, they are all within the scope of protection of this patent. Adding insignificant modifications or introducing insignificant designs to the algorithm or process, but without changing the core design of the algorithm and process, are also within the scope of protection of this patent.

[0208] Example 2

[0209] Please see Figure 3 As shown, this application also provides a PLC project description system, including:

[0210] The file import module 10 is used to import the transmitted PLC project file and parse the corresponding description content from it.

[0211] The editing module 20 is used to describe a PLC project in the development environment based on the TOML markup language; and to create corresponding program units, global variable sets, periodic tasks, and devices according to the description of the PLC project, and encapsulate them in the file of the PLC project, or modify the attributes of program units, global variable sets, periodic tasks, or devices in the PLC project file according to the description of the PLC project.

[0212] File export module 30 is used to export the generated PLC project file.

[0213] The PLC project and its corresponding program units, global variable sets, periodic tasks, and devices are all edited, generated, or modified according to the description format of metadata section + object definition section. The object definition section defines at least a field representing the operation mode, a field representing the object path, and a field representing the object type.

[0214] It should be noted that the PLC project description system provided in the above embodiments and the PLC project description method provided in Embodiment 1 belong to the same concept. The specific methods by which each module and unit performs operations have been described in detail in the method embodiments and will not be repeated here. In practical applications, the PLC project description method provided in Embodiment 1 can allocate the above functions to different functional modules as needed, that is, divide the internal structure of the device into different functional modules to complete all or part of the functions described above. This is not a limitation here.

[0215] In summary, this invention provides a unified and standardized method for describing PLC projects, which can fully describe various objects and their attribute relationships in PLC projects, and solves the problem of inconsistent data representation between different PLC systems and different IDEs.

[0216] At the same time, through standardized object descriptions and operation methods, the IDE can more easily extend new features, such as AI-assisted programming and advanced code analysis, without modifying the core code.

[0217] Furthermore, the BSML format file generated by the PLC project description method of this invention is easy to parse and generate, and can support a variety of application scenarios, including but not limited to: interaction between AI systems and IDEs, project import and export, version control and change tracking, code analysis and conversion, batch operations and automated processing.

[0218] The above embodiments are merely illustrative of the principles and effects of the present invention and are not intended to limit the invention. Any person skilled in the art can modify or alter the above embodiments without departing from the spirit and scope of the present invention. Therefore, all equivalent modifications or alterations made by those skilled in the art without departing from the spirit and technical concept disclosed in the present invention should still be covered by the claims of the present invention.

Claims

1. A method of describing a PLC project, characterized by, include: A markup language based on the TOML format is used to describe a PLC project in the development environment; Create corresponding program units, global variable sets, periodic tasks, and devices according to the description of the PLC project, and encapsulate them in the file of the PLC project, or modify the attributes of program units, global variable sets, periodic tasks, or devices in the PLC project file according to the description of the PLC project. Export the files of the PLC project; The PLC project and its corresponding program units, global variable sets, periodic tasks, and devices are all edited, generated, or modified according to the description format of metadata part + object definition part. The object definition part defines at least the fields representing the operation mode, the object path, the object type, the operation range, and the selected range. The system also updates the global variable set in the PLC project using KeyPath syntax, including: pre-defining different operation ranges using KeyPath syntax as field values ​​representing optional operation ranges; and defining different selection ranges using KeyPath syntax as field values ​​representing optional selection ranges. The steps for updating the global variable set in the PLC project using KeyPath syntax include: defining the values ​​of each field in the metadata section based on the development environment's attribute information; defining the field values ​​representing the operation method as updated; defining the field values ​​representing the object path based on the current location of the global variable set to be updated; defining the field values ​​representing the object type based on the description type of the global variable set; obtaining the number of variables to be updated and the range adjustment information for each variable for the variables that need to be updated in the global variable set; defining the field values ​​representing the operation range based on the predefined representation of the global variable set using KeyPath syntax; defining the field values ​​representing the selected range based on the position of the updated variable in the global variable set and its predefined representation using KeyPath syntax; and defining the field values ​​of relevant fields for each variable based on its corresponding range adjustment information.

2. The PLC project description method according to claim 1, characterized in that, The metadata section defines at least a field indicating whether it is in strict mode and a field indicating the protocol version.

3. The PLC project description method according to claim 1, characterized in that, The steps for editing, generating, or modifying the PLC project / program unit / global variable set / periodic task / device include: Define the values ​​of each field in the metadata section based on the attribute information of the development environment; Define the values ​​of each field in the object definition section based on the attribute information of the PLC project / program unit / global variable set / periodic task / equipment, including: The field values ​​representing the operation method are defined as create, update, or delete; The root path of the metadata section is concatenated with the relative path of the current object, and the field value representing the object path is defined based on the concatenated path. Define field values ​​representing object types based on the description type of the PLC project / program unit / global variable set / periodic task / equipment.

4. The PLC project description method according to claim 1, characterized in that, The steps for updating the global variable set in the PLC project using KeyPath syntax include: Define the values ​​of each field in the metadata section based on the attribute information of the development environment; The field value representing the operation method is defined as an update; Define the field value representing the object path based on the current location of the global variable set to be updated as needed; Define field values ​​representing object types based on the description type of the global variable set; For the variables that need to be added to the global variable set, obtain their corresponding range information; Define field values ​​representing the scope of operations based on the predefined representation of the global variable set using the KeyPath syntax; Define the field values ​​representing the selected range based on the predefined representation of the newly added variables using the KeyPath syntax; Define the field values ​​of the relevant fields based on the range information corresponding to the newly added variables.

5. The PLC project description method according to claim 1, characterized in that, The object definition section also defines fields that represent object indexes.

6. A PLC project description method, characterized in that, Import the PLC project file generated and exported by the PLC project description method according to any one of claims 1 to 5; the method includes: Obtain the PLC project file and parse the corresponding description content from it; Based on the description of the PLC project, the PLC project is reconstructed in the development environment using the TOML markup language, and corresponding program units, global variable sets, periodic tasks, and devices are created and encapsulated in the reconstructed PLC project file. The PLC project and its corresponding program units, global variable sets, periodic tasks, and devices are all edited and generated according to the description format of metadata part + object definition part, and the object definition part defines at least a field representing the operation mode, a field representing the object path, and a field representing the object type.

7. A PLC project description system, characterized in that, include: The file import module is used to import the transmitted PLC project files and parse the corresponding description content from them; The editing module is used to describe a PLC project in the development environment based on the TOML markup language; and to create corresponding program units, global variable sets, periodic tasks, and devices according to the description of the PLC project, and encapsulate them in the file of the PLC project, or modify the attributes of program units, global variable sets, periodic tasks, or devices in the PLC project file according to the description of the PLC project. The file export module is used to export the generated PLC project file. The PLC project and its corresponding program units, global variable sets, periodic tasks, and devices are all edited, generated, or modified according to the description format of metadata part + object definition part. The object definition part defines at least the fields representing the operation mode, the object path, the object type, the operation range, and the selected range. The editing module is also used to update the global variable set in the PLC project using KeyPath syntax, including: pre-defining different operation ranges using KeyPath syntax as field values ​​representing optional operation ranges; and defining different selection ranges using KeyPath syntax as field values ​​representing optional selection ranges. The steps for updating the global variable set in the PLC project using KeyPath syntax include: defining the values ​​of each field in the metadata section based on the development environment's attribute information; defining the field values ​​representing the operation method as updated; defining the field values ​​representing the object path based on the current location of the global variable set to be updated; defining the field values ​​representing the object type based on the description type of the global variable set; obtaining the number of variables to be updated and the range adjustment information for each variable for the variables that need to be updated in the global variable set; defining the field values ​​representing the operation range based on the predefined representation of the global variable set using KeyPath syntax; defining the field values ​​representing the selected range based on the position of the updated variable in the global variable set and its predefined representation using KeyPath syntax; and defining the field values ​​of relevant fields for each variable based on its corresponding range adjustment information.