A method and system for a terminal device to communicate with a generator set controller

The communication between the generator set controller and the terminal equipment is achieved through the HTTP protocol and WEBSOCKET connection, which solves the problem of long-distance transmission, simplifies the communication process, improves efficiency and reliability, and adapts to various user environments.

CN115589438BActive Publication Date: 2026-02-27BEIJING CAMPOWER ELECTRIC SCIENCE & TECHNOLOGY CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211189263.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-28
Publication Date
2026-02-27
Estimated Expiration
2042-09-28

AI Technical Summary

Technical Problem

In the existing technology, the communication method between the generator set controller and the terminal equipment cannot meet the requirements of long-distance transmission, and it requires the installation of specific host computer programs and COM ports, which cannot meet the needs of various users.

Method used

Using the HTTP protocol and WEBSOCKET connection, the terminal device accesses the generator set controller's network, initializes the WEBSERVER and WEBSOCKETSERVER, encapsulates data, and sends a WEBSOCKET connection request to realize communication between the generator set controller and the terminal device.

Benefits of technology

It simplifies communication steps, improves communication efficiency, supports long-distance, high-efficiency data transmission, and requires no specific application installation. It is easy to operate, has a reliable connection, and is inexpensive.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115589438B_ABST
    Figure CN115589438B_ABST
Patent Text Reader

Abstract

The present disclosure relates to the field of generator set controller communication technology, and particularly relates to a method and system for terminal equipment to communicate with a generator set controller, the method comprising: initializing a WEBSERVER and a WEBSOCKETSERVER by the generator set controller; accessing a network where the generator set controller is located by the terminal equipment, obtaining an HTML login page and a JS script of the generator set controller through the WEBSERVER, logging in and connecting to the WEBSOCKETSERVER; establishing a new connection and performing listening by the generator set controller, sending data required by a page according to different HTML pages currently browsed by the WEBSOCKET; and if the page currently browsed by the WEBSOCKET is a quick guide or a unit configuration page, sending a general statement to the generator set controller. By using the present disclosure, the communication efficiency of the generator set controller can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present disclosure relates to the technical field of generator set controller communication, in particular to a method and system for terminal device and generator set controller communication. BACKGROUND

[0002] Currently, the communication between the generator set controller and the host computer (or terminal device) is generally performed by USB, RS485, RS232, MODBUS TCP / IP, CAN (Controller Area Network) and other methods. However, the three communication methods of USB, RS485 and RS232 cannot meet the needs of long-distance transmission, so they cannot meet the needs of long-distance communication in scenarios such as trains and factory areas. MODBUS TCP / IP and CAN can perform long-distance high-speed data transmission, but the above methods need to install a specific host computer program on the PC when used, and the PC needs to have a COM port. If there is no COM port, a converter is needed, which is very inconvenient and cannot meet the needs of various users. SUMMARY

[0003] In order to solve the problems of the prior art, the embodiments of the present disclosure provide a method and system for terminal device and generator set controller communication. The technical solution is as follows:

[0004] According to an aspect of the present disclosure, a method for terminal device and generator set controller communication is provided, which comprises:

[0005] S1, the generator set controller initializes WEBSERVER and WEBSOCKETSERVER, and encapsulates the data to be sent into a sending list according to a preset format;

[0006] S2, the terminal device accesses the network where the generator set controller is located, requests the initialized WEBSERVER through the HTTP protocol to obtain the HTML login page and JS script of the generator set controller, logs in, and connects to the initialized WEBSOCKETSERVER to send a WEBSOCKET connection request to the generator set controller;

[0007] S3, after the generator set controller receives the WEBSOCKET connection request of the terminal device, a new connection is established and listening is performed;

[0008] S4, the generator set controller sends the required data of the page in the sending list to the WEBSOCKET according to the different HTML pages currently browsed by the WEBSOCKET;

[0009] S5, if the WEBSOCKET currently browsed page is a quick guide or a generator set configuration page, a general statement is sent to the generator set controller to modify the parameters of the generator set controller.

