A method for on-demand metering and billing control of BeiDou grid code spatiotemporal services

By analyzing the continuous positioning coordinates and confidence areas of BeiDou positioning terminals, false jump trajectories are identified and eliminated to form smooth trajectories. Short-term jitter and continuous cross-grid trajectories are determined, and non-overlapping billing invoices are generated. This solves the billing confusion problem of BeiDou grid code spatiotemporal services in boundary areas and achieves accurate billing.

CN123071044APending Publication Date: 2026-11-10ZHONGKE YUNYAO (SHENZHEN) TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611554870.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-10-09
Publication Date
2026-11-10

AI Technical Summary

Technical Problem

The existing BeiDou grid code spatiotemporal service has problems such as repeated splitting of the same service task for billing or settlement confusion when processing tasks in boundary areas. This is mainly due to the complexity of grid ownership determination caused by the confidence area characteristics of BeiDou positioning, which makes it difficult to distinguish between false jumps and real cross-grid movements.

Method used

By analyzing the continuous positioning coordinates and confidence areas of BeiDou positioning terminals, the boundaries of the same-level grid are extracted, the intersection patterns of continuous boundaries are identified, false jump trajectories are eliminated, smooth trajectories are formed, short-term jitter and continuous cross-grid trajectories are identified, and the ownership status is determined based on the persistence and direction of movement after crossing the boundary, generating non-overlapping bills.

Benefits of technology

It effectively solves the problems of duplicate billing and misclassification caused by boundary jitter, and realizes precise on-demand metering and billing control of Beidou grid code spatiotemporal services, ensuring the accuracy of billing and fine-grained attribution.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123071044A_ABST
    Figure CN123071044A_ABST
Patent Text Reader

Abstract

This application provides a method for on-demand metering and billing control of BeiDou grid code spatiotemporal services, including: acquiring the continuous positioning coordinates and confidence area of ​​the BeiDou positioning terminal, extracting the boundary of the preset same-level grid, analyzing the coverage process of the confidence area crossing the boundary, and forming a continuous boundary intersection pattern; based on the continuous boundary intersection pattern, marking adjacent coordinate segments that travel back and forth around the same boundary, removing coordinate segments that return to the original grid after crossing the boundary and whose first and last coordinates are on the same side of the boundary, connecting the first and last coordinates to obtain a smooth trajectory; analyzing the grid occupancy process of the continuous coordinates and the smooth trajectory along the grid level, extracting the adjacent grid travel paths corresponding to the removed coordinate segments, evaluating the dwell continuity and movement direction after crossing the boundary, and forming a short-term jitter trajectory and a continuous cross-grid trajectory.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of information technology, and in particular to a method for on-demand metering and billing control of BeiDou grid code spatiotemporal services. Background Technology

[0002] The spatiotemporal services supported by the BeiDou Navigation Satellite System have become an indispensable infrastructure in fields such as smart cities and shared mobility. The accuracy of its on-demand metering and billing directly affects the fairness of interests between service providers and users. Ideally, distributed storage and rapid retrieval of billing events can be achieved by using grid coding as the basis for ledger sharding. However, in practical applications, it has been found that existing solutions often result in the same service task being repeatedly split for billing or causing settlement chaos when handling tasks in boundary areas. The root cause of this settlement anomaly is that the fixed-level grid attribution determination ignores the confidence region characteristic inherent in BeiDou positioning itself. Each positioning result is not a precise point but an elliptical or circular area containing the real location. When this area happens to be near the grid boundary, it causes complexity in attribution determination. To obtain detailed spatial attribution records, the conventional approach is to use fine-level grids for attribution determination. Although fine-level grids can provide high-precision spatial positioning records, once the confidence region simultaneously covers two or more adjacent same-level grids, the grid attribution of the device will frequently jump between adjacent codes during continuous positioning. This is because the ledger system stores events in fragments based on grid codes. The intersection state between the confidence region and the grid boundary is dynamically changing. Relying solely on the spatial positional relationship at a single moment cannot distinguish between false jumps caused by transient positioning noise and actual cross-grid movement of the device. This results in the billing records for the same service task within the same time period being split and written to multiple grid fragments. While using a coarse-level grid can avoid jitter, it will lose the fine-grained attribution information that could otherwise be obtained. Increasing the granularity of grid attribution often increases the confusion in splitting billing records. Therefore, under the constraints of uncertain boundary time periods and dynamically changing confidence regions, how to simultaneously meet the requirements of avoiding repeated splitting of billing for the same task and accurately restoring fine-grained grid attribution has become an urgent technical challenge. Summary of the Invention

[0003] This invention provides a method for on-demand metering and billing control of BeiDou grid code spatiotemporal services, the method comprising: Obtain the continuous positioning coordinates and confidence area of ​​the Beidou positioning terminal, extract the boundary of the preset same-level grid, analyze the coverage process of the confidence area crossing the boundary, and form the continuous boundary intersection pattern; Based on the intersection pattern of continuous boundaries, adjacent coordinate segments that travel back and forth around the same boundary are marked. Coordinate segments that cross the boundary and return to the original grid with their first and last coordinates on the same side of the boundary are removed to obtain a smooth trajectory. Extract the round-trip path of the adjacent grid corresponding to the removed coordinate segment, evaluate the persistence and direction of movement after the boundary crossing, and form short-term jitter trajectory and continuous cross-grid trajectory. Track the short-term jitter trajectory and the dwell position and direction after the continuous cross-grid trajectory crosses the boundary, and identify the cross-grid belonging status; Based on false jump-attribution and true cross-cell attribution, coarse-grained billing events and fine-grained attribution events are determined respectively; Retrieve service task identifiers and billing time windows, aggregate coarse-level billing events and fine-grained attribution events, determine the corresponding grid code and billing period registration task, and generate the final billing statement.

[0004] Furthermore, the step of obtaining the continuous positioning coordinates and confidence region of the BeiDou positioning terminal, and extracting the boundary of the preset same-level grid, includes: Read the confidence region parameters associated with each coordinate, which include the major semi-axis, minor semi-axis and orientation angle, reconstruct the confidence region centered on the positioning coordinates, and arrange the continuously sampled coordinates and confidence regions according to the timestamp to form a coordinate sequence with confidence regions; The system retrieves the BeiDou grid code library to locate the preset same-level grid to which each coordinate belongs, reads the four boundaries of the grid and adjacent grids and converts them into boundary line segments, extracts the common boundary to obtain a set of candidate boundaries, and judges the geometric positional relationship between the confidence region and each boundary. If there is an intersection, it is recorded as a crossing state; if there is no intersection and it is located on one side, it is recorded as a single-sided state. The boundaries are then connected in a continuous boundary intersection pattern according to the timestamp.

[0005] Furthermore, the step of marking adjacent coordinate segments that travel back and forth around the same boundary based on the intersection pattern of continuous boundaries includes: Slide along the timestamp to capture adjacent coordinates to form a detection window. If the intersection state within the window is alternating between one-sided, cross-over, and one-sided, and the orientation labels at both ends are the same, it is registered as a round-trip coordinate segment and the common boundary number and the first and last timestamps are recorded. For each round trip coordinate segment, if the middle coordinate belongs to a different grid than the first and last coordinates, but the first and last coordinates still belong to the same original grid and the first and last orientation labels are consistent, it is determined to be a jittery coordinate segment. The middle coordinate is removed and the first and last coordinates are retained to obtain the jitter-removed sparse coordinate sequence.

[0006] Furthermore, the thinned coordinate sequence after jitter removal includes: For each pair of adjacent jittering first and last coordinates in the thinned coordinate sequence, the number of transition coordinate points is determined by dividing the span of the two coordinate timestamps by the original sampling interval. The corresponding number of transition coordinate points are generated between the two coordinates by linear interpolation. The transition coordinate points are then backfilled between the adjacent first and last coordinates and merged with the original coordinates that have not been removed by timestamp to form a smooth trajectory that continues along the inside of the original grid.

