An Upgrading Method for an Energy Controller APP

By connecting to external USB devices and remotely upgrading files, independent threads are used to automatically upgrade the container side and host side APPs of the energy controller, solving the problems of complex operation and high technical requirements in the existing technology, and simplifying the upgrade process and improving the degree of automation.

CN114924764BActive Publication Date: 2025-07-25SHENZHEN CLOU ELECTRONICS
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210450765.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-27
Publication Date
2025-07-25
Estimated Expiration
2042-04-27

AI Technical Summary

Technical Problem

The APP upgrade method of the existing energy controller is complex in operation, low in automation, and has high technical requirements for on-site operators.

Method used

By connecting with external USB devices, use USB monitoring threads, energy controller container-side threads and host-side threads to automatically upgrade the container-side and host-side APPs using automatic upgrade mode or LCD upgrade mode, or receive remote upgrade files for upgrade.

Benefits of technology

Reduces the operational complexity of energy controller upgrades, improves the degree of automation, and reduces technical requirements for on-site operators.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114924764B_ABST
    Figure CN114924764B_ABST
Patent Text Reader

Abstract

The present invention discloses an upgrading method for an energy controller APP, belonging to the field of power terminal products. The method includes: connecting to an external USB device, enumerating the USB device in the energy controller system to generate a USB device node corresponding to the USB device; accessing and mounting the USB device node according to the USB device node; starting a USB monitoring thread to select an upgrading mode for the energy controller container side thread and the energy controller host side thread, where the upgrading mode is an automatic upgrading mode or a liquid crystal upgrading mode; starting the energy controller container side thread and upgrading the container side APP according to the upgrading mode; starting the energy controller host side thread and upgrading the host side APP according to the upgrading mode. The present invention realizes a high degree of automation in the upgrading of the energy controller APP, and has low technical requirements for on-site personnel during the upgrading process.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of power terminal products, and particularly relates to an upgrade method for an energy controller APP Background Art

[0002] The energy controller is a new generation of power terminal product launched by the State Grid and is the core device of the low-voltage distribution and power consumption Internet of Things; the energy controller terminal hardware adopts a platform design concept, and the software part adopts an edge computing architecture, so it has the functions of local data storage and local data analysis and decision-making; it adopts industrial-grade, modular, scalable, and low-power design standards, can adapt to complex operating environments, and has high reliability, stability, and safety protection, etc.

[0003] The energy controller incorporates container technology, and its software is designed based on APP. Therefore, both the container side and the host side of the energy controller need to run the APP. However, currently, the upgrade methods for the APP on the container side and the host side of the energy controller can only transfer the upgrade file to the energy controller through the remote file copy command of the Secure Shell protocol, and then log in to the energy console through the Secure Shell protocol to complete the upgrade of the APP through instructions. The disadvantage is that personnel need to operate the instructions on-site at the device. For non-technical personnel, it is easy to make instruction operation mistakes, resulting in abnormal operation of the energy controller system, and it is still necessary to query whether the upgrade is successful through instructions after the upgrade; in addition, the upgrade file transmitted to the energy controller system by the above method can only be transmitted to the container side, but the final upgrade is completed by the setting command instructions on the host side; this upgrade method results in complex operations, low automation, and high technical requirements for on-site operators when upgrading the energy controller. Summary of the Invention

[0004] The purpose of the present invention is to provide an upgrade method for an energy controller APP to solve the technical problems of complex operations and low automation during the upgrade of the energy controller in the prior art. Further, it also solves the technical problem of high technical ability requirements for on-site operators during the upgrade of the energy controller in the prior art.

[0005] To solve the above technical problems, the technical solution of the present invention is as follows:

[0006] The present invention provides an upgrade method for an energy controller APP, including:

[0007] Connect to an external USB device, enumerate the USB device in the energy controller system, and generate a USB device node corresponding to the USB device;

[0008] Perform access and mounting of the USB device node according to the USB device node;

[0009] The USB monitoring thread is started to select the upgrade modes for the energy controller container - side thread and the energy controller host - side thread. The upgrade modes are the automatic upgrade mode or the LCD upgrade mode;

[0010] The energy controller container - side thread is started and the container - side APP is upgraded according to the upgrade mode;

[0011] The energy controller host - side thread is started and the host - side APP is upgraded according to the upgrade mode.

[0012] In some embodiments, the step of starting the USB monitoring thread to select the upgrade modes for the energy controller container - side thread and the energy controller host - side thread includes:

[0013] Initialize the state machine for USB device monitoring to the first state;

[0014] In the first state, detect the USB device node, and when the USB device node is detected, switch the state machine to the second state;

[0015] In the second state, detect the mounting state of the USB device node. When the USB device node is successfully mounted, detect the automatic upgrade directory in the USB device. When the automatic upgrade directory is detected, enter the automatic upgrade mode and switch the state machine to the third state; when the automatic upgrade directory is not detected, enter the LCD upgrade mode and switch the state machine to the fourth state.

[0016] In some embodiments, the step of starting the USB monitoring thread to select the upgrade modes for the energy controller container - side thread and the energy controller host - side thread further includes:

[0017] When the energy controller container - side upgrade state is the container - side fourth state or the container - side fifth state, and the energy controller host - side upgrade state is the host - side third state or the host - side fourth state, switch the state machine to the sixth state;