[0010] According to another aspect of the present disclosure, a system for a terminal device to communicate with a generator set controller is provided, which is used to perform the above-mentioned method for a terminal device to communicate with a generator set controller, and the system comprises a generator set controller, a terminal device, a WEBSERVER and a WEBSOCKET SERVER, wherein:

[0011] The generator set controller is configured to initialize the WEBSERVER and the WEBSOCKET SERVER, encapsulate the data to be sent into a sending list according to a preset format, establish a new connection and perform listening after receiving the WEBSOCKET connection request of the terminal device, and send the required data of the page in the sending list to the WEBSOCKET according to different HTML pages currently browsed by the WEBSOCKET.

[0012] The terminal device is configured to access the network where the generator set controller is located, request the initialized WEBSERVER through an HTTP protocol to obtain the HTML login page and JS script of the generator set controller, perform login, connect to the initialized WEBSOCKET SERVER, send a WEBSOCKET connection request to the generator set controller, and send a general statement to the generator set controller to modify the parameters of the generator set controller if the WEBSOCKET currently browsed page is a quick guide or a generator set configuration page.

[0013] The WEBSERVER is configured to obtain the HTML login page and JS script of the generator set controller.

[0014] The WEBSOCKET SERVER is configured to send a WEBSOCKET connection request to the generator set controller.

[0015] According to another aspect of the present disclosure, an electronic device is provided, which comprises:

[0016] a processor; and

[0017] a memory storing a program,

[0018] wherein the program comprises instructions which, when executed by the processor, cause the processor to perform the above-mentioned method for a terminal device to communicate with a generator set controller.

[0019] According to another aspect of the present disclosure, there is provided a computer program product comprising a computer program which, when executed by a processor, implements the method of communication between a terminal device and a generator set controller as described above.

[0020] The one or more technical solutions provided in the embodiments of the present application can be connected and accessed using a terminal device with network function at any time and anywhere, without the need to install specific application programs, greatly simplifying the steps and conditions required for establishing communication, and improving the communication efficiency. BRIEF DESCRIPTION OF DRAWINGS

[0021] More details, features and advantages of the present disclosure are disclosed in the following description of exemplary embodiments in conjunction with the accompanying drawings, in which:

[0022] Figure 1 A flow chart of a method of communication between a terminal device and a generator set controller according to an exemplary embodiment of the present disclosure is shown;

[0023] Figure 2 A flow chart of a method of communication between a terminal device and a generator set controller according to an exemplary embodiment of the present disclosure is shown;

[0024] Figure 3 A schematic block diagram of a system for communication between a terminal device and a generator set controller according to an exemplary embodiment of the present disclosure is shown;

[0025] Figure 4 A structural block diagram of an exemplary electronic device that can be used to implement embodiments of the present disclosure is shown. DETAILED DESCRIPTION

[0026] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments set forth herein, but rather the embodiments are provided to make the disclosure more thorough and complete. It should be understood that the drawings and embodiments of the present disclosure are for exemplary purposes only and are not intended to limit the scope of protection of the present disclosure.

[0027] It should be understood that each of the steps recited in the method embodiments of the present disclosure can be executed in different orders and / or in parallel. In addition, the method embodiments can include additional steps and / or omit the execution of the steps shown. The scope of the present disclosure is not limited in this respect.

[0028] As used herein, the term "includes" and its variants are to be read to be analogous to "comprises," or "comprising." The term "based on" is to be read as "based, at least in part, on." The term "one embodiment" means "at least one embodiment." The term "another embodiment" means "at least one additional embodiment." The term "some embodiments" means "at least some embodiments." Related terms have analogous meanings. It is noted that the use of "first," "second," etc., in the present disclosure is solely to differentiate one embodiment from another, and is not meant to limit the order of the functions performed by the embodiments.

[0029] It is noted that the terms "one," "multiple," and the like in the present disclosure are illustrative and not limiting, and those skilled in the art will understand that "one" or "a" should be interpreted as "one or more" unless the context clearly indicates otherwise.