[0007] Furthermore, the round-trip paths of adjacent grids corresponding to the removed coordinate segments are extracted, and the persistence and direction of motion after crossing the boundary are evaluated to form short-term jitter trajectories and continuous cross-grid trajectories, including: The grid code to which a coordinate belongs is recorded sequentially along the BeiDou grid code library from coarse to fine grid levels. Coordinates with adjacent timestamps belonging to the same code are merged into an occupancy record. The start and end timestamps, grid codes and data source markers are registered to obtain a grid occupancy process sequence covering the service task cycle. The occupancy record is distinguished from the original continuous positioning coordinate sequence or a smooth trajectory based on the data source marker. Based on the records derived from the original continuous positioning coordinate sequence, the timestamp interval of the eliminated jittery coordinate segment is retrieved. The adjacent grid codes to which the intermediate coordinates belong within the interval are traced back and concatenated with the original grid codes by timestamp, and the number of grid switching is recorded. The latitude and longitude difference between two adjacent intermediate coordinates is used as the direction vector to obtain the set of adjacent grid round-trip paths with direction vectors.

[0008] Furthermore, the set of adjacent grid round-trip paths with direction vectors includes: For each round-trip path in the set of adjacent grid round-trip paths, the continuous dwell time of the intermediate coordinates in the adjacent grid is counted and compared with the preset dwell time threshold. The cosine value of the angle between the direction vector at the time of crossing the boundary and the time of returning is calculated. If the continuous dwell time is less than the threshold and the cosine value is negative, it is determined to be a short-term jitter trajectory. If the continuous dwell time is not less than the threshold and the cosine value is positive, it is determined to be a continuous grid crossing trajectory.

[0009] Furthermore, the tracking of short-term jitter trajectories and the dwell position and direction after continuous cross-grid trajectories cross boundaries, and the identification of cross-grid attribution status, includes: The location of the out-of-bounds movement is tracked along the timestamp. The grid code to which the location belongs is compared with the original grid code to obtain a comparison mark with a value of either falling back or staying. This forms a cross-grid tracking entry with the location, comparison mark, and direction of movement. If a tracked entry originates from a short-term jitter trajectory and the attribution comparison is marked as a fallback and the continuous dwell time does not reach the preset dwell time threshold, the cross-grid attribution status is recorded as a false jump attribution conclusion. The tracking entry originates from a continuous cross-grid trajectory and is marked as a stalled entry, with the cosine of the angle between the direction vectors of the cross-boundary segment and the return segment being positive. The cross-grid attribution status is recorded as the true cross-grid attribution conclusion.

[0010] Furthermore, the coarse-level billing events are identified, including: The original grid codes and adjacent grid codes that the short-term jitter trajectory passes through are collected into a candidate sub-grid set. The parent grid code sequence of each code is retrieved from the Beidou grid code library and traced layer by layer from fine to coarse to form a set of parent and child code chains. The encoding of the parent grid at the same level of each encoding chain is compared along the direction from fine to coarse. The level at which the parent grid encoding of each encoding chain is the same for the first time is determined as the least common parent grid. The continuous time period between the first and last coordinates of the short-term jitter trajectory is defined as the cross-grid time period. The service task attribution for the cross-grid period is registered in the billing ledger using the parent grid code as the accounting key. The ledger writing channels of each subgrid code in the candidate subgrid set within the cross-grid period range are frozen. The parent grid code, the start and end times of the cross-grid period, and the list of frozen subgrid codes are packaged to obtain the coarse-level billing event.

[0011] Furthermore, determining the fine-grained attribution events includes: The adjacent grids that the continuous cross-grid trajectory enters are read as candidate subgrids. If the continuous dwell time is not less than the preset dwell time threshold and the cosine value of the angle between the direction vectors of the cross-boundary segment and the return segment is positive, the candidate subgrid is determined as the target subgrid. The first sampling time of entering the target subgrid is recorded as the first dwell time. The service task timestamp interval is divided into two non-overlapping billing periods at the first dwell time. The billing periods after the first dwell time are bound to the target subgrid code and packaged into a fine-grained attribution event carrying the target subgrid code, the start and end times of the billing period, and the service task identifier.

[0012] Furthermore, the process of retrieving service task identifiers and billing time windows, aggregating coarse-level billing events and fine-grained attribution events, determining the corresponding grid code and billing period registration task, and generating the final billing statement includes: Retrieve the coarse-level billing events and the fine-grained attribution events from the event queue, match and aggregate them according to the service task identifier, and register the parent grid code or target sub-grid code carried by the two types of events along with the start and end times of the billing period into the billing entry book with the service task identifier as the key. Each entry records the attribution grid code, the start and end times of the period, and the event category. Verify the time period coverage relationship of each billing item according to the timestamp along the billing time window. If two items have overlapping time periods on the time axis and carry parent grid code and child grid code respectively, and the child grid code belongs to the list of frozen child grid codes in the coarse-level billing event freeze record, retain the item carrying the parent grid code and remove the item carrying the child grid code, and summarize the output as the final billing bill.

[0013] The technical solutions provided by the embodiments of the present invention may include the following beneficial effects: This invention discloses a method for on-demand metering and billing control of BeiDou grid code spatiotemporal services. Addressing the problem of difficulty in distinguishing between false jumps and genuine grid crossings caused by positioning errors near grid boundaries in BeiDou positioning terminals, this method analyzes the intersection patterns of continuous boundaries in the confidence region, identifies coordinate segments traveling back and forth around the same boundary, and eliminates jitter trajectories that immediately return after crossing the boundary. After forming a smooth trajectory, it extracts two types of patterns: short-term jitter and continuous grid crossings. Then, based on the continuity of dwell time and the direction of movement after crossing the boundary, it determines the attribution status. For false jumps, it uses the least common parent grid for coarse-level billing and freezes sub-grid settlement. For genuine grid crossings, it divides the time period into fine-grained attribution events based on the first dwell time. Finally, it aggregates the two types of events to generate non-overlapping bills, effectively solving the problems of duplicate billing and misattribution caused by boundary jitter, and achieving accurate on-demand metering and billing control for BeiDou grid code spatiotemporal services. Attached Figure Description

[0014] Figure 1 This is a flowchart of a Beidou grid code spatiotemporal service on-demand metering and billing control method according to the present invention.

[0015] Figure 2 This is a schematic diagram of an on-demand metering and billing control method for BeiDou grid code spatiotemporal services according to the present invention.

[0016] Figure 3 This is another schematic diagram of a Beidou grid code spatiotemporal service on-demand metering and billing control method according to the present invention. Detailed Implementation

[0017] To further understand the content of this invention, a detailed description of the invention is provided in conjunction with the accompanying drawings and embodiments. The specific embodiments described herein are for illustrative purposes only and are not intended to limit the invention. It should also be noted that, for ease of description, only the parts relevant to the invention are shown in the accompanying drawings.

[0018] like Figures 1-3 This embodiment of a BeiDou grid code spatiotemporal service on-demand metering and billing control method may specifically include: Step S101: Obtain the continuous positioning coordinates and confidence area of ​​the Beidou positioning terminal, extract the boundary of the preset same-level grid, analyze the coverage process of the confidence area crossing the boundary, and form the continuous boundary intersection pattern.

[0019] The system acquires continuous positioning coordinates output by the BeiDou positioning terminal at preset sampling intervals within the service mission cycle. Simultaneously, it reads the confidence region parameters accompanying each coordinate, which include the major and minor axes and the orientation angle. Based on these parameters, a confidence region centered on the positioning coordinate is reconstructed. The continuously sampled coordinate points and their corresponding confidence regions are arranged by timestamp to obtain a coordinate sequence with confidence regions. Based on the latitude and longitude values ​​of each coordinate in the coordinate sequence with confidence regions, a pre-established BeiDou grid code library is retrieved to locate its corresponding preset peer grid. The latitude and longitude ranges of this peer grid and its adjacent peer grids are read, and the grid boundaries are converted into grid boundary segments. The common boundaries between each coordinate's grid and its adjacent grids are extracted to obtain a candidate boundary set corresponding one-to-one with the coordinate sequence. For each boundary in the candidate boundary set, the geometric positional relationship between the confidence region and the boundary is determined. If the confidence region and the boundary line segment intersect, it is recorded as a crossing state. If the confidence region and the boundary line segment do not intersect and the confidence region is located on one side of the boundary, it is recorded as a one-sided state. The crossing state and the one-sided state at each sampling time are concatenated according to the timestamp to obtain the intersection pattern of the continuous boundaries.

