Method and apparatus for generating composite function block, electronic device, and storage medium
By using the code generator to generate composite function blocks in controller application engineering, the problem of creating composite function blocks is solved, and the function of publishing composite function blocks is realized without exposing design details, supporting low-code engineering and Reduce dependence on basic functional blocks.
Patent Information
- Application Number
- PCT/CN2023/110338
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2023-07-31
- Publication Date
- 2025-02-06
AI Technical Summary
In controller application engineering, prior art is difficult to create composite function blocks without writing code, and controller suppliers want to publish composite function blocks to customers without exposing their design details.
By determining the function to be implemented, the appearance of the composite function block and the connection relationship between the basic function blocks, the code generator is used to generate the code of the composite function block, and the low-code method is used to generate the composite function block, and the internal basic function blocks are hidden when publishing. information.
It realizes the generation and release of composite function blocks without exposing design details. Users can use composite function blocks for low-code engineering without writing code, and the generated composite function blocks do not depend on the update of the basic function blocks.
Smart Images

Figure CN2023110338_06022025_PF_FP_ABST
Abstract
Description
Method, device, electronic device and storage medium for generating composite function block Technical Field
[0001] The present disclosure generally relates to the field of controller application engineering technology, and more particularly, to a method, apparatus, electronic device, and storage medium for generating a composite function block. Background Art
[0002] For controller application engineering, rich function blocks provide programmers with more possibilities and higher efficiency. Creating composite function blocks with higher complexity to help speed up application engineering is a very important topic, especially without writing any code.
[0003] Furthermore, in some cases, the controller vendor wants to release composite function blocks to customers without exposing the details or source code. This means, for example, that the controller vendor creates composite function block C based on basic function blocks A and B, but when C is released to the customer, the customer should not know which basic function blocks are used and how they are connected.
[0004] In current low-code programming methods for creating function blocks, development tools provide methods for creating function block layouts. However, if programmers want complete freedom to define new function blocks, they still need to write some code to implement the logic within the function block or obtain source code from the tool provider.
[0005] Summary of the Invention
[0006] A brief overview of the present invention is provided below to provide a basic understanding of certain aspects of the present invention. It should be understood that this overview is not an exhaustive overview of the present invention. It is not intended to identify key or important aspects of the present invention, nor is it intended to limit the scope of the present invention. Its purpose is simply to present certain concepts in a simplified form as a prelude to the more detailed description discussed later.
[0007] In view of this, the present disclosure provides a method for generating composite function blocks, which generates composite function blocks using existing basic function blocks in a low-code manner, and publishes the composite function blocks without exposing design details, so that end customers can use the composite function blocks to implement low-code projects.
[0008] According to one aspect of the present disclosure, there is provided a method for generating a composite function block, comprising:
[0009] Determine the basic function blocks to be used by the composite function block according to the functions to be realized;
[0010] determining an appearance of a composite function block, the appearance including inputs and outputs of the composite function block;
[0011] Implementing internal logic between the composite function blocks by determining the connection relationship between the input / output of the basic function block and the input / output of the composite function block;
[0012] Running a code generator for each basic function block to generate a code for each basic function block; and
[0013] A code generator for generating the composite function block based on the codes of the basic function blocks and according to the connection relationship between the basic function blocks.
[0014] In this way, the existing basic function blocks are used to generate composite function blocks, and the code generator of the existing basic function blocks can be reused. The connection relationship between the internal basic function blocks is implicit in the code generator instead of being exposed in a graphical way.
[0015] Optionally, in an example of the above aspect, determining the appearance of the composite functional block includes:
[0016] Determine the required input and output variables in sequence during the implementation of the internal logic between the composite function blocks, or
[0017] All input and output variables are determined in advance.
[0018] In this way, different methods can be selected to determine input and output variables according to needs.
[0019] Optionally, in an example of the above aspect, the determined input and output variables include variable names and data types of the variables.
[0020] Optionally, in an example of the above aspect, after running the code generators of the basic function blocks to generate the codes of the basic function blocks, the method further includes:
[0021] Modify the code generator of the basic function block as needed.
[0022] In this way, the code generator of the basic function block can be retained, and the code generator of the basic function block can also be modified according to user needs.
[0023] Optionally, in an example of the above aspect, the method further includes:
[0024] The generated composite function block appearance and code generator are published to the end user.
[0025] In this way, end users can use the published composite function blocks, see the input / output of the composite function blocks, and generate code, but they cannot know which basic function blocks are inside.
[0026] According to another aspect of the present disclosure, there is provided an apparatus for generating a composite function block, comprising:
[0027] a basic function block determining unit configured to determine a basic function block to be adopted by a composite function block according to a function to be implemented;
[0028] an appearance determining unit configured to determine an appearance of a composite function block, the appearance including an input and an output of the composite function block;
[0029] an internal logic implementation unit configured to implement internal logic between the composite function blocks by determining a connection relationship between the input / output of the basic function block and the input / output of the composite function block; and
[0030] An execution unit, configured to execute a code generator of each basic function block to generate a code of each basic function block;
[0031] The code generator generating unit is configured to generate a code generator for the composite function block according to the connection relationship between the basic function blocks.
[0032] According to another aspect of the present disclosure, an electronic device is provided, comprising: at least one processor; and a memory coupled to the at least one processor, the memory being used to store instructions that, when executed by the at least one processor, enable the processor to execute the method described above.
[0033] According to another aspect of the present disclosure, a non-transitory machine-readable storage medium is provided, which stores executable instructions. When the instructions are executed, the machine is caused to perform the method described above.
[0034] According to another aspect of the present disclosure, a computer program product is provided, which is tangibly stored on a computer-readable medium and includes computer-executable instructions that, when executed, cause at least one processor to perform the method described above.
[0035] According to the method and apparatus disclosed herein, the generated composite functional block has no dependency on the basic functional block used. If the basic functional block is updated, the generated synthetic functional block will not be affected. The user does not need to write any code, and the possibility of modification can be retained if the user needs. When the synthetic functional block is released, the source code or design details will not be exposed to the end user. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] The above and other purposes, features and advantages of the present invention will be more easily understood by referring to the following description of the embodiments of the present invention in conjunction with the accompanying drawings. The components in the accompanying drawings are only for illustrating the principles of the present invention. In the accompanying drawings, the same or similar technical features or components will be represented by the same or similar reference numerals. In the accompanying drawings:
[0037] 1 is a flow chart of an exemplary process of a method for generating a composite function block according to an embodiment of the present invention;
[0038] FIG2 is a block diagram illustrating an exemplary configuration of an apparatus for generating a composite function block according to another embodiment of the present disclosure;
[0039] FIG3 shows a block diagram of an electronic device according to an embodiment of the present disclosure.
[0040] The reference numerals are as follows: 100: Method for generating a composite function block S102, S104, S106, S108, S109, S110, S112: Steps 200: Apparatus for generating a composite function block 202: Basic function block determination unit 204: Appearance determination unit 206: Internal logic implementation unit 208: Execution unit 210: Code generator generation unit 209: Code modification unit 212: Publishing unit 300: Electronic device 302: Processor 304: Memory DETAILED DESCRIPTION
[0041] The subject matter described herein will now be discussed with reference to example embodiments. It should be understood that discussing these embodiments is intended only to enable those skilled in the art to better understand and implement the subject matter described herein, and is not intended to limit the scope of protection, applicability, or examples set forth in the claims. The functions and arrangements of the elements discussed may be changed without departing from the scope of protection of this disclosure. Various examples may omit, replace, or add various processes or components as needed. For example, the described method may be performed in an order different from the described order, and various steps may be added, omitted, or combined. In addition, features described relative to some examples may also be combined in other examples.
[0042] As used herein, the term "including" and its variations are open terms meaning "including but not limited to". The term "based on" means "based at least in part on". The terms "one embodiment" and "an embodiment" mean "at least one embodiment". The term "another embodiment" means "at least one other embodiment". The terms "first", "second", etc. may refer to different or the same objects. Other definitions may be included below, whether explicit or implicit. Unless the context clearly indicates otherwise, the definition of a term is consistent throughout the specification.
[0043] In view of this, the present disclosure provides a method for generating composite function blocks, which generates composite function blocks using existing basic function blocks in a low-code manner, and publishes the composite function blocks without exposing design details, so that end customers can use the composite function blocks to implement low-code projects.
[0044] First, some basic concepts commonly used in controller application engineering are introduced.
[0045] Functional blocks in low-code engineering tools generally include two main elements:
[0046] Layout - defines the inputs and outputs of function blocks
[0047] Internal logic - defines the relationship between outputs and inputs
[0048] Basic function blocks cannot be separated, while composite function blocks are composed of basic function blocks.
[0049] The code generator is a software component that converts low-code function blocks into text code and then into binary code. Each function block has its own code generator.
[0050] The method and apparatus for generating a composite function block according to an embodiment of the present disclosure will be described below with reference to the accompanying drawings.
[0051] FIG. 1 is a flowchart of an exemplary process of a method 100 for generating a composite function block according to an embodiment of the present invention.
[0052] First, in block S102 , the basic function blocks to be adopted by the composite function block are determined according to the functions to be implemented.
[0053] The composite function block is composed of basic function blocks. According to the functions to be implemented by the composite function block, appropriate basic function blocks can be selected.
[0054] Next, in block S104 , the appearance of the composite function block is determined, where the appearance includes the input and output of the composite function block.
[0055] In the operation of block S104 , the input and output variables of the composite function block are defined.
[0056] In an optional embodiment, a new input or output variable can be manually created and named as needed during the execution of the following S106. The input or output variable is regarded as an external interface of the composite function block, and its data type is automatically determined by the connected function block.
[0057] In another optional embodiment, before executing the following step S106 , all input and output variables of the composite function block may be predetermined, and the name and data type of each input or output variable may be determined. Specifically, the definition may be through a user interface table.
[0058] These input / output variables are used to store and exchange data between internal basic function blocks and external function blocks.
[0059] In block S106 , the internal logic between the composite function blocks is implemented by determining the connection relationship between the input / output of the basic function block and the input / output of the composite function block.
[0060] Next, in block S108 , the code generators of the respective basic function blocks are run to generate codes for the respective basic function blocks.
[0061] Optionally, based on the generated text code, in block S109 , the code generator of the basic function block may be modified as needed.
[0062] In block S110 , based on the codes of the basic function blocks, a code generator for the composite function block may be generated according to the connection relationship between the basic function blocks.
[0063] In this way, the complete source code of each basic function block is integrated into the composite function block. After the code generator of the composite function block is generated, the composite function block will no longer depend on the basic function blocks used.
[0064] Through the above steps, the appearance and code generator of the composite function block can be determined, thus obtaining a new composite function block.
[0065] Preferably, in block S112 , the appearance and code generator of the generated composite function block may be published to the end user.
[0066] When this composite function block is released, information about the basic function blocks used and how they are connected is completely hidden. The composite function block becomes a new basic function block. The code generator not only generates the target code for the function block but also obfuscates the code, making it difficult for users to understand. If the code generator were provided as binary code, end users would have no idea what the new function block contains.
[0067] In this way, end users can use the published composite function blocks, see the input / output of the composite function blocks, and generate code, but they cannot know which basic function blocks are inside.
[0068] Compared to the prior art, the method disclosed herein utilizes existing basic function blocks to generate composite function blocks, allowing the reuse of existing code generators for basic function blocks. The internal connections between basic function blocks are implicitly embedded in the code generators, rather than being exposed graphically. The code generators for basic function blocks can be retained or modified as needed.
[0069] The generated composite function block has no dependency on the basic function block used. If the basic function block is updated, the generated composite function block will not be affected.
[0070] The user does not need to write any code, and the possibility of modification is retained if the user needs.
[0071] When releasing synthesized functional blocks, neither source code nor design details are exposed to end users.
[0072] FIG2 is a block diagram illustrating an exemplary configuration of an apparatus 200 for generating a composite function block according to another embodiment of the present disclosure.
[0073] The apparatus 200 for generating a composite function block according to an embodiment of the present disclosure includes: a basic function block determining unit 202 , an appearance determining unit 204 , an internal logic implementing unit 206 , an operating unit 208 , and a code generator generating unit 210 .
[0074] The basic function block determining unit 202 is configured to determine the basic function blocks to be adopted by the composite function block according to the function to be implemented.
[0075] The appearance determination unit 204 is configured to determine the appearance of the composite function block, where the appearance includes the input and output of the composite function block.
[0076] The internal logic implementation unit 206 is configured to implement the internal logic between the composite function blocks by determining the connection relationship between the input / output of the basic function block and the input / output of the composite function block; and
[0077] The execution unit 208 is configured to execute the code generator of each basic function block to generate the code of each basic function block;
[0078] The code generator generating unit 210 is configured to generate a code generator for the composite function block according to the connection relationship between the basic function blocks.
[0079] Preferably, the appearance determination unit 204 is further configured to: determine the required input and output variables in sequence during the process of implementing the internal logic between the composite function blocks, or
[0080] All input and output variables are determined in advance.
[0081] Specifically, the determined input and output variables include variable names and variable data types.
[0082] Optionally, the apparatus 200 for generating a composite functional block may further include a code modifying unit 209 configured to modify the code generator of the basic functional block as needed.
[0083] Preferably, the apparatus 200 for generating a composite function block may further include a publishing unit 212 configured to publish the appearance and code generator of the generated composite function block to an end user.
[0084] The details of the operations and functions of the various parts of the device 200 for generating a composite functional block may be the same as or similar to the relevant parts of the embodiment of the method 100 for generating a composite functional block of the present disclosure described in conjunction with FIG. 1 , and will not be described in detail here.
[0085] It should be noted that the structure of the apparatus 200 for generating a composite functional block and its constituent units shown in FIG2 is merely exemplary, and those skilled in the art may modify the structural block diagram shown in FIG2 as needed.
[0086] The method and apparatus according to the embodiments of the present disclosure are described above with reference to Figures 1 and 2. Each unit of the apparatus for generating a composite function block described above can be implemented using hardware, software, or a combination of hardware and software.
[0087] 3 shows a block diagram of an electronic device 300 according to an embodiment of the present disclosure. According to one embodiment, the electronic device 300 may include at least one processor 302 that executes at least one computer-readable instruction stored or encoded in a computer-readable storage medium (ie, memory 304).
[0088] It should be understood that the computer executable instructions stored in the memory 304, when executed, cause the at least one processor 602 to perform the various operations and functions described above in conjunction with Figures 1-2 in various embodiments of the present disclosure.
[0089] According to one embodiment, a non-transitory machine-readable medium is provided. The non-transitory machine-readable medium may have machine-executable instructions, which, when executed by a machine, enable the machine to perform various operations and functions described above in conjunction with FIG. 1-2 in various embodiments of the present disclosure.
[0090] According to one embodiment, a computer program is provided, including computer-executable instructions, which, when executed, enable at least one processor to perform the various operations and functions described above in conjunction with Figures 1-2 in various embodiments of the present disclosure.
[0091] According to one embodiment, a computer program product is provided, including computer-executable instructions, which, when executed, enable at least one processor to perform the various operations and functions described above in conjunction with FIG. 1-2 in various embodiments of the present disclosure.
[0092] It should be understood that the various embodiments in this specification are described in a progressive manner, and reference can be made to the identical or similar parts of the various embodiments. Each embodiment focuses on the differences from the other embodiments. For example, the aforementioned apparatus embodiments, electronic device embodiments, and machine-readable storage medium embodiments are generally similar to the method embodiments, so their descriptions are relatively simple. For relevant details, reference can be made to the descriptions of the method embodiments.
[0093] The foregoing description of this specification describes specific embodiments. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be performed in an order different from that described in the embodiments and still achieve the desired results. Furthermore, the processes depicted in the accompanying drawings do not necessarily require the specific order shown or the sequential order to achieve the desired results. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0094] Not all steps and units in the above processes and system structure diagrams are required, and some steps or units may be omitted according to actual needs. The device structures described in the above embodiments can be physical structures or logical structures, that is, some units may be implemented by the same physical entity, or some units may be implemented by multiple physical entities, or may be implemented by certain components in multiple independent devices.
[0095] The specific embodiments described above in conjunction with the accompanying drawings describe exemplary embodiments, but do not represent all embodiments that can be implemented or fall within the scope of protection of the claims. The term "exemplary" used throughout this specification means "used as an example, instance or illustration" and does not mean "preferred" or "having advantages" over other embodiments. For the purpose of providing an understanding of the described technology, the specific embodiments include specific details. However, these technologies can be implemented without these specific details. In some instances, in order to avoid obscuring the concepts of the described embodiments, well-known structures and devices are shown in block diagram form.
[0096] The foregoing description of the present disclosure is provided to enable any person skilled in the art to implement or use the present disclosure. Various modifications to the present disclosure will be readily apparent to those skilled in the art, and the general principles defined herein may be applied to other variations without departing from the scope of the present disclosure. Therefore, the present disclosure is not limited to the examples and designs described herein, but is intended to be consistent with the widest range of principles and novel features disclosed herein.
[0097] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
[0098] Nouns and pronouns referring to persons in this patent application are not limited to a specific gender.
Claims
1. A method (100) for generating a composite function block, comprising: Determine the basic function block to be adopted by the composite function block according to the function to be realized (S102); Determining the appearance of the composite function block (S104), the appearance including the input and output of the composite function block; Implementing the internal logic between the composite function blocks by determining the connection relationship between the input / output of the basic function block and the input / output of the composite function block (S106); Running the code generator of each basic function block to generate the code of each basic function block (S108); and Based on the codes of the basic function blocks, a code generator for the composite function block is generated according to the connection relationship between the basic function blocks (S110).
2. The method (100) of claim 1, wherein: Determining the appearance of a composite function block includes: Determine the required input and output variables in sequence during the process of implementing the internal logic between the composite function blocks, or Determine all input and output variables in advance.
3. The method (100) of claim 2, wherein: The input and output variables determined include variable names and data types of the variables.
4. The method (100) according to any one of claims 1 to 3, wherein: After running the code generators of the basic function blocks to generate the codes of the basic function blocks, the method further includes: The code generator of the basic function block is modified as needed (S109).
5. The method (100) of claim 4, further comprising: The generated appearance and code generator of the composite function block are published to the end user (S112).
6. An apparatus (200) for generating a composite function block, comprising: A basic function block determination unit (202) is configured to determine a basic function block to be used by a composite function block according to a function to be implemented; An appearance determination unit (204) is configured to determine an appearance of a composite function block, the appearance including an input and an output of the composite function block; An internal logic implementation unit (206) configured to implement the internal logic between the composite function blocks by determining the connection relationship between the input / output of the basic function block and the input / output of the composite function block; as well as An operating unit (208), configured to operate a code generator of each basic function block to generate a code of each basic function block; A code generator generating unit (210) is configured to generate a code generator for the composite function block according to the connection relationship between the basic function blocks.
7. An electronic device (300), comprising: at least one processor (302); as well as A memory (304) coupled to the at least one processor (302), the memory being used to store instructions, which, when executed by the at least one processor (302), causes the processor (302) to perform the method according to any one of claims 1 to 5.
8. A non-transitory machine-readable storage medium storing executable instructions, which, when executed, cause the machine to perform the method according to any one of claims 1 to 5.
9. A computer program product tangibly stored on a computer readable medium and comprising computer executable instructions which, when executed, cause at least one processor to perform the method according to any one of claims 1 to 5.
Citation Information
Patent Citations
System, method and device for automatically generating program according to function block diagram
CN110147226A
Function block framework generation
CN111580789A
Code display method, system and device for graphical programming scene and storage medium
CN112306481A
Function block framework generation
US20200210154A1