[0030] The names of the messages or information exchanged between the plurality of devices in the embodiments of the present disclosure are only for illustrative purposes, and are not intended to limit the scope of the messages or information.

[0031] The following refers to the accompanying drawings, which are included to provide a further understanding of the disclosure and are incorporated in and constitute a part of this specification. Figure 1 A method for a terminal device to communicate with a generator set controller is described. The method can be implemented by a system for a terminal device to communicate with a generator set controller. The system includes a generator set controller and a terminal device. The terminal device is a network-capable electronic device, such as a mobile phone, a computer, a tablet computer, a server, etc. The method includes the following steps:

[0032] S1, the generator set controller initializes WEBSERVER and WEBSOCKETSERVER, and encapsulates the data to be sent into a sending list according to a preset format.

[0033] The WEBSERVER is also known as a web server in Chinese, and can parse the HTTP (HyperText Transfer Protocol) protocol. Therefore, the WEBSERVER can be used to process HTTP requests. The WEBSOCKETSERVER can be used to send data, respond to general statements, and respond to inquiry statements.

[0034] The sending list can include state indication data, timer data, engine data, sensor data, mains data, power generation data, load data, alarm data, input port data, output port data, historical data, version data, and configuration data.

[0035] In one possible implementation, after the generator set controller initializes the WEBSERVER and WEBSOCKETSERVER, it can wait for a connection request from a terminal device. Alternatively, the method for initializing the WEBSERVER and WEBSOCKETSERVER by the generator set controller in S1 can be as follows:

[0036] An object my_websocket of the websocketservermanager class is defined, and the object my_websocket is instantiated.

[0037] The websocketservermanager class has the following methods: creating a SOCKET and listening, closing a SOCKET, establishing a new connection, disconnecting, sending data, and receiving data.

[0038] Alternatively, when encapsulating the data to be sent, the data can be encapsulated in the following string format:

[0039] “$CT Type, device model, 1, data content, <cr> <lf>"

[0040] In the above string format, the type is the uppercase English abbreviation of the data type in the sending list (such as EDD for engine data); the device model is the model of the device corresponding to the data; and the data content is the specific content of the data to be sent. If the data content field contains multiple data, the data is arranged in a fixed order, and each data is separated by a comma, for example, the rotation speed, the oil pressure, the water temperature, and the like.

[0041] S2, the terminal device accesses the network where the generator set controller is located, and requests the initialized WEBSERVER to obtain the HTML login page and JS script of the generator set controller through the HTTP protocol, logs in, and connects to the initialized WEBSOCKETSERVER to send a WEBSOCKET connection request to the generator set controller.

[0042] The WebSocket is a new persistent protocol under HTML5, which stipulates a communication specification. Through a handshake mechanism, a connection similar to TCP can be established between the client and the server, so as to facilitate the communication between them. It realizes full-duplex communication between the browser and the server, can better save server resources and bandwidth, and achieves the purpose of real-time communication.

[0043] In a feasible implementation, HTML (Hyper Text Markup Language) and JS (JavaScript, a lightweight, interpreted or just-in-time compiled programming language with function priority) are deployed in the NAND (Non-volatile Memory Device) of the generator set controller in advance. When the terminal device accesses the network where the generator set controller is located, it can access the network where the generator set controller is located through wired, wireless or routing.

[0044] After accessing the network, the terminal device opens the browser, inputs the address of the generator set controller in the browser for sending. In this way, the browser can send an acquisition request based on the HTTP protocol to the WEBSERVER. The acquisition request at least includes the Web name and port number in the URL (Uniform Resource Locator) of the login page of the generator set controller and other information. After receiving the acquisition request, the WEBSERVER sends the HTML login page and JS script of the generator set controller to the terminal device.

[0045] The terminal device receives and displays an HTML login page of the generator set controller, a user can input user information through the HTML login page displayed by the terminal device to log in, and after successful login, automatically connects to the WEBSOCKET SERVER.

[0046] S3, after the generator set controller receives the WEBSOCKET connection request of the terminal device, establishes a new connection and listens.