[0020] In the application scenario of on-demand billing for shared mobility, the Beidou positioning terminal equipped on the service vehicle or shared bicycle outputs positioning messages at a preset sampling interval.

[0021] For example, the sampling interval is one second or half a second, and the message at each sampling time carries longitude, latitude and positioning accuracy description fields, which constitute the original data source for subsequent processing.

[0022] In one possible implementation, the confidence region parameter is characterized by three geometric elements: the major semi-axis, the minor semi-axis, and the orientation angle.

[0023] Specifically, the major semi-axis represents the distance the actual position may deviate from the positioning coordinates along the direction of greatest positioning uncertainty, the minor semi-axis represents the deviation distance in the direction orthogonal to it, and the orientation angle represents the angle between the major semi-axis and true north. Let the ratio of the minor semi-axis to the major semi-axis be r = b / a, satisfying a ≥ b > 0. When 0.85 ≤ r ≤ 1.0, it is judged as a near-circular shape; when 0.6 ≤ r < 0.85, it is judged as a general ellipse; when 0 < r < 0.6, it is judged as a narrow ellipse, with the orientation angle pointing towards the obstruction notch.

[0024] For example, when a shared bicycle travels to a high-rise canyon section, the long half-axis can reach 15 meters, while the short half-axis is only 4 meters, and the direction angle is approximately parallel to the street direction.

[0025] It should be noted that the positioning coordinates and the confidence region parameters are concatenated sequentially by timestamp to form a coordinate sequence with a confidence region. This coordinate sequence uses the timestamp as the primary key, supporting backtracking queries at any subsequent time. For each coordinate in the coordinate sequence with the confidence region, its affiliation is retrieved from a pre-established BeiDou grid code library. The BeiDou grid code library is generated according to the national standard recursive latitude and longitude partitioning method. Each grid code corresponds to a rectangular spatial unit, recording the west longitude, east longitude, south latitude, and north latitude values ​​of that unit.

[0026] In one embodiment, the retrieval process drills down through the grid code library level by level based on the latitude and longitude values ​​of the coordinates until a preset same-level grid layer is reached. After the same-level grid is determined, the grid codes and their boundary parameters of the grids adjacent to it in the east, west, south, and north directions are further read.

[0027] Preferably, the boundary extraction process processes the common edges of the same-level mesh and its adjacent same-level meshes as line segments in the horizontal or vertical direction.

[0028] For example, a grid at the same level shares a north-south longitude segment with its eastern neighbor, the length of which is determined by the latitudinal span covered by both grids; a grid at the same level shares an east-west latitude segment with its northern neighbor, the length of which is determined by the longitude span covered by both grids. The common boundaries of the grid corresponding to the coordinate and its four adjacent grids are sequentially aggregated to form a set of candidate boundaries corresponding one-to-one with that coordinate. For each boundary in the set of candidate boundaries, the geometric positional relationship between the confidence region and the boundary segment is determined.

[0029] Specifically, the positioning coordinates and endpoints of the boundary segment are first converted from WGS84 latitude and longitude to Gauss-Kruger or UTM projections into local Cartesian coordinates with the positioning point as the origin. The horizontal axis points due east, and the vertical axis points due north, with the conversion accuracy controlled within 0.01 meters. Under this geographic plane coordinate system, the coordinate axes are rotated by the direction angle to align the major semi-axis of the ellipse with the horizontal axis, obtaining the standard elliptical representation of the confidence region. Then, the two endpoints of the boundary segment are translated and rotated in the same rotating coordinate system to obtain the endpoint coordinates, denoted as P1 and P2. Interpolation is performed along the line segment using parameter t. The coordinates of any point on the line segment are obtained by a linear combination of P1 and P2 according to the value of t, where t ranges uniformly from 0 to 1 with a step size of 0.02.

[0030] For each interpolation point, calculate the discriminant value d = x × x / (a ​​× a) + y × y / (b × b), where x and y are the x and y coordinates of the interpolation point in the rotated coordinate system, a is the major semi-axis, and b is the minor semi-axis. If there exists any interpolation point such that d <= 1, then the boundary and confidence region are considered to be in a crossed state; if all interpolation points make d > 1, then it is considered to be in a one-sided state.

[0031] For directional labels in a unilateral state, the determination must be made in the unrotated geographic plane coordinate system: For a north-south common boundary, let the east coordinate of the boundary be Eb and the east coordinate of the ellipse center be Ec. When Ec-Eb > ε, it is labeled as east; when Ec-Eb < -ε, it is labeled as west. For an east-west common boundary, let the north coordinate of the boundary be Nb and the north coordinate of the ellipse center be Nc. When Nc-Nb > ε, it is labeled as north; when Nc-Nb < -ε, it is labeled as south. If P1 and P2 fall into different geographic quadrants, the component direction corresponding to the larger sum of the absolute values ​​of dE and dN at the two endpoints is taken as the dominant direction, and a unique directional label is assigned according to the above interval rules to avoid situations where no label is assigned.

[0032] For example, when a shared bicycle travels near the common longitude line of two adjacent grids, the stretching of the confidence region caused by building obstruction often results in the longitude line being covered by an ellipse, at which point the determination result is a crossing state. In one implementation, the crossing state and the one-sided state corresponding to each sampling time in the coordinate sequence with the confidence region are concatenated in time stamp order to obtain the continuous boundary intersection pattern. This continuous boundary intersection pattern is recorded in the form of record entries, each entry containing a timestamp, the number of the common boundary of the involved grids, an intersection state marker, and a directional label in the one-sided state, serving as the input basis for the next processing step.

[0033] Step S102: Based on the intersection pattern of continuous boundaries, mark adjacent coordinate segments that travel back and forth around the same boundary, remove coordinate segments that cross the boundary and return to the original grid and whose first and last coordinates are on the same side of the boundary, connect the first and last coordinates to obtain a smooth trajectory.

[0034] The record entries arranged by timestamp in the continuous boundary intersection pattern are obtained. Adjacent positioning coordinates are slid along the timestamp to form a detection window. If the intersection state sequence in the window shows an alternating pattern of single-sided, cross-border, and single-sided, and the azimuth labels corresponding to the single-sided states at both ends are the same, it is determined that the adjacent coordinates in the window have traveled back and forth around the same grid common boundary. The coordinate segment in the window is registered as a travel coordinate segment, and the common boundary number and the first and last timestamps are recorded to obtain a coordinate sequence with travel markers. For each travel coordinate segment in the coordinate sequence with travel markers, the same-level grid affiliation information of each positioning coordinate in the segment, which has been determined in the previous step, is read. If the grid affiliation of the middle coordinate in the segment is different from the grid affiliation of the first and last coordinates, but the first and last coordinates still belong to the same original grid, and the azimuth labels of the first and last coordinates relative to the involved common boundary are consistent, it is determined that the travel coordinate segment constitutes a jittery coordinate segment that crosses the boundary and returns to the original grid, and the first and last coordinates are located on the same side of the boundary. The middle coordinate of the jittery coordinate segment is removed from the coordinate sequence, and the first and last coordinates and their timestamps are retained to obtain a thinned coordinate sequence after jitter removal. For each pair of adjacent jittery first and last coordinates in the thinned coordinate sequence, the number of transition coordinate points is determined by dividing the timestamp span of the two coordinates by the original sampling interval. A corresponding number of transition coordinate points are generated between the two coordinates using linear interpolation. The transition coordinate points are then backfilled between the adjacent first and last coordinates and merged with the original positioning coordinates that were not removed in the thinned coordinate sequence according to the timestamp to obtain a smooth trajectory that continues along the inside of the original grid.

[0035] Continuing the continuous boundary intersection pattern output by the previous stage, the detection window is formed by sliding and truncating along the sequence of record entries according to the timestamp order.

[0036] For example, the detection window is truncated according to the time span, and the time difference between the first and last recorded entries in the window does not exceed 3 seconds. When the sampling interval is 1 second, the complete 3-second window contains 4 sampling points; when the sampling interval is 0.5 seconds, the complete 3-second window contains 7 sampling points.