[0018] In the sixth state, unmount the mounting directory of the USB device and switch the state machine to the seventh state;

[0019] In the seventh state, detect the USB device. When the USB device is not detected, switch the state machine to the first state.

[0020] In some embodiments, the automatic upgrade mode includes:

[0021] In the third state, share the automatic upgrade directory with the energy controller container - side thread and the energy controller host - side thread and start the upgrade task identifier. When the energy controller container - side thread obtains the upgrade script in the automatic upgrade directory, switch the state machine to the fifth state.

[0022] In some embodiments, the steps of starting the container-side thread of the energy controller and upgrading the container-side APP according to the upgrade mode include:

[0023] Obtain the upgrade task identifier and switch the container-side upgrade status to the first container-side state;

[0024] In the first container-side state, obtain the automatic upgrade directory and switch the container-side upgrade status to the second container-side state; when the automatic upgrade directory cannot be obtained, switch the container-side upgrade status to the fifth container-side state;

[0025] In the second container-side state, obtain the upgrade script in the automatic upgrade directory and execute the container-side script function in the upgrade script. After executing the container-side script function, switch the container-side upgrade status to the third container-side state; the container-side script function is used to upgrade the container-side APP and verify the container-side upgrade result, and the container-side upgrade result includes successful upgrade of the container-side APP and failed upgrade of the container-side APP;

[0026] In the third container-side state, obtain the host-side upgrade status until the host-side upgrade status switches to the second host-side state;

[0027] If the container-side upgrade result is successful upgrade of the container-side APP, switch the container-side upgrade status to the fourth container-side state; if the container-side upgrade result is failed upgrade of the container-side APP, switch the container-side upgrade status to the fifth container-side state.

[0028] In some embodiments, the steps of starting the host-side thread of the energy controller and upgrading the host-side APP according to the upgrade mode include:

[0029] Obtain the container-side upgrade status until the container-side upgrade status switches to the third container-side state;

[0030] Obtain the automatic upgrade directory and switch the host-side upgrade status to the first host-side state; when the automatic upgrade directory cannot be obtained, switch the host-side upgrade status to the fourth host-side state;

[0031] In the first host-side state, obtain the upgrade script in the automatic upgrade directory and execute the host-side script function in the upgrade script. After executing the host-side script function, switch the host-side upgrade status to the second host-side state until the container-side thread obtains the second host-side state; the host-side script function is used to upgrade the host-side APP and verify the host-side upgrade result, and the host-side upgrade result includes successful upgrade of the host-side APP and failed upgrade of the host-side APP;

[0032] If the host-side upgrade result is successful upgrade of the host-side APP, switch the host-side upgrade status to the third host-side state; if the host-side upgrade result is failed upgrade of the host-side APP, switch the host-side upgrade status to the fourth host-side state.

[0033] In some embodiments, the liquid crystal upgrade mode includes:

[0034] In the fourth state, operate the energy controller system to enter the liquid crystal upgrade interface;

[0035] Operate the energy controller system to initialize the container - side upgrade state and the host - side upgrade state in the liquid crystal upgrade interface to prevent the previously retained upgrade state from affecting the current upgrade;

[0036] Operate the energy controller system to select the liquid crystal upgrade directory in the USB device in the liquid crystal upgrade interface; wherein, after selecting the liquid crystal upgrade directory in the USB device, the USB monitoring thread will share the liquid crystal upgrade directory with the energy controller container - side thread and the energy controller host - side thread and start the upgrade task identifier. When the energy controller container - side thread obtains the upgrade script in the liquid crystal upgrade directory, the state machine is switched to the fifth state.

[0037] In some embodiments, the steps of starting the energy controller container - side thread and upgrading the container - side APP according to the upgrade mode include:

[0038] Obtain the upgrade task identifier and switch the container - side upgrade state to the container - side first state;

[0039] In the container - side first state, obtain the liquid crystal upgrade directory and switch the container - side upgrade state to the container - side second state; when the liquid crystal upgrade directory is not obtained, switch the container - side upgrade state to the container - side fifth state;

[0040] In the container - side second state, obtain the upgrade script in the liquid crystal upgrade directory and execute the container - side script function in the upgrade script. After executing the container - side script function, switch the container - side upgrade state to the container - side third state; the container - side script function is used to upgrade the container - side APP and verify the container - side upgrade result. The container - side upgrade result includes that the container - side APP upgrade is successful and the container - side APP upgrade fails;

[0041] In the container - side third state, obtain the host - side upgrade state until the host - side upgrade state is switched to the host - side second state;

[0042] If the container - side upgrade result is that the container - side APP upgrade is successful, switch the container - side upgrade state to the container - side fourth state; if the container - side upgrade result is that the container - side APP upgrade fails, switch the container - side upgrade state to the container - side fifth state.

[0043] In some embodiments, the steps of starting the energy controller host - side thread and upgrading the host - side APP according to the upgrade mode include:

[0044] Obtain the upgrade status on the container side until the upgrade status on the container side switches to the third state on the container side;

[0045] Obtain the LCD upgrade directory, and switch the upgrade status on the host side to the first state on the host side; when the LCD upgrade directory is not obtained, switch the upgrade status on the host side to the fourth state on the host side;