[0047] Optionally, the step of establishing a new connection and listening in S3 can include steps S31-S34.

[0048] S31, after the generator set controller receives the WEBSOCKET connection request of the terminal device, saves the WEBSOCKET descriptor to establish a new connection.

[0049] S32, insert the WEBSOCKET descriptor of the new connection into the HASH table to maintain multiple connections at the same time.

[0050] Wherein, the HASH table is established with IP address and port as key value, so as to facilitate the search.

[0051] S33, listen to whether there is new message to the new connection.

[0052] S34, listen to whether the new connection is disconnected, if disconnected, remove the descriptor of the new connection from the HASH table.

[0053] S4, the generator set controller sends the required data of the page in the sending list to the WEBSOCKET according to the different HTML pages currently browsed by the WEBSOCKET.

[0054] In a feasible implementation, different HTML pages can be divided into monitoring pages and other pages, if the currently browsed page is a monitoring page, the generator set controller determines the required data of the monitoring page in the sending list, and sends the required data to the new connection once a second, to ensure the real-time of the monitoring page; if the currently browsed page is other page, the real-time of the page does not need to be considered, therefore, the generator set controller determines the required data of the page in the sending list, and only sends the required data once when the connection is established.

[0055] Wherein, the required data of the monitoring page includes generator data, load data, mains data, engine data, state indication data and version data; the required data of other pages can include configuration data, version data and historical data according to the display content of different pages.

[0056] S5, if the page currently browsed by the WEBSOCKET is the quick guide or the generator set configuration page, a general statement is sent to the generator set controller to modify the parameters of the generator set controller.

[0057] In an available implementation, when the user wants to modify the generator set controller through the terminal device, the quick guide or the generator set configuration page can be browsed through the terminal device, and the quick guide or the generator set configuration page is a page set by the user in advance, so that when the WEBSOCKET identifies that the page currently browsed is the quick guide or the generator set configuration page, the general statement can be actively sent to the generator set controller.

[0058] Optionally, the general statement can include a timer setting, an engine setting, a generator setting, a mains setting, a load setting, a switch setting, an input port setting, an output port setting, a sensor setting, a basic setting, and a maintenance setting.

[0059] Optionally, the string format of the general statement can be as follows:

[0060] " $-- configuration type, device model, 1, parameter content, <cr> <lf>"

[0061] The configuration type is written in lowercase English (e.g., engine is set to edd). If the parameter content contains multiple parameters, the parameters are arranged in a fixed order, and each parameter is separated by a comma, for example: engine type, number of engine teeth, rated speed, ...

[0062] After receiving the general statement, the generator set controller modifies the corresponding parameters according to the configuration type and parameter content in the general statement.

[0063] Optionally, S2 to S5 can be repeated to establish multiple connections to access the generator set controller simultaneously.

