Dynamic memory allocation method and device for programmable logic controller and electronic equipment
By detecting device connection information in the PLC and sending it to the cloud platform to determine memory requirements, dynamically allocating PLC memory space, the problem of insufficient or excessive pre-allocated memory is solved, and memory utilization and device compatibility are improved.
Patent Information
- Application Number
- CN202411668909.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-20
- Publication Date
- 2025-02-25
AI Technical Summary
In the industrial Internet of Things, the preallocated memory space of the programmable logic controller (PLC) ports is insufficient or too large, resulting in device access failure or wasted memory space.
When the detection device is connected to the PLC, the connection information of each port is obtained and sent to the cloud platform. The cloud platform determines the memory space required for each port based on the connection information and generates a memory allocation configuration file. After the PLC receives the configuration file, it dynamically allocates memory to match the device requirements.
It realizes dynamic allocation of PLC memory space according to device needs, improves memory space utilization, reduces device connection failure and memory waste, and enhances compatibility and interconnection capabilities for different devices.
Smart Images

Figure CN119512758A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of Internet of Things, and in particular to a method, device and electronic device for dynamically allocating memory of a programmable logic controller. Background Art
[0002] In the Industrial Internet of Things, various devices and sensors on industrial sites need to be connected to the network through various communication interfaces to achieve interconnection.
[0003] In the cloud-edge collaborative architecture, on-site devices need to be connected to the programmable logic controller first. The programmable logic controller will allocate fixed memory space to the port connected to the device to process operations related to the connected device.
[0004] However, in actual applications, when a port of a programmable logic controller is connected to a large number of devices, its pre-allocated memory space is insufficient, which will cause device access failure. Alternatively, a port of the programmable logic controller is not connected to a device but occupies a large amount of memory space, resulting in a waste of memory space. Summary of the invention
[0005] The embodiments of the present application provide a method, device and electronic device for dynamically allocating memory of a programmable logic controller, so as to achieve the effect of allocating memory space of a programmable logic controller according to device requirements and improving the utilization rate of the memory space of the programmable logic controller.
[0006] In a first aspect, an embodiment of the present application provides a method for dynamically allocating memory of a programmable logic controller, comprising:
[0007] In response to detecting that a device is connected to a programmable logic controller, obtaining connection information between a plurality of ports of the programmable logic controller and the device respectively;
[0008] Sending the connection information corresponding to each of the multiple ports to the cloud platform; wherein the cloud platform determines the memory space size required for each port according to the connection information corresponding to each of the multiple ports, and generates a memory allocation configuration file including the memory space size required for each port;
[0009] Receive the memory allocation configuration file sent by the cloud platform, and allocate memory to each of the ports according to the memory allocation configuration file.
[0010] In a possible implementation manner, the cloud platform determines the size of the memory space required for each port according to the connection information corresponding to each of the multiple ports, including:
[0011] If the connection information corresponding to the first port indicates connection with the device, determining the corresponding target protocol file according to the device type of the device; the target protocol file includes mapping relationships between multiple ports and memory space sizes respectively; the first port belongs to multiple ports of the programmable logic controller;
[0012] The size of the memory space required by the first port is determined according to the mapping relationship in the target protocol file.
[0013] In a possible implementation manner, different device types correspond to different target protocol files.
[0014] In a possible implementation manner, the cloud platform determines the size of the memory space required for each port according to the connection information corresponding to each of the multiple ports, including:
[0015] If the connection information corresponding to the second port indicates that it is not connected to the device, a preset memory space size is set for the second port; wherein the second port belongs to multiple ports of the programmable logic controller.
[0016] In a possible implementation, the method further includes:
[0017] Receive the interconnection program sent by the cloud platform, and realize communication with the device according to the interconnection program.
[0018] In a possible implementation, the cloud platform generates the interconnection program based on the following steps:
[0019] Obtaining a program compiler corresponding to the programmable logic controller;
[0020] The program compiler is used to link and compile the communication protocol corresponding to the device type of the device to obtain the interconnection program.
[0021] In a second aspect, an embodiment of the present application provides a programmable logic controller memory dynamic allocation device, comprising:
[0022] an acquiring unit, configured to acquire connection information between a plurality of ports of the programmable logic controller and the device respectively in response to detecting that the device is connected to the programmable logic controller;
[0023] A sending unit, configured to send the connection information corresponding to each of the multiple ports to a cloud platform; wherein the cloud platform determines the size of the memory space required for each port according to the connection information corresponding to each of the multiple ports, and generates a memory allocation configuration file including the size of the memory space required for each port;
[0024] The processing unit is used to receive the memory allocation configuration file sent by the cloud platform, and allocate memory to each of the ports according to the memory allocation configuration file.
[0025] In a possible implementation manner, the sending unit includes:
[0026] A first determination module is used to determine a corresponding target protocol file according to a device type of the device if the connection information corresponding to the first port indicates that the device is connected; the target protocol file includes a mapping relationship between a plurality of ports and a memory space size respectively; the first port belongs to a plurality of ports of the programmable logic controller;
[0027] The second determining module is used to determine the memory space size required by the first port according to the mapping relationship in the target protocol file.
[0028] In a possible implementation manner, different device types correspond to different target protocol files.
[0029] In a possible implementation manner, the sending unit includes:
[0030] A setting module is used to set a preset memory space size for the second port if the connection information corresponding to the second port indicates that it is not connected to the device; wherein the second port belongs to multiple ports of the programmable logic controller.
[0031] In a possible implementation, the device further includes:
[0032] The receiving unit is used to receive the interconnection program sent by the cloud platform and realize communication with the device according to the interconnection program.
[0033] In a possible implementation, the cloud platform generates the interconnection program based on the following steps:
[0034] Obtaining a program compiler corresponding to the programmable logic controller;
[0035] The program compiler is used to link and compile the communication protocol corresponding to the device type of the device to obtain the interconnection program.
[0036] In a third aspect, an embodiment of the present application provides an electronic device, including: a memory, a processor;
[0037] The memory stores computer-executable instructions;
[0038] The processor executes the computer-executable instructions stored in the memory, so that the processor executes the above first aspect and / or various possible implementations of the first aspect.
[0039] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement the first aspect above and / or various possible implementations of the first aspect.
[0040] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the above first aspect and / or various possible implementation methods of the first aspect.
[0041] The present application provides a method, device and electronic device for dynamically allocating memory of a programmable logic controller. The method obtains connection information between a device and a port of a programmable logic controller, sends the connection information to a cloud platform, and allocates memory size to the port according to a memory allocation configuration file sent by the cloud platform based on the connection information, thereby allocating memory space of the programmable logic controller according to demand, improving memory space utilization, and also improving compatibility with different devices and enhancing interconnection between different devices. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0043] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0044] Figure 1 A schematic diagram of a scenario of a programmable logic controller memory dynamic allocation method provided in this application;
[0045] Figure 2 A schematic diagram of a programmable logic controller memory dynamic allocation method provided in this application Figure 1 ;
[0046] Figure 3 A schematic diagram of a programmable logic controller memory dynamic allocation method provided in this application Figure 2 ;
[0047] Figure 4 A schematic diagram of the structure of a programmable logic controller memory dynamic allocation device provided in this application;
[0048] Figure 5 A schematic diagram of the structure of an electronic device provided in this application.
[0049] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0050] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0051] First, the terms involved in this application are explained:
[0052] Programmable Logic Controller: PLC (Programmable Logic Controller) is an electronic system for digital computing operations used for automated control. It was originally designed to replace relay control panels, and later gradually developed into an intelligent controller widely used in the field of industrial automation.
[0053] In the Industrial Internet of Things, the programmable logic controller collects field data and controls the operation of mechanical equipment by connecting to various sensors and devices, such as buttons, limit switches, relays, contactors and other output devices.
[0054] In one example, the PLC may allocate a fixed-size memory space to a port connected to a device so that the port processes operations related to the interconnected device, such as caching data received from the port.
[0055] However, in actual application, if the memory space allocated by the PLC to the port connected to the hardware device is smaller than the memory space required by the hardware device at the port, the connection between the PLC and the hardware device will fail. If the memory space allocated by the PLC to the port connected to the hardware device is much larger than the memory required by the hardware device at the port, the memory space of the PLC will be wasted.
[0056] The present application provides a programmable logic controller memory dynamic allocation method, device and electronic device, aiming to solve the above-mentioned technical problems.
[0057] Figure 1 A scenario diagram of a programmable logic controller memory dynamic allocation method provided in this application.
[0058] Figure 1It includes a cloud platform 11, a PLC 12 and equipment 13.
[0059] The PLC 12 is connected to the cloud platform 11 through the northbound network, and is connected to the field device 13 through the field digital network and port. The PLC 12 sends the connection information with the device 13 to the cloud platform 11 through the northbound network.
[0060] The cloud platform 11 includes a protocol function block library 111 and a dynamic compilation service module 112. The cloud platform 11 is used to receive connection information sent by PLC12, and the connection information includes device information of the device 13 connected to PLC12 and port information connected to the device 13. The protocol function block library 111 is used to store the protocol file of the device 13, and the dynamic compilation service module 112 is used to generate an interconnection program and a memory allocation configuration file between PLC12 and the device 13 according to the protocol file, and send the interconnection program and the memory allocation configuration file to PLC12.
[0061] PLC12 receives the interconnection program and memory allocation configuration file sent by the cloud platform 11. Memory is allocated to the device 13 according to the memory allocation configuration file, and communication with the device 13 is completed through the interconnection program.
[0062] The present application provides a method, device and electronic device for dynamically allocating memory of a programmable logic controller. The PLC obtains connection information of ports of a device and a programmable logic controller, sends the connection information to a cloud platform, and allocates memory size to the port according to a memory allocation configuration file sent by the cloud platform based on the connection information, thereby achieving dynamic memory allocation for different ports according to the connection information of the device, thereby improving the memory space utilization of the PLC and enhancing the flexibility of device interconnection.
[0063] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0064] Figure 2 A schematic diagram of a programmable logic controller memory dynamic allocation method provided in this application Figure 1 ,like Figure 2 As shown, the method includes:
[0065] S201. In response to detecting that a device is connected to a programmable logic controller, obtain connection information between a plurality of ports of the programmable logic controller and the device respectively.
[0066] This method is applied to Figure 1As shown in the PLC. Exemplarily, when the industrial hardware device and the PLC are physically connected through a wired connection or a wireless connection, the hardware device reports its device information to the PLC, including the device type, and the port of the PLC reports port information to the PLC, and the port information includes information on whether it is connected to the device. The device information and the port information are bound to form the connection information.
[0067] Specifically, the PLC port list is Com1, Com2, Com3, Com4 and Com5, the hardware device is a switching power supply, model A-01, the switching power supply is connected to port Com2, and the connection information is [switching power supply A-01, Com2].
[0068] S202. Send the connection information corresponding to each of the multiple ports to the cloud platform; wherein the cloud platform determines the memory space size required for each port based on the connection information corresponding to each of the multiple ports, and generates a memory allocation configuration file including the memory space size required for each port.
[0069] Exemplarily, the editable logic controller sends connection information to the cloud platform. The cloud platform searches for the corresponding protocol file in the protocol function block library based on the mapping relationship between the device type in the connection information and the protocol file. The protocol file includes memory allocation information of the hardware device and the hardware port of the PLC.
[0070] When the protocol file corresponding to the hardware device is found, the protocol function block library sends the protocol file to the dynamic compilation service, generates a memory allocation configuration file based on the memory allocation information of the protocol file of the hardware device, and the dynamic compilation service module sends the generated memory allocation configuration file to the PLC.
[0071] Specifically, the cloud platform receives the connection information [switching power supply A-01, Com2], then searches for the switching power supply A-01.xml protocol file in the protocol function block library according to the mapping relationship, and sends the protocol file to the dynamic compilation service module. The dynamic compilation service module reads the switching power supply A-01.xml protocol file and obtains the memory allocation required for Com2: the receiving buffer size is 200K, the sending buffer size is 100K, and the marking status is 64Byte. The information required for Com2 allocation is generated into a memory allocation configuration file Allocate.txt and sent to the PLC.
[0072] S203: Receive a memory allocation configuration file sent by the cloud platform, and allocate memory to each port according to the memory allocation configuration file.
[0073] Specifically, the PLC reads the memory allocation in the memory allocation configuration file Allocate.txt. For example, if the memory allocation required by Com2 is: the receiving buffer size is 200K, the sending buffer size is 100K, and the marking status is 64Byte, then Com2 is allocated a receiving buffer of 200K, a sending buffer of 100K, and a marking status of 64Byte.
[0074] A method for dynamically allocating memory of a programmable logic controller provided in an embodiment of the present application obtains connection information of ports of a device and a PLC, sends the connection information to a cloud platform, and allocates memory size to the port according to a memory allocation configuration file sent by the cloud platform based on the connection information, thereby dynamically allocating memory space to the PLC port according to the memory requirements of the device connected to the PLC port, reducing resource waste caused by allocating too much fixed memory space to the PLC port and improving the memory space utilization of the PLC; at the same time, it also reduces the device connection failure rate caused by insufficient fixed memory allocated to the port; and improves the compatibility of the PLC in connecting with different devices.
[0075] Figure 3 A schematic diagram of a programmable logic controller memory dynamic allocation method provided in this application Figure 2 ,like Figure 3 As shown, in this embodiment Figure 2 Based on the embodiment, a programmable logic controller memory dynamic allocation method is described in detail, the method comprising:
[0076] S301 . In response to detecting that a device is connected to a programmable logic controller, obtain connection information between a plurality of ports of the programmable logic controller and the device respectively.
[0077] The step S301 of this embodiment can refer to the above step S201 and will not be described in detail.
[0078] S302. Send the connection information corresponding to each of the multiple ports to the cloud platform; wherein the cloud platform determines the memory space size required for each port based on the connection information corresponding to each of the multiple ports, and generates a memory allocation configuration file including the memory space size required for each port.
[0079] Different device types correspond to different target protocol files.
[0080] Exemplarily, the editable logic controller sends connection information to the cloud platform. The cloud platform searches for the corresponding target protocol file in the protocol function block library based on the mapping relationship between the device type in the connection information and the protocol file. The target protocol file includes memory allocation information of the hardware device and the hardware port of the PLC.
[0081] In one example, in step S302, “the cloud platform determines the size of the memory space required for each port according to the connection information corresponding to each of the multiple ports” includes the following steps:
[0082] If the connection information corresponding to the first port indicates connection with a device, the corresponding target protocol file is determined according to the device type of the device; the target protocol file includes mapping relationships between multiple ports and memory space sizes respectively; the first port belongs to multiple ports of a programmable logic controller.
[0083] The size of the memory space required by the first port is determined according to the mapping relationship in the target protocol file.
[0084] In this example, specifically, A-01 is connected to PLC through Com2, Com2 is the first port, and the cloud platform generates a memory allocation configuration file Allocate.txt including the memory space size required for Com2 according to the mapping relationship between the port and the memory space in the protocol file of A-01. The PLC reads the memory allocation information in the memory allocation configuration file Allocate.txt and obtains the memory allocation required for the first port Com2: the receiving buffer size is 200K, the sending buffer size is 100K, and the marking status is 64Byte. A receiving buffer of 200K, a sending buffer of 100K, and a marking status of 64Byte are allocated to Com2.
[0085] In one example, the step S302 of “the cloud platform determines the memory space required for each port according to the connection information corresponding to each of the multiple ports” includes the following steps:
[0086] If the connection information corresponding to the second port indicates that it is not connected to the device, a preset memory space size is set for the second port; wherein the second port belongs to multiple ports of the programmable logic controller.
[0087] In this example, specifically, A-01 is not connected to the PLC through Com1, Com3, Com4 and Com5, and Com1, Com3, Com4 and Com5 are all second ports. The cloud platform generates a memory allocation configuration file Allocate.txt including the memory space size required for Com1, Com3, Com4 and Com5 according to the mapping relationship between the port and the memory space in the protocol file of A-01. The PLC reads the memory allocation information in the memory allocation configuration file Allocate.txt, thereby disabling Com1, Com3, Com4 and Com5, that is, allocating a preset memory space size of 0 to the second ports Com1, Com3, Com4 and Com5.
[0088] S303: Receive a memory allocation configuration file sent by the cloud platform, and allocate memory to each port according to the memory allocation configuration file.
[0089] The step S303 of this embodiment can refer to the above step S203 and will not be described in detail.
[0090] S304: Receive the interconnection program sent by the cloud platform, and implement communication with the device according to the interconnection program.
[0091] In one example, the cloud platform generates an interconnection program based on the following steps:
[0092] Obtain a program compiler corresponding to the programmable logic controller; use the program compiler to link and compile a communication protocol corresponding to the device type of the device to obtain an interconnection program.
[0093] Exemplarily, the editable logic controller sends the connection information to the cloud platform. The cloud platform searches for the corresponding protocol file in the protocol function block library based on the mapping relationship between the device type in the connection information and the protocol file. In addition to the memory allocation information of the hardware device and the hardware port of the PLC, the protocol file also includes the corresponding communication protocol between the hardware device and the PLC.
[0094] When the protocol file corresponding to the hardware device is found, the protocol function block library sends the protocol file to the dynamic compilation service. At the same time, since the PLC carries its own IP address when sending connection information, the dynamic compilation service can determine the controller model of the editable logic controller based on the correspondence between the IP address and the PLC. The dynamic compilation service selects the compiler corresponding to the controller model of the editable logic controller, generates an interconnection program according to the communication protocol of the protocol file of the hardware device, and the dynamic compilation service sends the generated interconnection program to the PLC.
[0095] Specifically, the dynamic compilation service translates the selected switching power supply A-01.xml protocol file into standard C language using the abstract syntax tree AST (Abstract Syntax Tree) method, calls the PLC compiler to compile the C language, generates a PLC executable program.so file, and sends it to the PLC.
[0096] The PLC receives the program.so file, executes the program.so file, and communicates with the switching power supply A-01 through Com2.
[0097] A method for dynamically allocating memory of a programmable logic controller provided in an embodiment of the present application obtains connection information of a port of a device and a PLC, sends the connection information to a cloud platform, allocates memory size to the port according to a memory allocation configuration file sent by the cloud platform based on the connection information, and completes communication with the device according to an interconnection program sent by the cloud platform, thereby allocating PLC memory space to the device according to device requirements, reducing resource waste caused by excessive fixed memory space, improving memory space utilization of the PLC, and also reducing device connection failures caused by insufficient allocated fixed memory, thereby improving the compatibility of the programmable logic controller with different devices and enhancing the interconnection between different devices.
[0098] Figure 4 A schematic diagram of a programmable logic controller memory dynamic allocation device provided in this application is shown in FIG. Figure 4 As shown, a programmable logic controller memory dynamic allocation device 40 provided in this embodiment includes:
[0099] An acquiring unit 401 is used for acquiring connection information between a plurality of ports of the programmable logic controller and the devices respectively in response to detecting that the device is connected to the programmable logic controller;
[0100] The sending unit 402 is used to send the connection information corresponding to each of the multiple ports to the cloud platform; wherein the cloud platform determines the memory space size required for each port according to the connection information corresponding to each of the multiple ports, and generates a memory allocation configuration file including the memory space size required for each port;
[0101] The processing unit 403 is used to receive the memory allocation configuration file sent by the cloud platform, and allocate memory to each port according to the memory allocation configuration file.
[0102] In a possible implementation manner, the sending unit 402 includes:
[0103] The first determination module 4021 is used to determine the corresponding target protocol file according to the device type of the device if the connection information corresponding to the first port indicates that the device is connected; the target protocol file includes a mapping relationship between multiple ports and memory space sizes respectively; the first port belongs to multiple ports of the programmable logic controller;
[0104] The second determining module 4022 is used to determine the memory space size required by the first port according to the mapping relationship in the target protocol file.
[0105] In a possible implementation manner, different device types correspond to different target protocol files.
[0106] In a possible implementation manner, the sending unit 402 includes:
[0107] The setting module 4023 is used to set a preset memory space size for the second port if the connection information corresponding to the second port indicates that it is not connected to the device; wherein the second port belongs to multiple ports of the programmable logic controller.
[0108] In a possible implementation, the device 40 further includes:
[0109] The receiving unit 404 is used to receive the interconnection program sent by the cloud platform and realize communication with the device according to the interconnection program.
[0110] In a possible implementation, the cloud platform generates an interconnection program based on the following steps:
[0111] Obtain a program compiler corresponding to the programmable logic controller;
[0112] The communication protocol corresponding to the device type of the device is linked and compiled by using a program compiler to obtain an interconnection program.
[0113] The present embodiment provides a programmable logic controller memory dynamic allocation device, which can execute the method provided by the above method embodiment. Its implementation principle and technical effect are similar, and this embodiment will not be described in detail here.
[0114] Figure 5 This is a schematic diagram of the structure of an electronic device provided in this application. Figure 5 As shown, the electronic device 50 provided in this embodiment includes: at least one processor 501 and a memory 502. Optionally, the device 50 also includes a communication component 503. The processor 501, the memory 502 and the communication component 503 are connected via a bus 504.
[0115] In a specific implementation process, at least one processor 501 executes the computer-executable instructions stored in the memory 502, so that at least one processor 501 executes the above method.
[0116] The specific implementation process of the processor 501 can be found in the above method embodiment, and its implementation principle and technical effect are similar, so this embodiment will not be repeated here.
[0117] In the above embodiments, it should be understood that the processor can be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. A general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in the invention can be directly implemented as a hardware processor, or can be implemented by a combination of hardware and software modules in the processor.
[0118] The memory may include a high-speed memory (Random Access Memory, RAM), and may also include a non-volatile memory (NVM), such as at least one disk storage.
[0119] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the bus in the drawings of this application is not limited to only one bus or one type of bus.
[0120] The present application also provides a computer program product, including a computer program, which implements the above method when executed by a processor.
[0121] The present application also provides a computer-readable storage medium, in which computer-executable instructions are stored. When a processor executes the computer-executable instructions, the above method is implemented.
[0122] The above-mentioned readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The readable storage medium can be any available medium that can be accessed by a general or special-purpose computer.
[0123] An exemplary readable storage medium is coupled to a processor so that the processor can read information from the readable storage medium and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can be located in an application specific integrated circuit (Application Specific Integrated Circuits, referred to as: ASIC). Of course, the processor and the readable storage medium can also exist in the device as discrete components.
[0124] The division of units is only a logical function division, and there may be other divisions in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interface, device or unit, which can be electrical, mechanical or other forms.
[0125] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0126] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0127] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods of each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.
[0128] Those skilled in the art can understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk and other media that can store program codes.
[0129] Finally, it should be noted that those skilled in the art will readily conceive of other embodiments of the present invention after considering the specification and practicing the invention disclosed herein. The present invention is intended to cover any variations, uses or adaptations of the present invention, which follow the general principles of the present invention and include common knowledge or customary technical means in the art not disclosed by the present invention, are not limited to the precise structure described above and shown in the drawings, and may be modified and changed in various ways without departing from the scope thereof. The scope of the present invention is limited only by the appended claims.
Claims
1. A programmable logic controller memory dynamic allocation method, characterized in that: include: In response to detecting that a device is connected to a programmable logic controller, obtaining connection information between a plurality of ports of the programmable logic controller and the device respectively; Sending the connection information corresponding to each of the multiple ports to the cloud platform; wherein the cloud platform determines the memory space size required for each port according to the connection information corresponding to each of the multiple ports, and generates a memory allocation configuration file including the memory space size required for each port; Receive the memory allocation configuration file sent by the cloud platform, and allocate memory to each of the ports according to the memory allocation configuration file.
2. The method according to claim 1, characterized in that The cloud platform determines the memory space required for each port according to the connection information corresponding to each of the multiple ports, including: If the connection information corresponding to the first port indicates connection with the device, determining the corresponding target protocol file according to the device type of the device; the target protocol file includes mapping relationships between multiple ports and memory space sizes respectively; the first port belongs to multiple ports of the programmable logic controller; The size of the memory space required by the first port is determined according to the mapping relationship in the target protocol file.
3. The method according to claim 2, characterized in that Different device types correspond to different target protocol files.
4. The method according to claim 1, characterized in that: The cloud platform determines the memory space required for each port according to the connection information corresponding to each of the multiple ports, including: If the connection information corresponding to the second port indicates that it is not connected to the device, a preset memory space size is set for the second port; wherein the second port belongs to multiple ports of the programmable logic controller.
5. The method according to any one of claims 1 to 4, characterized in that: The method further comprises: Receive the interconnection program sent by the cloud platform, and realize communication with the device according to the interconnection program.
6. The method according to claim 5, characterized in that The cloud platform generates the interconnection program based on the following steps: Obtaining a program compiler corresponding to the programmable logic controller; The program compiler is used to link and compile the communication protocol corresponding to the device type of the device to obtain the interconnection program.
7. A programmable logic controller memory dynamic allocation device, characterized in that: include: an acquiring unit, configured to acquire connection information between a plurality of ports of the programmable logic controller and the device respectively in response to detecting that the device is connected to the programmable logic controller; A sending unit, configured to send the connection information corresponding to each of the multiple ports to a cloud platform; wherein the cloud platform determines the size of the memory space required for each port according to the connection information corresponding to each of the multiple ports, and generates a memory allocation configuration file including the size of the memory space required for each port; The processing unit is used to receive the memory allocation configuration file sent by the cloud platform, and allocate memory to each of the ports according to the memory allocation configuration file.
8. An electronic device, characterized in that: include: Memory, processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory, so that the processor performs the method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 6 when executed by a processor.
10. A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
Citation Information
Cited By
Equipment fault processing method, electronic equipment, storage medium and product
CN120011127A