[0046] In the first state on the host side, obtain the upgrade script in the LCD upgrade directory and execute the host-side script function in the upgrade script. After executing the host-side script function, switch the upgrade status on the host side to the second state on the host side until the container-side thread obtains the second state on the host side; the host-side script function is used to upgrade the host-side APP and verify the host-side upgrade result. The host-side upgrade result includes that the host-side APP upgrade is successful and the host-side APP upgrade fails;

[0047] If the host-side upgrade result is that the host-side APP upgrade is successful, switch the upgrade status on the host side to the third state on the host side. If the host-side upgrade result is that the host-side APP upgrade fails, switch the upgrade status on the host side to the fourth state on the host side.

[0048] Another technical solution of the present invention is as follows:

[0049] Provide an upgrade method for the energy controller APP, including:

[0050] Receive the remote upgrade file;

[0051] Initialize the upgrade status on the container side and the upgrade status on the host side to prevent the previous retained upgrade status from affecting the current upgrade;

[0052] Share the remote upgrade directory with the energy controller container-side thread and the energy controller host-side thread and start the upgrade task identifier;

[0053] Start the energy controller container-side thread to upgrade the container-side APP;

[0054] Start the energy controller host-side thread to upgrade the host-side APP;

[0055] When both the energy controller container-side thread and the energy controller host-side thread terminate, end the remote upgrade.

[0056] In some embodiments, the step of starting the energy controller container-side thread to upgrade the container-side APP includes:

[0057] Obtain the upgrade task identifier, and switch the upgrade status on the container side to the first state on the container side;

[0058] In the first state on the container side, obtain the remote upgrade directory, and switch the upgrade state on the container side to the second state on the container side; when the remote upgrade directory cannot be obtained, switch the upgrade state on the container side to the fifth state on the container side.

[0059] In the second state on the container side, obtain the upgrade script in the remote upgrade directory and execute the container-side script function in the upgrade script. After executing the container-side script function, switch the upgrade state on the container side to the third state on the container side; the container-side script function is used to upgrade the container-side APP and verify the container-side upgrade result, and the container-side upgrade result includes that the container-side APP upgrade is successful and the container-side APP upgrade fails.

[0060] In the third state on the container side, obtain the upgrade state on the host side until the upgrade state on the host side is switched to the second state on the host side.

[0061] If the container-side upgrade result is that the container-side APP upgrade is successful, switch the upgrade state on the container side to the fourth state on the container side; if the container-side upgrade result is that the container-side APP upgrade fails, switch the upgrade state on the container side to the fifth state on the container side.

[0062] In some embodiments, the steps of starting the host-side thread to upgrade the host-side APP include:

[0063] Obtain the upgrade state on the container side until the upgrade state on the container side is switched to the third state on the container side.

[0064] Obtain the remote upgrade directory, and switch the upgrade state on the host side to the first state on the host side; when the remote upgrade directory cannot be obtained, switch the upgrade state on the host side to the fourth state on the host side.

[0065] In the first state on the host side, obtain the upgrade script in the remote upgrade directory and execute the host-side script function in the upgrade script. After executing the host-side script function, switch the upgrade state on the host side to the second state on the host side until the container-side thread obtains the second state on the host side; the host-side script function is used to upgrade the host-side APP and verify the host-side upgrade result, and the host-side upgrade result includes that the host-side APP upgrade is successful and the host-side APP upgrade fails.

[0066] If the host-side upgrade result is that the host-side APP upgrade is successful, switch the upgrade state on the host side to the third state on the host side; if the host-side upgrade result is that the host-side APP upgrade fails, switch the upgrade state on the host side to the fourth state on the host side.

[0067] In some embodiments, for the upgrade method of the energy controller APP provided by the present invention, the energy controller system is a Linux system.

[0068] The beneficial effects of the present invention compared with the prior art:

[0069] The present invention provides an APP upgrade method for an energy controller. An external USB device is connected to the energy controller, and the upgrade file is set in the USB device. The container-side APP and the host-side APP are upgraded through independent USB monitoring threads, energy controller container-side threads, and energy controller host-side threads. This solves the technical problems of complex operation, low automation level, and high technical requirements for on-site operators during the upgrade of the energy controller. The present invention also provides an APP upgrade method for an energy controller, which receives a remote upgrade file and upgrades the container-side APP and the host-side APP through the energy controller container-side thread and the energy controller host-side thread, also solving the technical problems of complex operation, low automation level, and high technical requirements for on-site operators during the upgrade of the energy controller. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0071] Figure 1 It is a flowchart of the USB monitoring thread in an embodiment of the present invention.

[0072] Figure 2 It is a flowchart of the energy controller container-side thread in an embodiment of the present invention.

[0073] Figure 3 It is a flowchart of the energy controller host-side thread in an embodiment of the present invention.

[0074] Figure 4 It is a flowchart of the LCD upgrade in an embodiment of the present invention.

[0075] Figure 5 It is a flowchart of the remote upgrade of the energy controller in an embodiment of the present invention

[0076] Figure 6 It is a block diagram of the energy controller upgrade in an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0077] The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the drawings in the embodiments of the present invention. It should be clear that the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts belong to the scope of protection of the present invention.

[0078] An embodiment of the present invention provides an upgrade method for an energy controller APP, as Figures 1-4 shown. The embodiment of the present invention includes the following steps:

[0079] Connect to an external USB device, enumerate the USB device in the energy controller system, and generate a USB device node corresponding to the USB device;