[0064] In one feasible implementation, multiple terminal devices can simultaneously access the generator set controller, such as... Figure 2 The flowchart shown ( Figure 2 In this document, the generator set controller is abbreviated as controller. Device 1, Device 2, ..., Device n can simultaneously establish a connection with the generator set controller. The connection establishment process of each terminal device can refer to the above steps S2 to S5, which will not be elaborated here.

[0065] This invention enables communication between the generator set controller and the network terminal via WEBSOCKET. Users can connect and access the network anytime, anywhere using any network-enabled terminal device, without needing to install any specific application. This greatly simplifies the steps and conditions required to establish communication and improves communication efficiency. Furthermore, multiple connections can be established simultaneously within the same network, further enhancing work efficiency. The invention combines the advantages of long communication distance, high speed, and large data volume with the advantages of simple operation, low latency, reliable connection, and low cost. It is scientifically sound, practical, and highly adaptable to various environments.

[0066] This disclosure provides a system for communication between a terminal device and a generator set controller, which implements the aforementioned method for communication between the terminal device and the generator set controller. Figure 3 The diagram shows a schematic block diagram of a device for communication between a terminal device and a generator set controller. The system includes a generator set controller 310, a terminal device 320, a web server 330, and a web socket server 340, wherein:

[0067] The generator set controller 310 is configured to initialize a WEB SERVER and a WEB SOCKET SERVER, encapsulate data to be sent into a sending list according to a preset format, establish a new connection and perform listening after receiving a WEB SOCKET connection request of the terminal device, and send required data of a page in the sending list to the WEB SOCKET according to a different HTML page currently browsed by the WEB SOCKET.

[0068] The terminal device 320 is configured to access a network where the generator set controller is located, request an HTML login page and a JS script of the generator set controller from the initialized WEB SERVER through an HTTP protocol, perform login, and connect to the initialized WEB SOCKET SERVER to send a WEB SOCKET connection request to the generator set controller.

[0069] The WEB SERVER 330 is configured to obtain an HTML login page and a JS script of the generator set controller.

[0070] The WEB SOCKET SERVER 340 is configured to send a WEB SOCKET connection request to the generator set controller.

[0071] Optionally, the sending list includes state indication data, timer data, engine data, sensor data, mains data, power generation data, load data, alarm data, input port data, output port data, historical data, version data and configuration data.

[0072] Optionally, the generator set controller 310 is further configured to:

[0073] An object my_websocket of a websocketservermanager class is defined, and the object my_websocket is instantiated.

[0074] Optionally, the terminal device 320 is further configured to:

[0075] The terminal device accesses the network where the generator set controller is located in a wired, wireless or routing manner.

[0076] Optionally, the generator set controller 310 is further configured to:

[0077] S31, after receiving the WEBSOCKET connection request of the terminal device, save the WEBSOCKET descriptor to establish a new connection;

[0078] S32, insert the WEBSOCKET descriptor of the new connection into the HASH table to maintain multiple connections simultaneously;

[0079] S33, monitor whether there is a new message to the new connection;

[0080] S34, monitor whether the new connection is disconnected, and if so, remove the descriptor of the new connection from the HASH table.

[0081] Optionally, the general statements include timer settings, engine settings, generator settings, city power settings, load settings, switch settings, input port settings, output port settings, sensor settings, basic settings, and maintenance settings.

[0082] Optionally, the terminal device 320 is further configured to:

[0083] S6, repeat S2 to S5 to establish multiple connections to access the generator controller simultaneously.

[0084] The present disclosure realizes the communication between the generator controller and the network terminal through WEBSOCKET, and the terminal with network function can be connected and accessed anytime and anywhere without installing specific application programs, greatly simplifying the steps and conditions required for establishing communication and improving the communication efficiency; and in the same network, multiple connections can be established to access simultaneously, improving the work efficiency. The present disclosure has the advantages of long communication distance, high speed, large data volume, simple operation, low delay, reliable connection, and low price, and has the advantages of scientificity, practicality, and strong adaptability to the environment.

[0085] Reference Figure 4 The structural block diagram of an electronic device 400 that can be a server or a client of the present disclosure will now be described, which is an example of a hardware device that can be applied to various aspects of the present disclosure. The electronic device is intended to represent various forms of digital electronic computing devices, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections, and relationships, and their functions, are merely examples and are not intended to limit implementations of the present disclosure described and / or claimed herein.

[0086] As Figure 4 As shown, the electronic device 400 includes a computing unit 401 that can perform various appropriate actions and processes in accordance with a computer program stored in a read-only memory (ROM) 402 or a computer program loaded into a random access memory (RAM) 403 from a storage unit 408. In the RAM 403, various programs and data required for the operation of the device 400 can also be stored. The computing unit 401, the ROM 402, and the RAM 403 are connected to each other through a bus 404. An input / output (I / O) interface 405 is also connected to the bus 404.

[0087] A plurality of components in the electronic device 400 are connected to the I / O interface 405, including an input unit 406, an output unit 407, a storage unit 408, and a communication unit 409. The input unit 406 can be any type of device that can input information to the electronic device 400, and can receive inputted digital or character information, and generate key signal inputs related to user settings and / or function controls of the electronic device. The output unit 407 can be any type of device that can present information, and can include, but is not limited to, a display, a speaker, a video / audio output terminal, a vibrator, and / or a printer. The storage unit 404 can include, but is not limited to, a magnetic disk, an optical disk. The communication unit 409 allows the electronic device 400 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks, and can include, but is not limited to, a modem, a network card, an infrared communication device, a wireless communication transceiver, and / or a chipset, such as a Bluetooth™ device, a WiFi device, a WiMax device, a cellular communication device, and / or the like.

[0088] The computing unit 401 can be various general and / or special purpose processing components having processing and computing capabilities. Some examples of the computing unit 401 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The computing unit 401 performs various methods and processes described above. For example, in some embodiments, the above-described method of a terminal device communicating with a generator set controller can be implemented as a computer software program tangibly embodied in a machine-readable medium, such as the storage unit 408. In some embodiments, part or all of the computer program can be loaded and / or installed onto the electronic device 400 via the ROM 402 and / or the communication unit 409. In some embodiments, the computing unit 401 can be configured to perform the above-described method of a terminal device communicating with a generator set controller by any other appropriate means, such as by means of firmware.

[0089] Program code for carrying out methods of the present disclosure can be written in any combination of one or more programming languages. The program code can be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the program code, when executed by the processor or controller, produces the functions / operations specified in the flowcharts and / or block diagrams. The program code can be embodied entirely on a machine, partially on a machine, fully on a machine, partially on a machine and partially on a remote machine, or fully on a remote machine or server.

[0090] In the context of the present disclosure, a machine-readable medium can be a tangible medium that contains or stores a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of the machine-readable storage medium would include a lined- based system, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0091] As used in the present disclosure, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, apparatus and / or device (e.g., magnetic discs, optical disks, memory, Programmable Logic Devices (PLDs)) used to provide machine instructions and / or data to a programmable processor, including a machine-readable medium that receives machine instructions as a machine-readable signal. The term "machine-readable signal" refers to any signal that can be used to provide machine instructions and / or data to a programmable processor.

