A method for judging the range of an electronic fence of a hazardous chemical vehicle
By improving the ray casting algorithm and machine learning algorithm, combined with vehicle positioning and historical records, the shortcomings of existing electronic fences in judging the target position within irregular polygonal areas have been solved. This has enabled accurate location detection and predictive deviation warning for hazardous chemical vehicles, thus improving transportation safety.
Patent Information
- Application Number
- CN202410654926.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-24
- Publication Date
- 2025-11-18
- Estimated Expiration
- 2044-05-24
AI Technical Summary
Existing electronic fence technology cannot effectively determine the location of targets within irregular polygonal areas and lacks predictive deviation warnings for commonly used vehicle routes, thus failing to meet the safety requirements for the transportation of hazardous chemicals.
By utilizing improved ray casting and machine learning algorithms, combined with vehicle positioning and historical records, the system can determine in real time whether a vehicle's location is within a polygonal electronic fence and predict whether its trajectory will deviate from the fence. A predictive deviation warning is then provided using a support vector machine model.
It enables precise target detection within irregular polygonal electronic fence areas, improves the flexibility of judgment methods, issues timely alarms, reduces the probability of accidents, and enhances the safety of hazardous chemical transportation vehicles.
Smart Images

Figure CN118628004B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of logistics and transportation technology, specifically to a method for determining the range of an electronic fence for hazardous chemical vehicles. Background Technology
[0002] With the rapid development of the hazardous chemicals transportation industry, the number of hazardous chemicals transport vehicles on roads is increasing daily. However, hazardous chemicals transportation is a high-risk industry, requiring strict safety measures to ensure the safety of vehicles and personnel. Electronic fences are a common safety measure that can restrict vehicles to travel within a specific area, reducing the chance of accidents.
[0003] Traditional electronic fence technology has some limitations, such as fixed range, fixed fence area shape, low accuracy, and inability to provide predictive deviation warnings based on the vehicle's usual routes, which cannot meet the actual needs of hazardous chemical vehicle transportation.
[0004] A search revealed Chinese patent application number 2023114072324, published on October 26, 2023, which discloses a method and apparatus for determining the range of an electronic fence for a courier service point. The method includes: acquiring source data for an electronic fence to be determined; performing deduplication on the source data to obtain preprocessed data; using the convex hull algorithm to determine whether the range of the electronic fence formed by each location point in the preprocessed data is accurate, obtaining a judgment result; determining target data for accurately delineating the range of the electronic fence for the courier service point based on the judgment result, the target data including at least one electronic fence data; and saving the target data, which is used to delineate the range of the electronic fence for the courier service point to be determined. While this method can be used to construct an electronic fence range, it cannot determine whether a target location is within the electronic fence area, resulting in poor applicability and limited functionality.
[0005] Chinese patent application number 201811617347.5, published on December 28, 2018, discloses a method for determining bus entry and exit based on electronic fences at bus stops. The method includes: collecting centimeter-level coordinates of the first and last points on the side of the bus stop and setting the road width; performing a Gaussian transform to convert the latitude and longitude coordinates of the electronic fence and the bus location points to Cartesian coordinates, and calculating the coordinates of the four vertices of the rectangular electronic fence, dividing it into entry and exit sides perpendicular to the road direction based on entry and exit intersections; determining whether the bus's current location and its previous location are contained within the rectangular electronic fence, thus determining whether the bus has entered, exited, or stopped at the bus stop. While this method can determine whether a target location is within the electronic fence, its applicability is limited. First, the electronic fence must be a rectangular area; second, the electronic fence's location is relatively fixed within the bus stop area, lacking flexibility; and third, it does not perform any predictive deviation warning analysis for the bus's route, lacking safety warning prompts.
[0006] Both methods described above achieve the construction of electronic fence areas, but they only partially implement the function of determining whether a target location is within the electronic fence area. This makes them difficult to apply to real-world scenarios involving complex, irregular polygonal electronic fence areas, and they cannot provide accurate judgments. Furthermore, neither method analyzes the target point's common driving routes and boundary violation warning records to perform predictive deviation warning analysis. Summary of the Invention
[0007] To address these issues, this invention proposes a method for determining the range of an electronic fence for hazardous chemical vehicles. This method utilizes advanced positioning technology to monitor and track the location of hazardous chemical vehicles. Based on the actual conditions of the hazardous chemical vehicles themselves and their commonly used transportation routes, and using electronic fence technology, it achieves control over vehicle movement, continuously tracks, checks, and predicts the vehicle's trajectory, and promptly issues alerts and takes measures to ensure that the vehicle does not cross the electronic fence, thus solving the problems mentioned in the background art.
[0008] The specific technical solution is as follows:
[0009] This invention provides a method for determining the range of an electronic fence for hazardous chemical vehicles, the method comprising:
[0010] S1. Obtain the latitude and longitude coordinate source data of each vertex of the polygonal electronic fence area to be judged, and perform vertex data deduplication processing. Based on the latitude and longitude position of each vertex, connect them sequentially to construct the polygonal electronic fence area.
[0011] S2. Standardize and preprocess the source data obtained in S1, and then persistently store the preprocessed electronic fence area data in the database.
[0012] S3. By using positioning equipment installed on hazardous chemical vehicles, the latitude and longitude coordinates of the hazardous chemical vehicles can be obtained in real time;
[0013] S4. Based on the license plate number of the hazardous chemical vehicle, find one or more polygonal electronic fence information associated with the hazardous chemical vehicle, find the latitude and longitude coordinates of each vertex of the polygonal electronic fence area, and provide judgment data for subsequent determination of whether the location of the hazardous chemical vehicle is within the electronic fence area.
[0014] S5. Use an improved ray casting algorithm to determine whether the location of the hazardous materials vehicle is within the associated polygonal electronic fence area.
[0015] S6. Based on the vehicle positioning system's data analysis of the vehicle's common route trajectory and historical records of exceeding the electronic fence, predict whether the vehicle's trajectory will deviate from the electronic fence using machine learning algorithms, thus achieving predictive deviation warning.
[0016] Preferably, in S5, the specific steps of the improved ray casting algorithm include:
[0017] S5.1 Assume the current position of the vehicle is (x, y), and the polygonal electronic fence has n sides, with the endpoints of each side being (x1, y1) and (x2, y2) respectively. A ray is emitted from the target point of the vehicle position and intersects with the polygonal electronic fence area.
[0018] S5.2 Initialize the number of intersection points count = 0. For each edge of the polygonal electronic fence area, obtain the two endpoints (x1, y1) and (x2, y2) of the edge, and determine whether the ray intersects the edge:
[0019] If the ray's starting point (x, y) is between the two endpoints of the edge, or if the edge is parallel to the ray, then they do not intersect, and the process continues with the next edge; otherwise, the intersects between the ray and the fence boundary is calculated using equations (1) and (2):
[0020] intersect x = x∈[x1,x2] (1)
[0021] intersect y =x∈[y1,y2] (2)
[0022] S5.3 If the x-coordinates and y-coordinates of the intersection point satisfy the above conditions, then they are considered to intersect, and the intersection point count is increased by count = count + 1;
[0023] S5.4 Determine the parity of the number of intersection points count:
[0024] If count is odd, it means the vehicle is inside the polygonal electronic fence;
[0025] If count is even, it means the vehicle is outside the polygonal electronic fence;
[0026] S5.5. Based on a specific target point, an arc-shaped margin is set for movement. When the target point is located at any of the following conditions: fence boundary, fence vertex, projection line intersecting at fence vertex, or ray coinciding with fence boundary, the boundary distance is set to b. Circles are drawn around each vertex of the involved fence boundary with radius b. The projection line is extended to intersect the arc of the circle. The original vertex remains unchanged. The connecting lines of other boundaries are extended to the intersection point, which is set as p. Rays are drawn from the original vertex to re-determine the number of intersection points. Let the original vertex coordinates be (x0, y0), the angle between the projection line and the horizontal axis be θ, and the x and y coordinates of point p(x, y) be:
[0027] x = x0 + b·cos(f(θ) + 2πn)
[0028] y = y0 + b·sin(f(θ) + 2πn)
[0029] The algorithm described above determines whether a vehicle is within a polygonal electronic fence by adding an arc-shaped edge distance ray intersection method, and determines the position based on the parity of the number of intersections.
[0030] Preferably, in step S6, based on the vehicle's predetermined route, a linear interpolation method is used to predict the vehicle's position at a certain point in time, thereby obtaining the predicted vehicle trajectory. Specifically, this includes:
[0031] Assume the vehicle travels at a constant speed between each location point and along a straight path connecting these locations;
[0032] Suppose we have a series of coordinates of points, denoted as (x1, y1), (x2, y2), ..., (x... n ,y n ); where x i and y i These are the x and y coordinates of the i-th position point of the vehicle;
[0033] The linear interpolation formulas of equations (3) and (4) are used to predict the vehicle's trajectory:
[0034]
[0035]
[0036] In this context, adjustment coefficients α and β are introduced, dynamically changing based on external conditions or prior knowledge, to fine-tune the interpolation results. φ(α) and φ(β) are introduced nonlinear adjustment terms, denoted as ln(1+z), where z is any real number, used to increase or decrease the fine-tuning of the interpolation; t is the prediction time point. i It is the time at the i-th position point; considering possible time delays or accelerations, a time adjustment function τ(t) = t + δ is introduced; the time offset is dynamically adjusted based on certain conditions, and Δx(t) and Δy(t) are used to optimize the accuracy of the interpolation results; determined based on historical data or prediction models, x(t) and y(t) represent the predicted horizontal and vertical coordinates at time point t, respectively;
[0037] Formulas (3) and (4) obtain the vehicle's position coordinates (x(t), y(t)) by calculating the linear interpolation between two position points at a given time point t.
[0038] Preferably, in S6, a support vector machine is used to construct an algorithm model to predict whether a vehicle deviates from the electronic fence, specifically including:
[0039] Suppose the training dataset contains m samples, and each sample contains n features; for the i-th sample, it is represented as... in Let y represent the j-th feature of the sample, and y be the true label of the sample (whether it deviates from the electronic fence). i y i ∈{-1,1};
[0040] To predict the label of a new sample, a classification model needs to be learned from the training dataset. The goal of the support vector machine algorithm is to find a hyperplane that can separate samples with different labels, while also maximizing the "minimum distance" between the hyperplane and the training data, that is, to maximize the distance from the hyperplane to the point closest to it.
[0041] Consider the standard form of the separating hyperplane: w T x + b = 0, where w is the normal vector representing the direction of the hyperplane, and b is the offset; for a given sample x i y i (w T x i +b) is compared with 0 to determine its position. If y i (w T x i If (w + b) > 0, then the sample is correctly classified; otherwise, it is misclassified. Therefore, we need to find a suitable set of w and b such that all samples are correctly classified and the generalization error between the training dataset and the test dataset is minimized.
[0042] Based on the support vector machine algorithm, a soft-margin support vector machine is adopted. It takes into account that there may be some noise or atypical data in the training dataset. Therefore, by introducing slack variables, some samples are allowed to be relaxed in the case of misclassification of the hyperplane, thereby obtaining a wide margin region.
[0043] Specifically, the objective function becomes:
[0044]
[0045] Wherein, the constant c represents the penalty weight for misclassified points; ε i It is a slack variable, representing the classification error of the i-th sample. Let represent the sum of squared distances from the hyperplane to each support vector. In order to maximize the distance between the support vectors and the hyperplane, equation (5) should be minimized.
[0046] By solving equation (5), the corresponding classification decision function is obtained:
[0047]
[0048] Where, α i These are coefficients obtained through Lagrange optimization, which represent the importance of each sample vector; Represents the eigenvector x i The inner product between the data point x to be predicted; b is the bias term used to adjust the position of the decision boundary, thereby affecting the classification result; the sign() function in equation (6) represents the sign function, which has a value of 1 or -1 and is used to classify new samples.
[0049] Preferably, after predicting whether a vehicle has deviated from the electronic fence area, an alarm message is sent to the terminal device, and an alarm message is also pushed to the corresponding vehicle driver's mobile phone.
[0050] The present invention has the following advantages:
[0051] The method for determining the range of an electronic fence for hazardous chemical vehicles provided by this invention can perform target detection within an irregular polygonal electronic fence area, improving the flexibility of the determination method. It can also accurately determine whether a hazardous chemical vehicle has exceeded the range of the electronic fence, promptly issuing alarms or taking measures. At the same time, it can prevent hazardous chemical vehicles from entering restricted areas or exceeding the control range, reducing the probability of accidents, protecting the safety of vehicles and personnel, and improving safety. In addition, this invention predicts vehicle trajectories based on common routes combined with machine learning algorithms, strengthening the early warning mechanism. Attached Figure Description
[0052] Figure 1 Flowchart of the method for determining the range of electronic fences for hazardous chemical vehicles provided by the present invention;
[0053] Figure 2 A visual schematic diagram of an electronic fence provided by the present invention;
[0054] Figure 3 A schematic diagram of the improved ray projection algorithm for setting arc-shaped margins provided by the present invention;
[0055] Figure 4 The predictive deviation early warning flowchart provided by this invention;
[0056] Figure 5 This is a schematic diagram of the vehicle prediction trajectory provided by the present invention. Detailed Implementation
[0057] The following specific embodiments illustrate the implementation of the present invention. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0058] Example 1
[0059] like Figure 1 As shown in the figure, this embodiment provides a method for determining the range of an electronic fence for hazardous chemical vehicles. The method includes:
[0060] S1. Obtain the latitude and longitude coordinate source data of each vertex of the polygonal electronic fence area to be judged, and perform vertex data deduplication processing. Based on the latitude and longitude position of each vertex, connect them sequentially to construct the polygonal electronic fence area and determine the polygonal electronic fence information.
[0061] In S1, the coordinate information of each vertex of the original electronic fence can be manually entered by the user, or it can be automatically identified and entered using an online map drawing method; the entry process can be local or remote, and the electronic fence visualization diagram is as follows. Figure 2 As shown.
[0062] Specifically, the vertex position coordinates are mainly longitude and latitude coordinate information; due to occasional vertex duplication events caused by manual input or map recognition input of raw data, vertex data deduplication is performed, and then each vertex position in the region is sequentially connected, and the associated hazardous chemical vehicles are selected.
[0063] S2. Standardize and preprocess the source data obtained in S1, and then persistently store the preprocessed electronic fence area data in the database.
[0064] S3. Real-time communication with vehicle positioning equipment for data exchange: Real-time acquisition of the latitude and longitude coordinates of the hazardous chemical vehicle through positioning equipment installed on the vehicle.
[0065] S4. Based on the license plate number of the hazardous chemical vehicle, find one or more polygonal electronic fence information associated with the hazardous chemical vehicle, indicating that the vehicle should only be allowed to drive within this electronic fence area. Find the latitude and longitude coordinates of each vertex of the polygonal electronic fence area to provide judgment data for subsequent determination of whether the location of the hazardous chemical vehicle is within the electronic fence area.
[0066] S5. Use an improved ray projection algorithm to determine whether the location of the hazardous chemical vehicle is within the associated polygonal electronic fence area; from the target location of the vehicle, emit a ray in any direction to intersect with the polygonal electronic fence area, and determine whether the target location exceeds the polygonal electronic fence area according to the algorithm. If it exceeds the area, issue an alarm message.
[0067] In S5, the specific steps of the improved ray casting algorithm include:
[0068] S5.1 Assume the current position of the vehicle is (x, y), and the polygonal electronic fence has n sides, with the endpoints of each side being (x1, y1) and (x2, y2) respectively. A ray is emitted from the target point of the vehicle position and intersects with the polygonal electronic fence area.
[0069] S5.2 Initialize the number of intersection points count = 0. For each edge of the polygonal electronic fence area, obtain the two endpoints (x1, y1) and (x2, y2) of the edge, and determine whether the ray intersects the edge:
[0070] If the ray's starting point (x, y) is between the two endpoints of the edge, or if the edge is parallel to the ray, then they do not intersect, and the process continues with the next edge; otherwise, the intersects between the ray and the fence boundary is calculated using equations (1) and (2):
[0071] intersect x = x∈[x1,x2] (1)
[0072] intersect y =x∈[y1,y2] (2)
[0073] S5.3 If the x-coordinates and y-coordinates of the intersection point satisfy the above conditions, then they are considered to intersect, and the intersection point count is increased by count = count + 1;
[0074] S5.4 Determine the parity of the number of intersection points count:
[0075] If count is odd, it means the vehicle is inside the polygonal electronic fence;
[0076] If count is even, it means the vehicle is outside the polygonal electronic fence;
[0077] S5.5. Based on a specific target point, an arc-shaped margin is set for movement. When the target point is located at any of the following conditions: fence boundary, fence vertex, projection line intersecting at fence vertex, or ray coinciding with fence boundary, the boundary distance is set to b. Circles are drawn around each vertex of the involved fence boundary with radius b. The projection line is extended to intersect the arc of the circle. The original vertex remains unchanged. The connecting lines of other boundaries are extended to the intersection point, which is set as p. Rays are drawn from the original vertex to re-determine the number of intersection points. Let the original vertex coordinates be (x0, y0), the angle between the projection line and the horizontal axis be θ, and the x and y coordinates of point p(x, y) be:
[0078] x = x0 + b·cos(f(θ) + 2πn)
[0079] y = y0 + b·sin(f(θ) + 2πn)
[0080] For example, if the selected data is that the vehicle is located at the vertex of the fenced area and the angle between the projection line and the horizontal axis is 30 degrees, the data can be substituted into the calculation.
[0081] The algorithm described above determines whether a vehicle is within a polygonal electronic fence by adding an arc-shaped edge ray intersection method, and determines its position based on the parity of the number of intersections. Figure 3 As shown.
[0082] S6. Based on the vehicle positioning system, analyze the data on the common routes and historical records of hazardous chemical vehicles that have deviated from the electronic fence (S6.1), and use machine learning algorithms to predict whether the route of hazardous chemical vehicles will deviate from the electronic fence, so as to realize predictive deviation warning and improve the timeliness and effectiveness of responding to emergencies.
[0083] In S6, based on the vehicle's predetermined route, a linear interpolation method is used to predict the vehicle's position at a certain point in time, thereby obtaining the predicted vehicle trajectory. Specifically, this includes:
[0084] Assuming the vehicle travels at a constant speed between each location point and along a straight path connecting these locations, the predicted vehicle trajectory is illustrated in the diagram below. Figure 5 As shown;
[0085] Suppose we have a series of coordinates of points, denoted as (x1, y1), (x2, y2), ..., (x... n ,y n ); where x i and yi These are the x and y coordinates of the i-th position point of the vehicle;
[0086] The linear interpolation formulas of equations (3) and (4) are used to predict the vehicle's trajectory:
[0087]
[0088]
[0089] In this context, adjustment coefficients α and β are introduced, dynamically changing based on external conditions or prior knowledge, to fine-tune the interpolation results. φ(α) and φ(β) are introduced nonlinear adjustment terms, denoted as ln(1+z), where z is any real number, used to increase or decrease the fine-tuning of the interpolation; t is the prediction time point. i It is the time at the i-th position point; considering possible time delays or accelerations, a time adjustment function τ(t) = t + δ is introduced; the time offset is dynamically adjusted based on certain conditions, and Δx(t) and Δy(t) are used to optimize the accuracy of the interpolation results; determined based on historical data or prediction models, x(t) and y(t) represent the predicted horizontal and vertical coordinates at time point t, respectively;
[0090] For example, if we select the following data, the coordinates of a series of location points are: (35.66,256.8), (65.42,66.8), (78.6,398.66)..., and the latitude and longitude coordinates of the vehicle are: (32.66,106.2).
[0091] Formulas (3) and (4) obtain the vehicle's position coordinates (x(t), y(t)) by calculating the linear interpolation between two position points at a given time point t.
[0092] In S6, a support vector machine is used to construct an algorithm model to predict whether a vehicle deviates from the electronic fence (S6.2), specifically including:
[0093] Suppose the training dataset contains m samples, and each sample contains n features; for the i-th sample, it is represented as... in Let y represent the j-th feature of the sample, and y be the true label of the sample (whether it deviates from the electronic fence). i y i ∈{-1,1};
[0094] To predict the label of a new sample, a classification model needs to be learned from the training dataset. The goal of the support vector machine algorithm is to find a hyperplane that can separate samples with different labels (S6.3), while also maximizing the "minimum distance" between the hyperplane and the training data, that is, to maximize the distance from the hyperplane to the point closest to it.
[0095] Consider the standard form of the separating hyperplane: w T x + b = 0, where w is the normal vector representing the direction of the hyperplane, and b is the offset; for a given sample x i y i (w T x i +b) is compared with 0 to determine its position. If y i (w T x i If (w + b) > 0, then the sample is correctly classified; otherwise, it is misclassified. Therefore, we need to find a suitable set of w and b such that all samples are correctly classified and the generalization error between the training dataset and the test dataset is minimized.
[0096] Based on the support vector machine algorithm, a soft-margin support vector machine is adopted. It takes into account that there may be some noise or atypical data in the training dataset. Therefore, by introducing slack variables, some samples are allowed to relax in the case of misclassification of the hyperplane, thereby obtaining a wide margin region (S6.4).
[0097] Specifically, the objective function becomes:
[0098]
[0099] Wherein, the constant c represents the penalty weight for misclassified points; ε i It is a slack variable, representing the classification error of the i-th sample. Let represent the sum of squared distances from the hyperplane to each support vector. In order to maximize the distance between the support vectors and the hyperplane, equation (5) should be minimized.
[0100] By solving equation (5), the corresponding classification decision function is obtained:
[0101]
[0102] Where, α i These are coefficients obtained through Lagrange optimization, which represent the importance of each sample vector; Represents the eigenvector x i The inner product between the data point x to be predicted and the data point x to be predicted; b is the bias term, used to adjust the position of the decision boundary, thereby affecting the classification result; the sign() function in equation (6) represents the sign function, with a value of 1 or -1, used to classify new samples, and the flowchart for predicting deviation warning is as follows. Figure 4 As shown.
[0103] The vehicle is classified according to the solution of the sign() decision classification function (S6.5). A result of 1 indicates that the vehicle is inside the fence area, and a result of -1 indicates that the vehicle is outside the fence area. After predicting whether the vehicle has deviated from the electronic fence area, an alarm message is sent to the terminal device and an alarm message is pushed to the corresponding vehicle driver's mobile phone.
[0104] The method and system disclosed in this invention, when applied in specific situations, offer beneficial effects such as improved safety, enhanced controllability, increased efficiency, and strengthened early warning mechanisms. It has significant application value in the field of hazardous chemical vehicle transportation, improving transportation safety and controllability, and ensuring the safety of personnel and property.
[0105] Although the present invention has been described in detail above with general descriptions and specific embodiments, modifications or improvements can be made to it, which will be obvious to those skilled in the art. Therefore, all such modifications or improvements made without departing from the spirit of the present invention fall within the scope of protection claimed by the present invention.
Claims
1. A method for determining the range of an electronic fence for hazardous chemical vehicles, characterized in that: The methods include: S1. Obtain the latitude and longitude coordinate source data of each vertex of the polygonal electronic fence area to be judged, and perform vertex data deduplication processing. Based on the latitude and longitude position of each vertex, connect them sequentially to construct the polygonal electronic fence area. S2. Standardize and preprocess the source data obtained in S1, and then persistently store the preprocessed electronic fence area data in the database. S3. By using positioning equipment installed on hazardous chemical vehicles, the latitude and longitude coordinates of the hazardous chemical vehicles can be obtained in real time; Based on the vehicle's predetermined route, a linear interpolation method is used to predict the vehicle's position at a certain point in time, thereby obtaining the predicted vehicle trajectory, specifically including: Assume the vehicle travels at a constant speed between each location point and along a straight path connecting these locations; Suppose we have a series of coordinates of points, denoted as (x1, y1), (x2, y2), ..., (x... n ,y n ); where x i and y i These are the x and y coordinates of the i-th position point of the vehicle; The linear interpolation formulas of equations (1) and (2) are used to predict the vehicle's trajectory: In this context, adjustment coefficients α and β are introduced, dynamically changing based on external conditions or prior knowledge, to fine-tune the interpolation results. φ(α) and φ(β) are introduced nonlinear adjustment terms, denoted as ln(1+z), where z is any real number, used to increase or decrease the fine-tuning of the interpolation; t is the prediction time point. i It is the time at the i-th position point; considering possible time delays or accelerations, a time adjustment function τ(t) = t + δ is introduced; the time offset is dynamically adjusted based on certain conditions, and Δx(t) and Δy(t) are used to optimize the accuracy of the interpolation results; determined based on historical data or prediction models, x(t) and y(t) represent the predicted horizontal and vertical coordinates at time point t, respectively; Formulas (1) and (2) obtain the vehicle's position coordinates (x(t), y(t)) by calculating the linear interpolation between two position points at a given time point t; S4. Based on the license plate number of the hazardous chemical vehicle, find one or more polygonal electronic fence information associated with the hazardous chemical vehicle, find the latitude and longitude coordinates of each vertex of the polygonal electronic fence area, and provide judgment data for subsequent determination of whether the location of the hazardous chemical vehicle is within the electronic fence area. S5. Use an improved ray casting algorithm to determine whether the location of the hazardous materials vehicle is within the associated polygonal electronic fence area. S6. Based on the vehicle positioning system's data analysis of the vehicle's common route trajectory and historical records of exceeding the electronic fence, predict whether the vehicle's trajectory will deviate from the electronic fence using machine learning algorithms, thus achieving predictive deviation warning.
2. The method for determining the range of an electronic fence for hazardous chemical vehicles according to claim 1, characterized in that: In S5, the specific steps of the improved ray casting algorithm include: S5.1 Assume the current position of the vehicle is (x, y), and the polygonal electronic fence has n sides, with the endpoints of each side being (x1, y1) and (x2, y2) respectively. A ray is emitted from the target point of the vehicle position and intersects with the polygonal electronic fence area. S5.2 Initialize the number of intersection points count = 0. For each edge of the polygonal electronic fence area, obtain the two endpoints (x1, y1) and (x2, y2) of the edge, and determine whether the ray intersects the edge: If the ray's starting point (x, y) is between the two endpoints of the edge, or if the edge is parallel to the ray, then they do not intersect, and the process continues with the next edge; otherwise, the intersects between the ray and the fence boundary is calculated using equations (3) and (4): intersect x =x∈[x1,x2] (3) intersect y =x∈[y1,y2] (4) S5.3 If the x-coordinates and y-coordinates of the intersection point satisfy the conditions of equations (3) and (4), then they are considered to intersect, and the intersection point count is increased by count = count + 1. S5.4 Determine the parity of the number of intersection points count: If count is odd, it means the vehicle is inside the polygonal electronic fence; If count is even, it means the vehicle is outside the polygonal electronic fence; S5.
5. Based on a specific target point, an arc-shaped margin is set for movement. When the target point is located at any of the following conditions: fence boundary, fence vertex, projection line intersecting at fence vertex, or ray coinciding with fence boundary, the boundary distance is set to b. Circles are drawn around each vertex of the involved fence boundary with radius b. The projection line is extended to intersect the arc of the circle. The original vertex remains unchanged. The connecting lines of other boundaries are extended to the intersection point, which is set as p. Rays are drawn from the original vertex to re-determine the number of intersection points. Let the original vertex coordinates be (x0, y0), the angle between the projection line and the horizontal axis be θ, and the x and y coordinates of point p(x, y) be: x = x0 + b·cos(f(θ) + 2πn) y = y0 + b·sin(f(θ) + 2πn) The algorithm described above determines whether a vehicle is within a polygonal electronic fence by adding an arc-shaped edge distance ray intersection method, and determines the position based on the parity of the number of intersections.
3. The method for determining the range of an electronic fence for hazardous chemical vehicles according to claim 1, characterized in that: In S6, a support vector machine is used to build an algorithm model to predict whether a vehicle deviates from the electronic fence, specifically including: Suppose the training dataset contains m samples, and each sample contains n features; for the i-th sample, it is represented as... in Let represent the j-th feature of the sample, and y be the true label of the sample. i y i ∈{-1,1}; To predict the label of a new sample, a classification model needs to be learned from the training dataset. The goal of the support vector machine algorithm is to find a hyperplane that can separate samples with different labels, while also maximizing the "minimum distance" between the hyperplane and the training data, that is, to maximize the distance from the hyperplane to the point closest to it. Consider the standard form of the separating hyperplane: w T x + b = 0, where w is the normal vector representing the direction of the hyperplane, and b is the offset; for a given sample x i y i (w T x i +b) is compared with 0 to determine its position. If y i (w T x i If (w + b) > 0, then the sample is correctly classified; otherwise, it is misclassified. Therefore, we need to find a suitable set of w and b such that all samples are correctly classified and the generalization error between the training dataset and the test dataset is minimized. Based on the support vector machine algorithm, a soft-margin support vector machine (SM SVM) is adopted; Specifically, the objective function becomes: Wherein, the constant c represents the penalty weight for misclassified points; ε i It is a slack variable, representing the classification error of the i-th sample. Let represent the sum of squared distances from the hyperplane to each support vector. In order to maximize the distance between the support vectors and the hyperplane, equation (5) should be minimized. By solving equation (5), the corresponding classification decision function is obtained: Where, α i These are coefficients obtained through Lagrange optimization, which represent the importance of each sample vector; Represents the eigenvector x i The inner product between the data point x to be predicted; b is the bias term used to adjust the position of the decision boundary, thereby affecting the classification result; the sign() function in equation (6) represents the sign function, which has a value of 1 or -1 and is used to classify new samples.
4. The method for determining the range of an electronic fence for hazardous chemical vehicles according to claim 1, characterized in that: After predicting whether a vehicle has deviated from the electronic fence area, an alarm message is sent to the terminal device, and an alarm message is also pushed to the corresponding vehicle driver's mobile phone.
Citation Information
Patent Citations
Method for determining bus entry and exit based on electronic fences at bus stops
CN109859514B
Limited position-based region prewarning method
CN107154133A
Vehicle driving early warning method, system, device and equipment
CN112235712A