[0080] Perform access and mounting of the USB device node according to the USB device node; among them, after the energy controller accesses the USB device, a device node is generated, and the access and mounting of the device node are the normal reactions of the energy controller system to access the USB device, and will not be further described in this embodiment;

[0081] Start the USB monitoring thread to select the upgrade mode of the energy controller container side thread and the energy controller host side thread. The upgrade mode includes an automatic upgrade mode or a liquid crystal upgrade mode;

[0082] Start the energy controller container side thread and upgrade the container side APP according to the upgrade mode;

[0083] Start the energy controller host side thread and upgrade the host side APP according to the upgrade mode.

[0084] In the embodiment of the present invention, the energy controller system adopts a linux system, and the USB monitoring thread, the energy controller container side thread, and the energy controller host side thread are independent of each other in the energy controller system. It should be clear that the above three threads will always exist in the system after being set. The start of the USB monitoring thread, the start of the energy controller container side thread, and the start of the energy controller host side thread described in the present invention should be regarded as their execution order in the system when an external USB device is connected.

[0085] In the embodiment of the present invention, as Figure 1 shown in the USB monitoring thread flow chart, the USB monitoring thread process is as follows:

[0086] Initialize the state machine for USB device monitoring to the first state USB_HOT_PLUG_IN;

[0087] In the first state USB_HOT_PLUG_IN, the USB monitoring thread detects the USB device node, and when the USB device node is detected, the state machine is switched to the second state USB_MOUNT;

[0088] In the second state USB_MOUNT, detect whether the USB device node is successfully mounted. If the mount is successful, continue to detect the automatic upgrade directory in the USB device. When the automatic upgrade directory is detected, the energy controller enters the automatic upgrade mode and switches the state machine to the third state USB_AUTO_UPGRADE; if the automatic upgrade directory is not detected, enter the LCD upgrade mode and switch the state machine to the fourth state USB_DISP_UPGRADE;

[0089] In the third state USB_AUTO_UPGRADE, that is, when the energy controller is in the automatic upgrade mode, the USB monitoring thread shares the automatic upgrade directory with the energy controller container-side thread and the energy controller host-side thread and starts the upgrade task identifier. When the energy controller container-side thread obtains the upgrade script in the automatic upgrade directory, switch the state machine to the fifth state USB_WORKING;

[0090] Or in the fourth state USB_DISP_UPGRADE, that is, when the energy controller is in the LCD upgrade mode, operate the energy controller to enter the LCD upgrade interface, operate the energy controller to select the LCD upgrade directory in the USB device in the LCD upgrade interface, and the USB monitoring thread shares the LCD upgrade directory with the energy controller container-side thread and the energy controller host-side thread and starts the upgrade task identifier. When the energy controller container-side thread obtains the upgrade script in the LCD upgrade directory, switch the state machine to the fifth state USB_WORKING;

[0091] In the fifth state USB_WORKING, wait until the upgrade state of the energy controller container side is the fourth state or the fifth state on the container side, and the upgrade state of the energy controller host side is the third state or the fourth state on the host side, and then switch the state machine to the sixth state USB_UMOUNT;

[0092] In the sixth state, unmount the mount directory of the USB device and switch the state machine to the seventh state USB_HOT_PLUG_OUT;

[0093] In the seventh state, detect the USB device. When the USB device is not detected, that is, after the USB device is pulled out of the energy controller, switch the state machine to the first state USB_HOT_PLUG_IN.

[0094] In the embodiments of the present invention, the USB monitoring thread is responsible for the access, mounting, and unloading of USB devices, and determines the upgrade modes of the energy controller container-side thread and the host-side thread; among them, the states of the state machine are used for system identification, so they are not limited to the above naming; the execution processes of the upgrade scripts in the automatic upgrade directory and the LCD upgrade directory include two parts. First, it is determined whether it is a container-side upgrade or a host-side upgrade, and then the corresponding container-side script function or the corresponding host-side script function is executed. After the upgrade is completed, the APP is checked to ensure the success of the upgrade.

[0095] In the embodiments of the present invention, when the energy controller is in the automatic upgrade mode, the upgrade processes of the container-side thread and the host-side thread are as follows:

[0096] As Figure 2 As shown in the flowchart of the energy controller container-side thread, the container-side upgrade process is as follows:

[0097] Obtain the upgrade task identifier, and switch the container-side upgrade status to the container-side first state TERM_INIT;

[0098] In the container-side first state TERM_INIT, obtain the automatic upgrade directory, and switch the container-side upgrade status to the container-side second state TERM_CONTAINER_START. If the automatic upgrade directory cannot be obtained, it means that the container-side APP upgrade fails, and the container-side upgrade status is switched to the container-side fifth state UPGRADE_FAIL;

[0099] In the container-side second state TERM_CONTAINER_START, obtain the upgrade script in the automatic upgrade directory and execute the container-side script function in the upgrade script. After executing the container-side script function, switch the container-side upgrade status to the container-side third state TERM_CONTAINER_STOP; among them, the container-side script function is used to upgrade the container-side APP and check the container-side upgrade result. The container-side upgrade result includes that the container-side APP upgrade is successful and the container-side APP upgrade fails;

[0100] In the container-side third state TERM_CONTAINER_STOP, obtain the host-side upgrade status until the host-side upgrade status is switched to the host-side second state TERM_HOST_STOP;