[0037] In one possible implementation, the criteria for determining whether the intersection state sequence within the detection window exhibits an alternating pattern of "one-sided, crossing, one-sided" are as follows: The intersection state corresponding to the first entry of the window is marked as one-sided, indicating that the confidence region is completely located on one side of a common boundary of a certain grid at that moment; the intersection state of the middle entry of the window is marked as crossing, indicating that the confidence region intersects with the common boundary; the intersection state of the last entry of the window returns to one-sided. The three states form a symmetrical entry and exit pattern in the time series, reflecting the short-term back-and-forth oscillation of the positioning terminal near the boundary.

[0038] Specifically, alternating patterns alone are insufficient to determine round trip; the azimuth labels corresponding to the states on both ends of the window must also be compared. The previous processing step registered an azimuth label for each state, with the label value being one of East, West, South, or North, representing the azimuth of the confidence region relative to the grid boundary where the ellipse center is located. If the azimuth label values ​​of the starting and ending entries of the window are the same, it indicates that the confidence region has returned to the same side of the common boundary before and after crossing the boundary. The adjacent coordinates covered by windows that meet the above pattern and azimuth consistency conditions are registered as round trip coordinate segments, and the common boundary numbers involved and the start and end timestamps are recorded, forming a coordinate sequence with round trip markings.

[0039] It should be noted that the round-trip marker is only a preliminary screening criterion, and further verification is needed to determine whether the segment constitutes jitter that needs to be removed. For each round-trip coordinate segment in the coordinate sequence with the round-trip marker, the grid affiliation information of each positioning coordinate within the segment, which was determined in the previous step, is read, without needing to re-perform the grid code library search. Jitter determination adopts a triple joint condition: First, the grid affiliation of the middle coordinate within the segment is different from the grid affiliation of the first and last coordinates, indicating that the confidence region crossed the common boundary at an intermediate moment and briefly entered the adjacent grid; second, the first and last coordinates still belong to the same original grid, indicating that after crossing the boundary, they returned to the starting grid; third, the orientation labels of the first and last coordinates relative to the common boundary remain consistent, indicating that the orientation relationship of the confidence region relative to the boundary has not changed substantially after returning.

[0040] For example, if a shared bicycle is traveling bumpily near an east-west public boundary, and at the initial moment the confidence region is north of the boundary and belongs to the northern grid, at the intermediate moment the center of the confidence region briefly crosses into the southern grid, and at the final moment the confidence region returns to the northern grid while the orientation label remains north, then all three conditions are met, and this is considered jitter. If any one of the three conditions is not met, then the round-trip coordinate segment does not constitute jitter. For example, if the initial and final coordinates belong to the same grid but the orientation label is flipped, or the final coordinate belongs to a different grid than the initial one, these are all excluded from jitter. In round-trip coordinate segments determined to be jitter, the intermediate coordinates are considered false deviations caused by positioning noise and are removed from the coordinate sequence, while the initial and final coordinates and their timestamps are retained as anchor points for that segment.

[0041] Preferably, the coordinate sequence after removing intermediate coordinates is named the thinned coordinate sequence. In the thinned coordinate sequence, there is a gap between adjacent original jitter first and last coordinates with a timestamp span greater than a single sampling interval. For each pair of adjacent jitter first and last coordinates in the thinned coordinate sequence, the timestamp span between the two coordinates is calculated, and this span is divided by the original sampling interval and then subtracted by 1 to obtain the number of transition coordinate points.

[0042] For example, if the original sampling interval is 1 second, and the first and last timestamps of a jitter segment differ by 3 seconds, then there should originally be 2 sampling points in the middle. After removing them, 2 transition coordinate points need to be inserted to make the timing of the supplemented timestamps consistent with the original sampling timing.

[0043] Specifically, the longitude and latitude of the transition coordinate points are determined using linear interpolation. Let the longitude and latitude of the initial coordinates be L1 and B1, and the longitude and latitude of the final coordinates be L2 and B2. Let n be the number of sampling times removed between the two coordinates. Then, the longitude of the k-th transition coordinate point is L1 + (L2 - L1) × k / (n + 1), and the latitude is B1 + (B2 - B1) × k / (n + 1), where k ranges from 1 to n, and n + 1 corresponds to the total number of time steps between the initial and final coordinates, ensuring that the initial and final coordinates are not covered by interpolation and that intermediate times are evenly distributed. The timestamps of the transition coordinate points are allocated at equal intervals between the initial and final timestamps, aligning one-to-one with the original sampling times. In one embodiment, the transition coordinate points are backfilled between the corresponding adjacent initial and final coordinates in the thinned coordinate sequence, and merged with the original positioning coordinates that were not removed in the thinned coordinate sequence according to the timestamp order, forming a smooth trajectory continuing along the interior of the original grid. The smoothed trajectory no longer exhibits cross-boundary oscillations within the original jitter period, retaining only coordinate points that reflect the actual movement trend of the positioning terminal.

[0044] Step S103: Analyze the grid occupancy process of continuous coordinates and smooth trajectories along the grid hierarchy, extract the round-trip paths of adjacent grids corresponding to the removed coordinate segments, evaluate the dwell continuity and movement direction after crossing the boundary, and form short-term jitter trajectory and continuous cross-grid trajectory.

[0045] The continuous positioning coordinate sequence and the smoothed trajectory are obtained. Drilling down sequentially along the pre-established BeiDou grid code library, from coarse to fine grid levels, coordinates are recorded as belonging to the grid code at each level. Coordinates with adjacent timestamps belonging to the same grid code at the same level are merged into a single occupancy record. The start and end timestamps, the grid code, and the data source tag of this segment are recorded, resulting in a grid occupancy process sequence covering the entire service task cycle. The data source tag is used to distinguish whether the occupancy record originates from the original continuous positioning coordinate sequence or the smoothed trajectory. Based on the records originating from the original continuous positioning coordinate sequence in the grid occupancy process sequence, the timestamp intervals corresponding to the jittery coordinate segments removed in the preceding steps are retrieved. The adjacent grid codes belonging to the intermediate coordinates within this interval are traced back. The adjacent grid codes entered by the intermediate coordinates are concatenated with the original grid codes according to their timestamps. The number of grid switching times for the intermediate coordinates is recorded synchronously. The latitude and longitude difference between two adjacent intermediate coordinates within this interval is used as a direction vector, resulting in a set of adjacent grid round-trip paths with direction vectors. For each round-trip path in the set of adjacent grid round-trip paths, the continuous dwell time of the intermediate coordinates in the adjacent grid is counted and compared with a preset dwell time threshold. At the same time, the cosine value of the angle between the direction vector at the boundary crossing time and the return time is calculated. If the continuous dwell time is less than the threshold and the cosine value of the angle is negative, the round-trip path is determined to be a short-term jitter trajectory. If the continuous dwell time is not less than the threshold and the cosine value of the angle is positive, the round-trip path is determined to be a continuous grid crossing trajectory.

[0046] In the application scenario of on-demand billing for shared mobility, the Beidou grid code library generates a multi-level coding structure by recursively partitioning latitude and longitude.

[0047] For example, the coarse-level grid has a side length of approximately 110 meters, the medium-level grid has a side length of approximately 14 meters, and the fine-level grid has a side length of approximately 1.7 meters. The coarse-level grid covers commercial areas or blocks, the medium-level grid corresponds to cycling segments around buildings, and the fine-level grid is used to accurately record parking points.

[0048] In one possible implementation, for each coordinate point in the continuous positioning coordinate sequence and the smooth trajectory, drilling down level by level from the coarse-level grid, the coordinate latitude and longitude are compared layer by layer with the four boundaries of each level of grid to obtain the three grid codes for the coordinate at the coarse-level, medium-level, and fine-level. After each coordinate is recorded, adjacent coordinates are scanned sequentially along the timestamp at each level. If adjacent coordinates have the same grid code at that level, they are merged into the same occupied record.

[0049] Specifically, each occupancy record registers four items: start timestamp, end timestamp, the grid code to which it belongs, and a data source marker. The data source marker has two values: original or smoothed. Occupancy records with an original value originate from the continuous positioning coordinate sequence, while occupancy records with a smoothed value originate from the smoothed trajectory. All occupancy records at all levels are aggregated in ascending order of timestamps to obtain a grid occupancy process sequence covering the entire service task cycle.

