Controller authorization method and controller
By using authorization code matching technology in diesel generator set controllers, the compatibility problem between different models of controller boards is solved, the stability and safety of the system are improved, and equipment damage and safety hazards are avoided.
Patent Information
- Application Number
- CN202411021530.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-29
- Publication Date
- 2024-11-19
AI Technical Summary
The compatibility problems of existing diesel generator set controllers between different models of controller boards may lead to abnormal functions, unstable performance and even equipment damage, especially in critical scenarios such as industrial production and medical equipment.
By generating and matching authorization codes in microcontrollers and peripheral storage modules, we ensure that the controller's microcontroller identification number matches the peripheral storage module identification number, and use XOR operation and MD5 algorithm to generate authorization codes, and establish authorization in the application The structure performs authorization verification to ensure the consistency of authorization codes to ensure the security and stability of the system.
It improves the reliability and accuracy of controller authorization, effectively avoids the safety hazards caused by matching different models of controllers and units, and ensures the stable operation and safety of the system between different models of controllers.
Smart Images

Figure CN118981753A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of controllers, and more specifically, to a controller authorization method and a controller. Background Art
[0002] The diesel generator set controller that currently downloads the program is connected to the controller through the JLINK downloader, reads the program on the controller, and downloads it again to the controller board of other series and different models, and runs normally.
[0003] There are some potential problems and risks in this situation:
[0004] Different models of controller boards may differ in hardware configuration, interface specifications, etc. Although they can operate normally at present, compatibility issues may occur in long-term use or under certain working conditions, such as abnormal functions, unstable performance, or even equipment damage.
[0005] For example, if the memory capacity of the new controller board is smaller than that of the original controller, it may cause a memory overflow error when the program is running. Or, different models of controllers have different electrical characteristics in the input and output interfaces, which may affect the transmission and processing of signals, thus causing system failure.
[0006] In addition, such operations may also violate relevant product quality and safety standards. If these controllers are used in critical scenarios such as industrial production, medical equipment, etc., once problems occur, it may have serious consequences. Summary of the invention
[0007] In view of the deficiencies in the prior art, the present invention innovatively provides a controller authorization method and a controller, which can solve the above-mentioned technical problems existing in the prior art.
[0008] To achieve the above technical objectives, the first aspect of the present invention discloses a controller authorization method, in which an application is downloaded and installed on the controller, and the authorization method includes:
[0009] Data generation: read the identification number on the microcontroller of the controller to generate data A, and read the identification number of the controller peripheral storage module to generate data B;
[0010] Process the data A and the data B to generate an authorization code D, write the authorization code D into the internal storage module of the single-chip microcomputer to form an authorization code D1, write the authorization code D into the external storage module to form an authorization code D2,
[0011] An authorization structure is established in the application, and the authorization code D is stored in the authorization structure to form an authorization code D3;
[0012] Authorization process: the application is restarted, and the authorization code D1, the authorization code D2 and the authorization code D3 are matched. When the authorization match is successful, the program can continue to run, otherwise the authorization fails.
[0013] Furthermore, before the identification number on the single-chip microcomputer of the reading controller is generated into data A, the system clock, serial port and GPIO of the single-chip microcomputer are initialized.
[0014] Further, the processing of the data A and the data B to generate the authorization code D includes:
[0015] Data C is generated by performing an XOR operation on the data A and the data B, and the data C is processed using the MD5 algorithm to generate the authorization code D.
[0016] Furthermore, the authorization structure includes a char*s string, and the string of the authorization code D3 is generated in the authorization structure.
[0017] Furthermore, the authorization structure also stores the data A, data B and unit parameters.
[0018] Furthermore, the unit parameters include: equipment model, time and equipment quantity.
[0019] Furthermore, the restart of the application includes initialization of data saved in the authorization structure.
[0020] Further, the matching of the authorization code D1, the authorization code D2 and the authorization code D3 includes:
[0021] Read the authorization code D1 and match it with the authorization code D3. When the authorization code D1 is consistent with the authorization code D3, read the authorization code D2 again. When the authorization code D2 is consistent with the authorization code D3, it indicates that the authorization is successful.
[0022] When the authorization code D1 or the authorization code D2 is inconsistent with the authorization code D3, the authorization fails.
[0023] Furthermore, when the authorization fails, the application stops running and prompts for authorization operation.
[0024] A second aspect of the present invention discloses a controller for controlling a generator set, and authorization is performed by the controller authorization method described above.
[0025] The beneficial effects of the present invention are:
[0026] The present invention matches authorization codes through a single chip microcomputer and an external storage device, and improves the reliability and accuracy of authorization through the matching of multiple authorization codes, and can effectively avoid potential safety hazards caused by matching multiple controllers of different models with units. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] Figure 1 A flowchart showing a controller authorization method according to an embodiment of the present invention is shown;
[0028] Figure 2 A data generation flow chart of an embodiment of the present invention is shown;
[0029] Figure 3 A schematic diagram of the authorization process according to an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0030] The controller authorization method and the controller provided by the present invention are explained and illustrated in detail below in conjunction with the accompanying drawings of the specification.
[0031] The present invention matches authorization codes through a single-chip microcomputer and an external storage device, and through the matching of multiple authorization codes, improves the reliability and accuracy of authorization, and can effectively avoid the potential safety hazards caused by the matching of multiple controllers of different models with the unit. The present invention is described in detail below in conjunction with specific embodiments:
[0032] According to a first aspect of the present invention, a controller authorization method is provided. In one embodiment, the controller authorization method is used for a generator set, for example, a diesel generator set controller authorization method. The controller downloads and installs an application program, such as Figure 1 As shown, the authorization method includes: data generation and authorization process, generating an authorization code through the data generation step, and completing the authorization by verifying the authorization code in the authorization process. Figure 2 , Figure 3 As shown, the specific steps include:
[0033] Step 1: Read the identification number on the single chip microcomputer of the controller to generate data A, and read the identification number of the peripheral storage module of the controller to generate data B;
[0034] Step 2: Process the data A and data B to generate an authorization code D, write the authorization code D into the internal storage module of the single-chip microcomputer to form an authorization code D1, write the authorization code D into the external storage module to form an authorization code D2, establish an authorization structure in the application, and store the authorization code D into the authorization structure to form an authorization code D3;
[0035] Step 3: The application is restarted, and the authorization code D1, the authorization code D2 and the authorization code D3 are matched. When the authorization match succeeds, the program can continue to run, otherwise the authorization fails.
[0036] The controller includes a single-chip microcomputer and an external storage module (i.e., a peripheral flash chip). In some embodiments, step 1 further includes: initializing the system clock, serial port, and GPIO of the single-chip microcomputer, reading the identification number (Unique ID code) of the single-chip microcomputer, each single-chip microcomputer has a unique identification code, reading the identification number of the single-chip microcomputer and generating data A. Then, the identification number of the controller peripheral storage module is read to generate data B. Optionally, in this embodiment, the identification number is read through an SPI flash (with a serial peripheral interface, Serial Peripheral Interface, SPI).
[0037] In some embodiments, in step 2, processing the data A and data B to generate the authorization code D includes: generating data C by performing an XOR operation on the data A and data B, and processing the data C using the MD5 (Message-Digest Algorithm 5) algorithm to generate the authorization code D.
[0038] The authorization code D is written into the peripheral storage module to form the authorization code D1, written into the internal storage module of the single-chip microcomputer to form the authorization code D2, and written into the application to form the authorization code D3. In this embodiment, an authorization structure is established in the application, and the authorization structure includes a char*s string, and the string for generating the authorization code D3 is stored in the authorization structure. Optionally, in some embodiments, the authorization structure also stores data A, data B and unit parameters, and the unit parameters include the device model, time and number of devices. Through the unit data, it can be obtained how many devices the controller has authorized, when the authorization was made, etc., so that when problems occur, it can be better traced, or the shipment quantity can be recorded to track the shipment quantity, etc.
[0039] In some embodiments, in step 3, the application restart includes powering off and restarting the controller, starting the application, and initializing the external storage module. The data stored in the authorization structure is initialized, all the data stored in it is initialized, and then the authorization code D1, the authorization code D2 and the authorization code D3 are matched, specifically including:
[0040] The authorization code D1 is read and matched with the authorization code D3. When the authorization code D1 is consistent with the authorization code D3, the authorization code D2 is read again. When the authorization code D2 is consistent with the authorization code D3, the authorization is successful. When the authorization code D1 or the authorization code D2 is inconsistent with the authorization code D3, the authorization fails. Optionally, when the authorization fails, the application stops running and prompts for authorization operation.
[0041] According to a second aspect of the present invention, there is provided a controller for controlling a generator set, which is authorized by the controller authorization method described above, and each type of generator set corresponds to a dedicated type of controller.
[0042] In the description of the present invention, it is to be understood that the terms “center”, “longitudinal”, “lateral”, “length”, “width”, “thickness”, “up”, “down”, “front”, “back”, “left”, “right”, “vertical”, “horizontal”, “top”, “bottom”, “inside”, “outside”, “clockwise”, “counterclockwise”, “axial”, “radial”, “circumferential”, etc., indicating orientations or positional relationships based on the orientations or positional relationships shown in the accompanying drawings, are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be understood as limiting the present invention.
[0043] In the present invention, unless otherwise clearly specified and limited, the terms "installed", "connected", "connected", "fixed" and the like should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, it can be the internal connection of two elements or the interaction relationship between two elements, unless otherwise clearly defined. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0044] In the description of this specification, the description with reference to the terms "this embodiment", "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in a suitable manner in any at least one embodiment or example. In addition, those skilled in the art may combine and combine different embodiments or examples described in this specification and the features of different embodiments or examples, unless they are contradictory.
[0045] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In the description of the present invention, the meaning of "plurality" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined.
[0046] The above are only preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent substitutions and simple improvements made to the essential contents of the present invention should be included in the protection scope of the present invention.
Claims
1. A controller authorization method, downloading and installing the application on the controller, It is characterized in that Authorization methods include: Data generation: read the identification number on the microcontroller of the controller to generate data A, and read the identification number of the controller peripheral storage module to generate data B; Process the data A and the data B to generate an authorization code D, write the authorization code D into the internal storage module of the single-chip microcomputer to form an authorization code D1, write the authorization code D into the external storage module to form an authorization code D2, An authorization structure is established in the application, and the authorization code D is stored in the authorization structure to form an authorization code D3; Authorization process: the application is restarted, and the authorization code D1, the authorization code D2 and the authorization code D3 are matched. When the authorization match is successful, the program can continue to run, otherwise the authorization fails.
2. The controller authorization method according to claim 1, It is characterized in that Before the identification number on the single-chip microcomputer of the reading controller is generated into data A, the system clock, serial port and GPIO of the single-chip microcomputer are initialized.
3. The controller authorization method according to claim 1, It is characterized in that The processing of the data A and the data B to generate the authorization code D comprises: Data C is generated by performing an XOR operation on the data A and the data B, and the data C is processed using the MD5 algorithm to generate the authorization code D.
4. The controller authorization method according to claim 1, It is characterized in that The authorization structure includes a char*s string, and the string of the authorization code D3 is generated in the authorization structure.
5. The controller authorization method according to claim 4, It is characterized in that The authorization structure also stores the data A, data B and unit parameters.
6. The controller authorization method according to claim 5, It is characterized in that The unit parameters include: equipment model, time and equipment quantity.
7. The controller authorization method according to claim 6, It is characterized in that The application restart includes initialization of data stored in the authorization structure.
8. The controller authorization method according to claim 1, It is characterized in that The matching of the authorization code D1, the authorization code D2 and the authorization code D3 comprises: Read the authorization code D1 and match it with the authorization code D3. When the authorization code D1 is consistent with the authorization code D3, read the authorization code D2 again. When the authorization code D2 is consistent with the authorization code D3, it indicates that the authorization is successful. When the authorization code D1 or the authorization code D2 is inconsistent with the authorization code D3, the authorization fails.
9. The controller authorization method according to claim 1, It is characterized in that When the authorization fails, the application stops running and prompts for authorization operation.
10. A controller for controlling a generator set, It is characterized in that Authorization is performed through the controller authorization method described in any one of claims 1-9.