[0101] If the container-side upgrade result is that the container-side APP upgrade is successful, switch the container-side upgrade status to the container-side fourth state UPGRADE_SUCC. If the container-side upgrade result is that the container-side APP upgrade fails, switch the container-side upgrade status to the container-side fifth state UPGRADE_FAIL.

[0102] As Figure 3As shown in the thread flow chart of the host side of the energy controller, the host side upgrade process is as follows:

[0103] Obtain the upgrade status on the container side until the upgrade status on the container side switches to the third state on the container side, TERM_CONTAINER_STOP;

[0104] Obtain the automatic upgrade directory, and switch the upgrade status on the host side to the first state on the host side, TERM_HOST_START; if the automatic upgrade directory cannot be obtained, it means that the host side APP upgrade fails, and the upgrade status on the host side is switched to the fourth state on the host side, UPGRADE_FAIL;

[0105] In the first state on the host side, TERM_HOST_START, obtain the upgrade script in the automatic upgrade directory and execute the host side script function in the upgrade script. After executing the host side script function, switch the upgrade status on the host side to the second state on the host side, TERM_HOST_STOP, until the container side thread obtains the second state on the host side, TERM_HOST_STOP; the host side script function is used to upgrade the host side APP and verify the host side upgrade result. The host side upgrade result includes successful upgrade of the host side APP and failed upgrade of the host side APP;

[0106] If the host side upgrade result is successful upgrade of the host side APP, switch the upgrade status on the host side to the third state on the host side. If the host side upgrade result is failed upgrade of the host side APP, switch the upgrade status on the host side to the fourth state on the host side.

[0107] In the embodiment of the present invention, as Figure 5 described in the liquid crystal upgrade flow chart, the liquid crystal upgrade mode is as follows:

[0108] In the fourth state, operate the energy controller system to enter the liquid crystal upgrade interface;

[0109] Operate the energy controller system to initialize the upgrade status on the container side and the upgrade status on the host side in the liquid crystal upgrade interface to prevent the previously retained upgrade status from affecting the current upgrade;

[0110] Operate the energy controller system to select the liquid crystal upgrade directory in the USB device in the liquid crystal upgrade interface; among them, after selecting the liquid crystal upgrade directory in the USB device, the USB monitoring thread will share the liquid crystal upgrade directory with the energy controller container side thread and the energy controller host side thread and start the upgrade task identifier. When the energy controller container side thread obtains the upgrade script in the liquid crystal upgrade directory, the state machine is switched to the fifth state, USB_WORKING; in the liquid crystal upgrade mode, entering the liquid crystal upgrade interface, initializing the upgrade status, and selecting the liquid crystal upgrade directory all require manual operations.

[0111] Specifically, when the energy controller is in the LCD upgrade mode, as Figure 2 shown in the energy controller container-side thread flow chart, the container-side upgrade process is as follows:

[0112] Obtain the upgrade task identifier and switch the container-side upgrade status to the container-side first state TERM_INIT;

[0113] In the container-side first state TERM_INIT, obtain the LCD upgrade directory and switch the container-side upgrade status to the container-side second state TERM_CONTAINER_START. If the LCD upgrade directory cannot be obtained, it means that the container-side APP upgrade fails, and the container-side upgrade status is switched to the container-side fifth state UPGRADE_FAIL;

[0114] In the container-side second state TERM_CONTAINER_START, obtain the upgrade script in the LCD upgrade directory and execute the container-side script function in the upgrade script. After executing the container-side script function, switch the container-side upgrade status to the container-side third state TERM_CONTAINER_STOP; among them, the container-side script function is used to upgrade the container-side APP and verify the container-side upgrade result. The container-side upgrade result includes that the container-side APP upgrade is successful and the container-side APP upgrade fails;

[0115] In the container-side third state TERM_CONTAINER_STOP, obtain the host-side upgrade status until the host-side upgrade status is switched to the host-side second state TERM_HOST_STOP;

[0116] If the container-side upgrade result is that the container-side APP upgrade is successful, switch the container-side upgrade status to the container-side fourth state UPGRADE_SUCC. If the container-side upgrade result is that the container-side APP upgrade fails, switch the container-side upgrade status to the container-side fifth state UPGRADE_FAIL.

[0117] As Figure 3 shown in the energy controller host-side thread flow chart, the host-side upgrade process is as follows:

[0118] Obtain the container-side upgrade status until the container-side upgrade status is switched to the container-side third state TERM_CONTAINER_STOP;

[0119] Obtain the LCD upgrade directory and switch the host-side upgrade status to the host-side first state TERM_HOST_START; if the LCD upgrade directory cannot be obtained, it means that the host-side APP upgrade fails, and the host-side upgrade status is switched to the host-side fourth state UPGRADE_FAIL;

[0120] In the first state TERM_HOST_START on the host side, the upgrade script in the LCD upgrade directory is obtained and the host side script function in the upgrade script is executed. After the host side script function is executed, the host side upgrade state is switched to the second state TERM_HOST_STOP on the host side until the container side thread obtains the second state TERM_HOST_STOP on the host side; the host side script function is used to upgrade the host side APP and verify the host side upgrade result, which includes the host side APP upgrade success and the host side APP upgrade failure;

[0121] The host side upgrade result is that the host side APP upgrade is successful, and the host side upgrade state is switched to the host side third state. The host side upgrade result is that the host side APP upgrade fails, and the host side upgrade state is switched to the host side fourth state.