[0050] It should be noted that the significance of data source marking lies in enabling on-demand filtering during subsequent processing. In scenarios involving determining round-trip paths, records with the original markings are selected for backtracking; in scenarios involving evaluating final attribution, records with smooth markings are selected for calculation. Based on the records marked as original in the data source within the grid occupancy process sequence, the timestamp intervals corresponding to the jitter coordinate segments removed in the preceding stages are retrieved.

[0051] For example, the timestamp interval of a jittery coordinate segment is from the 10th to the 13th second, and this interval contains two intermediate coordinates. The grid code to which the jittery first coordinate belongs at the fine level is taken as the original grid code of the jittery coordinate segment, i.e., the reference grid code, to identify the grid where the trajectory is located when it enters the jittery state. The grid code to which each intermediate coordinate belongs at the fine level within this interval is traced back, and the grids to which they belong that are inconsistent with the original grid code are determined to be adjacent grids, while the remaining intermediate coordinates are considered to still be in the original grid. According to the timestamp order, the original grid code and the adjacent grid codes to which the intermediate coordinates enter are concatenated in sequence to form the prototype of a round-trip path between adjacent grids. In one embodiment, the process of constructing the direction vector is as follows. The jittery coordinate segment is divided into two sub-segments, an out-of-bounds segment and a return segment, according to the time point when the intermediate coordinates enter the adjacent grid. The starting point of the out-of-bounds segment is the jittery first coordinate, and the ending point is the first intermediate coordinate after entering the adjacent grid; the starting point of the return segment is the last intermediate coordinate before leaving the adjacent grid, and the ending point is the jittery last coordinate. For each sub-segment, the latitude and longitude of its starting point are denoted as L1 and B1, and the latitude and longitude of its ending point are denoted as L2 and B2. The horizontal component of the direction vector is L2-L1, and the vertical component is B2-B1, thus obtaining the direction vectors for the boundary crossing segment and the return segment. If the jittering coordinate segment contains only one intermediate coordinate, then that intermediate coordinate is used as both the end point of the boundary crossing segment and the starting point of the return segment. The number of times the grid to which the intermediate coordinate of the jittering coordinate segment belongs is switched from the original grid code to the adjacent grid code is recorded simultaneously. The path entries of all jittering coordinate segments are collected to obtain a set of round-trip paths between adjacent grids with direction vectors.

[0052] Preferably, the dwell time threshold is set to 3 seconds. This threshold is chosen because the normal riding speed of a shared bicycle is approximately 4 meters per second, and the time required to traverse a mid-level grid with a side length of approximately 14 meters is approximately 3.5 seconds. Dwell times shorter than 3 seconds are considered temporary deviations caused by confidence region jitter, while dwell times of 3 seconds or more indicate that the device has actually entered the adjacent grid. For each round-trip path in the set of adjacent grid round-trip paths, the continuous dwell time of the intermediate coordinate within the adjacent grid is calculated. This is done by subtracting the timestamp of the intermediate coordinate entering the adjacent grid from the timestamp of leaving the adjacent grid, and comparing this continuous dwell time with the dwell time threshold. Simultaneously, the cosine of the angle between the direction vector of the outbound segment and the direction vector of the return segment is calculated. Because the Earth's latitude and longitude grid is not equidistant, the direction vector is first corrected to be equidistant by multiplying the longitude difference by the cosine value of the latitude at the intermediate coordinate to obtain the corrected horizontal component, and the latitude difference is directly used as the vertical component. The two corrected components are used to form a plane vector, and the dot product of the boundary segment vector and the return segment vector is calculated. Then, it is divided by the product of the magnitudes of the two vectors. The result ranges from negative 1 to positive 1.

[0053] In one embodiment, if the continuous dwell time is less than 3 seconds and the cosine value of the included angle is not greater than the reverse threshold, it is determined to be a short-term jitter trajectory; if the continuous dwell time is not less than 3 seconds and the cosine value of the included angle is not less than the same-direction threshold, it is determined to be a continuous cross-grid trajectory; all other cases are entered into the pending queue.

[0054] For example, occasional oscillations in the confidence region when a shared bicycle is waiting at a traffic light are typically identified as short-term jitter trajectories, while normal riding across the intersection is identified as continuous grid-crossing trajectories. The short-term jitter trajectories and the continuous grid-crossing trajectories are packaged separately, along with their corresponding timestamp intervals, adjacent grid codes, and direction vector records, serving as input for the grid-crossing attribution status identification step.

[0055] Step S104: Track the short-term jitter trajectory and the dwell position and direction of the continuous cross-grid trajectory after crossing the boundary, and identify the cross-grid ownership status. If the cross-grid returns to the original grid and does not continuously dwell in the adjacent grid, it is defined as a false jump ownership conclusion. If it continuously dwells in the adjacent grid and maintains the cross-boundary direction, it is defined as a true cross-grid ownership conclusion.

[0056] The timestamp intervals, adjacent grid codes, and direction vector records attached to the short-term jitter trajectory and the continuous cross-grid trajectory are obtained. The dwell position after crossing the boundary is tracked sequentially along the timestamps. The grid code to which the dwell position belongs is compared one by one with the original grid code to obtain a classification comparison mark with a value of either "fallback" or "stagnation." Simultaneously, the direction vector is read to depict the movement direction after crossing the boundary, forming a cross-grid tracking entry with dwell position, classification comparison mark, and movement direction. For each cross-grid tracking entry with dwell position, classification comparison mark, and movement direction, its trajectory type label is determined. If the tracking entry originates from the short-term jitter trajectory, and the classification comparison mark is "fallback," and the continuous dwell time obtained in the preceding step does not reach the preset dwell time threshold, then the cross-grid classification status of the tracking entry is recorded as a false jump classification conclusion. If the tracking entry originates from the continuous cross-grid trajectory, and the classification comparison mark is "stagnation," and the cosine value of the angle between the direction vectors of the cross-boundary segment and the return segment obtained in the preceding step is positive, then the cross-grid classification status of the tracking entry is recorded as a true cross-grid classification conclusion. Based on the judgment output of the false jump attribution conclusion and the true cross-grid attribution conclusion, each cross-grid tracking entry, together with its trajectory type label, original grid code, adjacent grid code, dwell position and direction vector record, is archived to obtain a cross-grid attribution status list grouped by conclusion category.

[0057] In the application scenario of on-demand billing for shared mobility, the pre-processing stage has already output the short-term jitter trajectory and the continuous cross-grid trajectory. The two types of trajectory entries correspond to the movement segments of shared bicycles or service vehicles near the public boundary of the grid, respectively. The cross-grid attribution status identification stage tracks and processes each trajectory entry in the order of timestamps, and collects its dwell position at each time after crossing the boundary.

[0058] Specifically, based on the timestamp interval of the trajectory entries, a sampling time sequence is generated at a sampling rhythm of 5 seconds. For each sampling time, the two nearest actual positioning points before and after that time are retrieved. If the time difference between the two points and that time does not exceed 3 seconds, linear interpolation is performed using time distance as the weight to obtain the positioning coordinates at that time. If only one side meets the condition, the coordinates of that side are directly used. If the time difference between both positioning points and the sampling time exceeds 3 seconds, that time is reserved as a missing measurement state. Missing measurement states cannot be filled using the previous valid marker, nor can they be included in the number of consecutive fallbacks or consecutive stays. The grid code to which the positioning coordinates of each sampling time belong at the fine level is read, and this grid code is compared with the original grid code registered in the trajectory entry. If the time grid code returns to the original grid code, the attribution comparison mark for that time is recorded as "fallback"; if the time grid code is still within the adjacent grid code, the attribution comparison mark for that time is recorded as "residual"; if the time grid code is neither the original grid code nor the adjacent grid code, but falls into the third grid, the attribution comparison mark for that time is recorded as "discrete," and further distinguished as near-end discrete or far-end discrete based on whether the distance from the location coordinates at that time to the center of the original grid exceeds 1.5 times the side length of the adjacent grid. The attribution comparison marks of all times are concatenated in timestamp order, with missing times filled in by the previous valid mark, forming an attribution comparison mark sequence. At the same time, the residence positions of each time are collected into a residence position sequence.

