A multi-protocol compatible client simulator and a method for building a multi-protocol charging server
By designing a multi-protocol-compatible client emulator, the cumbersome problem of charging server and communication protocol connection is solved, and the communication protocol is quickly and stably accessed and upgraded, improving development efficiency and user experience.
Patent Information
- Application Number
- CN202211288427.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-20
- Publication Date
- 2025-01-03
- Estimated Expiration
- 2042-10-20
AI Technical Summary
The charging server and communication protocol docking process is cumbersome and inefficient, and requires rapid and stable access and upgrade of new communication protocols to meet the changing user needs.
Design a multi-protocol-compatible client simulator, including data import module, logic abstract module, protocol analysis module and test case module, to build a charging server by simulating the sending of data packets by charging equipment, supporting multiple communication protocols and logic abstraction and extension.
It realizes rapid and stable access and upgrade of communication protocols on the charging server, simplifies the docking process, and improves development efficiency and user experience.
Smart Images

Figure CN115766904B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of new energy technology, and in particular to a multi-protocol compatible client simulator and a method for constructing a multi-protocol charging server. Background Art
[0002] At present, there are many charging equipment manufacturers, communication protocols are not unified, and interoperability cannot meet some specific needs. There is no national standard for communication protocols. At the same time, the charging service end needs to obtain real-time status information, parameter information, billing information and other data of the charging equipment to control the charging equipment. After the electric vehicle is connected to the charging equipment, it also needs to start and end charging through the charging service end. Therefore, it is necessary for the charging service end to achieve compatibility with multiple protocols.
[0003] In the prior art, the charging service end often uses the traditional docking method to connect to the communication protocol, that is, first build the charging environment, then let the charging equipment connect to the charging service end, and the charging service end developer will then develop and test the method. Therefore, the current way of connecting the charging service end with the communication protocol is cumbersome and inefficient, and the charging service end is inevitably updated iteratively in order to optimize the user experience and meet new user needs. At the same time, the update and expansion of the communication protocol must also be considered. Therefore, the programming of the charging service end must be able to quickly and stably access the new communication protocol, and also stably upgrade the already implemented communication protocol and the existing service logic. Summary of the invention
[0004] The present invention aims to provide a multi-protocol compatible client simulator and a method for constructing a multi-protocol charging server, so as to solve the technical problem that the current method of connecting the charging server with the communication protocol is complicated and inefficient.
[0005] In order to solve the above technical problems, the specific scheme adopted by the present invention is: a multi-protocol compatible client simulator, including a data import module, a logic abstraction module, a protocol parsing module, a data transmission module and a test case module; the data import module is used to import communication protocols and charging equipment parameters; the logic abstraction module is used to abstract the control words or control logic of different communication protocols into common logic; the protocol parsing module splices the common logic transmitted by the logic abstraction module into original data packets and passes it to the data transmission module, parses the received reply data packets according to their corresponding protocols, and distributes the parsed control words and data to the logic abstraction module; the data transmission module is used to receive the original data packets transmitted by the protocol parsing module and send them to the charging server, receive the reply data packets sent by the charging server and pass them to the protocol parsing module; the test case module can construct test cases according to the functions that need to be tested by the charging server, combined with the common logic obtained in the logic abstraction module.
[0006] As a further optimization of the above technical solution, the charging device parameter information includes but is not limited to a charging device identifier, the number of charging interfaces or a charging user identity.
[0007] As a further optimization of the above technical solution, the logic abstraction module is extensible and protocol-independent.
[0008] As a further optimization of the above technical solution, the general logic includes but is not limited to login, heartbeat, status, behavior control, rate, information synchronization or settlement.
[0009] A method for constructing a multi-protocol charging server based on the above-mentioned client simulator comprises the following steps:
[0010] S1. Configure multiple communication protocols to the client simulator;
[0011] S2. Configuring charging device parameter information to the client simulator as a simulated charging device;
[0012] S3. Select the number of simulated charging devices and the communication protocol corresponding to the simulated charging devices on the client simulator;
[0013] S4. Edit and simulate the actions of using the charging device on the client simulator or edit the control operations according to the needs of the charging server, and then send the original data message to the charging server according to these operations, receive the reply data message returned by the charging server, translate and display the original data message in the reply data message as the basis for judging the correctness of the charging server, and record the message response time to judge the performance of the charging server to drive the development of the charging server.
[0014] According to further optimization of the above technical solution, the format of the communication protocol imported into the client simulator in step S1 includes but is not limited to json, XML or excel.
[0015] According to further optimization of the above technical solution, the message response time is the time from when the original message is sent to when the reply data message is received.
[0016] According to further optimization of the above technical solution, the actions of simulating the use of the charging device in step S4 include login operation, charging operation, gun insertion and gun removal operations; the control operation includes sending login and maintaining heartbeat after successful login.
[0017] According to further optimization of the above technical solution, the selection of the communication protocol in step S3 includes selecting the logic of the communication protocol in the logic abstraction module through the test case module according to the functions that need to be tested by the charging service end, and assembling them into different test cases.
[0018] Compared with the prior art, the beneficial effects of the present invention are as follows: the present invention constructs a charging server based on a multi-protocol compatible client simulator that simulates the sending of data messages by a charging device, and drives the development of the charging server by simulating different communication protocol formats and simulating different logical timings, so that the charging server can quickly and stably access new communication protocols, upgrade already implemented communication protocols and existing service logic. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 It is the layered structure diagram of the client simulator;
[0020] Figure 2 A flowchart of a method for building a multi-protocol charging server;
[0021] Figure 3 It is a schematic diagram for describing the protocol extension in the logic abstraction module;
[0022] Figure numerals: 201, data transmission layer, 202, protocol layer, 203, logic abstraction layer, 204, use case layer, 205, charging service end. DETAILED DESCRIPTION
[0023] The present invention is a multi-protocol compatible client simulator and a method for constructing a multi-protocol charging server. The method for constructing a multi-protocol charging server is to use a client simulator to simulate the logic of a charging device and send a pre-set data message to the charging server 205 to develop the charging server 205.
[0024] like Figure 1 As shown, the client simulator includes a data import module, a logic abstraction module, a protocol parsing module, a data transmission module and a test case module; wherein the data transmission module is located at the data transmission layer 201, the protocol parsing module and the data import module are located at the protocol layer 202, the logic abstraction module is located at the logic abstraction layer 203, and the test case module is located at the case layer 204.
[0025] The data import module is used to import communication protocols and charging equipment parameters. The data import module must at least include the import of communication protocols and the import of charging equipment related parameter information, and the imported communication protocols are multiple. The communication protocol is imported in the following way: the communication protocol is imported into the data import module of the client simulator in a fixed format. The content of the imported communication protocol at least includes the complete frame format specified by the communication protocol. All operation codes and their data lengths in the communication protocol are encapsulated into a fixed file format (such as: json, XML, excel), etc., which can be implemented as needed, and then the corresponding format interface is provided on the client simulator, so as to import the communication protocol into the data import module of the client simulator. After the import, the protocol can be identified by the protocol parsing module in the subsequent links. The charging equipment parameter information is imported in the following way: the charging equipment identifier, the number of charging interfaces, the charging user identity and other data are edited into a fixed file format and imported into the data import module of the client simulator. Then the logic in the logic abstraction module can use these imported charging equipment parameter information to perform related operations.
[0026] The logic abstraction module is used to abstract the control words or control logic of different communication protocols into common logic. Since the logics to be expressed in different communication protocols are similar, such as login, heartbeat, status, behavior control, rate, information synchronization, settlement, etc., the control words (or control logic) of different communication protocols can be abstracted into a common logic. The abstracted common logics such as login, heartbeat, status, behavior control, rate, information synchronization, settlement, etc., perform the same processing on the same common logic.
[0027] The logic layer is extensible and protocol-independent. Extensibility means that one or more new logics can be added at any time. The purpose of protocol-independence is to be compatible with multiple protocols. For example, protocol A and protocol B both have behavior control logic, and protocol C itself does not support behavior control. Then, after the behavior control logic is passed to the logic abstraction layer, it will be judged according to its protocol. If it is supported, the message will be spliced and passed to the data transmission module. If it is not supported, it will not be processed. The process is shown in Figure 3 The data used by the logic is the charging equipment parameter information imported from the data import module.
[0028] The protocol parsing module splices the common logic sent by the logic abstraction module into the original data message and passes it to the data transmission module, parses the received reply data message according to its corresponding protocol, and distributes the parsed control words and data to the logic abstraction module;
[0029] The data transmission module is used to receive the original data message from the protocol analysis module and send it to the charging server 205, receive the reply data message sent by the charging server 205 and pass it to the protocol analysis module;
[0030] The test case module can construct test cases based on the functions that need to be tested by the charging server 205 and the general logic obtained in the logic abstraction module. The logic in the logic abstraction layer is set and used according to the functions that need to be tested by the charging server 205 and assembled into different test cases.
[0031] A method for constructing a multi-protocol charging server based on the above client simulator, the implementation method is as follows Figure 2 The following are shown in sequence: S1. configuring multiple communication protocols to the client simulator. Multiple communication protocols refer to communication protocols of different charging equipment manufacturers. The formats of the communication protocols imported into the client simulator include but are not limited to json, XML and excel;
[0032] S2. Configuring charging device parameter information to the client simulator as a simulated charging device, the charging device parameter information including but not limited to: charging device identifier, number of charging ports, and charging user identity;
[0033] S3. Select the number of simulated charging devices and the communication protocol corresponding to the simulated charging devices on the client simulator;
[0034] S4. Edit and simulate the actions of using the charging device on the client simulator or edit the control operations according to the needs of the charging server, then send the original data message to the charging server according to these operations, receive the reply data message returned by the charging server, translate and display the original data message in the reply data message as the basis for judging the correctness of the charging server, and record the message response time to judge the performance of the charging server, and drive the development of the charging server. Specifically: edit and simulate the login operation, charging operation, gun insertion and extraction operation and other possible actions of the charging device on the client simulator, or edit the required operations and quantity according to the needs of the charging server, and then send the original data message to the charging server according to the order and quantity of these edited operations, receive the reply data message returned by the server, translate and display the original data message and the key information therein, as the basis for judging the correctness of the charging server, and record and display the time from sending this message to receiving the reply from the server, that is, its message response time, as the basis for judging the performance of the charging server, and drive the development of the server based on this client simulator.
[0035] A specific example is: first edit protocols A, B, C, and D into json format and import them into the client simulator, then import the charging device identifier, number of charging interfaces, and charging user identity as charging device parameter information into the client simulator. Select four simulation devices A, B, C, and D to simulate the four communication protocols A, B, C, and D respectively. Edit the logical sequence in sequence: login->plug the gun->start charging->end charging->upload order->draw the gun. The corresponding message generated by protocol A is: login operation code of protocol A (0x0001) + data required for protocol A login (0x0102030405), and the message that the receiving server should reply is: login reply operation code of protocol A (0x0002) + login success or login failure (0xFF or 0x00), and the same applies to protocols B, C, D, and other logics. The time interval between the client simulator sending the login message of protocol A and receiving the login reply message of protocol A is the time used.
[0036] It should be noted that the selection of the communication protocol includes selecting the logic of the communication protocol in the logic abstraction module through the test case module according to the functions that the charging service needs to test, and assembling them into different test cases. Figure 3 As shown, the logic in the logic abstraction layer can be used and assembled into different test cases according to the function settings that the charging server needs to test. It can target a single protocol (such as: protocol A's login, rate, status, charging, and settlement as a process), can target multiple protocols (such as: protocols A, B, C, D, etc. are logged in at the same time), and support the concurrency of multiple protocols (such as: protocols A, B, C, D, etc. are logged in, rate, status, charging, and settlement at the same time), and finally achieve the effect of stress testing. At the same time, the benchmark test of the charging server can also be implemented according to the response speed of the charging server and the quality of the response content.
Claims
1. A multi-protocol compatible client simulator, characterized in that: It includes data import module, logic abstraction module, protocol parsing module, data transmission module and test case module; The data import module is used to import communication protocols and charging equipment parameters; The logic abstraction module is used to abstract the control words or control logic of different communication protocols into common logic; The protocol parsing module splices the common logic sent by the logic abstraction module into the original data message and passes it to the data transmission module, parses the received reply data message according to its corresponding protocol, and distributes the parsed control words and data to the logic abstraction module; The data transmission module is used to receive the original data message from the protocol analysis module and send it to the charging server, receive the reply data message from the charging server and pass it to the protocol analysis module; The test case module can construct test cases based on the functions that need to be tested on the charging server and the general logic obtained in the logic abstraction module.
2. A multi-protocol compatible client simulator according to claim 1, characterized in that: The charging device parameter information includes but is not limited to the charging device identifier, the number of charging ports or the charging user identity.
3. A multi-protocol compatible client simulator according to claim 1, characterized in that: The logic abstraction module is extensible and protocol independent.
4. A multi-protocol compatible client simulator according to claim 1, characterized in that: Common logic includes but is not limited to login, heartbeat, status, behavior control, rate, information synchronization or settlement.
5. A method for constructing a multi-protocol charging server based on the client simulator of claim 1, characterized in that: The following steps are involved: S1. Configure multiple communication protocols to the client simulator; S2. Configuring charging device parameter information to the client simulator as a simulated charging device; S3. Select the number of simulated charging devices and the communication protocol corresponding to the simulated charging devices on the client simulator; S4. Edit and simulate the actions of using the charging device on the client simulator or edit the control operations according to the needs of the charging server, and then send the original data message to the charging server according to these operations, receive the reply data message returned by the charging server, translate and display the original data message in the reply data message as the basis for judging the correctness of the charging server, and record the message response time to judge the performance of the charging server to drive the development of the charging server.
6. A method for constructing a charging service terminal according to claim 5, characterized in that: The format of the communication protocol imported into the client simulator in step S1 includes but is not limited to json, XML or excel.
7. A method for constructing a charging service terminal according to claim 5, characterized in that: The message response time is the time from when the original message is sent to when the reply data message is received.
8. A method for constructing a charging service terminal according to claim 5, characterized in that: The actions of simulating the use of the charging device in step S4 include login operation, charging operation, gun insertion and gun removal operations; the control operation includes sending a login and maintaining a heartbeat after a successful login.
9. A method for constructing a charging service terminal according to claim 5, characterized in that: The selection of the communication protocol in step S3 includes selecting the logic of the communication protocol in the logic abstraction module through the test case module according to the functions that need to be tested by the charging service end, and assembling them into different test cases.