[0122] In an embodiment of the present invention, the upgrade status of the above-mentioned container side thread and host side thread is used for system identification, and is therefore not limited to the above-mentioned naming. In automatic upgrade mode, the entire upgrade process of the container side thread and the host side thread is automatically performed by the system, and manual operation only requires the insertion and removal of the USB device; in LCD upgrade mode, it is only necessary to select the LCD upgrade directory in the LCD display interface, and the upgrade of the container side thread and the host side thread is also automatically performed; the energy controller upgrade operation is reduced, the degree of automation is improved, and there are almost no technical requirements for on-site personnel; the automatic upgrade mode is suitable for on-site operation and maintenance upgrades, and the LCD upgrade mode is suitable for selective upgrades, and different APPs can be selected for upgrades.

[0123] The embodiment of the present invention also provides an upgrade method of an energy controller APP, such as Figure 5 As shown in the energy controller remote upgrade flow chart, the specific process of this upgrade method is as follows:

[0124] Receive remote upgrade files transmitted by the server;

[0125] Initialize the upgrade status of the container side and the host side to prevent the previous retained upgrade status from affecting the current upgrade;

[0126] Share the remote upgrade directory with the energy controller container side thread and the energy controller host side thread and start the upgrade task identifier;

[0127] Start the energy controller container-side thread to upgrade the container-side APP;

[0128] Start the host-side thread of the energy controller to upgrade the host-side APP;

[0129] When both the energy controller container-side thread and the energy controller host-side thread are terminated, the remote upgrade is terminated.

[0130] Specifically, when the energy controller receives a remote upgrade file, as Figure 2 shown in the energy controller container - side thread flow chart, the container - side upgrade process is as follows:

[0131] Obtain the upgrade task identifier and switch the container - side upgrade status to the container - side first status TERM_INIT;

[0132] In the container - side first status TERM_INIT, obtain the remote upgrade directory and switch the container - side upgrade status to the container - side second status TERM_CONTAINER_START. If the remote upgrade directory cannot be obtained, it means that the container - side APP upgrade fails, and the container - side upgrade status is switched to the container - side fifth status UPGRADE_FAIL;

[0133] In the container - side second status TERM_CONTAINER_START, obtain the upgrade script in the remote upgrade directory and execute the container - side script function in the upgrade script. After executing the container - side script function, switch the container - side upgrade status to the container - side third status TERM_CONTAINER_STOP; among them, the container - side script function is used to upgrade the container - side APP and verify the container - side upgrade result. The container - side upgrade result includes that the container - side APP upgrade is successful and the container - side APP upgrade fails;

[0134] In the container - side third status TERM_CONTAINER_STOP, obtain the host - side upgrade status until the host - side upgrade status is switched to the host - side second status TERM_HOST_STOP;

[0135] If the container - side upgrade result is that the container - side APP upgrade is successful, switch the container - side upgrade status to the container - side fourth status UPGRADE_SUCC. If the container - side upgrade result is that the container - side APP upgrade fails, switch the container - side upgrade status to the container - side fifth status UPGRADE_FAIL.

[0136] As Figure 3 shown in the energy controller host - side thread flow chart, the host - side upgrade process is as follows:

[0137] Obtain the container - side upgrade status until the container - side upgrade status is switched to the container - side third status TERM_CONTAINER_STOP;

[0138] Obtain the remote upgrade directory and switch the host - side upgrade status to the host - side first status TERM_HOST_START; if the remote upgrade directory cannot be obtained, it means that the host - side APP upgrade fails, and the host - side upgrade status is switched to the host - side fourth status UPGRADE_FAIL;

[0139] In the first state of the host side, TERM_HOST_START, obtain the upgrade script in the remote upgrade directory and execute the host-side script function in the upgrade script. After executing the host-side script function, switch the host-side upgrade state to the second state of the host side, TERM_HOST_STOP, until the container-side thread obtains the second state of the host side, TERM_HOST_STOP; the host-side script function is used to upgrade the host-side APP and verify the host-side upgrade result. The host-side upgrade result includes that the host-side APP upgrade is successful and the host-side APP upgrade fails.

[0140] If the host-side upgrade result is that the host-side APP upgrade is successful, switch the host-side upgrade state to the third state of the host side. If the host-side upgrade result is that the host-side APP upgrade fails, switch the host-side upgrade state to the fourth state of the host side.

[0141] The execution process in the remote upgrade directory includes two parts. First, determine whether it is a container-side upgrade or a host-side upgrade, and then execute the corresponding container-side script function or the corresponding host-side script function. After the upgrade is completed, check the APP to ensure the upgrade is successful.

[0142] In the embodiments of the present invention, the three upgrade methods of automatic upgrade, liquid crystal upgrade, and remote upgrade are all implemented based on software and do not require modification of the hardware; the energy controller system is a Linux system. Based on the multi-threading of the linux system, the USB monitoring thread, the container-side thread of the energy controller, and the host-side thread of the energy controller in the embodiments of the present invention are designed independently of each other; and the embodiments of the present invention modularize each upgrade function, such as Figure 6 As shown in the energy controller upgrade block diagram, the USB monitoring module is responsible for the access, mounting, and unloading of USB devices by the USB monitoring thread, and also determines the automatic upgrade mode and the liquid crystal upgrade mode; the upgrade module is used for the upgrade of the container side and the host side, and can also use remote upgrade for the upgrade of the container side and the host side. Compared with the prior art, the energy controller upgrade operation in the embodiments of the present invention has a low difficulty, a high degree of automation, and low technical requirements for on-site personnel.