[0059] Preferably, the direction vector record attached to the trajectory entry is read together and bound with the attribution comparison mark sequence and the dwell position sequence to form a complete cross-grid tracking entry.

[0060] For example, a cross-grid tracking entry corresponds to the process of a shared bicycle crossing from the west grid into the east grid. The entry simultaneously stores the direction vectors of the crossing segment and the return segment. For cross-grid tracking entries originating from short-term jitter trajectories, a false jump attribution conclusion is determined. The determination condition is: the markers at the last three consecutive moments of the attribution comparison marker sequence are all falling back, indicating that the device has stably returned to the original grid after crossing the boundary; at the same time, the preceding process has determined that the continuous dwell time corresponding to this trajectory entry does not reach the preset dwell time threshold of 3 seconds, indicating that the stay of the confidence region on the adjacent grid is only a momentary deviation. When both conditions are met, the cross-grid attribution status of this cross-grid tracking entry is recorded as a false jump attribution conclusion.

[0061] For example, a shared bicycle travels bumpily near the common boundary of two adjacent grids, briefly deviates, and immediately returns to the original grid, meeting the judgment condition for this conclusion. For cross-grid tracking entries originating from continuous cross-grid trajectories, a true cross-grid attribution conclusion is determined. The judgment condition is: the attribution comparison marker sequence contains at least three consecutive time-lapse markers, and the end time of the time-lapse marker coverage period remains within the adjacent grid; simultaneously, the preceding process has determined that the cosine of the angle between the direction vector of the boundary-crossing segment and the direction vector of the return segment corresponding to the trajectory entry is positive, indicating that the device continued its original direction after crossing the boundary. When both conditions are met, the cross-grid attribution status of the cross-grid tracking entry is recorded as the true cross-grid attribution conclusion. This cross-grid attribution status list also serves as the common input basis for the subsequent coarse-level billing event and fine-grained attribution event generation stages. The coarse-level billing event is generated directly by calling the existing billing channel after the list is sorted in ascending order by timestamp. The fine-grained attribution event generation process reads each archived entry in the list one by one, segments the attribution comparison records according to the timestamp interval of the residence position sequence within the entry, and assembles the grid code, direction vector record, and attribution category corresponding to each residence segment into a fine-grained attribution event. The event timestamp is taken as the start time of the residence segment and included in the current billing cycle. Each event includes a trajectory type label, original grid code, adjacent grid codes, and attribution conclusion category. These are batched and stored on disk according to the billing cycle to form a fine-grained attribution event table for subsequent accurate billing and anomaly review. Entries in the pending queue do not participate in fine-grained attribution event generation; they are supplemented and generated as corresponding events only after the review includes one of the two conclusion categories.

[0062] Step S105: For false jump attribution conclusions, the same-level grids traversed by the short-term jitter trajectory are taken as candidate sub-grids, their parent-child coding chains are extracted and the least common parent grid is determined, the cross-grid time period is defined by the first and last moments of the trajectory, the time period is recorded according to the parent grid code and the sub-grid settlement is frozen to form a coarse-level billing event.

[0063] Obtain the cross-grid tracking entry corresponding to the false jump attribution conclusion, read the original grid code and adjacent grid codes registered in the entry, and aggregate the original grid codes and adjacent grid codes traversed by the short-term jitter trajectory to form a candidate sub-grid set. Retrieve the parent-layer grid code sequence obtained by tracing each code in the candidate sub-grid set from fine to coarse from the BeiDou grid code library, forming a set of parent-child code chains that correspond one-to-one with the candidate sub-grids. For the set of parent-child code chains, perform string comparison on the parent grid codes of the same level of each code chain in the direction from fine to coarse. When all code chains have the same parent grid code value at a certain level for the first time, the parent grid code at that level is determined as the least common parent grid. Simultaneously read the first and last coordinate times of the short-term jitter trajectory from the cross-grid tracking entry, and define the continuous time period between the two times as the cross-grid period. Based on the least common parent grid and the cross-grid time period, the service task attribution within the cross-grid time period is registered in the billing ledger using the parent grid code as the accounting primary key. At the same time, the ledger writing channel for each sub-grid code in the candidate sub-grid set within the cross-grid time period is frozen. The parent grid code, the start and end times of the cross-grid time period, and the list of frozen sub-grid codes are packaged to obtain the coarse-level billing event.

[0064] In the application scenario of on-demand billing for shared mobility, the false jump in the cross-grid attribution status list corresponds to the brief deviation of shared bicycles or service vehicles near the common boundary of two adjacent same-level grids.

[0065] For example, when a shared bicycle travels between two buildings, the building obstruction causes the confidence region to swing, triggering a false jump attribution conclusion. When a cross-grid tracking entry is generated, a service task identifier is extracted from the context of the current riding order. This identifier is a 16-digit order serial number and is written into the same record along with the original grid code, adjacent grid code, and jump timestamp. The original grid code points to the same grid at the western level, and the adjacent grid code points to the same grid at the eastern level. The service task identifier is used to bind the jitter to the riding trip it belongs to, facilitating subsequent backtracking and deduplication by task dimension. Taking this event as an example, after the entry is written to the disk, it forms a quadruple of the form: original grid GW, adjacent grid GE, task identifier T-8842, and timestamp T0. Based on this entry, the original grid code GW and the adjacent grid code GE are combined to form the candidate sub-grid set required for this settlement process. The task identifier T-8842 serves as a filter key, ensuring that the set only contains jitter samples belonging to the same ride.

[0066] Specifically, the parent-child coding chain is based on the hierarchical recursive structure of the BeiDou grid code. When generating the BeiDou grid code, it is divided into layers from coarse to fine according to latitude and longitude. The code of each fine-level grid is composed of the code of its corresponding coarse-level grid as a prefix, and sub-level identification bits are added level by level.

[0067] For example, the first 6 bits of a fine-level grid code are the coarse-level prefix, the middle 4 bits are the intermediate-level identification bits, and the last 3 bits are the fine-level identification bits. During reading, the parent grid codes of each level can be separated by dividing the code according to the above bit segment length. Each code in the candidate sub-grid set is divided layer by layer in the above manner to obtain a parent-level grid code sequence arranged from fine to coarse. Several parent-level grid code sequences are collected into a set of parent-child code chains.

[0068] In one possible implementation, the process of determining the least common parent grid is as follows: All coding chains in the parent-child coding chain set are extracted according to the parent grid encoding at the same fine level, forming a set of encoded values ​​for that level. A string consistency check is performed on all values ​​in this set. If the values ​​in the set are not completely identical, the process moves up to a coarser level, extracting the parent grid encoding of all coding chains at that level to form a new set of values ​​and repeating the consistency check. This upward tracing process is repeated until all encoded values ​​in the set of values ​​at a certain level are completely identical. The parent grid encoding value at that level is then determined as the least common parent grid.

[0069] For example, if the grids of the same level on the west side and the grids of the same level on the east side have different codes at the fine level, different codes at the medium level, and the same codes at the coarse level, then the code value of the coarse level grid is determined as the least common parent grid.

[0070] Preferably, the first and last coordinate times of the short-term jitter trajectory are read simultaneously from the cross-grid tracking entries, and the continuous time period between the two times is defined as the cross-grid period.

[0071] For example, the first coordinate time of a certain false jump attribution conclusion is the 10th second, the last coordinate time is the 13th second, and the span time period is defined as 3 seconds.

[0072] It should be noted that the implementation method of parent grid code accounting is as follows: The billing ledger is stored in segments according to grid codes, with each grid code corresponding to an independent ledger segment. The written accounting entries include the service task identifier, the start and end times of the time period, and the belonging grid code. Using the code of the least common parent grid as the accounting primary key, an accounting entry is written in the corresponding parent grid code ledger segment. The service task identifier in the entry comes from the cross-grid tracking entry, and the start and end times of the time period are taken from the two ends of the cross-grid time period.