[0092] To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the computer. Other kinds of devices can be used to provide for interaction with a user as well; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form, including acoustic, speech, or tactile input.

[0093] The systems and techniques described here can be implemented in a computing system that includes a back end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front end component (e.g., a user computer having a graphical user interface or a Web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back end, middleware, or front end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network (LAN), a wide area network (WAN), and the Internet.

[0094] The computing system can include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other.< / lf> < / cr> < / lf> < / cr>

Claims

1. A method of a terminal device communicating with a generator set controller, characterized by, The method comprises: S1, the generator set controller initializes WEBSERVER and WEBSOCKETSERVER, and encapsulates data to be sent into a sending list according to a preset format; S2, the terminal device accesses a network in which the generator set controller is located, requests the initialized WEBSERVER to obtain an HTML login page and a JS script of the generator set controller through an HTTP protocol, logs in, and connects to the initialized WEBSOCKETSERVER to send a WEBSOCKET connection request to the generator set controller; Wherein, the method for requesting the initialized WEBSERVER to obtain the HTML login page and the JS script of the generator set controller through the HTTP protocol comprises: after accessing the network, the terminal device opens a browser, inputs an address of the generator set controller in the browser to send, and sends a request for obtaining to the WEBSERVER based on the HTTP protocol through the browser, wherein the request for obtaining at least includes a Web name and a port number in a URL of the login page of the generator set controller and other information, and after the WEBSERVER receives the request for obtaining, the WEBSERVER sends the HTML login page and the JS script of the generator set controller to the terminal device; S3, after the generator set controller receives the WEBSOCKET connection request of the terminal device, a new connection is established and listening is performed; S4, the generator set controller sends page required data in the sending list to the WEBSOCKET according to different HTML pages currently browsed by the WEBSOCKET; S5, if the page currently browsed by the WEBSOCKET is a quick wizard or a unit configuration page, the terminal device sends a general statement to the generator set controller to modify parameters of the generator set controller.

2. The method of claim 1, wherein the terminal device communicates with the generator set controller by, The sending list comprises state indication data, timer data, engine data, sensor data, mains data, power generation data, load data, alarm data, input port data, output port data, historical data, version data and configuration data.

3. The method of claim 1, wherein the terminal device communicates with the generator set controller by, The WEBSERVER and the WEBSOCKETSERVER of the generator set controller in S1 comprise: An object my_websocket of a websocketservermanager class is defined, and the object my_websocket is instantiated.

4. The method of claim 1, wherein the terminal device communicates with the generator set controller by, The terminal device accesses the network in which the generator set controller is located in S2, which comprises: The terminal device accesses the network in which the generator set controller is located through a wired, wireless or routing manner.

5. The method of claim 1, wherein the terminal device communicates with the generator set controller by, After the generator set controller receives the WEBSOCKET connection request of the terminal device in S3, a new connection is established and listening is performed, which comprises: S31, after the generator set controller receives the WEBSOCKET connection request of the terminal device, saves the WEBSOCKET descriptor to establish a new connection; S32, inserts the WEBSOCKET descriptor of the new connection into a HASH table to maintain multiple connections at the same time; S33, listens to whether there is a new message to the new connection; S34, listens to whether the new connection is disconnected, and if so, removes the descriptor of the new connection from the HASH table.

6. The method of claim 1, wherein the terminal device communicates with the generator set controller by, The general statements include timer settings, engine settings, generator settings, power settings, load settings, switch settings, input port settings, output port settings, sensor settings, basic settings, and maintenance settings.

7. The method of claim 1, wherein the terminal device communicates with the generator set controller by, The method further comprises: S6, repeatedly performing S2 to S5 to establish multiple connections to access the generator set controller at the same time.

8. A system for a terminal device to communicate with a generator set controller, the system comprising: The system for communication between the terminal device and the generator set controller is used to perform the method for communication between the terminal device and the generator set controller according to any one of claims 1-7, and the system comprises a generator set controller, a terminal device, a WEBSERVER, and a WEBSOCKETSERVER, wherein: The generator set controller is configured to initialize the WEBSERVER and the WEBSOCKETSERVER, encapsulate data to be sent into a sending list according to a preset format, after receiving a WEBSOCKET connection request of the terminal device, establish a new connection and listen to it, and send data required by a page in the sending list to the WEBSOCKET according to a different HTML page currently browsed by the WEBSOCKET; The terminal device is configured to access a network where the generator set controller is located, request the initialized WEBSERVER through an HTTP protocol to obtain an HTML login page and a JS script of the generator set controller, log in, connect to the initialized WEBSOCKETSERVER, and send a WEBSOCKET connection request to the generator set controller; if a page currently browsed by the WEBSOCKET is a quick wizard or a generator set configuration page, send general statements to the generator set controller to modify parameters of the generator set controller; wherein the request of the initialized WEBSERVER through the HTTP protocol to obtain the HTML login page and the JS script of the generator set controller comprises: after accessing the network, the terminal device opens a browser, inputs an address of the generator set controller in the browser to send, and sends a request for acquisition to the WEBSERVER based on the HTTP protocol through the browser, wherein the request for acquisition at least includes information such as a Web name and a port number in a URL of the login page of the generator set controller, and the WEBSERVER sends the HTML login page and the JS script of the generator set controller to the terminal device after receiving the request for acquisition; The WEBSERVER is configured to acquire an HTML login page and a JS script of the generator set controller. The WEBSOCKET SERVER is configured to send a WEBSOCKET connection request to the generator set controller. 9.An electronic device comprising: a processor; and a memory storing a program, wherein the program includes instructions that, when executed by the processor, cause the processor to perform the method according to any one of claims 1-7.

10. A non-transitory computer readable storage medium having stored thereon computer instructions, wherein, The computer instructions are configured to cause a computer to perform the method according to any one of claims 1-7.

Citation Information

Patent Citations

  • Method and system for monitoring equipment in real time through browser, and server

    CN108667861A

  • Data control method and device, electronic equipment and storage medium

    CN110474980A