[0143] The above content is a further detailed description of the present invention in combination with specific implementation manners. It cannot be determined that the specific implementation of the present invention is only limited to these descriptions. For those of ordinary skill in the technical field to which the present invention belongs, without departing from the concept of the present invention, several simple deductions or substitutions can be made, which should all be regarded as the protection scope of the present invention.

Claims

1. A method for upgrading an energy controller APP, characterized in that Including: Connect to an external USB device, enumerate the USB device in the energy controller system, and generate a USB device node corresponding to the USB device; Access and mount the USB device node according to the USB device node; Start a USB monitoring thread to select an upgrade mode for the energy controller container-side thread and the energy controller host-side thread, where the upgrade mode is an automatic upgrade mode or a liquid crystal upgrade mode; Start the energy controller container-side thread and upgrade the container-side APP according to the upgrade mode; Start the energy controller host-side thread and upgrade the host-side APP according to the upgrade mode; The step of starting the USB monitoring thread to select an upgrade mode for the energy controller container-side thread and the energy controller host-side thread includes: Initialize the state machine for USB device monitoring to the first state; In the first state, detect the USB device node, and when the USB device node is detected, switch the state machine to the second state; In the second state, detect the mounting state of the USB device node. When it is detected that the USB device node is successfully mounted, detect the automatic upgrade directory in the USB device. When the automatic upgrade directory is detected, enter the automatic upgrade mode and switch the state machine to the third state; when the automatic upgrade directory is not detected, enter the liquid crystal upgrade mode and switch the state machine to the fourth state; The automatic upgrade mode includes: In the third state, share the automatic upgrade directory with the energy controller container-side thread and the energy controller host-side thread and start the upgrade task identifier. When the energy controller container-side thread obtains the upgrade script in the automatic upgrade directory, switch the state machine to the fifth state.

2. The upgrade method of the energy controller APP according to claim 1, characterized in that, The step of starting the USB monitoring thread to select an upgrade mode for the energy controller container-side thread and the energy controller host-side thread further includes: When the energy controller container-side upgrade state is the container-side fourth state or the container-side fifth state, and the energy controller host-side upgrade state is the host-side third state or the host-side fourth state, switch the state machine to the sixth state; In the sixth state, unmount the mounting directory of the USB device and switch the state machine to the seventh state; In the seventh state, detect the USB device. When the USB device is not detected, switch the state machine to the first state.

3. The upgrading method of the energy controller APP according to claim 1, characterized in that The step of starting the energy controller container-side thread and upgrading the container-side APP according to the upgrade mode includes: Obtain the upgrade task identifier and switch the container-side upgrade state to the container-side first state; In the container-side first state, obtain the automatic upgrade directory and switch the container-side upgrade state to the container-side second state; when the automatic upgrade directory is not obtained, switch the container-side upgrade state to the container-side fifth state; In the second state on the container side, obtain the upgrade script in the automatic upgrade directory and execute the container-side script function in the upgrade script. After executing the container-side script function, switch the container-side upgrade state to the third state on the container side; the container-side script function is used to upgrade the container-side APP and verify the container-side upgrade result, and the container-side upgrade result includes successful upgrade of the container-side APP and failed upgrade of the container-side APP. In the third state on the container side, obtain the host-side upgrade state until the host-side upgrade state switches to the second state on the host side. If the container-side upgrade result is successful upgrade of the container-side APP, switch the container-side upgrade state to the fourth state on the container side; if the container-side upgrade result is failed upgrade of the container-side APP, switch the container-side upgrade state to the fifth state on the container side.

4. The method for upgrading the energy controller APP according to claim 3, wherein, The steps of starting the host-side thread of the energy controller and upgrading the host-side APP according to the upgrade mode include: Obtain the container-side upgrade state until the container-side upgrade state switches to the third state on the container side. Obtain the automatic upgrade directory and switch the host-side upgrade state to the first state on the host side; when the automatic upgrade directory cannot be obtained, switch the host-side upgrade state to the fourth state on the host side. In the first state on the host side, obtain the upgrade script in the automatic upgrade directory and execute the host-side script function in the upgrade script. After executing the host-side script function, switch the host-side upgrade state to the second state on the host side until the container-side thread obtains the second state on the host side; the host-side script function is used to upgrade the host-side APP and verify the host-side upgrade result, and the host-side upgrade result includes successful upgrade of the host-side APP and failed upgrade of the host-side APP. If the host-side upgrade result is successful upgrade of the host-side APP, switch the host-side upgrade state to the third state on the host side; if the host-side upgrade result is failed upgrade of the host-side APP, switch the host-side upgrade state to the fourth state on the host side.

5. The upgrade method of the energy controller APP according to claim 2, wherein, The LCD upgrade mode includes: In the fourth state, operate the energy controller system to enter the LCD upgrade interface. Operate the energy controller system to initialize the container-side upgrade state and the host-side upgrade state in the LCD upgrade interface to prevent the previous retained upgrade state from affecting the current upgrade. Operate the energy controller system to select the LCD upgrade directory in the USB device in the LCD upgrade interface; among them, after selecting the LCD upgrade directory in the USB device, the USB monitoring thread will share the LCD upgrade directory with the container-side thread and the host-side thread of the energy controller and start the upgrade task identifier. When the container-side thread of the energy controller obtains the upgrade script in the LCD upgrade directory, the state machine will be switched to the fifth state.