[0073] Specifically, the implementation of sub-grid ledger freezing is as follows. In the shared mobility billing system, ledger shards provide write channels. For each sub-grid code within the candidate sub-grid set, a freeze record is registered in its corresponding ledger shard. The freeze record indicates the start and end times of the spanning time period and the service task identifier. Within the time period covered by the freeze record, the sub-grid ledger shard refuses to accept any accounting entries for the same service task identifier through the write channel, preventing the same false jump time period from being repeatedly recorded by the sub-level ledger. In one implementation, the parent grid code of the least common parent grid, the start and end times of the spanning time period, and the list of frozen sub-grid codes are packaged into a coarse-level billing event entry, along with the service task identifier, and stored in the on-demand metering and billing event queue as input for subsequent billing aggregation.

[0074] Step S106: Based on the true cross-grid attribution conclusion, the adjacent grids entered by the continuous cross-grid trajectory are taken as candidate sub-grids. The continuous residence and directional continuation within the confidence region are verified. The target sub-grid and the first residence time are determined. Non-overlapping billing periods are divided according to the first residence time. Fine-grained attribution events are formed with the target sub-grid code and the billing period.

[0075] Obtain the continuous cross-grid trajectory entry corresponding to the true cross-grid attribution conclusion. Read the adjacent grid codes entered within the entry as candidate subgrids. Read the continuous dwell time and the cosine value of the angle between the direction vectors of the boundary segment and the return segment obtained in the previous step. If the continuous dwell time is not less than the preset dwell time threshold of 3 seconds and the cosine value of the angle is positive, then the candidate subgrid is determined as the target subgrid. Simultaneously register the first sampling time when the continuous cross-grid trajectory enters the target subgrid as the first dwell time. Based on the first dwell time, divide the timestamp interval of the service task into two non-overlapping billing periods at that time. Bind the billing period after the first dwell time to the target subgrid code and package it into a fine-grained attribution event carrying the target subgrid code, the start and end times of the billing period, and the service task identifier.

[0076] In the application scenario of on-demand billing for shared mobility, the actual cross-grid attribution conclusion in the cross-grid attribution status list corresponds to the driving segment where a shared bicycle or service vehicle actually crosses the grid public boundary and enters an adjacent grid.

[0077] For example, a shared bicycle travels eastward along an east-west street, crossing from a western grid into an eastern grid and continuing to ride within the eastern grid. The codes for entering adjacent grids registered in the continuous cross-grid trajectory entry are used as candidate subgrids. The determination result of the continuous dwell time and the cosine of the angle between the direction vector of the cross-boundary segment and the return segment, obtained in the previous step, is read. If the continuous dwell time is not less than a preset dwell time threshold of 3 seconds and the cosine of the angle is positive, then the candidate subgrid is determined as the target subgrid.

[0078] Specifically, the first sampling moment when a continuously cross-grid trajectory enters the target sub-grid is recorded as the first dwell time. The false jump assignment conclusion here comes from the jitter identification step of the cross-grid assignment status list. When the number of consecutive dwell samples in the new grid is less than 3, or when it jumps back to the original grid within 1.5 seconds, the assignment is marked as a false jump assignment conclusion. This conclusion is written into the list together with the true cross-grid assignment conclusion that has passed the stability check. The two share the same entry structure and are only distinguished by the status bit.

[0079] For example, a continuously crossing-grid trajectory first falls into the same-level grid to the east at the 22nd second, which is the first dwell time. Using this time as a boundary, the timestamp interval of the service task is divided into two non-overlapping billing periods. The first period ends at the first dwell time, and the second period begins at the first dwell time and continues until the next true cross-grid attribution conclusion or false jump attribution conclusion appears in the cross-grid attribution status list. If no new attribution conclusion appears before the end of the service task, the second period continues until the end of the service task. In one implementation, the second period is bound to the target sub-grid code and packaged into a fine-grained attribution event entry. The entry includes the target sub-grid code, the start and end times of the billing period, and the service task identifier, and is stored in the on-demand metering and billing event queue as input for subsequent billing aggregation.

[0080] Step S107: Retrieve the service task identifier and billing time window, collect the two types of events, register the grid code and billing period to the corresponding task, verify time coverage and remove duplicate records, and generate the final billing bill for use in the on-demand metering and billing control of Beidou grid code spatiotemporal services.

[0081] The service task identifier and the billing time window are obtained. The coarse-level billing event and the fine-grained attribution event are retrieved from the event queue. The two types of events are matched and aggregated according to the service task identifier. The parent grid code or target sub-grid code carried in the two types of event entries, along with their billing period start and end times, are sequentially registered into the billing entry book with the service task identifier as the key. The billing entry book consists of several entries, each entry recording the attribution grid code, period start time, period end time, and event category, resulting in a billing entry book grouped by task. For each service task in the billing entry book, the period coverage relationship of each billing entry is verified along the billing time window in timestamp order. If the period of one billing entry overlaps with the period of another billing entry on the time axis, and the two entries carry a parent grid code and a sub-grid code respectively, and the sub-grid code belongs to the frozen sub-grid code list listed in the frozen record of the coarse-level billing event, then the billing entry carrying the parent grid code is retained and the billing entry carrying the sub-grid code is removed. The billing entry book after removal is summarized and output as the final billing bill.

[0082] In the application scenario of on-demand billing for shared mobility, settlement processing is triggered after a shared bicycle or service vehicle completes a ride or trip.

[0083] For example, the service task identifier for a shared bicycle is the ride order number, and the billing time window is the time span from the unlocking time to the locking time of the order. The coarse-level billing event and the fine-grained attribution event are retrieved from the on-demand metering event queue, and the two types of event entries are matched according to the service task identifier. Event entries carrying the same service task identifier are directly included in the billing entry book with that service task identifier as the key.

[0084] Specifically, the parent grid code or target sub-grid code carried in each event entry, along with its billing period start and end times, are sequentially registered in the billing entry book. The billing entry book consists of several entries, each recording the belonging grid code, period start time, period end time, and event category. The event category can be either a coarse-level billing event or a fine-grained belonging event. For each coarse-level billing event, a corresponding freeze record is generated simultaneously with the registration of the billing entry. This freeze record contains a list of frozen sub-grid codes, derived from the set of all lower-level sub-grid codes spatially encompassed by the coarse-level parent grid code, and includes the period start and end times of the coarse-level event as the freeze effective interval. In one implementation, the period coverage relationship of each billing entry is verified along the billing time window in timestamp order. Let the period ranges of two billing entries to be compared be [t1,t2] and [t3,t4], then the overlap duration L = min(t2,t4) - max(t1,t3). If L is not less than the preset overlap threshold of 1 second, and the two entries carry a parent grid code and a child grid code respectively, and the child grid code falls into the frozen child grid code list in the coarse-layer billing event freeze record, and the comparison time is within the effective range of the freeze record, then the bill entry carrying the parent grid code is retained and the bill entry carrying the child grid code is removed.

[0085] For example, if the coarse-layer event period is from 10:00:00 to 10:00:30, and its frozen subgrid code list contains G1 to G8, and a fine-grained entry for subgrid G3 appears in the same window with an overlap duration of 12 seconds, then the G3 entry is removed. The billing entry book after removal is summarized in ascending order of timestamp and output as the final billing bill that can be used for on-demand metering and billing control of BeiDou grid code spatiotemporal services.

[0086] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any equivalent substitutions or modifications made by those skilled in the art within the scope of the technology disclosed in the present invention, based on the technical solution and inventive concept of the present invention, should be covered within the scope of protection of the present invention.

Claims

1. A method for on-demand metering and billing control of BeiDou grid code spatiotemporal services, characterized in that, The method includes: Obtain the continuous positioning coordinates and confidence area of ​​the Beidou positioning terminal, extract the boundary of the preset same-level grid, analyze the coverage process of the confidence area crossing the boundary, and form the continuous boundary intersection pattern; Based on the intersection pattern of continuous boundaries, adjacent coordinate segments that travel back and forth around the same boundary are marked. Coordinate segments that cross the boundary and return to the original grid with their first and last coordinates on the same side of the boundary are removed to obtain a smooth trajectory. Extract the round-trip path of the adjacent grid corresponding to the removed coordinate segment, evaluate the persistence and direction of movement after the boundary crossing, and form short-term jitter trajectory and continuous cross-grid trajectory. Track the short-term jitter trajectory and the dwell position and direction after the continuous cross-grid trajectory crosses the boundary, and identify the cross-grid belonging status; Based on false jump-attribution and true cross-cell attribution, coarse-grained billing events and fine-grained attribution events are determined respectively; Retrieve service task identifiers and billing time windows, aggregate coarse-level billing events and fine-grained attribution events, determine the corresponding grid code and billing period registration task, and generate the final billing statement.

