Container-based Edge Device Operation Method, Apparatus, and System
Through cloud collaboration mode and container technology, edge devices receive and compile PLC control programs and generate executable files, solving the problems of multiplexing and dynamic changes caused by PLC program solidification, and improving the efficiency of program file reuse and application convenience of edge devices.
Patent Information
- Application Number
- CN202011190493.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-10-30
- Publication Date
- 2025-07-29
- Estimated Expiration
- 2040-10-30
AI Technical Summary
The PLC programs in existing edge devices are solidified into their devices, and the multiplexing and dynamic changes of PLC programs cannot be achieved, resulting in limited expansion and functional optimization of edge devices.
Adopting cloud collaboration mode, through system containers and application containers, edge devices receive and compile PLC control program files sent by cloud, generate executable files, and run them by executors, supporting multiplexing of the program files in multiple edge devices.
It improves the reuse efficiency and application convenience of PLC programs, and realizes the dynamic changes and functional execution of PLC programs in different edge devices.
Smart Images

Figure CN112269565B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to computer technology, and in particular to a container-based edge device operation method, apparatus, and system. Background Art
[0002] With the advancement of chip performance, technologies such as artificial intelligence (AI) and the Industrial Internet of Things (IIoT) are entering a period of rapid development, supported by hardware. AI and IIoT technologies can be applied to programmable logic controllers (PLCs). When applied to edge devices, these devices can achieve significantly improved execution efficiency.
[0003] However, different edge computing scenarios typically involve different edge devices, as well as different application environments and user requirements. Furthermore, different edge devices have different underlying environments. In existing AI and Industrial IoT applications, customized programming is often used to implement different edge devices and meet different user needs for different edge computing scenarios.
[0004] However, the PLC programs in existing edge devices are fixed in the edge devices, making it impossible to reuse and dynamically change the PLC programs. Summary of the Invention
[0005] The present application provides a container-based edge device operation method, device and system to solve the problem that the PLC program in the existing edge device is solidified in the edge device and the PLC program cannot be reused and dynamically changed.
[0006] In a first aspect, the present application provides a container-based edge device operation method, comprising:
[0007] receiving a program file, wherein the program file includes a control program for the edge device;
[0008] The program file is compiled and executed, and the system container executes the function of the edge device by compiling and executing the program file.
[0009] Optionally, compiling and executing the program file includes:
[0010] Compile the program file using a target compiler, where the target compiler is determined according to the code language of the program file;
[0011] If the program file is compiled correctly, an executable file is generated and the executable file is executed;
[0012] If there is an error in compiling the program file, an error message will be sent.
[0013] Optionally, at least one compiler is included in the system container, and the program file is compiled using a target compiler, where the target compiler is determined according to the code language of the program file, and includes:
[0014] Obtain the code language of the program file;
[0015] Select a target compiler from the compilers in the system container according to the code language;
[0016] Compile the program file using the target compiler.
[0017] Optionally, applied to an edge device, where an application container is included in the edge device, and the method further includes:
[0018] Send a pull request for pulling one or more custom images stored in the cloud;
[0019] According to the pull request, pull the custom image into the application container, and the application container executes the custom image to implement the preset custom function in the custom image.
[0020] Optionally, when the program file or the custom image stored in the cloud changes, the method further includes:
[0021] Obtain a change instruction for updating, adding, or deleting the program file or the custom image in the edge device;
[0022] Change the program file or the custom image according to the change instruction.
[0023] In a second aspect, the present application provides a method for running an edge device based on a container, including:
[0024] Obtain a program file, where the program file is specified to be applied to at least one edge device;
[0025] Execute the edge device of the application according to the program file and send the program file.
[0026] Optionally, the method further includes:
[0027] Obtain a pull request for pulling one or more custom images;
[0028] According to the pull request, send the custom image to the application container of the edge device.
[0029] In a third aspect, the present application provides a device for running an edge device based on a container, including:
[0030] A receiving module, configured to receive a program file, where the program file includes a control program of the edge device;
[0031] An execution module, configured to compile and execute the program file, and the system container executes the functions of the edge device by compiling and executing the program file.
[0032] Optionally, the execution module includes:
[0033] A compilation sub-module, configured to compile the program file using a target compiler, where the target compiler is determined according to the code language of the program file;
[0034] A generation sub-module, configured to generate an executable file if the program file is compiled correctly;
[0035] An execution sub-module, configured to execute the executable file using a target executor, where the target executor is determined according to the extension of the executable file.
[0036] Optionally, the system container includes at least one compiler, and the compilation sub-module is specifically configured to obtain the code language of the program file; select a target compiler from the compilers in the system container according to the code language; and compile the program file using the target compiler.
[0037] Optionally, the system container includes at least one executor, and the execution sub-module is specifically configured to obtain the extension of the executable file; select a target executor from the executors in the system container according to the extension; and execute the executable file using the target executor.
[0038] Optionally, it is applied to an edge device, where the edge device includes an application container, and the device further includes:
[0039] A sending module, configured to send a pull request, where the pull request is used to request to pull one or more custom images, and the custom images are stored in the cloud;
[0040] A pull-down module, configured to pull down the custom images to the application container according to the pull request, and the application container executes the custom images to implement the preset custom functions in the custom images.
[0041] Optionally, when the program file or the custom image stored in the cloud changes, the device further includes:
[0042] An acquisition module, configured to acquire a change instruction, where the change instruction is used to update, add, or delete the program file or the custom image in the edge device;
[0043] A change module, configured to change the program file or the custom image according to the change instruction.
[0044] In a fourth aspect, the present application provides a container-based edge device operation device, including:
[0045] An acquisition module, configured to acquire a program file, where the program file is specified to be applied to at least one edge device;
[0046] A sending module, configured to send the program file according to the edge device on which the application is executed based on the program file.
[0047] Optionally, the device further includes:
[0048] The acquisition module is further configured to acquire a pull request, where the pull request is used to request to pull one or more custom images;
[0049] The sending module is further configured to send the custom image to the application container of the edge device according to the pull request.
[0050] In a fifth aspect, the present application provides a container-based edge device operation system, including: an edge device, a cloud;
[0051] The cloud is configured to store and send a program file and a custom image;
[0052] The edge device is configured to execute the container-based edge device operation method in the first aspect and any possible design of the first aspect.
[0053] The container-based edge device operation method, device, and system provided by the present application, after the cloud acquires the PLC control program, compile the PLC control program into a program file corresponding to the edge device; the cloud sends the program file to the specified edge device according to the edge device to which the program file is specified to be applied; the edge device receives the program file sent by the server to the edge device; the edge device uses the compiler installed in the system container to compile the program file to generate an executable file, and hands it over to the executor for running. The executor runs the program file to execute the function of the edge device, so that the program file does not have to be solidified in a fixed edge device, and the program file can be reused among multiple edge devices through the cloud, improving the reuse efficiency of the program file and the convenience of applying the program file in the edge device. Description of the Drawings
[0054] To more clearly illustrate the technical solutions in the present application or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the drawings in the following description are some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0055] Figure 1 Schematic diagram of the container structure of an edge device provided by an embodiment of the present application;
[0056] Figure 2 Flowchart of a method for operating an edge device based on a container provided by an embodiment of the present application;
[0057] Figure 3 Flowchart of another method for operating an edge device based on a container provided by an embodiment of the present application;
[0058] Figure 4 Flowchart of still another method for operating an edge device based on a container provided by an embodiment of the present application;
[0059] Figure 5 Schematic diagram of the structure of a device for operating an edge device based on a container provided by an embodiment of the present application;
[0060] Figure 6 Schematic diagram of the structure of another device for operating an edge device based on a container provided by an embodiment of the present application;
[0061] Figure 7 Schematic diagram of the structure of still another device for operating an edge device based on a container provided by an embodiment of the present application;
[0062] Figure 8 Schematic diagram of the structure of yet another device for operating an edge device based on a container provided by an embodiment of the present application;
[0063] Figure 9 Schematic diagram of the structure of a system for operating an edge device based on a container provided by an embodiment of the present application;
[0064] Figure 10 Schematic diagram of the container support kernel structure of an edge device provided by an embodiment of the present application. Detailed implementation manners
[0065] To make the objectives, technical solutions, and advantages of this application more clear, the technical solutions in this application will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the embodiments described are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0066] The following specific embodiments are used to describe the technical solution of the present application in detail. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.
[0067] With the improvement of chip performance, technologies such as artificial intelligence and the Industrial Internet of Things (IIoT), supported by hardware, have entered a period of rapid development. AI and IIoT technologies can be applied to PLCs. When applied to edge devices, these technologies can improve their execution efficiency. However, different edge computing scenarios typically involve different edge devices, as well as different application environments and user requirements. These devices also have different underlying environments. Existing AI and IIoT applications often use customized programming to address different edge devices and user needs for different edge computing scenarios. However, the PLC programs in existing edge devices are fixed within the device, often preventing reuse and dynamic changes. With the diversification of application scenarios and the increase in the variety of edge devices, the inability to reuse and dynamically change PLC programs has limited the addition and use of edge devices to the PLC program, making rapid expansion in number or optimization of functionality difficult.
[0068] To address the above issues, this application proposes a container-based edge device operation method, apparatus, and system. This application adopts a cloud-edge collaborative model, with the cloud as the server side and the edge device as the control program and application container operation side. The cloud can be various public clouds or private clouds, such as Alibaba Cloud. The edge device is a PLC device that can perform edge computing, which includes various container engines and container management tools.
[0069] The cloud stores program files and custom images, with custom images stored in an image library. Program files can be compiled by the user using a standard PLC programming language. Alternatively, program files can be pre-written program files uploaded by the user. Custom images can also be image files uploaded by the user with customized functions.
[0070] Among them, the edge device mainly includes a system container and an application container. The edge device can obtain the program file sent by the cloud, compile and execute the program file, and implement the function execution of the edge device. The edge device can also pull down the custom image from the cloud to the application container. The edge device runs the image instance of the custom image in the application container to implement the custom function preset in the custom image.
[0071] Figure 1 FIG. shows a schematic diagram of the container structure of an edge device provided by an embodiment of the present application. As shown in the figure, the edge device may include a system container and an application container.
[0072] Among them, the system container is the built-in default container of the edge device and is the container that comes with the edge device when it leaves the factory. Specifically, the system container may include a compilation and execution container, a data volume container, and a database container. Among them, compilers of different languages are installed in the compilation and execution container. When the edge device receives the program file sent by the cloud, the edge device can determine the compiler corresponding to the program file according to the code language corresponding to the program file, and then compile the program file. For example, when the language corresponding to the program file is C language, the edge device determines that the corresponding compiler is the gcc compiler. A program file transceiver client based on the FTP service is installed in the compilation and execution container, and the client calls the FTP service to receive various PLC control program files distributed from the cloud, such as the.c file in C language. At the same time, the corresponding compiler, such as the gcc compiler corresponding to the C language, is installed in this container. After compilation, the edge device hands the generated executable file to the corresponding executor for running. Among them, the data volume container is responsible for realizing data sharing between multiple containers. A data volume can be provided in the data volume container for other containers to mount. Among them, a database management system, such as the SQLite database management system, etc., is deployed in the database container. The database container can be used to save the data generated by other containers. At the same time, the database container can also be used for the collaborative management of persistent data.
[0073] Among them, the application container is a non-default container. The application container may include multiple custom images. The custom image is an image file pulled down from the cloud by the user through a pull request. The custom image includes a preset custom function. For example, the custom image can be a data cleaning container based on machine learning algorithms, a data transmission container based on the MQTT protocol, etc.
[0074] Figure 2 FIG. shows a flowchart of a method for running an edge device based on a container provided by an embodiment of the present application. On the basis of Figure 1 the embodiment shown, as Figure 2 shown, taking the edge device as the execution subject, the method of this embodiment may include the following steps:
[0075] S101. Obtain a program file, which is specified to be applied to at least one edge device.
[0076] In this embodiment, during the development stage of the PLC control program in the cloud, the user can use the standard PLC programming language through the PLC programming and development platform to design and develop the PLC control program. Since the underlying environments of different edge devices are different and the requirements of different edge devices are also different, different program files are usually applied to different edge devices. When the user designs and develops the PLC control program, the edge device to which the PLC control program is applied is usually specified. Among them, the number of the edge devices is greater than or equal to one.
[0077] After the cloud obtains the PLC control program, it compiles the PLC control program into a program file corresponding to the edge device. Among them, the PLC programming and development platform set in the cloud will check the syntax and semantics of the completed PLC control program and compile it into a language that the edge device can actually run, such as C language or assembly language.
[0078] S102. Execute the applied edge device according to the program file and send the program file.
[0079] In this embodiment, after the cloud obtains the program file, according to the edge device specified by the program file to be applied, the cloud sends the program file to the specified edge device. Among them, the edge device can send the program file in the form of a file through the FTP server.
[0080] S103. Receive the program file, which has the control program of the edge device.
[0081] In this embodiment, the edge device receives the program file sent by the server to the edge device. Among them, the program file is the PLC control program designed and developed by the user through the PLC programming and development platform in the cloud using the standard PLC programming language. Or, the program file is the PLC control program sent to the cloud after the user completes the design and development through the PLC programming and development platform. Since the underlying environments of different edge devices are different and the requirements of different edge devices are also different, different program files are usually applied to different edge devices. That is, when the user designs and develops the PLC control program to generate the program file, the edge device that uses the program file is usually determined correspondingly. The edge device can be one or more edge devices.
[0082] The edge device includes system containers, the system containers include compilation and execution containers, and a program file transceiver client based on the FTP service is installed in the compilation and execution containers. The transceiver client invokes the FTP service to receive various PLC control program files distributed from the cloud. Correspondingly, the cloud also includes an FTP server, and the FPT server is used to send program files to the edge device.
[0083] S104. Compile and execute the program file, and the system container executes the functions of the edge device by compiling and executing the program file.
[0084] In this embodiment, when the FTP receiving client in the compilation and execution container of the edge device receives the program file sent from the cloud, the program file is sent to the compiler of the corresponding language installed in the system container for compilation. If a compilation error occurs, an error message is sent to the cloud. If the compilation is correct, an executable file is generated and handed over to the executor for execution. The executor runs the program file to execute the functions of the edge device.
[0085] In the method for container-based edge device provided by this application, after obtaining the PLC control program, the cloud compiles the PLC control program into a program file corresponding to the edge device. The cloud designates the edge device to which the application corresponds according to the program file, and sends the program file to the designated edge device. The edge device receives the program file sent by the server to the edge device. The edge device uses the compiler installed in the system container to compile the program file, generates an executable file, and hands it over to the executor for execution. The executor runs the program file to execute the functions of the edge device. In this application, the system container of the edge device receives the program file sent from the cloud, so that the program file does not have to be solidified in a fixed edge device, and the program file can be reused in multiple edge devices through the cloud, improving the reuse efficiency of the program file and the convenience of applying the program file in the edge device.
[0086] Figure 3 The flowchart of another method for running a container-based edge device provided by an embodiment of this application is shown. In Figure 1 and Figure 2 Based on the embodiments shown, as Figure 3 shown, taking the edge device as the execution subject, the method of this embodiment may include the following steps:
[0087] S201. Receive the program file, and the program file contains the control program of the edge device.
[0088] Among them, the implementation of step S201 is similar to that of step S103 in Figure 2 the embodiment, and will not be elaborated here in this embodiment.
[0089] S202. Compile the program file using the target compiler, where the target compiler is determined according to the code language of the program file.
[0090] In this embodiment, the code language of the program file may include assembly, C language, etc. After receiving the program file, the transceiver client of the edge device sends the program file to the compilation execution container. The compilation execution container may include at least one compiler. Each compiler is used to compile the program file of a certain code language. This process specifically includes:
[0091] Step 1. Obtain the code language of the program file.
[0092] In this step, the edge device detects the code language used in the program file. Among them, the code language of the program file can be determined according to information such as the suffix name, comment content, and file header of the program file.
[0093] Step 2. Select the target compiler from the compilers in the system container according to the code language.
[0094] In this step, after determining the code language, the edge device determines the target compiler according to the code language. The target compiler is used to compile the program file corresponding to the code language.
[0095] Step 3. Compile the program file using the target compiler.
[0096] S203. If the program file is compiled correctly, generate an executable file and execute the executable file.
[0097] In this embodiment, when the edge device compiles the program file using the target compiler, it may compile successfully or fail. When the target compiler compiles the program file successfully, after completing the compilation, the target compiler generates the executable file of the program file correspondingly. The edge device executes the executable file according to the preset execution instruction.
[0098] S204. If the program file is compiled incorrectly, send an error message.
[0099] In this embodiment, when the target compiler fails to compile the program file, the target compiler generates an error message according to the compilation result. The edge device sends the error message. Among them, the edge device can send the error message to the cloud for backup. Or, the edge device can send the error message to the display device of the edge device to implement an error warning for the edge device. Or, the edge device can also send the error message to a preset address to remind the administrator to pay attention to the error message.
[0100] The method for running an edge device based on a container provided in this application is that the edge device receives a program file sent by the cloud. The edge device selects a target compiler from the compilers of the system container according to the code language of the program file. If the edge device successfully compiles the program file using the target compiler, an executable file is generated. If the edge device fails to compile the program file using the target compiler, an error message is sent. The edge device executes the executable file to implement the execution of the functions of the edge device. In this application, the system container of the edge device receives the program file sent by the cloud, so that the program file does not have to be solidified in a fixed edge device, and the program file can be reused among multiple edge devices through the cloud, improving the reuse efficiency of the program file and the convenience of applying the program file in the edge device.
[0101] Figure 4 The flowchart of still another method for running an edge device based on a container provided in an embodiment of this application is shown. On the basis of the embodiment shown in Figures 1 to 3 As shown in Figure 4 Taking the edge device as the execution subject, the method of this embodiment may include the following steps:
[0102] S301. Send a pull request, where the pull request is used to request to pull one or more custom images stored in the cloud.
[0103] In this embodiment, the edge device sends a pull request to the cloud to request to pull a certain custom image. The pull request includes one or more custom images and the information of the edge device.
[0104] S302. Obtain the pull request, where the pull request is used to request to pull one or more custom images;
[0105] In this embodiment, the cloud obtains the pull request sent by the edge device.
[0106] S303. According to the pull request, send the custom image to the application container of the edge device.
[0107] In this embodiment, the cloud includes an image library that stores at least one custom image. The custom image includes a preset custom function for executing a custom algorithm, such as a data cleaning method based on a machine learning algorithm and a data transmission method based on the MQTT protocol, etc.
[0108] The cloud obtains the custom image from the image library according to the custom image included in the pull request. When the custom image exists in the cloud, the cloud sends the custom image to the edge device. Otherwise, the cloud rejects the pull request.
[0109] S304. According to the pull request, pull the custom image into the application container, and the application container executes the custom image to implement the custom functions preset in the custom image.
[0110] In this embodiment, when the custom image exists in the cloud, the cloud sends the custom image to the edge device. The edge device successfully pulls the custom image. The edge device saves the custom image in the application container. The edge device runs the custom image in the application container to implement the custom functions preset in the custom image.
[0111] S305. Obtain the modification instructions for the program file or the custom image, and the instructions are used to update, add, or delete the program file or the custom image in the cloud.
[0112] In this embodiment, when the user needs to modify the program file or the custom image in the edge device, the user directly modifies the program file or the custom image in the cloud. The user can modify the content in the program file or the custom image, such as modifying the algorithm process, fixing bugs, etc. Or, the user can also delete the program file or the custom image.
[0113] S306. Poll the edge devices and send change instructions to the edge devices that have pulled the program file or the custom image.
[0114] In this embodiment, when the user completes the modification of the program file or the custom image in the cloud, the cloud polls the edge devices connected to it. The cloud sends change instructions to the edge devices that have pulled the program file or the custom image. The change instructions include the change method and the changed program file or custom image.
[0115] S307. Obtain the change instructions, and the change instructions are used to update, add, or delete the program file or the custom image in the edge device.
[0116] In this embodiment, the edge device obtains the change instructions sent by the cloud.
[0117] S308. According to the change instructions, change the program file or the custom image.
[0118] In this embodiment, the edge device changes the program file or the custom image in the edge device according to the change method in the change instructions. For example, when a new reference image is added to the custom image, the edge device adds the new reference image to the application container of the edge device according to the change instructions. When the content in the custom image is modified, the edge device pulls the updated custom image according to the change instructions. When the custom image is deleted, the edge device deletes the custom image in the edge device according to the change instructions.
[0119] In the container-based edge device operation method provided by this application, the edge device sends a pull request to the cloud to request pulling a certain custom image. The cloud obtains the pull request sent by the edge device. The cloud obtains the custom image from the image library according to the custom image included in the pull request. When the custom image exists in the cloud, the cloud sends the custom image to the edge device. Otherwise, the cloud rejects the pull request. The edge device saves the custom image in the application container and runs the custom image in the application container. When the user needs to modify the program file or custom image in the edge device, the user directly modifies the program file or custom image in the cloud. After the user completes the modification of the program file or custom image in the cloud, the cloud polls the edge devices connected to it. The cloud sends a change instruction to the edge device that has pulled the program file or custom image. The edge device obtains the change instruction sent by the cloud. The edge device changes the program file or custom image in the edge device according to the change method in the change instruction. In this application, through the pull request, the repeated use of the cloud custom image is realized, the code reuse rate is improved, the use efficiency of the custom image is improved, and the unnecessary consumption of human resources in the programming process is reduced. This application also realizes the dynamic update of the program file and custom image through the change request.
[0120] Figure 5 The structure diagram of a container-based edge device operation device provided by an embodiment of this application is shown, as Figure 5 shown, the container-based edge device operation device 10 of this embodiment is applied to the edge device and is used to implement the operations corresponding to the edge device in any of the above method embodiments. The container-based edge device operation device 10 of this embodiment includes:
[0121] A receiving module 11, configured to receive a program file, where the program file has a control program of the edge device.
[0122] An execution module 12, configured to compile and execute the program file, and the system container executes the functions of the edge device by compiling and executing the program file.
[0123] The container-based edge device operation device 10 provided by the embodiment of this application can execute the above method embodiment. For the specific implementation principle and technical effect, reference can be made to the above method embodiment, and details are not described herein again.
[0124] Figure 6 The structure diagram of another container-based edge device operation device provided by an embodiment of this application is shown. On the basis of the Figure 5 embodiment shown, as Figure 6As shown, the container-based edge device operating device 10 of this embodiment is applied to an edge device and is used to implement the operations corresponding to the edge device in any of the above method embodiments. The building unit 12 of this embodiment includes:
[0125] A compilation sub-module 121, configured to compile a program file using a target compiler, where the target compiler is determined according to the code language of the program file.
[0126] A generation sub-module 122, configured to generate an executable file and execute the executable file if the program file is compiled correctly.
[0127] A sending sub-module 123, configured to send an error message if the program file fails to compile.
[0128] In one example, the compilation sub-module 121 is specifically configured to obtain the code language of the program file. According to the code language, select a target compiler from the compilers of the system container. Use the target compiler to compile the program file.
[0129] In one example, the execution sub-module 123 is specifically configured to obtain the extension of the executable file. According to the extension, select a target executor from the executors of the system container. Use the target executor to execute the executable file.
[0130] The container-based edge device operating device 10 provided in the embodiments of the present application can execute the above method embodiments. For the specific implementation principle and technical effects, reference can be made to the above method embodiments, and details are not described herein again.
[0131] Figure 7 The structural schematic diagram of yet another container-based edge device operating device provided in an embodiment of the present application is shown. On the basis of the embodiments shown in Figure 5 and Figure 6 as shown in Figure 7 as shown, the container-based edge device operating device 10 of this embodiment is applied to an edge device and is used to implement the operations corresponding to the edge device in any of the above method embodiments. The container-based edge device operating device 10 of this embodiment further includes:
[0132] A sending module 13, configured to send a pull request, where the pull request is used to request to pull one or more custom images, and the custom images are stored in the cloud.
[0133] A pull module 14, configured to pull the custom image into the application container according to the pull request, and the application container executes the custom image to implement the preset custom functions in the custom image.
[0134] An obtaining module 15, configured to obtain a change instruction, where the change instruction is used to update, add, or delete program files or custom images in the edge device.
[0135] A change module 16, configured to change a program file or a custom image according to a change instruction.
[0136] The container-based edge device running device 10 provided in the embodiment of the present application can execute the above method embodiment, and for the specific implementation principle and technical effect, reference can be made to the above method embodiment, which will not be elaborated here in this embodiment.
[0137] Figure 8 The structural schematic diagram of another container-based edge device running device provided in an embodiment of the present application is shown. On the basis of the Figures 5 to 7 shown embodiment, as Figure 8 shown, the container-based edge device running device 20 in this embodiment is applied to the cloud and is used to implement the operations corresponding to the cloud in any of the above method embodiments. The container-based edge device running device 20 in this embodiment includes:
[0138] An obtaining module 21, configured to obtain a program file, where the program file is specified to be applied to at least one edge device;
[0139] A sending module 22, configured to send the program file according to the edge device where the application is executed based on the program file.
[0140] In one example,
[0141] The obtaining module is further configured to obtain a pull request, where the pull request is used to request to pull one or more custom images;
[0142] The sending module is further configured to send the custom image to the application container of the edge device according to the pull request.
[0143] The container-based edge device running device 10 provided in the embodiment of the present application can execute the above method embodiment, and for the specific implementation principle and technical effect, reference can be made to the above method embodiment, which will not be elaborated here in this embodiment.
[0144] Figure 9 The structural schematic diagram of a container-based edge device running system provided in the embodiment of the present application is shown. As Figure 9 shown, the container-based edge device running system 30 in this embodiment may include: an edge device 21 and a cloud 22.
[0145] The cloud 32 is configured to store and send a program file and a custom image.
[0146] The edge device 31 is configured to implement the container-based edge device running method shown in any one of the Figures 1 to 3 embodiments.
[0147] The container support kernel of the edge device 31 can be as follows Figure 10 As shown. To enable edge devices to support the running of real-time control programs, one of the optional solutions is to use a real-time framework, such as the Xenomai framework. The real-time framework is essentially an architecture that provides dual-kernel support for containers in actual use. The dual cores are the high-priority real-time microkernel co-kernel and the system's own non-real-time kernel. When running a real-time control program, the implementation framework will prioritize migrating to the real-time microkernel domain and calling the co-kernel kernel service API. At this time, non-real-time task calls will migrate to the non-real-time domain and call the system kernel service. In the edge device, the real-time PLC program in the system class container runs and calls the real-time microkernel, while the compilation execution container, data volume container, database container, etc. call the system non-real-time kernel. In addition, the application container also calls the system non-real-time kernel.
[0148] The container-based edge device operation system 30 provided in this embodiment can be used to execute the above-mentioned container-based edge device operation method. Its implementation method and technical effects are similar, and this embodiment will not be repeated here.
[0149] The present application also provides a program product, which includes execution instructions stored in an edge device. The edge device can read the execution instructions, and the edge device executes the execution instructions so that the device implements the methods provided in the various embodiments described above.
[0150] The present application also provides a chip comprising a memory and a processor, which is installed in an edge device. The memory is used to store computer programs, and the processor is used to call and execute computer programs from the memory, so that the device equipped with the chip executes the methods in various possible implementations described above.
[0151] It should be understood that the processor may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), or application-specific integrated circuits (ASICs). A general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the present invention may be directly implemented by a hardware processor or implemented by a combination of hardware and software modules in the processor.
[0152] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements on some or all of the technical features. And these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for running edge devices based on containers, characterized in that Applied to an edge device, which includes a system container and an application container, the method includes: Receiving a program file having a control program for the edge device; the program file is obtained by the cloud after obtaining the PLC control program and compiling the PLC control program into a program file corresponding to the edge device; Compiling and executing the program file, and the system container executes the functions of the edge device by compiling and executing the program file; Sending a pull request for pulling down one or more custom images stored in the cloud; Pulling down the custom image to the application container according to the pull request, and the application container executes the custom image to implement the preset custom functions in the custom image; The compiling and executing the program file includes: Compiling the program file using a target compiler determined according to the code language of the program file; if the program file is compiled correctly, an executable file is generated and the executable file is executed; if the program file is compiled incorrectly, an error message is sent; The system container includes at least one compiler, and the compiling the program file using a target compiler determined according to the code language of the program file includes: Obtaining the code language of the program file; selecting a target compiler from the compilers in the system container according to the code language; and compiling the program file using the target compiler; When the program file or the custom image stored in the cloud changes, the method further includes: Obtaining a change instruction for updating, adding or deleting the program file or the custom image in the edge device; and changing the program file or the custom image according to the change instruction.
2. A method for running edge devices based on containers, characterized in that, Applied to the cloud, the method includes: Obtaining a program file specified for application to at least one edge device; the program file is obtained by the cloud after obtaining the PLC control program and compiling the PLC control program into a program file corresponding to the edge device; the system container includes at least one compiler, and the program file is compiled and executed by the following method: obtaining the code language of the program file; selecting a target compiler from the compilers in the system container according to the code language; compiling the program file using the target compiler; if the program file is compiled correctly, an executable file is generated and the executable file is executed; if the program file is compiled incorrectly, an error message is sent; Executing the edge device of the application according to the program file and sending the program file; Obtain a pull request for pulling one or more custom images; when the program file or the custom image stored in the cloud changes, obtain a change instruction for updating, adding, or deleting the program file or the custom image in the edge device; according to the change instruction, change the program file or the custom image. According to the pull request, send the custom image to the application container of the edge device.
3. A container-based edge device operating apparatus, characterized in that, Applied to an edge device, which includes a system container and an application container, the device includes: A receiving module for receiving a program file having a control program of the edge device; the program file is obtained by the cloud after obtaining the PLC control program and compiling the PLC control program into a program file corresponding to the edge device. An execution module for compiling and executing the program file, and the system container executes the functions of the edge device by compiling and executing the program file. A sending module for sending a pull request for requesting to pull one or more custom images, and the custom images are stored in the cloud. A pulling module for pulling the custom image into the application container according to the pull request, and the application container executes the custom image to implement the preset custom functions in the custom image. The execution module is specifically configured to compile the program file using a target compiler determined according to the code language of the program file; if the program file is compiled correctly, generate an executable file and execute the executable file; if the program file is compiled incorrectly, send an error message. The system container includes at least one compiler, and the execution module is specifically configured to obtain the code language of the program file; select a target compiler from the compilers in the system container according to the code language; use the target compiler to compile the program file. An obtaining module for obtaining a change instruction for updating, adding, or deleting the program file or the custom image in the edge device. A changing module for changing the program file or the custom image according to the change instruction.
4. A container-based edge device operating apparatus, characterized in that, Applied to the cloud, the device includes: An obtaining module for obtaining a program file specified for application to at least one edge device; the program file is obtained by the cloud after obtaining the PLC control program and compiling the PLC control program into a program file corresponding to the edge device; the system container includes at least one compiler, and the program file is compiled and executed by the following method: obtain the code language of the program file; select a target compiler from the compilers in the system container according to the code language; use the target compiler to compile the program file; if the program file is compiled correctly, generate an executable file and execute the executable file; if the program file is compiled incorrectly, send an error message. A sending module, configured to execute an edge device of an application according to the program file and send the program file; The obtaining module is further configured to obtain a pull request for pulling one or more custom images; when the program file or the custom image stored in the cloud changes, obtain a change instruction for updating, adding, or deleting the program file or the custom image in the edge device; and change the program file or the custom image according to the change instruction; The sending module is further configured to send the custom image to an application container of the edge device according to the pull request.
5. A container-based edge device operating system, characterized in that, The system includes: an edge device and a cloud; The cloud is configured to store and send a program file and a custom image; The edge device is configured to implement the container-based edge device operation method according to claim 1 or 2.
6. A program product, which includes execution instructions stored in an edge device, and the edge device executes the execution instructions to cause the device to implement the container-based edge device operation method according to claim 1 or 2.
Citation Information
Patent Citations
Application program update method of mobile terminal, server and client
CN104063239A
Docker container-based multi-environment compiling system and docker container-based multi-environment compiling method
CN111008016A
Edge computing-oriented container mirror image construction method
CN111324360A