Grayscale release method of charging pile service program without direct connection to charging pile
Through the TCP direct connection gateway program to parse the protocol frame and maintain the device identification, it realizes the non-perceptual grayscale release of electric vehicle charging pile services, solves the problem of charging business interruption, and ensures business continuity and platform availability.
Patent Information
- Application Number
- CN202011256138.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-11-11
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2040-11-11
AI Technical Summary
When the back-end service of existing electric vehicle charging piles is upgraded, the connection is disconnected, causing the charging service to be interrupted. Moreover, due to the dynamic allocation of IP of the SIM card, it is difficult to achieve grayscale release by pile, station by station, and city by city, affecting the availability of the charging platform. and user experience.
Through the TCP direct connection gateway program, the protocol frame of the charging pile is parsed, and the equipment identification and connection relationship are maintained. The operation and maintenance personnel can gradually switch to the new version of the service without interrupting the existing connection, and use the pile equipment identification for grayscale release. Ensure charging business continuity.
It achieves non-perceptual grayscale release during charging service upgrades, ensuring uninterrupted charging services, and supports smooth transition from pile to pile, charging station to charging station, and city to city, improving the usability and user experience of the charging platform.
Smart Images

Figure CN112463204B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of the Internet and charging piles, and in particular to a grayscale publishing method for a pile service program that is directly connected to a charging pile without being perceived. Background Art
[0002] Referring to the T / CEC 102 standard of the China Electricity Council, electric vehicle charging piles are currently connected to the charging service platform through mobile SIM cards. The pile program connects to the backend pile service program developed by each platform by establishing a TCP connection and keeping it connected. The upgrade and restart of the backend service will cause the connection between the pile and the service to be disconnected, and the charging service will be temporarily interrupted.
[0003] Charging platform operators often upgrade in the early morning and inform customers and company management in advance. However, electricity prices are relatively cheap in the early morning, and many buses and operating vehicles are still charging in the early morning. The sudden restart of the service will affect their charging. In addition, operating vehicles have high requirements for the availability of the charging service platform. Once they cannot be charged, it will affect the normal operation of the company's business.
[0004] In order to reduce the risk of releasing new versions of service programs, most Internet platforms will adopt a grayscale release method for upgrades: the old and new versions coexist for a period of time, gradually directing more and more users to the new version, and once a problem is found, the traffic can be quickly cut back to the stable old version.
[0005] For the universal gateway program of the Internet, the life cycle of the upstream and downstream TCP connections on the entire link is consistent, that is, when the TCP connection from the gateway to the backend is disconnected, it will definitely trigger the disconnection of the corresponding connection between the charging pile and the gateway. The communication protocol of the charging platform is a private protocol developed by each operator according to the T / CEC 102 standard, not a universal HTTP protocol. When the universal gateway cannot parse the content of the private protocol, it can only determine where the connection comes from based on the requesting end IP. The IP of the SIM card on the charging pile is dynamically allocated by the network operator, so it is difficult to use the universal gateway to do grayscale releases by charging pile, station, and city. Summary of the invention
[0006] In order to improve the availability of the charging platform and enhance the charging user experience, the present invention proposes a grayscale release method for a pile service program that is directly connected to the charging pile without perception. The method can maintain a continuous TCP connection to the pile and an unaware effect of the charging pile and the charging user, and has the advantages of charging service upgrade and uninterrupted charging business during grayscale release. The pile service program can be grayscale released pile by pile, charging station by charging station, and city by city, and the business can be smoothly transitioned to the newly released service program.
[0007] In order to achieve the above technical purpose, a technical solution provided by the present invention is a grayscale release method of a pile service program without perception of a direct-connected charging pile, comprising the following steps:
[0008] The charging pile first directly connects to the gateway program through TCP, and then the gateway directly connects to the backend pile service program through TCP. After the gateway receives the pile connection, it parses the protocol frame from the charging pile and maintains the corresponding relationship between the pile device identifier and the TCP connection in the memory;
[0009] The operation and maintenance personnel start the new version of the service program while keeping the current connection and service unchanged;
[0010] The administrator uses the local command terminal program of the gateway to set the switching parameters and HTTP switching request authentication password, and add the address of the new version of the service program to the switching target option list;
[0011] The operation and maintenance personnel will release the backend stub service program in grayscale according to different spatial dimensions;
[0012] The grayscale release gateway regularly polls the switchover request, queries the correspondence between the stub device identifier and the TCP connection previously maintained in the memory, finds the link to be switched, and connects the specified stub to the new version of the service program;
[0013] After the back-end connection is successfully switched, the gateway disguises itself as a charging pile and sends a registration request to the pile service program. Without the direct-connected pile being aware of it, the pile is reinjected into the charging platform, making it easier for the back-end service node to send a charging request to the charging pile via the new pile service.
[0014] In this solution, when grayscale release is performed, the switching is not based on the request path, weight or client IP as simply done by the general gateway, but is based on the pile device identification list; the reason for switching based on the pile device identification instead of the client IP is that the IP of the charging pile SIM card is dynamically allocated by the mobile network operator and will change upon reconnection, but the pile device identification is statically configured and fixed.
[0015] As a preferred option, when the operation and maintenance personnel perform a grayscale release of the backend stub service program, the following steps are included:
[0016] Determine the spatial dimensions involved in this grayscale release; the spatial dimensions include grayscale by charging pile, grayscale by charging station, and grayscale by city;
[0017] Determine the time span; the time span includes: how long to observe after each batch of piles are switched before switching to the next batch and how long it is estimated to take to complete the upgrade;
[0018] The operation and maintenance personnel send the pile device identification list and the switching target address to the gateway HTTP service through a remote HTTP request;
[0019] After receiving the request, the HTTP service program checks the target address and the request key MD5. If the check passes, the request is recorded locally through shared memory.
[0020] In this solution, the gateway not only supports sending switching requests and querying switching results through HTTP, but also supports switching through command line tools. In order to protect the platform from network attacks, only local command line tools are allowed to set the switching destination and control parameters, and HTTP request passwords are set through local command line tools to authenticate remote HTTP requests.
[0021] As a preference, each link between the stub and the backend service program has four switching states including the following:
[0022] First switching state: SWITCH_NONE: The current channel is in the process of being established or has been connected to the specified backend target, and the specified switching target address is the same as the backend address during initial loading;
[0023] Second switching state: SWITCH_OK: The current channel is in the process of being established or has been connected to the specified backend target, and the specified switching target address is different from the backend address during initial loading;
[0024] The third switching state: SWITCH_CANCELING: The current channel has been established and the backend connection address is inconsistent with the target address, but the specified switching target address is the same as the backend address during initial loading;
[0025] Fourth switching state: SWITCH_PENDING: The current channel has been established and the backend connection address is inconsistent with the target address, but the specified switching target address is different from the backend address during initial loading;
[0026] If the current state is SWITCH_PENDING or SWITCH_CANCELING, the gateway will further determine the postponement state and then make a connection switch when the opportunity arises.
[0027] Preferably, the switching request will be postponed in the following situations:
[0028] The first scenario: trying to parse the stub device identifier in the protocol frame;
[0029] The second situation: On the uplink or downlink of the channel, some cached data is still not fully sent to the receiver (charging pile or backend platform service program);
[0030] The third situation: The gateway only processes part of a frame of data. In this case, switching may cause frame fragmentation.
[0031] The fourth situation: the link idle time does not reach the set threshold requirement, or the idle time of the key data frame does not reach the threshold;
[0032] The fifth situation: The other end is not ready. Common reasons include: incorrect address configuration, incorrect listening port, service failure to start successfully, or firewall restrictions.
[0033] As a preferred method, in order not to affect various services on the pile and make the pile unaware, the connection between the pile and the gateway is always maintained, and the connection switching is only performed between the gateway and the backend service.
[0034] In this solution, the charging pile program is not informed that the backend service will be upgraded, nor is the connection between the client and the charging pile disconnected. Instead, while maintaining the connection between the gateway and the charging pile, only the connection between the gateway and the backend service is disconnected, and then the new backend direction is immediately connected. In order to avoid half frames when switching connections, the gateway forwarding in this solution is not simply based on TCP network packets, but is forwarded frame by frame after unpacking and encapsulation according to the charging pile communication private protocol. When the backend connection is switched to the new service direction, in order to allow the charging pile to join the backend charging platform, the gateway will simulate the charging pile and send a registration message frame to the charging pile service program.
[0035] As a preference, in order not to affect the normal communication between the pile and the service program, after the gateway receives the request, it does not immediately switch the connection, but monitors the message category and busyness on the network link, and chooses to switch the connection when the link is idle.
[0036] As a preferred method, the link is switched when it is idle as follows:
[0037] The two-way channel between the gateway listening pile and the backend service program is busy. The link is switched after being idle for a period of time t1. The network flow idle interval time t1 is configurable.
[0038] The gateway receives the protocol frame, parses the command number, and analyzes whether each frame is a key frame;
[0039] In order not to affect the normal charging service, the connection switching is performed after the protocol key frame is idle for a period of time t2. The key frame idle interval time t2 is configurable.
[0040] As a preferred method, in order to ensure continuous charging services, the gateway first tries to connect to the new backend service address. After the new connection is successful, it disconnects and replaces the old connection to the server.
[0041] The new switching target direction is used as the main direction, and the previous back-end direction is used as the backup direction. When an abnormality occurs and the main direction cannot be connected, the pile can still be connected to the charging platform through the previous direction.
[0042] In order to avoid forwarding incomplete fragmented packets, the gateway, according to the charging pile communication protocol, regularizes the stream data after receiving the TCP original data packet and sends it one by one in protocol frames, including the following steps:
[0043] First, parse the protocol identifier in each frame to get the starting position of the protocol frame, and then read the current protocol frame length according to the position of the frame length defined by the protocol;
[0044] After parsing each protocol frame, the data is always passed down frame by frame as quickly as possible. If the downstream send buffer is full, it stops receiving upstream data.
[0045] When the protocol identifier cannot be found, the frame length is abnormal, or the CRC check error occurs, the gateway still needs to pass the data downward, but it will no longer update the protocol frame statistics, and it will not affect data transfer and connection switching.
[0046] Beneficial effects of the present invention: The grayscale release method of the charging pile service program that is unaware of the direct-connected charging pile proposed in the present invention can maintain a continuous TCP connection to the pile and an unaware effect of the charging pile and the charging user, and has the advantages of charging service upgrade and uninterrupted charging business during grayscale release; the charging pile service program can be grayscale released pile by pile, charging station by charging station, and city by city, and the business can be smoothly transitioned to the newly released service program. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] Figure 1 It is a schematic diagram of the grayscale release method of the pile service program without perception of the direct-connected charging pile of the present invention. DETAILED DESCRIPTION
[0048] In order to make the objectives, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific implementation method described herein is only an optimal embodiment of the present invention, which is only used to explain the present invention and does not limit the scope of protection of the present invention. All other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0049] Example: Figure 1 As shown, in order to utilize TCP's inherent flow control, the gateway establishes a corresponding TCP connection to the backend for each TCP connection from the charging pile, so that the upstream and downstream connections correspond one to one. In addition, two fixed-size buffers are opened in the memory for the two different flows on the channel as TCP data flow transfer stations. When the buffer is full and the downstream has no time to consume, it will no longer try to receive data from the upstream.
[0050] As long as there is no manual connection switching during grayscale release, like other Internet gateways, the life cycle of the two TCP connections in each pair of channels is the same. That is, the disconnection of a TCP connection will trigger the release of both upstream and downstream TCP connections on the channel.
[0051] In order to achieve high availability and efficient forwarding, the C language multi-process approach is adopted. The Master process is only responsible for scheduling, and one or more Worker processes are responsible for data forwarding services. The Worker process is only a single thread, and all IOs are asynchronous IOs.
[0052] The master process, multiple worker processes, HTTP switching request processing process, and command line processing process all read and write the same data area through shared memory, and persist the data in a file-mapped memory sharing manner, so that the switching parameters and switching requests will not be lost after the process is restarted, and file block locks are introduced to prevent multiple processes from writing the same block at the same time.
[0053] In order to avoid forwarding incomplete fragmented packets, the gateway regularizes the stream data after receiving the TCP original data packet according to the charging pile communication protocol and sends it frame by frame:
[0054] First, parse the protocol identifier in each frame to get the starting position of the protocol frame, and then read the current protocol frame length according to the position of the frame length defined by the protocol. Knowing the frame starting position and frame length, the frame end position can be determined;
[0055] After parsing each protocol frame, always pass the data downstream frame by frame as quickly as possible. If the downstream send buffer is full, do not try to receive upstream data;
[0056] When the protocol identifier cannot be found, the frame length is abnormal, or the CRC check error occurs, the gateway still needs to pass the data downward, but it will no longer update the protocol frame statistics, and it will not affect data transfer and connection switching.
[0057] The pile device ID is assigned when joining the charging platform and remains unchanged after the assignment. The pile device ID, the charging station where the pile is located, and the city where the pile is located are stored in the pile table of the charging service platform database. Therefore, before switching, the operation and maintenance personnel can query the pile table to obtain all the pile device IDs under the charging station and city, and then send the pile ID list in different spaces to the gateway, so as to achieve grayscale release according to different spatial dimensions.
[0058] In order to achieve idle time switching, the two-way channel between the gateway listening pile and the backend service program is busy, and the link is chosen to switch after being idle for a period of time t1 (for example, 3 seconds). The network flow idle interval time t1 is configurable.
[0059] The gateway receives the protocol frame, parses the command number, and analyzes whether each frame is a key frame. In order not to affect the normal charging service, it is necessary to wait for the protocol key frame to be idle for a period of time t2 (for example, 10 seconds) before switching the connection. The key frame idle interval time t2 is configurable.
[0060] Each link between the stub and the backend service program has four switching states:
[0061] 1) SWITCH_NONE: The current channel is being established or has been connected to the specified backend target, and the specified switching target address is the same as the backend address during initial loading;
[0062] 2) SWITCH_OK: The current channel is being established or has been connected to the specified backend target, and the specified switching target address is different from the backend address during initial loading;
[0063] 3) SWITCH_CANCELING: The current channel has been established and the backend connection address is inconsistent with the target address, but the specified switching target address is the same as the backend address during initial loading;
[0064] 4) SWITCH_PENDING: The current channel has been established and the backend connection address is inconsistent with the target address, but the specified switching target address is different from the backend address during initial loading.
[0065] If the current state is SWITCH_PENDING or SWITCH_CANCELING, the gateway will further determine the postponement state and then make a connection switch when the opportunity arises.
[0066] The situations in which the switchover request will be postponed include:
[0067] Trying to parse out the stub device identifier in the protocol frame;
[0068] On the uplink or downlink of the channel, some cached data has not been fully sent to the receiver (charging station or backend platform service program);
[0069] The gateway only processes part of a frame of data, and switching at this time will cause frame fragmentation;
[0070] The link idle time does not reach the set threshold requirement, or the idle time of the key data frame does not reach the threshold;
[0071] The peer is not ready. Common reasons include: incorrect address configuration, incorrect listening port, service failure to start, or firewall restrictions.
[0072] When the switch request does not need to be postponed, the gateway will start the probe program to check whether the target address is reachable before switching. Although there are thousands of piles with different IP addresses, the address and port of the backend service program are the same, so a group of piles connected to the same destination can share a probe program and share the detection results. In order to avoid unnecessary network storms and avoid being mistaken for network attacks and being banned, the detection cycle of the gateway probe program is generally 3 to 10 seconds, and the cycle parameters can be set.
[0073] After the probe program passes the check, try to establish a new connection first when switching, and then replace and disconnect the old direction after connecting to the new direction. The new switching target direction is used as the main direction, and the previous backend direction is used as the backup direction. When an abnormality occurs and the main direction cannot be connected, there is still an alternative direction to try.
[0074] In order to make the charging pile unaware of the back-end connection switching, the gateway needs to simulate the charging pile and send a registration command to the charging platform after the back-end switching is successful, so that other service nodes in the platform know that the path from the command to the charging pile has changed.
[0075] When the pile is just connected, after the gateway receives and identifies the registration protocol frame from the pile, it saves the registration frame to the memory for standby use, and then resends the registration frame to the new backend service program after receiving the switching request and switching the backend connection to the specified target. Since the pile service program does not know whether the registration request is sent by the pile or simulated by the gateway after receiving the registration frame, according to the protocol, the backend service will send a response frame. For the gateway, in order to make the pile unaware, it should intercept and discard the response information corresponding to the registration request it simulates, and cannot let these responses reach the pile program to avoid interfering with the normal operation of the pile program.
[0076] The specific implementation method described above is a preferred implementation method of the grayscale release method of the pile service program without perception of the direct-connected charging pile of the present invention, and it is not intended to limit the specific implementation scope of the present invention. The scope of the present invention includes but is not limited to this specific implementation method. All equivalent changes made in accordance with the shape and structure of the present invention are within the protection scope of the present invention.
Claims
1. A grayscale release method for a service program of a directly connected charging pile without any perception, characterized in that: The steps include: The charging pile first directly connects to the gateway program through TCP, and then the gateway directly connects to the backend pile service program through TCP. After the gateway receives the pile connection, it parses the protocol frame from the charging pile and maintains the corresponding relationship between the pile device identifier and the TCP connection in the memory; The operation and maintenance personnel start the new version of the service program while keeping the current connection and service unchanged; The administrator uses the local command terminal program of the gateway to set the switching parameters and HTTP switching request authentication password, and add the address of the new version of the service program to the switching target option list; The operation and maintenance personnel will release the backend stub service program in grayscale according to different spatial dimensions; The grayscale release gateway regularly polls the switchover request, queries the correspondence between the stub device identifier and the TCP connection previously maintained in the memory, finds the link to be switched, and connects the specified stub to the new version of the service program; After the back-end connection is successfully switched, the gateway disguises itself as a charging pile and sends a registration request to the pile service program. Without the direct-connected pile being aware of it, the pile is reinjected into the charging platform, making it easier for the back-end service node to send a charging request to the charging pile via the new pile service program.
2. The method for grayscale release of a direct-connected charging pile service program without perception according to claim 1 is characterized in that: When the operation and maintenance personnel perform a grayscale release of the backend stub service program, the following steps are included: Determine the spatial dimensions involved in this grayscale release; the spatial dimensions include grayscale by charging pile, grayscale by charging station, and grayscale by city; Determine the time span; the time span includes: how long to observe after each batch of piles are switched before switching to the next batch and how long it is estimated to take to complete the upgrade; The operation and maintenance personnel send the pile device identification list and the switching target address to the gateway HTTP service through a remote HTTP request; After receiving the request, the HTTP service program checks the target address and the request key MD5. If the check passes, the request is recorded locally through shared memory.
3. The grayscale release method of the direct-connected charging pile service program without perception according to claim 1 is characterized in that: Each link between the stub and the backend service program has four switching states: First switching state: SWITCH_NONE: The current channel is in the process of being established or has been connected to the specified backend target, and the specified switching target address is the same as the backend address during initial loading; Second switching state: SWITCH_OK: The current channel is in the process of being established or has been connected to the specified backend target, and the specified switching target address is different from the backend address during initial loading; The third switching state: SWITCH_CANCELING: The current channel has been established and the backend connection address is inconsistent with the target address, but the specified switching target address is the same as the backend address during initial loading; Fourth switching state: SWITCH_PENDING: The current channel has been established and the backend connection address is inconsistent with the target address, but the specified switching target address is different from the backend address during initial loading; If the current state is SWITCH_PENDING or SWITCH_CANCELING, the gateway will further determine the postponement state and then make a connection switch when the opportunity arises.
4. The grayscale release method of the direct-connected charging pile service program without perception according to claim 3 is characterized in that: The switchover request will be postponed in the following situations: The first scenario: trying to parse the stub device identifier in the protocol frame; The second situation: On the uplink or downlink of the channel, some cached data is still not sent to the receiver (charging pile or backend platform service program); The third situation: The gateway only processes part of a frame of data. In this case, switching may cause frame fragmentation. The fourth situation: the link idle time does not reach the set threshold requirement, or the idle time of the key data frame does not reach the threshold; The fifth situation: The other end is not ready. Common reasons include: incorrect address configuration, incorrect listening port, service failure to start successfully, or firewall restrictions.
5. The grayscale release method of the direct-connected charging pile service program without perception according to claim 1 is characterized in that: In order not to affect various businesses on the pile and make the pile unaware, the connection between the pile and the gateway is always maintained, and the connection switching is only performed between the gateway and the backend service.
6. The grayscale release method of the direct-connected charging pile service program without perception according to claim 1 is characterized in that: In order not to affect the normal communication between the stub and the service program, after the gateway receives the request, it does not immediately switch the connection, but monitors the message category and busyness on the network link, and chooses to switch the connection when the link is idle.
7. The grayscale release method of the direct-connected charging pile service program without perception according to claim 6 is characterized in that: The link is switched when the link is idle as follows: The two-way channel between the gateway listening pile and the backend service program is busy. The link is switched after being idle for a period of time t1. The network flow idle interval time t1 is configurable. The gateway receives the protocol frame, parses the command number, and analyzes whether each frame is a key frame; In order not to affect the normal charging service, the connection switching is performed after the protocol key frame is idle for a period of time t2. The key frame idle interval time t2 is configurable.
8. The grayscale release method of the direct-connected charging pile service program without perception according to claim 1 is characterized in that: To ensure continuous charging services, the gateway first tries to connect to the new backend service address. After the new connection is successful, it disconnects and replaces the old connection to the server. The new switching target direction is used as the main direction, and the previous back-end direction is used as the backup direction. When an abnormality occurs and the main direction cannot be connected, the pile can still be connected to the charging platform through the previous direction.
9. The grayscale release method of the direct-connected charging pile service program without perception according to claim 1 is characterized in that: In order to avoid forwarding incomplete fragmented packets, the gateway, according to the charging pile communication protocol, regularizes the stream data after receiving the TCP original data packet and sends it one by one in protocol frames, including the following steps: First, parse the protocol identifier in each frame to get the starting position of the protocol frame, and then read the current protocol frame length according to the position of the frame length defined by the protocol; After parsing each protocol frame, the data is always passed down frame by frame as quickly as possible. If the downstream send buffer is full, it stops receiving upstream data. When the protocol identifier cannot be found, the frame length is abnormal, or the CRC check is wrong, the gateway still has to pass the data down.