6. The method for upgrading the energy controller APP according to claim 5, wherein The steps of starting the container-side thread of the energy controller and upgrading the container-side APP according to the upgrade mode include: Obtain the upgrade task identifier and switch the container - side upgrade status to the first container - side status; In the first container - side status, obtain the LCD upgrade directory and switch the container - side upgrade status to the second container - side status; when the LCD upgrade directory cannot be obtained, switch the container - side upgrade status to the fifth container - side status; In the second container - side status, obtain the upgrade script in the LCD upgrade directory and execute the container - side script function in the upgrade script. After executing the container - side script function, switch the container - side upgrade status to the third container - side status; the container - side script function is used to upgrade the container - side APP and verify the container - side upgrade result, and the container - side upgrade result includes successful container - side APP upgrade and failed container - side APP upgrade; In the third container - side status, obtain the host - side upgrade status until the host - side upgrade status is switched to the second host - side status; If the container - side upgrade result is a successful container - side APP upgrade, switch the container - side upgrade status to the fourth container - side status; if the container - side upgrade result is a failed container - side APP upgrade, switch the container - side upgrade status to the fifth container - side status.

7. The upgrading method of the energy controller APP according to claim 6, characterized in that, The steps of starting the host - side thread of the energy controller and upgrading the host - side APP according to the upgrade mode include: Obtain the container - side upgrade status until the container - side upgrade status is switched to the third container - side status; Obtain the LCD upgrade directory and switch the host - side upgrade status to the first host - side status; when the LCD upgrade directory cannot be obtained, switch the host - side upgrade status to the fourth host - side status; In the first host - side status, obtain the upgrade script in the LCD upgrade directory and execute the host - side script function in the upgrade script. After executing the host - side script function, switch the host - side upgrade status to the second host - side status until the container - side thread obtains the second host - side status; the host - side script function is used to upgrade the host - side APP and verify the host - side upgrade result, and the host - side upgrade result includes successful host - side APP upgrade and failed host - side APP upgrade; If the host - side upgrade result is a successful host - side APP upgrade, switch the host - side upgrade status to the third host - side status; if the host - side upgrade result is a failed host - side APP upgrade, switch the host - side upgrade status to the fourth host - side status.

8. A method for upgrading an energy controller APP, characterized in that, Include: Receive the remote upgrade file; Initialize the container - side upgrade status and the host - side upgrade status to prevent the previous retained upgrade status from affecting the current upgrade; Share the remote upgrade directory with the container - side thread and the host - side thread of the energy controller and start the upgrade task identifier; Start the container - side thread of the energy controller to upgrade the container - side APP; Start the host - side thread of the energy controller to upgrade the host - side APP; When the energy controller container - side upgrade status is the fourth container - side state or the fifth container - side state, and the energy controller host - side upgrade status is the third host - side state or the fourth host - side state, the remote upgrade ends; The steps of starting the energy controller container - side thread for container - side APP upgrade include: Obtain the upgrade task identifier and switch the container - side upgrade status to the first container - side state; In the first container - side state, obtain the remote upgrade directory and switch the container - side upgrade status to the second container - side state; when the remote upgrade directory is not obtained, switch the container - side upgrade status to the fifth container - side state; In the second container - side state, obtain the upgrade script in the remote upgrade directory and execute the container - side script function in the upgrade script. After executing the container - side script function, switch the container - side upgrade status to the third container - side state; the container - side script function is used to upgrade the container - side APP and verify the container - side upgrade result, and the container - side upgrade result includes successful container - side APP upgrade and failed container - side APP upgrade; In the third container - side state, obtain the host - side upgrade status until the host - side upgrade status switches to the second host - side state; If the container - side upgrade result is a successful container - side APP upgrade, switch the container - side upgrade status to the fourth container - side state; if the container - side upgrade result is a failed container - side APP upgrade, switch the container - side upgrade status to the fifth container - side state; The steps of starting the host - side thread for host - side APP upgrade include: Obtain the container - side upgrade status until the container - side upgrade status switches to the third container - side state; Obtain the remote upgrade directory and switch the host - side upgrade status to the first host - side state; when the remote upgrade directory is not obtained, switch the host - side upgrade status to the fourth host - side state; In the first host - side state, obtain the upgrade script in the remote upgrade directory and execute the host - side script function in the upgrade script. After executing the host - side script function, switch the host - side upgrade status to the second host - side state until the container - side thread obtains the second host - side state; the host - side script function is used to upgrade the host - side APP and verify the host - side upgrade result, and the host - side upgrade result includes successful host - side APP upgrade and failed host - side APP upgrade; If the host - side upgrade result is a successful host - side APP upgrade, switch the host - side upgrade status to the third host - side state; if the host - side upgrade result is a failed host - side APP upgrade, switch the host - side upgrade status to the fourth host - side state.

9. The upgrade method of the energy controller APP according to any one of claims 1-8, characterized in that, The energy controller system is a Linux system.

Citation Information

Patent Citations

  • Repeater device and upgrading method thereof

    CN103037405A

  • A system and method for realizing intelligent and automatic upgrading of software based on a multi-thread technology

    CN109766131A