Calculation Method, Device, Electronic Device and Storage Medium for Available Parking Spaces
By obtaining in and out records in the parking lot and dividing time granularity, generating license plate numbers and record sets, and calculating the number of vehicles in each time unit, the problem of difficulty in obtaining the actual number of available parking spaces in the parking lot is solved, and the accuracy of parking lot management is achieved.
Patent Information
- Application Number
- CN202410300375.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-15
- Publication Date
- 2025-08-05
- Estimated Expiration
- 2044-03-15
AI Technical Summary
It is difficult to accurately obtain the actual number of available parking spaces in the parking lot, resulting in inaccurate parking space scheduling functions.
By obtaining the in-and-out records within the preset time period, the time granularity division is performed, the license plate number set, the entry record set, the exit record set and the entry and exit record set are generated, the target number of vehicles in each time unit is calculated, and the number of available parking spaces in the parking lot is determined based on the number of vehicles in multiple time units.
The accurate calculation of the number of available parking spaces in the parking lot is achieved, and the accuracy of parking space scheduling and the effectiveness of parking lot management are improved.
Smart Images

Figure CN118212801B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of parking space management in parking lots, and particularly to a method, device, electronic device and storage medium for calculating the available number of parking spaces in a parking lot. Background Art
[0002] With the continuous increase in the vehicle ownership, the demand for parking spaces is also growing day by day. In order to implement the functions of querying and dispatching parking spaces, information on the total number of parking spaces in the parking lot and the current number of available parking spaces is required. The total number of parking spaces in the parking lot is determined during the planning and design of the parking lot. However, due to the large parking demand, the parking spaces in the parking lot are exploited, and the actual available number of parking spaces may exceed the total number of parking spaces planned and designed.
[0003] Obtaining accurate available number of parking spaces helps to implement a more accurate parking space dispatching function. However, in reality, only the total number of parking spaces planned and designed for the parking lot can be obtained, and it is difficult to obtain the actual available number of parking spaces. Summary of the Invention
[0004] In view of this, embodiments of this application provide a method, device, electronic device and storage medium for calculating the available number of parking spaces in a parking lot, which are used to solve the technical problem that it is difficult to obtain the actual available number of parking spaces in a parking lot.
[0005] In a first aspect, this application provides a method for calculating the available number of parking spaces in a parking lot, and the method includes:
[0006] Obtain all historical vehicle entry and exit records in which the entry and exit records in the parking lot during a preset time period exist in pairs;
[0007] Divide the preset time period into time granularities to obtain multiple time units;
[0008] For each of the time units, obtain the license plate numbers of target vehicles that enter the parking lot before the start time node of the time unit and have not exited the parking lot until the start time node from all the historical vehicle entry and exit records, and generate a license plate number set according to the license plate numbers of the target vehicles;
[0009] Obtain a set of target entry records that have entry records within the time unit and have exit records after the end time node of the time unit;
[0010] Obtain a set of target exit records that have entry records before the start time node of the time unit and have exit records within the time unit;
[0011] Obtain a set of target entry and exit records that have entry records within the time unit and have exit records within the time unit;
[0012] Based on the license plate number set, the target entry record set, the target exit record set, and the target entry / exit record set, obtain the number of target vehicles within the time unit;
[0013] Based on the number of target vehicles within multiple time units, obtain the available number of parking spaces in the parking lot.
[0014] In an optional implementation manner, the obtaining the number of target vehicles within the time unit according to the license plate number set, the target entry record set, the target exit record set, and the target entry / exit record set includes:
[0015] Sort all the records in the target entry record set, the target exit record set, and the target entry / exit record set in the order of entry / exit time to obtain a record sequence;
[0016] Based on the record sequence and the license plate number set, obtain the number of target vehicles within the time unit.
[0017] In an optional implementation manner, the obtaining the number of target vehicles within the time unit according to the record sequence and the license plate number set includes:
[0018] Take the number of license plate numbers in the license plate number set as the initial value of a preset variable;
[0019] Start traversing from the first record in the record sequence in order until the last record is traversed. When a record is traversed at the current moment, determine whether the traversed record is an entry record or an exit record;
[0020] When the traversed record is an entry record, write the license plate number corresponding to the traversed record into the license plate number set updated at the previous moment to obtain the license plate number set updated at the current moment; when the traversed record is an exit record, delete the license plate number corresponding to the traversed record from the license plate number set updated at the previous moment to obtain the license plate number set updated at the current moment;
[0021] Obtain the number of license plate numbers in the license plate number set updated at the current moment. If the number of license plate numbers in the license plate number set updated at the current moment is greater than the initial value of the preset variable, take the number of license plate numbers in the license plate number set updated at the current moment as the updated value of the preset variable;
[0022] After traversing the last record in the record sequence, determine the updated value of the preset variable as the number of target vehicles within the time unit.
[0023] In an optional implementation manner, when the traversed record is an entry record, the method further includes:
[0024] Query whether there is a first target license plate number in the license plate number set that is the same as the license plate number corresponding to the traversed record;
[0025] When there is no such first target license plate number in the license plate number set, execute writing the license plate number corresponding to the traversed record into the license plate number set updated at the previous moment.
[0026] In an optional implementation manner, when the traversed record is an exit record, the method further includes:
[0027] Query whether there is a second target license plate number in the license plate number set that is the same as the license plate number corresponding to the traversed record;
[0028] When there is such second target license plate number in the license plate number set, execute deleting the license plate number corresponding to the traversed record from the license plate number set updated at the previous moment.
[0029] In an optional implementation manner, obtaining the available number of parking spaces in the parking lot according to the number of target vehicles in multiple said time units includes:
[0030] Obtain the maximum number of target vehicles among the number of target vehicles in multiple said time units;
[0031] Determine the maximum number of target vehicles as the available number of parking spaces in the parking lot.
[0032] In an optional implementation manner, the method further includes:
[0033] Continuously dynamically calculate the available number of parking spaces in the parking lot through a selected time period.
[0034] In a second aspect, the present application provides a device for calculating the available number of parking spaces in a parking lot, and the device includes:
[0035] A record acquisition module, configured to acquire all historical vehicle entry and exit records in which entry and exit records in the parking lot exist in pairs within a preset time period.
[0036] A time division module, configured to divide the preset time period into time granularities to obtain multiple time units.
[0037] A set generation module, for each said time unit, obtain the license plate numbers of target vehicles whose entry time is before the start time node of the time unit and have not exited as of the start time node from all the historical vehicle entry and exit records, and generate a license plate number set according to the license plate numbers of the target vehicles.
[0038] The first recording module is configured to obtain a set of target entry records that have entry records within the time unit and have exit records after the end time node of the time unit.
[0039] The second recording module is configured to obtain a set of target exit records that have entry records before the start time node of the time unit and have exit records within the time unit.
[0040] The third recording module is configured to obtain a set of target entry and exit records that have entry records within the time unit and have exit records within the time unit.
[0041] The first calculation module is configured to obtain the number of target vehicles within the time unit according to the license plate number set, the set of target entry records, the set of target exit records, and the set of target entry and exit records.
[0042] The second calculation module is configured to obtain the available number of parking spaces in the parking lot according to the number of target vehicles in multiple time units.
[0043] In a third aspect, the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method for calculating the available number of parking spaces in the parking lot are implemented.
[0044] The present application obtains all historical vehicle entry and exit records in which entry and exit records in the parking lot exist in pairs within a preset time period; divides the preset time period into multiple time units according to time granularity; obtains the license plate number set corresponding to each time unit according to the historical vehicle entry and exit records; obtains the set of target entry records, the set of target exit records, and the set of target entry and exit records corresponding to the corresponding time unit; obtains the number of target vehicles within the time unit according to the license plate number set, the set of target entry records, the set of target exit records, and the set of target entry and exit records; and obtains the available number of parking spaces in the parking lot according to the number of target vehicles in multiple time units. The technical problem that it is difficult to obtain the actual available number of parking spaces in the parking lot is solved. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] Figure 1 is a flowchart of a method for calculating the available number of parking spaces in a parking lot shown in an embodiment of the present application;
[0046] Figure 2 is a functional module diagram of a device for calculating the available number of parking spaces in a parking lot shown in an embodiment of the present application;
[0047] Figure 3 is a schematic structural diagram of an electronic device shown in an embodiment of the present application. DETAILED DESCRIPTION
[0048] The terms used in the following embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to limit the present application. As used in the specification of the present application, the singular forms "a", "an", "the", "above-mentioned", "said", "this" are intended to include the plural forms as well, unless there is a clear indication to the contrary in the context. It should also be understood that the term "and / or" used in the present application refers to any or all possible combinations including one or more of the listed items.
[0049] Hereinafter, the terms "first" and "second" are only used for descriptive purposes and cannot be construed as implying or suggesting relative importance or implicitly indicating the quantity of the indicated technical features. Thus, the features defined with "first" and "second" may explicitly or implicitly include one or more of such features. In the description of the embodiments of the present application, unless otherwise specified, the meaning of "plural" is two or more.
[0050] The embodiments of the present application also provide a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed, all or part of the steps of the method for calculating the available number of parking spaces in a parking lot are implemented.
[0051] Refer to Figure 1 As shown, it is a flowchart of a method for calculating the available number of parking spaces in a parking lot shown in the embodiments of the present application. The method for calculating the available number of parking spaces in the parking lot specifically includes the following steps.
[0052] S11, obtain all historical vehicle entry and exit records in the parking lot where the entry and exit records exist in pairs within a preset time period.
[0053] The preset time period refers to the time range traced back and forward from a given date. The given date is a node date set artificially and is the middle date of the preset time period. For example, assume the given date is September 1st and the time range is 6 months. Assuming a month has 30 days, that is, trace back 3 months from September 1st to June 1st and trace forward from September 1st to December 1st. That is, the preset time period is from June 1st to December 1st for a total of 6 months.
[0054] In the parking lot, for each vehicle entering the lot, the parking lot generates an entry record for the vehicle, and the entry record includes the entry time and license plate number information of the vehicle. For each vehicle leaving the lot, the parking lot generates an exit record for the vehicle, and the exit record includes the entry time, exit time, and license plate number information of the vehicle. For vehicles that enter and leave the parking lot multiple times, the parking lot records and saves all the entry and exit records of the corresponding vehicles.
[0055] When calculating the available parking spaces in a parking lot, the parking lot obtains the historical vehicle entry and exit records with both entry records and corresponding exit records during a preset time period according to the preset time period. That is, the historical vehicle entry and exit records include paired entry records and exit records, and the paired entry records and exit records are simply referred to as entry and exit records.
[0056] By setting the preset time period, the date can be adaptively selected according to the actual changes in the parking lot. For example, when the parking lot is expanded on a certain date, the time before and after the corresponding expansion date is selected as the preset time period. By analyzing the entry and exit records during the preset time period, the daily traffic volume in the parking lot can be obtained, and the peak hours of vehicle entry and exit in the parking lot and the usage and idle conditions of parking spaces in the parking lot at different time periods can be obtained, so as to better grasp the operation situation and parking space load situation of the parking lot.
[0057] S12, divide the preset time period into time granularities to obtain multiple time units.
[0058] Time granularity division is a method of dividing a time period into smaller time units. Different granularity sizes can be set according to the length of the time period for granularity division. Short time periods can be divided by seconds, minutes, or hours as the granularity size, and long time periods can be divided by days, months, or years as the granularity size. Through time granularity division, a time period can be divided into multiple time units. For example, assuming the time period is set to 24 hours and the granularity size is set to 1 hour, the time period is divided based on the 1-hour granularity size, and 24 time units can be obtained, where each time unit is 1 hour.
[0059] In this application, the preset time period of the parking lot is mainly in months, and the time granularity is divided with one day as the granularity size. After the parking lot obtains the historical entry and exit records of vehicles with paired entry and exit records during the preset time period, the preset time period is divided into time granularities with one day as the granularity size to obtain multiple time units, where each time unit represents the time length of one day, and the start time and end time of the time unit correspond to 0:00 and 24:00 of the same day. In the following description, unless otherwise specified, the time unit is defaulted to the time length of one day time unit.
[0060] By dividing the preset time period according to time granularity into multiple time units, by obtaining the in-out records of vehicles in each time unit, the in-out record data of vehicles in the preset time period can be divided into more time units for display. By analyzing the in-out records of vehicles in each time period within the time unit, a more refined and accurate change in the traffic flow of the parking lot can be obtained. Based on the change in traffic flow, the maximum parking volume during the peak parking period can be obtained. Based on the maximum parking volume in each time unit, the upper limit of the number of vehicles that can be accommodated in the parking lot during the preset time period can be determined, thereby achieving more effective parking lot management and planning.
[0061] S13. For each of the time units, obtain the license plate numbers of the target vehicles whose entry time is before the start time node of the time unit and have not exited the parking lot until the start time node from all the historical vehicle in-out records, and generate a license plate number set according to the license plate numbers of the target vehicles.
[0062] After dividing the preset time period according to time granularity to obtain multiple time units, the start time node of the time unit refers to 0:00 of the corresponding day. The parking lot will, based on all the historical vehicle in-out records obtained during the preset time period, obtain the license plate numbers of all the vehicles that have entered the parking lot and have not exited before the start time node of each time unit, and mark these vehicle license plate numbers as the license plate numbers of the target vehicles corresponding to the time unit. The vehicle corresponding to the license plate number of the target vehicle is the vehicle that has been parked in the parking lot before the start time node of the time unit and has not exited before the start time node of the time unit. That is, before the start time node of the time unit, a vehicle can have multiple in-out records in the parking lot, but if the last in-out record before the start time node of the time unit is an entry record, then the vehicle is a target vehicle. The parking lot obtains and generates a license plate number set for the corresponding license plate numbers of the target vehicles.
[0063] Exemplarily, assume that the preset time period is two months from June 1st to August 1st. When dividing the time granularity with one day as the granularity, 62 granularity time periods can be obtained. Assume that the selected granularity time period is July 1st. The parking lot will obtain the license plate number information of all target vehicles during the time period from 0:00 on June 1st to 0:00 on July 1st, and generate a license plate number set according to these vehicle license plate numbers for storing the license plate number information and the number of license plates obtained.
[0064] Obtain the license plate numbers of the target vehicles whose entry time is before the start time node of the time unit and have not exited until the start time node, which can confirm the number of vehicles and their license plate numbers existing in the parking lot before the corresponding time unit, and generate a license plate number set based on the vehicle license plate numbers.
[0065] The number of parked vehicles in the parking lot can be judged according to the quantity in the license plate number set.
[0066] S14. Obtain a set of target entrance records that have entrance records within the time unit and have exit records after the end time node of the time unit.
[0067] If a vehicle has an entrance record within a time unit, there is a corresponding exit record after the end time node of the time unit, and there can be multiple entrance records and corresponding exit records for the corresponding vehicle within the time unit, but the last record of the vehicle at the end time node of the time unit must be an entrance record, then all the entrance and exit records of the vehicle within the time unit are target entrance records. The set of target entrance records is the set composed of the target entrance records corresponding to multiple vehicles. For example, within a time unit, the parking lot obtains the vehicle information of the entrance records from 0:00 to 24:00 in the corresponding time unit. If the corresponding vehicle has an exit record after 24:00 of the time unit, then all the entrance and exit records of the corresponding vehicle from 0:00 to 24:00 in the time unit are target entrance records.
[0068] By obtaining the set of target entrance records with exit records after the end time node of the time unit, the vehicle information of the vehicles that enter the parking lot within the time unit and drive out of the parking lot after the time unit can be accurately obtained, thereby filtering out the vehicle information with entrance records but missing exit records, effectively avoiding the problem of missing and omitting vehicle information in the parking lot, and ensuring the accuracy of the number of parked vehicles in the parking lot.
[0069] S15. Obtain a set of target exit records that have entrance records before the start time node of the time unit and have exit records within the time unit.
[0070] If the last entrance and exit record of a vehicle before the start time node of the time unit is an entrance record, and the last entrance and exit record of the vehicle within the time unit is an exit record, then all the entrance and exit records of the vehicle within the time unit are target exit records. The set of target exit records is the set composed of the target exit records corresponding to multiple vehicles. For example, in a time unit, the parking lot obtains the vehicle information of the vehicle whose last record before 0:00 in the corresponding time unit is an entrance record. If the last record of the corresponding vehicle from 0:00 to 24:00 in the time unit is an exit record, then all the entrance and exit records of the corresponding vehicle from 0:00 to 24:00 in the time unit are target exit records.
[0071] By obtaining the set of target departure records that have entry records before the start time node of the time unit and are within the time unit, the vehicle information of those vehicles that entered the parking lot before the time unit and exited the parking lot within the time unit can be accurately obtained, thereby filtering out the vehicle information with departure records but missing entry records, further avoiding the problem of missing and omitting vehicle information in the parking lot, and improving the accuracy of the number of parked vehicles in the parking lot.
[0072] S16. Obtain a set of target entry and departure records that have entry records within the time unit and have departure records within the time unit.
[0073] If the nearest entry and departure record of a vehicle after the start time node of the time unit is an entry record, and the nearest entry and departure record before the end time node of the time unit is a departure record, then all the entry records and departure records of the vehicle within the time unit form the target entry and departure records. The set of target entry and departure records is the set composed of the target entry and departure records corresponding to multiple vehicles. For example, within a time unit, the parking lot obtains the vehicle information of the vehicle whose nearest record after 0:00 in the corresponding time unit is an entry record. If the nearest entry and departure record of the corresponding vehicle before 24:00 in the time unit is a departure record, then all the entry records and departure records from 0:00 to 24:00 in the time unit form the target entry and departure records.
[0074] By obtaining the set of target entry and departure records that have entry records within the time unit and have departure records within the time unit, the vehicle information of those vehicles that entered the parking lot within the time unit and exited the parking lot within the time unit, that is, the vehicle information of those vehicles that entered and exited on the same day, can be accurately obtained.
[0075] Combining the set of target entry and departure records, the set of target entry records, and the set of target departure records, the real-time change status of vehicles in the parking lot and the number of parked vehicles within the time unit can be obtained, so as to obtain the maximum number of parked vehicles in the parking lot, which is used to further confirm the maximum available parking spaces in the parking lot.
[0076] S17. According to the license plate number set, the set of target entry records, the set of target departure records, and the set of target entry and departure records, obtain the number of target vehicles within the time unit.
[0077] The number of target vehicles refers to the maximum number of vehicles that the parking lot can accommodate in the corresponding time unit. In the parking lot, obtain the license plate number data and the number of license plate numbers in the license plate number set. According to the license plate information corresponding in the set of target entry and departure records, the set of target entry records, and the set of target departure records, update the license plate number set in chronological order. The update method is mainly to query whether there is corresponding license plate information in the license plate number set.
[0078] For the license plate number information in the target entry record set, if there is no same license plate number information in the license plate number set, the corresponding license plate number information is written into the license plate number set. For the license plate number information in the target exit record set, if there is the same license plate number information in the license plate number set, the corresponding license plate number information is deleted from the license plate number set. For the target entry / exit record set, the license plate number information in the license plate number set is added or removed according to the vehicle entry / exit time sequence, so that the real-time change of the parking quantity in the parking lot can be obtained in real time. In the corresponding time unit, when the license plate number set reaches the maximum quantity, the maximum license plate number quantity is the target vehicle number in the corresponding time unit.
[0079] In an optional implementation manner, obtaining the target vehicle number in the time unit according to the license plate number set, the target entry record set, the target exit record set and the target entry / exit record set includes:
[0080] Sort all the records in the target entry record set, the target exit record set and the target entry / exit record set in the entry / exit time sequence to obtain a record sequence;
[0081] Obtain the target vehicle number in the time unit according to the record sequence and the license plate number set.
[0082] The record sequence refers to the sequence obtained by sorting all the entry records and exit records of the vehicle in the corresponding time unit in the unit time based on time sequence. Based on the record sequence, the real-time dynamic change of the vehicle quantity in the parking lot can be obtained in real time.
[0083] In the record sequence, according to the time sequence from 0:00 to 24:00 in the unit time, sort each entry record in the target entry record set, each exit record in the target exit record set, and each entry record and exit record in the target entry / exit record set. According to the license plate number information corresponding to all the entry records and exit records in the record sequence, update the license plate number set according to time sequence.
[0084] Among them, for the license plate number information corresponding to the entry records in the record sequence, if there is no same license plate number information in the license plate number set, the corresponding license plate number information is written into the license plate number set; for the license plate number information corresponding to the exit records in the record sequence, if there is the same license plate number information in the license plate number set, the corresponding license plate number information is deleted from the license plate number set. Update the license plate number set according to the license plate number information corresponding to the entry records and exit records in the record sequence according to time sequence. The maximum license plate number quantity owned by the license plate number set during the update process is the target vehicle number in the time unit.
[0085] Exemplarily, assume that in the record sequence, there are 2 target entry records corresponding to license plates A1 and A2, 2 target entry and exit records corresponding to license plates B1 and B2, and 1 target entry and exit record whose corresponding entry record corresponds to license plate C1 and whose corresponding exit record corresponds to license plate C1. Assume that license plates A3, B1, and B2 exist in the license plate set. The license plate numbers corresponding to the record sequence arranged according to the time sequence are A1, A2, C1, B1, B2, C1. Update the license plate set according to the record sequence in the time sequence. For the entry record A1, there is no same license plate number in the license plate set, so write the license plate number into the license plate set. The updated license plate set is A3, B1, B2, A1. Similarly, update the license plate set according to the entry records A2 and C1 corresponding to the entry records in the time sequence. The obtained license plate set is A3, B1, B2, A1, A2, C1. Update the license plate numbers according to the exit records B1, B2, and C1. Finally, the obtained license plate set is A3, A1, A2. In the process of updating the license plate set according to the time sequence, the license plate set A3, B1, B2, A1, A2, C1 has the largest number of license plates, and the corresponding maximum number of license plates 6 is the number of target vehicles.
[0086] Sort all the records in the target entry record set, the target exit record set, and the target entry and exit record set according to the time sequence to obtain a record sequence. Based on the record sequence, the entry and exit situations of vehicles at each time node within the time unit in the parking lot can be obtained. Update the license plate set according to the record sequence, and the change situation of the license plate set each time a vehicle enters or exits can be obtained. Thus, the number of vehicles existing in the parking lot can be determined according to the number of license plate numbers included in the license plate set after each update. Among them, when the number of license plate numbers in the license plate set is the largest, the corresponding number of license plate numbers is the number of target vehicles. According to the dynamic change of the license plate set based on the record sequence, it is possible to better monitor the number of vehicles in the parking lot and accurately calculate the number of vehicles, obtain the change of the traffic flow in the parking lot and the maximum available parking spaces in the parking lot, so as to optimize the management strategy of the parking lot.
[0087] In an optional implementation manner, obtaining the number of target vehicles within the time unit according to the record sequence and the license plate set includes:
[0088] Take the number of license plate numbers in the license plate set as the initial value of a preset variable;
[0089] Start traversing from the first record in the record sequence in order until the last record is traversed. When a record is traversed at the current moment, determine whether the traversed record is an entry record or an exit record;
[0090] When the record traversed is an entry record, write the license plate number corresponding to the traversed record into the license plate number set updated at the previous moment to obtain the license plate number set updated at the current moment; when the record traversed is an exit record, delete the license plate number corresponding to the traversed record from the license plate number set updated at the previous moment to obtain the license plate number set updated at the current moment;
[0091] Obtain the number of license plate numbers in the license plate number set updated at the current moment. If the number of license plate numbers in the license plate number set updated at the current moment is greater than the initial value of the preset variable, use the number of license plate numbers in the license plate number set updated at the current moment as the updated value of the preset variable;
[0092] After traversing the last record in the record sequence, determine the updated value of the preset variable as the number of target vehicles within the time unit.
[0093] After obtaining the license plate number set, use the number of license plate numbers in the license plate number set as the initial value of the preset variable. The preset variable is a dynamically changing data used to represent the number of license plate numbers in the parking lot license plate number set. The initial value of the preset variable is the number of license plate numbers in the license plate number set after obtaining the license plate number set.
[0094] After obtaining the record sequence, perform a traversal query in the license plate number set based on the first record to the last record in the record sequence to check whether there is the same license plate number corresponding to each record in the record sequence in the license plate number set. When traversing and querying each record, it is necessary to determine whether the corresponding record is a vehicle entry record or a vehicle processing record.
[0095] When the query record is an entry record, obtain the license plate number corresponding to the entry record. If there is no corresponding license plate number information in the license plate number set, write the license plate number of the entry record into the license plate number set updated at the previous moment to obtain the license plate number set updated at the current moment.
[0096] When the query record is an exit record, obtain the license plate number corresponding to the exit record. If there is corresponding license plate number information in the license plate number set, delete the license plate number corresponding to the exit record from the license plate number set updated at the previous moment to obtain the license plate number set updated at the current moment.
[0097] According to the entry and exit order in the record sequence, for each traversed record, obtain the number of license plate numbers in the updated license plate number set at the current moment. If the number of license plate numbers in the updated license plate number set at the current moment is greater than the initial value of the preset variable, update the number of license plate numbers in the updated license plate number set at the current moment to the updated value of the preset variable. If the number of license plate numbers in the updated license plate number set at the next moment is greater than the number of license plate numbers in the updated license plate number set at the current moment, use the number of license plate numbers in the updated license plate number set at the next moment as the updated value of the preset variable; if the number of license plate numbers in the updated license plate number set at the next moment is less than the number of license plate numbers in the updated license plate number set at the current moment, still use the number of license plate numbers in the updated license plate number set at the current moment as the updated value of the preset variable.
[0098] After traversing all the entry and exit records in the record sequence, the finally obtained updated value of the preset variable is the number of target vehicles within the time unit, that is, the maximum number of parked vehicles in the parking lot within the time unit.
[0099] By using the number of license plate numbers in the license plate number set as the initial value of the preset variable, updating the license plate number set according to the traversal and query of the entry records and exit records in the record sequence, comparing the number of license plate numbers in the updated license plate number set with the initial value, comparing based on the number of license plate numbers in the license plate number sets at the current moment and the previous moment, and comparing based on the number of license plate numbers in the license plate number sets at the next moment and the current moment, the preset variable is updated in real time, and the maximum number of parked vehicles accommodated in the parking lot within the entire time unit can be dynamically obtained.
[0100] In an optional implementation manner, when the traversed record is an entry record, the method further includes:
[0101] Query whether there is a first target license plate number in the license plate number set that is the same as the license plate number corresponding to the traversed record;
[0102] When the first target license plate number does not exist in the license plate number set, execute the operation of writing the license plate number corresponding to the traversed record into the license plate number set updated at the previous moment.
[0103] During the process of traversing the record sequence, when the traversed record is an entry record, the license plate number corresponding to the entry record is the first target license plate number. Based on the first target license plate number, query in the license plate number set. If there is no license plate number in the license plate number set that is the same as the first license plate number, it indicates that the vehicle corresponding to the first license plate number is a newly entered vehicle. Write the first license plate number into the license plate number set updated at the previous moment to obtain the license plate number set updated at the current moment. At this time, the value of the preset variable corresponding to the license plate number set needs to be incremented by 1.
[0104] In an optional embodiment, when the traversed record is an exit record, the method further includes:
[0105] Query whether there is a second target license plate number in the license plate number set that is the same as the license plate number corresponding to the traversed record;
[0106] When the second target license plate number exists in the license plate number set, execute deleting the license plate number corresponding to the traversed record from the license plate number set updated at the previous moment.
[0107] During the process of traversing the record sequence, when the traversed record is an exit record, the license plate number corresponding to the exit record is the second target license plate number. Based on the second target license plate number, query in the license plate number set. If there is a license plate number in the license plate number set that is the same as the second license plate number, it indicates that the vehicle corresponding to the second license plate number has exited the parking lot. Delete the second license plate number from the license plate number set updated at the previous moment to obtain the license plate number set updated at the current moment. At this time, the preset variable value in the license plate number set remains unchanged.
[0108] S18. Obtain the available parking spaces of the parking lot according to the number of target vehicles in multiple said time units.
[0109] Based on multiple time units obtained by dividing a preset time period, update the license plate number set corresponding to the record sequence for each time unit, obtain the number of target vehicles in each time unit, compare the number of target vehicles at the previous moment and the current moment one by one, retain the largest number of target vehicles, and compare it with the number of target vehicles at the next moment. Traverse the number of target vehicles in each time unit in the entire preset time period in this way, and obtain the largest number of target vehicles in all time units, that is, the available parking spaces of the parking lot.
[0110] By selecting a preset time period and dividing the time granularity based on the preset time period to obtain multiple time units, and through data processing of vehicle entry and exit for each time unit, obtain the number of target vehicles in each time unit, so as to obtain the available parking spaces of the parking lot in the entire preset time period. It realizes dynamically obtaining the real-time vehicle data changes in the parking lot and the maximum number of parked vehicles in the parking lot during the preset time period. At the same time, based on the parking lot usage situation in each time unit, these data can be used for long-term data analysis and trend prediction, providing decision-making support for parking lot managers, such as formulating long-term parking policies or planning the expansion of the parking lot.
[0111] In an optional embodiment, the obtaining the available parking spaces of the parking lot according to the number of target vehicles in multiple said time units includes:
[0112] Obtain the maximum number of target vehicles within multiple of the said time units;
[0113] Determine the maximum number of target vehicles as the available parking spaces of the parking lot.
[0114] Based on the number of target vehicles corresponding to multiple time units obtained, compare the number of target vehicles in each time unit one by one in chronological order, so as to obtain the maximum number of target vehicles among multiple time units, and determine the maximum number of target vehicles as the available parking spaces of the parking lot.
[0115] In an optional implementation manner, the method further includes:
[0116] Continuously calculate the available parking spaces of the parking lot dynamically through a selected time period.
[0117] In subsequent use of the parking lot, multiple new time units can be obtained by dividing the time granularity through a continuously selected time period, and the maximum number of target vehicles among multiple new time units can be obtained according to the above scheme, so as to obtain the available parking spaces of the parking lot in the selected time period. Then compare the available parking spaces of the parking lot in the selected time period with the previously determined available parking spaces of the parking lot. If the available parking spaces of the parking lot in the selected time period are greater than the previously determined available parking spaces of the parking lot, update the available parking spaces of the parking lot to the available parking spaces of the parking lot in the selected time period.
[0118] By continuously selecting a time period to dynamically calculate the available parking spaces of the parking lot, for a parking lot that has never been full of vehicles, this calculated value is the maximum number of vehicles parked simultaneously in this parking lot. As time goes by and the number of parked vehicles gradually increases, by continuously selecting a time period to calculate the available parking spaces of the parking lot, it will gradually approach the actual total number of parking spaces in the parking lot. Until the day when the parking lot is full of vehicles, this calculated value is the actual total number of parking spaces in the parking lot. Continuously calculating the available parking spaces and making corresponding adjustments can optimize the utilization rate of parking resources. This includes avoiding waste of resources caused by vacant parking spaces, and ensuring that there are enough available parking spaces during peak demand periods, thus improving the overall utilization efficiency of the parking lot.
[0119] In an embodiment of the present application, all historical vehicle entry and exit records in which the entry and exit records in a parking lot exist in pairs within a preset time period are obtained; the preset time period is divided into multiple time units according to a time granularity; a license plate number set corresponding to each time unit is obtained according to all historical vehicle entry and exit records; a target entry record set, a target exit record set, and a target entry and exit record set corresponding to the corresponding time unit are obtained; the number of target vehicles within the time unit is obtained according to the license plate number set, the target entry record set, the target exit record set, and the target entry and exit record set; and the available number of parking spaces in the parking lot is obtained according to the number of target vehicles in multiple time units. The technical problem that it is difficult to obtain the actual available number of parking spaces in a parking lot is solved.
[0120] Figure 2 It is a functional module diagram of a device for calculating the available number of parking spaces in a parking lot provided by an embodiment of the present application.
[0121] In some embodiments, the device 20 for calculating the available number of parking spaces in the parking lot may include multiple functional modules composed of computer program segments. The computer programs of each program segment in the device 20 for calculating the available number of parking spaces in the parking lot may be stored in the memory of the device for calculating the available number of parking spaces in the parking lot and executed by at least one processor to execute (see details in Figure 1 the description) the function of calculating the available number of parking spaces in the parking lot.
[0122] In this embodiment, the device 20 for calculating the available number of parking spaces in the parking lot can be divided into multiple functional modules according to the functions it executes. The functional modules may include: a record acquisition module 201, a time division module 202, a set generation module 203, a first record module 204, a second record module 205, a third record module 206, a first calculation module 207, a second calculation module 208, and a parking space update module 209. The module referred to in the present invention means a series of computer program segments that can be executed by at least one processor and can complete a fixed function, and is stored in the memory. In this embodiment, the functions of each module will be described in detail in subsequent embodiments.
[0123] The first acquisition module 201 is used to obtain all historical vehicle entry and exit records in which the entry and exit records in a parking lot exist in pairs within a preset time period.
[0124] The time division module 202 is used to divide the preset time period according to a time granularity to obtain multiple time units.
[0125] The set generation module 203 is configured to, for each of the time units, obtain the license plate numbers of target vehicles that enter the lot before the start time node of the time unit and have not exited the lot as of the start time node from all the historical vehicle entry and exit records, and generate a license plate number set according to the license plate numbers of the target vehicles.
[0126] The first recording module 204 is configured to obtain a set of target entry records that have entry records within the time unit and have exit records after the end time node of the time unit.
[0127] The second recording module 205 is configured to obtain a set of target exit records that have entry records before the start time node of the time unit and have exit records within the time unit.
[0128] The third recording module 206 is configured to obtain a set of target entry and exit records that have entry records within the time unit and have exit records within the time unit.
[0129] The first calculation module 207 is configured to obtain the number of target vehicles within the time unit according to the license plate number set, the set of target entry records, the set of target exit records, and the set of target entry and exit records.
[0130] The second calculation module 208 is configured to obtain the available number of parking spaces in the parking lot according to the number of target vehicles in multiple time units.
[0131] The parking space update module 209 is configured to continuously and dynamically calculate the available number of parking spaces in the parking lot over a selected time period.
[0132] In an embodiment of the present application, all historical vehicle entry and exit records in which entry and exit records in the parking lot exist in pairs within a preset time period are obtained; the preset time period is divided into multiple time units according to time granularity; a license plate number set corresponding to each time unit is obtained according to all historical vehicle entry and exit records; a set of target entry records, a set of target exit records, and a set of target entry and exit records corresponding to the corresponding time unit are obtained; the number of target vehicles within the time unit is obtained according to the license plate number set, the set of target entry records, the set of target exit records, and the set of target entry and exit records; and the available number of parking spaces in the parking lot is obtained according to the number of target vehicles in multiple time units. The technical problem that it is difficult to obtain the actual available number of parking spaces in the parking lot is solved.
[0133] An embodiment of the present application further provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, all or part of the steps of the method for calculating the available number of parking spaces in the parking lot are implemented.
[0134] Refer to Figure 3 As shown, it is a schematic structural diagram of an electronic device provided by an embodiment of the present application. In a preferred embodiment of the present application, the electronic device 3 includes a memory 31, at least one processor 32, and at least one communication bus 33.
[0135] Those skilled in the art should understand that Figure 3 The structure of the electronic device shown does not constitute a limitation on the embodiments of the present application. It can be a bus structure or a star structure. The electronic device may further include more or fewer other hardware or different component arrangements than those shown.
[0136] In some embodiments, the electronic device 3 is a device capable of automatically performing numerical calculations and / or information processing according to pre-set or stored instructions. Its hardware includes, but is not limited to, microprocessors, application-specific integrated circuits, programmable gate arrays, digital processors, and embedded devices, etc. The electronic device 3 may further include a client device, and the client device includes, but is not limited to, any electronic product that can interact with a client through means such as a keyboard, mouse, remote control, touchpad, or voice control device. For example, a personal computer, a tablet computer, a smart phone, a digital scanning device, etc.
[0137] In some embodiments, a computer program is stored in the memory 31, and when the computer program is executed by the at least one processor 32, all or part of the steps in the parking lot available vehicle number calculation method as described are implemented. The memory 31 includes a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), a one-time programmable read-only memory (OTPROM), an electrically-erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM), or other optical disc memories, magnetic disk memories, tape memories, or any other computer-readable medium capable of carrying or storing data. Further, the computer-readable storage medium mainly includes a storage program area and a storage data area. Among them, the storage program area can store an operating system, application programs required for at least one function, etc.
[0138] In some embodiments, the at least one processor 32 is the control core (Control Unit) of the electronic device 3, connecting various components of the entire electronic device 3 through various interfaces and circuits. By running or executing programs or modules stored in the memory 31, and invoking data stored in the memory 31, it performs various functions of the electronic device 3 and processes data. For example, when the at least one processor 32 executes the computer program stored in the memory, it implements all or part of the steps of the method for calculating the available number of parking spaces in the parking lot described in the embodiments of the present application; or implements all or part of the functions of the device for calculating the available number of parking spaces in the parking lot. The at least one processor 32 may be composed of integrated circuits. For example, it may be composed of a single packaged integrated circuit, or may be composed of multiple integrated circuits with the same or different functions, including a combination of one or more central processing units (Central Processing Unit, CPU), microprocessors, digital processing chips, graphics processors, and various control chips, etc.
[0139] In some embodiments, the at least one communication bus 33 is configured to enable connection communication between the memory 31 and the at least one processor 32, etc. Although not shown, the electronic device 3 may further include a power source (such as a battery) for supplying power to each component. Preferably, the power source can be logically connected to the at least one processor 32 through a power management device, so as to implement functions such as management of charging, discharging, and power consumption management through the power management device. The power source may also include any components such as one or more DC or AC power sources, recharge devices, power failure detection circuits, power converters or inverters, and power status indicators. The electronic device 3 may also include various sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be elaborated here.
[0140] The integrated unit implemented in the form of software functional modules can be stored in a computer-readable storage medium. The above software functional modules are stored in a storage medium, including several instructions for causing a processor to execute part of the methods described in the embodiments of the present application.
[0141] In several embodiments provided in the present application, it should be understood that the disclosed device and method can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation.
[0142] The module described as a separation component may or may not be physically separated. The component shown as a module may or may not be a physical unit, and it may be located in one place or distributed across multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0143] The above content is only a specific implementation manner of this application, but the protection scope of this application is not limited thereto. Any person skilled in the art within the technical scope disclosed by this application can easily think of changes or substitutions, which should all be covered within the protection scope of this application.
Claims
1. A method for calculating the number of available parking spaces in a parking lot, characterized in that: The method comprises: Obtain all historical vehicle entry and exit records that exist in pairs in the parking lot within a preset time period; Divide the preset time period into time granularity to obtain multiple time units; For each time unit, obtaining from all historical vehicle entry and exit records the license plate numbers of target vehicles whose entry time is before the start time node of the time unit and have not yet exited the vehicle by the start time node, and generating a license plate number set based on the license plate numbers of the target vehicles; Acquire a target entry record set having an entry record within the time unit and an exit record after the end time node of the time unit; Acquire a target exit record set having an entry record before the start time node of the time unit and an exit record within the time unit; Obtain a target entry and exit record set that has an entry record within the time unit and an exit record within the time unit; obtain the number of target vehicles within the time unit based on the license plate number set, the target entry record set, the target exit record set, and the target entry and exit record set; Obtaining the number of available parking spaces in the parking lot according to the target number of vehicles within the plurality of time units; The step of obtaining the number of target vehicles within the time unit according to the license plate number set, the target entry record set, the target exit record set, and the target entry and exit record set comprises: Sorting the target entry record set, the target exit record set, and all records in the target entry / exit record set in order of entry / exit time to obtain a record sequence; Obtaining the target number of vehicles within the time unit according to the record sequence and the license plate number set; Obtaining the number of available parking spaces in the parking lot according to the target number of vehicles in the plurality of time units includes: Obtaining a maximum number of target vehicles among the numbers of target vehicles within the plurality of time units; Determining the maximum target number of vehicles as the number of available parking spaces in the parking lot; The number of available parking spaces in the parking lot is dynamically calculated continuously through a selected time period.
2. The method for calculating the number of available parking spaces in a parking lot according to claim 1, wherein: The step of obtaining the target number of vehicles within the time unit according to the record sequence and the license plate number set includes: The number of license plate numbers in the license plate number set is used as the initial value of the preset variable; Starting from the first record in the record sequence, traversing in order until the last record is finished, and when a record is traversed at the current moment, determining whether the traversed record is an entry record or an exit record; When the traversed record is an entry record, the license plate number corresponding to the traversed record is written into the license plate number set updated at the previous moment to obtain the license plate number set updated at the current moment; when the traversed record is an exit record, the license plate number corresponding to the traversed record is deleted from the license plate number set updated at the previous moment to obtain the license plate number set updated at the current moment; Obtaining the number of license plate numbers in the license plate number set updated at the current moment, and if the number of license plate numbers in the license plate number set updated at the current moment is greater than the initial value of the preset variable, using the number of license plate numbers in the license plate number set updated at the current moment as the updated value of the preset variable; After traversing the last record in the record sequence, the updated value of the preset variable is determined as the target number of vehicles in the time unit.
3. The method for calculating the number of available parking spaces in a parking lot according to claim 2, wherein: When the traversed record is an entry record, the method further includes: Check whether there is a first target license plate number in the license plate number set that is the same as the license plate number corresponding to the traversed record; When the first target license plate number does not exist in the license plate number set, the step of writing the license plate number corresponding to the traversed record into the license plate number set updated at the last moment is executed.
4. The method for calculating the number of available parking spaces in a parking lot according to claim 2, wherein: When the traversed record is an exit record, the method further includes: Check whether there is a second target license plate number in the license plate number set that is the same as the license plate number corresponding to the traversed record; When the second target license plate number exists in the license plate number set, the license plate number corresponding to the traversed record is deleted from the license plate number set updated at the last moment.
5. The method for calculating the number of available parking spaces in a parking lot according to claim 1, wherein: The method further comprises: The number of available parking spaces in the parking lot is dynamically calculated continuously through a selected time period.
6. A device for calculating the number of available parking spaces in a parking lot, characterized in that: The device comprises: A record acquisition module is used to acquire all historical vehicle entry and exit records that exist in pairs in the parking lot within a preset time period; A time division module, configured to divide the preset time period into time granularities to obtain a plurality of time units; A set generation module is configured to obtain, for each time unit, from all historical vehicle entry and exit records, the license plate numbers of target vehicles whose entry times are before the start time node of the time unit and have not yet exited the vehicle by the start time node, and generate a license plate number set based on the license plate numbers of the target vehicles; A first recording module is configured to obtain a target entry record set having an entry record within the time unit and an exit record after the end time node of the time unit; A second recording module is configured to obtain a target exit record set having an entry record before the start time node of the time unit and an exit record within the time unit; A third recording module is used to obtain a target entry and exit record set having an entry record within the time unit and an exit record within the time unit; a first calculation module, configured to obtain the number of target vehicles within the time unit according to the license plate number set, the target entry record set, the target exit record set, and the target entry and exit record set; The second calculation module is configured to obtain the number of available parking spaces in the parking lot according to the target number of vehicles within the plurality of time units. The first calculation module is specifically configured to: Sorting the target entry record set, the target exit record set, and all records in the target entry / exit record set in order of entry / exit time to obtain a record sequence; Obtaining the target number of vehicles within the time unit according to the record sequence and the license plate number set; The second calculation module is specifically configured to: Obtaining a maximum number of target vehicles among the numbers of target vehicles within the plurality of time units; Determining the maximum target number of vehicles as the number of available parking spaces in the parking lot; The number of available parking spaces in the parking lot is dynamically calculated continuously through a selected time period.
7. An electronic device, characterized in that: The method comprises a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the method for calculating the number of available parking spaces in a parking lot according to any one of claims 1 to 5 is implemented.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method for calculating the number of available parking spaces in a parking lot according to any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Method for calculating number of vehicles in parking lot by using in-and-out data in intelligent parking lot
CN111429719A