2. The BeiDou grid code spatiotemporal service on-demand metering and billing control method according to claim 1, characterized in that, The process of obtaining the continuous positioning coordinates and confidence region of the BeiDou positioning terminal and extracting the boundary of the preset same-level grid includes: Read the confidence region parameters associated with each coordinate, which include the major semi-axis, minor semi-axis and orientation angle, reconstruct the confidence region centered on the positioning coordinates, and arrange the continuously sampled coordinates and confidence regions according to the timestamp to form a coordinate sequence with confidence regions; The system retrieves the BeiDou grid code library to locate the preset same-level grid to which each coordinate belongs, reads the four boundaries of the grid and adjacent grids and converts them into boundary line segments, extracts the common boundary to obtain a set of candidate boundaries, and judges the geometric positional relationship between the confidence region and each boundary. If there is an intersection, it is recorded as a crossing state; if there is no intersection and it is located on one side, it is recorded as a single-sided state. The boundaries are then connected in a continuous boundary intersection pattern according to the timestamp.

3. The BeiDou grid code spatiotemporal service on-demand metering and billing control method according to claim 1, characterized in that, The method of marking adjacent coordinate segments that travel back and forth around the same boundary based on the intersection pattern of continuous boundaries includes: Slide along the timestamp to capture adjacent coordinates to form a detection window. If the intersection state within the window is alternating between one-sided, cross-over, and one-sided, and the orientation labels at both ends are the same, it is registered as a round-trip coordinate segment and the common boundary number and the first and last timestamps are recorded. For each round trip coordinate segment, if the middle coordinate belongs to a different grid than the first and last coordinates, but the first and last coordinates still belong to the same original grid and the first and last orientation labels are consistent, it is determined to be a jittery coordinate segment. The middle coordinate is removed and the first and last coordinates are retained to obtain the jitter-removed sparse coordinate sequence.

4. The BeiDou grid code spatiotemporal service on-demand metering and billing control method according to claim 3, characterized in that, The thinned coordinate sequence after jitter removal includes: For each pair of adjacent jittering first and last coordinates in the thinned coordinate sequence, the number of transition coordinate points is determined by dividing the span of the two coordinate timestamps by the original sampling interval. The corresponding number of transition coordinate points are generated between the two coordinates by linear interpolation. The transition coordinate points are then backfilled between the adjacent first and last coordinates and merged with the original coordinates that have not been removed by timestamp to form a smooth trajectory that continues along the inside of the original grid.

5. The BeiDou grid code spatiotemporal service on-demand metering and billing control method according to claim 1, characterized in that, Extract the round-trip paths of adjacent grids corresponding to the removed coordinate segments, evaluate the persistence and direction of motion after crossing the boundary, and form short-term jitter trajectories and continuous cross-grid trajectories, including: The grid code to which a coordinate belongs is recorded sequentially along the BeiDou grid code library from coarse to fine grid levels. Coordinates with adjacent timestamps belonging to the same code are merged into an occupancy record. The start and end timestamps, grid codes and data source markers are registered to obtain a grid occupancy process sequence covering the service task cycle. The occupancy record is distinguished from the original continuous positioning coordinate sequence or a smooth trajectory based on the data source marker. Based on the records derived from the original continuous positioning coordinate sequence, the timestamp interval of the eliminated jittery coordinate segment is retrieved. The adjacent grid codes to which the intermediate coordinates belong within the interval are traced back and concatenated with the original grid codes by timestamp, and the number of grid switching is recorded. The latitude and longitude difference between two adjacent intermediate coordinates is used as the direction vector to obtain the set of adjacent grid round-trip paths with direction vectors.

6. The BeiDou grid code spatiotemporal service on-demand metering and billing control method according to claim 5, characterized in that, The set of adjacent grid round-trip paths with direction vectors includes: For each round-trip path in the set of adjacent grid round-trip paths, the continuous dwell time of the intermediate coordinates in the adjacent grid is counted and compared with the preset dwell time threshold. The cosine value of the angle between the direction vector at the time of crossing the boundary and the time of returning is calculated. If the continuous dwell time is less than the threshold and the cosine value is negative, it is determined to be a short-term jitter trajectory. If the continuous dwell time is not less than the threshold and the cosine value is positive, it is determined to be a continuous grid crossing trajectory.

7. The BeiDou grid code spatiotemporal service on-demand metering and billing control method according to claim 1, characterized in that, The tracking of short-term jitter trajectories and the dwell position and direction after continuous cross-grid trajectories cross boundaries, and the identification of cross-grid attribution status, include: The location of the out-of-bounds movement is tracked along the timestamp. The grid code to which the location belongs is compared with the original grid code to obtain a comparison mark with a value of either falling back or staying. This forms a cross-grid tracking entry with the location, comparison mark, and direction of movement. If a tracked entry originates from a short-term jitter trajectory and the attribution comparison is marked as a fallback and the continuous dwell time does not reach the preset dwell time threshold, the cross-grid attribution status is recorded as a false jump attribution conclusion. The tracking entry originates from a continuous cross-grid trajectory and is marked as a stalled entry, with the cosine of the angle between the direction vectors of the cross-boundary segment and the return segment being positive. The cross-grid attribution status is recorded as the true cross-grid attribution conclusion.

8. The BeiDou grid code spatiotemporal service on-demand metering and billing control method according to claim 1, characterized in that, Identifying coarse-level billing events includes: The original grid codes and adjacent grid codes that the short-term jitter trajectory passes through are collected into a candidate sub-grid set. The parent grid code sequence of each code is retrieved from the Beidou grid code library and traced layer by layer from fine to coarse to form a set of parent and child code chains. The encoding of the parent grid at the same level of each encoding chain is compared along the direction from fine to coarse. The level at which the parent grid encoding of each encoding chain is the same for the first time is determined as the least common parent grid. The continuous time period between the first and last coordinates of the short-term jitter trajectory is defined as the cross-grid time period. The service task attribution for the cross-grid period is registered in the billing ledger using the parent grid code as the accounting key. The ledger writing channels of each subgrid code in the candidate subgrid set within the cross-grid period range are frozen. The parent grid code, the start and end times of the cross-grid period, and the list of frozen subgrid codes are packaged to obtain the coarse-level billing event.

9. The BeiDou grid code spatiotemporal service on-demand metering and billing control method according to claim 1, characterized in that, Determining fine-grained attribution events includes: The adjacent grids that the continuous cross-grid trajectory enters are read as candidate subgrids. If the continuous dwell time is not less than the preset dwell time threshold and the cosine value of the angle between the direction vectors of the cross-boundary segment and the return segment is positive, the candidate subgrid is determined as the target subgrid. The first sampling time of entering the target subgrid is recorded as the first dwell time. The service task timestamp interval is divided into two non-overlapping billing periods at the first dwell time. The billing periods after the first dwell time are bound to the target subgrid code and packaged into a fine-grained attribution event carrying the target subgrid code, the start and end times of the billing period, and the service task identifier.

10. The BeiDou grid code spatiotemporal service on-demand metering and billing control method according to claim 1, characterized in that, The process of retrieving service task identifiers and billing time windows, aggregating coarse-level billing events and fine-grained attribution events, determining the corresponding grid code and billing period registration task, and generating the final billing statement includes: Retrieve the coarse-level billing events and the fine-grained attribution events from the event queue, match and aggregate them according to the service task identifier, and register the parent grid code or target sub-grid code carried by the two types of events along with the start and end times of the billing period into the billing entry book with the service task identifier as the key. Each entry records the attribution grid code, the start and end times of the period, and the event category. Verify the time period coverage relationship of each billing item according to the timestamp along the billing time window. If two items have overlapping time periods on the time axis and carry parent grid code and child grid code respectively, and the child grid code belongs to the list of frozen child grid codes in the coarse-level billing event freeze record, retain the item carrying the parent grid code and remove the item carrying the child grid code, and summarize the output as the final billing bill.