Ship lock data determination method and device based on real-time position of ship
By collecting and encapsulating real-time ship location data, obtaining lock area information, determining the relationship between ships and locks, and calculating ship passage data, the problem of low utilization rate of ship passage data is solved, thereby improving lock passage efficiency and reducing operating costs.
Patent Information
- Application Number
- CN202310731791.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-19
- Publication Date
- 2025-12-12
- Estimated Expiration
- 2043-06-19
AI Technical Summary
Existing technologies cannot calculate ship passage data, resulting in low utilization of ship-related data, which affects lock passage efficiency and operating costs.
By collecting real-time ship location data, encapsulating it according to a preset format, obtaining lock area information, determining the relationship between ships and locks, calculating ship passage data, and using distributed resource management and real-time streaming computing technologies for efficient data processing.
It enables efficient use of ship passage data, improves lock passage efficiency, reduces operating costs, and has strong scalability and flexibility, reducing hardware procurement and maintenance costs.
Smart Images

Figure CN116701464B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of intelligent operation of ship lock, in particular to a ship lock passing data determination method and device based on real-time ship position. BACKGROUND
[0002] In inland waterway transportation, as an important transportation hub, the ship lock plays an important role in connecting water systems and improving navigation conditions. However, the ship lock cannot be continuously passed through, and in busy navigation sections, the ship lock often becomes a bottleneck in the navigation channel, affecting the navigation efficiency of the entire navigation system. Due to factors such as infrastructure conditions, operation and management, the passing efficiency of most ship locks in China is low, but the operation cost is high. Using information means (for example, by obtaining ship lock passing related data, using digital technology and intelligent algorithms for analysis and mining) can improve the passing efficiency of the ship lock and reduce the operation cost. With the popularization of AIS, Beidou, radar and other ship positioning equipment, the number of ships equipped with positioning equipment has increased significantly. A large amount of ship position data contains a lot of important information. By calculating the real-time position of the ship and the ship lock area data, detailed ship lock passing data can be obtained for in-depth analysis and mining. The bottleneck of the ship lock system can be found, the process can be continuously optimized, and the ship lock passing efficiency, port competitiveness and service level can be improved. This has extremely important significance for realizing efficient use of resources, improving operation efficiency, reducing cost, improving service and promoting development.
[0003] In related technologies, there is no method for calculating ship lock passing data and ship lock passing efficiency, which cannot calculate ship lock passing data, resulting in low utilization rate of ship related data.
[0004] In view of the above problems, no effective solution has been proposed so far. SUMMARY
[0005] The embodiments of the present application provide a ship lock passing data determination method and device based on real-time ship position, which at least solve the technical problem in the related art that ship lock passing data cannot be calculated, resulting in low utilization rate of ship related data.
[0006] According to an aspect of an embodiment of the present application, a ship lock passing data determination method based on real-time ship position is provided, comprising: collecting real-time position data of each ship, and packaging the real-time position data according to a preset data format to obtain ship position data corresponding to each ship; obtaining area information of each ship lock to obtain ship lock area data; determining the relationship between each ship and the ship lock based on the ship lock area data and the ship position data, taking each ship as a grouping information column; and determining ship lock passing data based on the relationship between each ship and the ship lock, taking each ship lock as a grouping information column.
[0007] Optionally, the step of obtaining the area information of each ship lock to obtain the ship lock area data comprises: obtaining N point information of each ship lock to obtain total area information of the ship lock, wherein the point information is used to locate the area range of the ship lock, and N is an integer greater than or equal to 3; obtaining an upstream waiting lock area, a lock chamber and a downstream waiting lock area in each ship lock within the ship lock area to obtain a ship lock sub-area set; and determining the ship lock area data based on the total area information of the ship lock and the ship lock sub-area set.
[0008] Optionally, the step of determining the relationship between each ship and the ship lock based on the ship lock area data and the ship position data comprises: judging whether the ship information of a current ship has been cached; if the ship information of the current ship has not been cached, caching the ship information of the current ship to a target cache space; if the ship information of the current ship has been cached, judging whether the ship lock basic information has been cached; if the ship lock basic information has not been cached, judging whether the current ship is located in any ship lock based on the ship lock basic information and the ship lock area data; if the current ship is not located in any ship lock, returning to the ship position data of the next ship; if the current ship is located in a target ship lock, defining the state information of the current ship as the ship just entering the ship lock; caching the ship lock information of the target ship lock entered by the current ship; and generating the relationship between the ship and the ship lock based on the ship information of the current ship, the ship lock information of the target ship lock entered by the current ship and the state information.
[0009] Optionally, after judging whether the ship lock basic information has been cached, the step further comprises: if the ship lock basic information has been cached, judging whether the current ship is still in the cached ship lock; if the current ship is still in the cached ship lock, defining the state information of the current ship as the ship being in the ship lock; and if the current ship is not in the cached ship lock, defining the state information of the current ship as the ship leaving the ship lock.
[0010] Optionally, based on the relationship between the each ship and the ship lock, the step of determining the ship lock passing data in the group information column of each ship lock comprises: determining whether the current group has cached the ship lock information; in the case that the current group has cached the ship lock information, obtaining the state information of the current ship in the relationship between the ship and the ship lock; in the case that the state information is that the ship has just entered the ship lock, determining that the current ship lock has a ship entering, obtaining the ship navigation information of the current ship and the sub-area of the current ship in the current ship lock, wherein the ship navigation information comprises at least one of the following: ship speed, ship latitude and longitude, time and ship lock sub-area; if the sub-area of the current ship in the current ship lock is a waiting zone, clearing the historical passing navigation information of the current ship, and caching the information and the entering time of the current ship entering the first waiting zone, wherein the first waiting zone is one of the following: an upstream waiting zone and a downstream waiting zone; caching the lock chamber information and the entering time of the current ship entering the lock chamber from the waiting zone; caching the information and the entering time of the current ship entering the second waiting zone from the lock chamber; after confirming that the current ship has passed through the first waiting zone, the lock chamber and the second waiting zone in the ship lock, confirming that the current ship has completed the passing process; in the case that the current ship has completed the passing process, generating the ship passing data based on the cached information of the ship passing through each ship lock sub-area.
[0011] Optionally, the step of caching the lock chamber information and the entering time of the current ship entering the lock chamber from the waiting zone comprises: after confirming that the current ship has entered the first waiting zone, determining whether the current ship lock has cached the lock chamber information of the current ship entering the lock chamber; if the current ship lock has not cached the lock chamber information of the current ship entering the lock chamber, determining whether the current ship has entered the lock chamber of the current ship lock; if the current ship has entered the lock chamber of the current ship lock, caching the lock chamber information and the entering time of the current ship entering the lock chamber.
[0012] Optionally, the step of caching the information and the entering time of the current ship entering the second waiting zone from the lock chamber comprises: after confirming that the current ship has cached the information and the lock chamber information of the first waiting zone, determining whether the current ship lock has cached the information of the current ship entering the second waiting zone; if the current ship lock has not cached the information of the current ship entering the second waiting zone, determining whether the current ship has entered the second waiting zone from the lock chamber; if the current ship has entered the second waiting zone from the lock chamber, caching the information and the entering time of the current ship entering the second waiting zone from the lock chamber.
[0013] Optionally, after determining the ship lock passing data based on the relationship between each ship and the ship lock, the grouping information is listed for each ship lock, and the method further comprises: traversing the ship lock passing data to obtain passing information of all ships entering the current ship lock, wherein the passing information comprises: time and position of the ship entering the first waiting zone, entering the lock chamber and entering the second waiting zone, start and end stopping time of the ship in the first waiting zone and the lock chamber; based on the passing information, calculating the sailing distance, sailing time and average speed of the ship; calculating the waiting time length, entering time length, lock chamber stopping time length, exiting time length, passing time length of the ship to obtain the ship lock passing information of the ship when passing through the current ship lock; and storing the ship lock passing information of the ship when passing through the current ship lock to the database.
[0014] According to another aspect of the embodiment of the present application, a ship lock passing data determination device based on real-time ship position is further provided, comprising: a collection unit configured to collect real-time position data of each ship and encapsulate the real-time position data in a preset data format to obtain ship position data corresponding to each ship; an acquisition unit configured to acquire area information of each ship lock to obtain ship lock area data; a first determination unit configured to determine the relationship between each ship and the ship lock based on the ship lock area data and the ship position data, and list the grouping information for each ship; and a second determination unit configured to determine ship lock passing data based on the relationship between each ship and the ship lock, and list the grouping information for each ship lock.
[0015] Optionally, the acquisition unit comprises: a first acquisition module configured to acquire N point position information of each ship lock to obtain total ship lock area information, wherein the point position information is used to locate the area range of the ship lock, and N is an integer greater than or equal to 3; a second acquisition module configured to acquire an upstream waiting zone, a lock chamber and a downstream waiting zone in each ship lock within the ship lock area to obtain a ship lock sub-area set; and a determination module configured to determine the ship lock area data based on the total ship lock area information and the ship lock sub-area set.
[0016] Optionally, the first obtaining unit comprises: a first judging module, configured to judge whether the ship information of the current ship has been cached; a first caching module, configured to cache the ship information of the current ship to a target cache space when the ship information of the current ship has not been cached; a second judging module, configured to judge whether the ship lock basic information has been cached when the ship information of the current ship has been cached; a third judging module, configured to judge whether the current ship is located in any ship lock based on the ship lock basic information and the ship lock area data when the ship lock basic information has not been cached; a returning module, configured to return the ship position data of the next ship when the current ship is not located in any ship lock; a first defining module, configured to define the state information of the current ship as the ship just entering the ship lock when the current ship is located in the target ship lock; a second caching module, configured to cache the ship lock information of the target ship lock entered by the current ship; and a first generating module, configured to generate the ship and ship lock relationship based on the ship information of the current ship, the ship lock information of the target ship lock entered by the current ship and the state information, and take each ship as the grouping information column.
[0017] Optionally, the ship lock passing data determination device based on the real-time position of the ship further comprises: a fourth judging module, configured to judge whether the current ship is still in the cached ship lock when the ship lock basic information has been cached; a second defining module, configured to define the state information of the current ship as the ship in the ship lock when the current ship is still in the cached ship lock; and a third defining module, configured to define the state information of the current ship as the ship leaving the ship lock when the current ship is not in the cached ship lock.
[0018] Optionally, the second determining unit comprises: a fifth judging module, configured to judge whether a current group has cached lock information with each lock as a group information column; a third obtaining module, configured to obtain state information of a current ship in the ship-lock relationship in a case that the current group has cached the lock information; a fourth obtaining module, configured to obtain ship navigation information of the current ship and a sub-area of the current ship in the current lock when the state information is that the ship has just entered the lock and it is determined that the current lock has a ship entering; the ship navigation information comprises at least one of ship speed, ship longitude and latitude, time and lock sub-area; a third caching module, configured to clean historical lock-passing navigation information of the current ship and cache information and entering time of the current ship entering a first waiting area when the sub-area of the current ship in the current lock is the waiting area; the first waiting area is one of an upbound waiting area and a downbound waiting area; a fourth caching module, configured to cache lock chamber information and entering time of the current ship after entering the lock chamber from the waiting area; a fifth caching module, configured to cache information and entering time of the current ship after entering a second waiting area from the lock chamber; a confirming module, configured to confirm that the current ship has completed the lock-passing process after confirming that the current ship has passed through the first waiting area, the lock chamber and the second waiting area in the lock; and a second generating module, configured to generate the ship lock-passing data based on the cached information of the ship passing through each lock sub-area in a case that it is confirmed that the current ship has completed the lock-passing process.
[0019] Optionally, the fourth caching module comprises: a first judging submodule, configured to judge whether the current lock has cached lock chamber information of the current ship entering the lock chamber after it is confirmed that the current ship has entered the first waiting area; a second judging submodule, configured to judge whether the current ship has entered the lock chamber of the current lock when the current lock has not cached the lock chamber information of the current ship entering the lock chamber; and a first caching submodule, configured to cache the lock chamber information of the current ship entering the lock chamber and entering time when the current ship has entered the lock chamber of the current lock.
[0020] Optionally, the fifth caching module comprises: a third judging submodule, configured to judge whether the current lock has cached information of the current ship entering the second waiting area after it is confirmed that the current ship has cached information and lock chamber information of the first waiting area; a fourth judging submodule, configured to judge whether the current ship has entered the second waiting area from the lock chamber when the current lock has not cached the information of the current ship entering the second waiting area; and a second caching submodule, configured to cache information and entering time of the current ship entering the second waiting area from the lock chamber when the current ship has entered the second waiting area from the lock chamber.
[0021] Optionally, the ship lock data determination apparatus based on real-time ship position further comprises a traversal module configured to traverse the ship lock data to obtain passage information of all ships entering a current ship lock, wherein the passage information comprises time and position of the ship entering a first waiting zone, entering a lock chamber and entering a second waiting zone, and start and end stopping time of the ship in the first waiting zone and the lock chamber; a first calculation module configured to calculate sailing distance, sailing time and average speed of the ship based on the passage information; a second calculation module configured to calculate waiting time, entering time, lock chamber stopping time, exiting time, and lock passing time of the ship, and obtain lock passing information of the ship when passing through the current ship lock; and a storage module configured to store the lock passing information of the ship when passing through the current ship lock into a database.
[0022] According to another aspect of the embodiments of the present application, a computer readable storage medium is provided, which includes a stored computer program, wherein the computer readable storage medium controls a device where the computer readable storage medium is located to perform the ship lock data determination method based on real-time ship position as described above when the computer program is executed.
[0023] According to another aspect of the embodiments of the present application, an electronic device is provided, which includes one or more processors and a memory, and the memory is configured to store one or more programs, wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the ship lock data determination method based on real-time ship position as described above.
[0024] In the present disclosure, real-time position data of each ship is first collected, and the real-time position data is packaged according to a preset data format to obtain ship position data corresponding to each ship. Then, area information of each ship lock is obtained to obtain ship lock area data. Based on the ship lock area data and the ship position data, the relationship between each ship and the ship lock is determined with each ship as a grouping information column. Finally, based on the relationship between each ship and the ship lock, the ship lock data is determined with each ship lock as a grouping information column.
[0025] In the present disclosure, complete navigation data and position information of each ship can be obtained by collecting real-time position data of the ship and performing data format packaging; the relative position relationship between each ship and the ship lock during the process of passing through the ship lock can be accurately determined based on the ship lock region data and the ship position data, that is, whether the passing process of the ship through the ship lock is smooth can be determined, and then the ship passing data in the ship lock can be calculated based on the position relationship between the ship and the ship lock and the ship position data, so as to realize the effect of efficient utilization of the ship passing related data, and solve the technical problems in the related art that the ship passing data cannot be calculated, resulting in low utilization rate of the ship related data.
[0026] Meanwhile, in the present disclosure, distributed resource management, real-time streaming calculation, message queue technology and cache technology are used to cooperate with each other, so as to have strong expansibility and high concurrent data processing capacity on the basis of high operation efficiency; the ship lock region can be directly configured through a software interface, without being limited by the number and position of the ship locks, so as to have high flexibility; meanwhile, in the present disclosure, no ship monitoring equipment needs to be installed on site, so that the hardware procurement and maintenance cost can be greatly saved. BRIEF DESCRIPTION OF DRAWINGS
[0027] The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiments of the application and serve to explain the principles of the application, and do not limit the application. In the drawings:
[0028] Figure 1 is a flow chart of an optional ship passing data determination method based on real-time position of a ship according to an embodiment of the present application;
[0029] Figure 2 is a flow chart of another optional ship passing data determination method based on real-time position of a ship according to an embodiment of the present application;
[0030] Figure 3 is a flow chart of an optional method for calculating the relationship between a ship and a ship lock according to an embodiment of the present application;
[0031] Figure 4 is a schematic diagram of an optional ship lock region data layout according to an embodiment of the present application;
[0032] Figure 5 is a flow chart of an optional method for calculating ship passing data in a ship lock according to an embodiment of the present application;
[0033] Figure 6 is a flow chart of an optional streaming calculation method for batch warehousing of passing information according to an embodiment of the present application;
[0034] Figure 7is a schematic diagram of an optional ship lock data determination device based on real-time ship position according to an embodiment of the application;
[0035] Figure 8 is an electronic device (or mobile device) hardware structure block diagram of a ship lock data determination method based on real-time ship position according to an embodiment of the application. DETAILED DESCRIPTION
[0036] In order for those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the accompanying drawings of the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, not all. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor should be within the scope of protection of the present application.
[0037] It should be noted that the terms "first", "second" and the like in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily indicate a specific order or a chronological sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the application described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device including a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to these processes, methods, products or devices.
[0038] In order for those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the accompanying drawings of the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, not all. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor should be within the scope of protection of the present application.
[0039] Flink, a framework and distributed processing engine, is used for state calculation on data stream, provides core functions such as data distribution, fault tolerance mechanism and resource management, and Flink streaming analysis can interface real-time event stream, continuously generate and update results as the event state is updated.
[0040] Kafka, a high-throughput distributed stream processing system, runs on one or more server clusters, can support multiple clients sending message streams and reading data in the system without affecting each other; implements the replica set mechanism to realize data redundancy and ensure data losslessness; classifies and batch compresses data through topic, and supports cross-data-center data replication.
[0041] AIS, Automatic Identification System, is a new type of navigation system for maritime safety and communication between ships and shore, ships and ships, which is usually composed of a communication machine, a positioning instrument and a communication controller connected with a shipborne display and a sensor, and can automatically exchange important information such as ship position, speed, heading, ship name and call number.
[0042] It should be noted that the ship gate data determination method based on the real-time position of the ship in the present disclosure can be used in the field of intelligent operation of ship gate when calculating and analyzing the ship gate data, and can also be used in any field other than the field of intelligent operation of ship gate when calculating and analyzing the ship gate data. The application field of the ship gate data determination method based on the real-time position of the ship in the present disclosure is not limited.
[0043] It should be noted that the related information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in the present disclosure are all information and data authorized by the user or authorized by all parties, and the collection, use and processing of related data need to comply with relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation portal for user to choose authorization or refusal. For example, an interface is provided between the system and the related user or agency. Before obtaining the related information, the interface needs to send a request to the aforementioned user or agency, and after receiving the consent information feedback from the aforementioned user or agency, the related information is obtained.
[0044] The following embodiments of the present application can be applied to various systems / applications / devices that need to determine ship gate data, and can realize ship gate data based on the positional relationship between the ship and the ship gate and the time data contained in the ship position data. The ship gate data in the ship gate can be calculated, which contains the passing efficiency of the ship gate, and further solves the technical problem that the ship gate data cannot be calculated in the related art, resulting in low utilization rate of ship related data.
[0045] The present application will be described in detail below in conjunction with various embodiments.
[0046] Embodiment one
[0047] According to the embodiments of the present application, an embodiment of a ship gate data determination method based on the real-time position of the ship is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in a different order from here.
[0048] Figure 1 is a flow chart of an optional ship lock data determination method based on real-time ship position according to an embodiment of the present application, as shown in Figure 1 The method comprises the following steps:
[0049] In step S101, real-time position data of each ship is collected, and the real-time position data is packaged according to a preset data format to obtain ship position data corresponding to each ship.
[0050] In step S102, area information of each ship lock is obtained to obtain ship lock area data.
[0051] In step S103, the relationship between each ship and the ship lock is determined based on the ship lock area data and the ship position data, with each ship as a grouping information column.
[0052] In step S104, ship lock data is determined based on the relationship between each ship and the ship lock, with each ship lock as a grouping information column.
[0053] Through the above steps, the real-time position data of each ship is first collected, and the real-time position data is packaged according to a preset data format to obtain ship position data corresponding to each ship. Then, the area information of each ship lock is obtained to obtain ship lock area data. Then, the relationship between each ship and the ship lock is determined based on the ship lock area data and the ship position data, with each ship as a grouping information column. Finally, ship lock data is determined based on the relationship between each ship and the ship lock, with each ship lock as a grouping information column.
[0054] In the embodiment of the present application, the complete navigation data and position information of each ship can be obtained by collecting real-time position data of the ship and packaging the data format. The relative position relationship between each ship and the ship lock during the ship passing through the lock can be accurately determined based on the ship lock area data and the ship position data, that is, whether the ship passing through the lock is smooth can be determined. Then, the ship lock data in the ship lock is calculated based on the position relationship between the ship and the ship lock and the ship position data, realizing efficient use of ship lock related data, and solving the technical problem of low utilization rate of ship related data caused by the inability to calculate ship lock data in the related art.
[0055] The embodiment of the present application will be described in detail below in combination with the above steps.
[0056] In the embodiment of the present application, the real-time position data of the ship and the navigation environment information in the ship lock area are utilized, and the process data and detailed result data of the ship passing through the lock are accurately calculated by the method of stream computing. In the method, the big data real-time stream processing technology Flink is used for program calculation, the Kafka message queue is used for data flow between steps, and the Redis is used as the cache for data transmission in the calculation process.
[0057] In step S101, the real-time position data of each ship is collected, and the real-time position data is packaged according to a preset data format to obtain ship position data corresponding to each ship.
[0058] It should be noted that the preset data format includes but is not limited to: ship unique identifier, ship name, ship type, ship longitude, ship latitude, data source (AIS, Beidou, radar, fusion signal), time point, etc.
[0059] It should be noted that the packaged data also needs to be preprocessed, mainly including: data verification, data cleaning, deduplication, parsing, etc. To avoid data loss, the ship real-time position data should be collected as quickly and comprehensively as possible when collecting the data for the first time.
[0060] In step S102, the area information of each ship lock is obtained to obtain ship lock area data.
[0061] Optionally, step S102 includes: obtaining N point information of each ship lock to obtain total ship lock area information, wherein the point information is used to locate the area range of the ship lock, N is an integer greater than or equal to 3; obtaining an uplink waiting lock area, a lock chamber and a downlink waiting lock area in each ship lock within the ship lock area to obtain a ship lock sub-area set; determining the ship lock area data based on the total ship lock area information and the ship lock sub-area set.
[0062] It should be noted that the layout of the ship lock area data is shown by a solid line. Figure 4 It should be noted that the point information can be longitude and latitude data or other positioning data. The point information of each area or sub-area can be connected in a certain order to form a polygon (shown by a dashed line) with a certain area. Figure 4 It should be noted that the polygons corresponding to the sub-areas cannot intersect, and the total area and the sub-areas form a containing relationship.
[0063] In step S103, the relationship between each ship and the ship lock is determined based on the ship lock area data and the ship position data, and each ship is taken as a grouping information column.
[0064] It should be noted that the ship and ship lock relationship information at least includes: ship real-time position data, ship information, ship lock information, and ship state information, wherein the ship state information includes: just entering the ship lock, being in the ship lock all the time, just leaving the ship lock, and the ship not entering the ship lock will be ignored.
[0065] Optionally, the step S103 comprises: calling the ship information of the current ship corresponding to the ship position data and the ship lock basic information corresponding to the ship lock area data; judging whether the ship information of the current ship has been cached; if the ship information of the current ship has not been cached, caching the ship information of the current ship to the target cache space; if the ship information of the current ship has been cached, judging whether the ship lock basic information has been cached; if the ship lock basic information has not been cached, judging whether the current ship is located in any ship lock based on the ship lock basic information and the ship lock area data; if the current ship is not located in any ship lock, returning to wait for the position data of the next ship; if the current ship is located in the target ship lock, defining the state information of the current ship as the ship just entering the ship lock; caching the ship lock information of the target ship lock entered by the current ship; and generating the ship and ship lock relationship based on the ship information of the current ship, the ship lock information of the target ship lock entered by the current ship, and the state information, taking each ship as a grouping information column.
[0066] It should be noted that in the embodiment, after completing a ship lock passing period (at least one ship passing through the ship lock once), the related results are calculated and stored, and the related cache information of the ship lock passing this time is deleted.
[0067] It should be noted that in the embodiment, the ship just entering the ship lock area is monitored, and the historical passing cache information of the ship is deleted. Optionally, after judging whether the ship lock basic information has been cached, it further comprises: if the ship lock basic information has been cached, judging whether the current ship is still in the cached ship lock; if the current ship is still in the cached ship lock, defining the state information of the current ship as the ship being in the ship lock; and if the current ship is not in the cached ship lock, defining the state information of the current ship as the ship leaving the ship lock.
[0068] According to the above steps, the ship state information can be calculated based on the ship real-time position information and the ship lock area information according to the ship grouping, the ship and ship lock relationship information is generated by assembling the ship information, the ship lock information, the ship state information, and the ship real-time position information, and the ship and ship lock relationship information is sent to the ship lock data processing center to determine the ship passing data of each ship lock as a grouping information column.
[0069] In step S104, the ship passing data is determined based on the relationship between each ship and the ship lock, taking each ship lock as a grouping information column.
[0070] Optionally, the step S104 comprises: judging whether the current group has cached the lock information according to the group information column of each lock; in the case that the current group has cached the lock information, obtaining the state information of the current ship in the ship-lock relationship; in the case that the state information is that the ship has just entered the lock, determining that the current lock has a ship entering, obtaining the ship navigation information of the current ship and the sub-area of the current ship in the current lock, wherein the ship navigation information comprises at least one of the ship speed, the ship latitude and longitude, the time and the lock sub-area; in the case that the sub-area of the current ship in the current lock is the waiting zone, clearing the historical lock-passing navigation information of the current ship, and caching the information and the entering time of the current ship entering the first waiting zone, wherein the first waiting zone is one of the upstream waiting zone and the downstream waiting zone; caching the lock chamber information and the entering time of the current ship after entering the lock chamber from the waiting zone; caching the information and the entering time of the current ship entering the second waiting zone from the lock chamber; in the case that the current ship is confirmed to pass through the first waiting zone, the lock chamber and the second waiting zone in the lock, confirming that the current ship completes the lock-passing process; in the case that the current ship completes the lock-passing process, generating the ship lock-passing data based on the cached information of the ship passing through each lock sub-area.
[0071] When it is detected that the ship state is just entering the lock but is located in the lock chamber of the current lock, there are usually two possible cases: one is that the program is just started and the ship has been docked in the lock chamber of the lock before the program is started, and the other is that the ship opens the position signal transmitter on the ship after entering the lock chamber, at this time, the lock-passing data of the ship in the current lock is incomplete, and the corresponding navigation information of the ship in the current lock cache needs to be cleared.
[0072] In addition, when the ship passes through the current lock, if the cache information of the current lock does not include all the information of the ship entering the waiting zone, the lock chamber and the other side waiting zone, it means that the ship position signal is not received by the position collection program, resulting in the loss of the position information of the ship in the waiting zone or the lock chamber, which may cause errors in the calculation process of the lock-passing data of the ship, and the corresponding navigation information of the ship in the current lock cache needs to be cleared.
[0073] Optionally, the step of caching the lock chamber information and the entering time of the current ship after entering the lock chamber from the waiting zone comprises: after confirming that the current ship has entered the first waiting zone, judging whether the current lock has cached the lock chamber information of the current ship entering the lock chamber; if the current lock has not cached the lock chamber information of the current ship entering the lock chamber, judging whether the current ship has entered the lock chamber of the current lock; if the current ship has entered the lock chamber of the current lock, caching the lock chamber information and the entering time of the current ship entering the lock chamber.
[0074] Optionally, the step of caching the information of the current ship entering the second waiting zone by the lock chamber and the entering time comprises: after confirming that the current ship has cached the information of the first waiting zone and the information of the lock chamber, judging whether the current ship lock has cached the information of the current ship entering the second waiting zone; if the current ship lock has not cached the information of the current ship entering the second waiting zone, judging whether the current ship has entered the second waiting zone by the lock chamber; if the current ship has entered the second waiting zone by the lock chamber, caching the information of the current ship entering the second waiting zone by the lock chamber and the entering time.
[0075] The first waiting zone can be an uplink waiting zone, and the second waiting zone is a downlink waiting zone at this time. If the first waiting zone is a downlink waiting zone, the second waiting zone is an uplink waiting zone at this time. No ship is stopped in the second waiting zone, and stopping occurs in the waiting zone (part of the ship waiting zone will not stop, and the lock gate is directly opened to enter the lock chamber) and the lock chamber (all ships are stopped and wait for water level adjustment). After the completion of the current lock, the complete navigation data of all ships can be obtained to calculate and sort the lock data of the current ship.
[0076] It should be noted that there are two methods for judging whether the current lock is completed: regular judgment and special judgment.
[0077] The regular judgment method is to integrate the navigation data of all ships cached by the current ship lock in the current lock, and to count the number of times of entering the waiting zone, the number of times of entering the lock chamber and the number of times of entering the waiting zone on the other side. If the numbers are consistent, it is considered that the current lock is completed, and data integration and calculation can be performed, otherwise, special judgment is entered.
[0078] There are two methods for special judgment. If the number of ships entering the lock chamber cached by the current ship lock in the current lock is M, and the number of ships entering the waiting zone on the other side is N, then the first method is used for special judgment: if M≥1 and M=N, it is considered that the current lock is completed. If the first method still judges that the current lock is not completed, the second method is entered: if N≥1, M≥3, the relationship between M and N satisfies M-N≥2, and the cumulative stopping time of the last ship leaving the lock chamber from entering the ship lock exceeds the preset time, it is considered that the current lock is completed. If the result of special judgment is that the current lock is completed, data integration and calculation can be performed, otherwise, the next ship and ship lock relationship information is required until the current lock is completed.
[0079] Optionally, after step S104, further comprising: traversing the ship lock data to obtain the passing information of all ships entering the current ship lock, wherein the passing information comprises: the time and position of the ship entering the first waiting lock area, entering the lock chamber and entering the second waiting lock area, the start and end stopping time of the ship in the first waiting lock area and the lock chamber; based on the passing information, calculating the sailing distance, sailing time and average speed of the ship; calculating the waiting lock time length, entering lock time length, lock chamber stopping time length, exiting lock time length, lock passing time length of the ship to obtain the lock passing information of the ship when passing through the current ship lock; and storing the lock passing information of the ship when passing through the current ship lock to the database.
[0080] It should be noted that the lock passing information of the ship when passing through the current ship lock includes but is not limited to: ship lock name, ship lock ID, ship MMSI, ship Chinese name, ship English name, ship type, ship type code, ship tonnage, waiting lock area stay time, waiting lock area stopping time point, lock chamber stay time, lock chamber stopping time point, another side waiting lock area stay time, another waiting lock area stopping time point, lock passing time (not including waiting lock time), total lock passing time (including waiting lock time), waiting lock time, entering lock time, exiting lock time, sailing distance, cumulative time, average speed, lock passing trajectory information, same trip ship number in the current ship lock, etc.
[0081] Through the above steps of the embodiments, the process data and detailed result data of the ship passing through the ship lock can be accurately calculated by using the real-time position data of the ship and the navigation environment information in the ship lock area through the method of stream computing; by using the distributed resource management, real-time stream computing, message queue technology and cache technology to cooperate with each other, the method is not limited by the number and position of the ship lock, has high flexibility, has strong expansibility and high concurrent data processing capacity on the basis of high operation efficiency.
[0082] The embodiment of the application can directly configure the ship lock area through the software interface, and the real-time position information is transmitted by the position information transmitter on the ship, so that the hardware procurement and maintenance costs are saved without installing ship detection equipment on site.
[0083] The application will be described in detail below with reference to another specific embodiment.
[0084] Figure 2 is a flow chart of another optional ship lock passing data determination method based on real-time ship position according to the embodiment of the application, as shown in Figure 2 The method comprises the following steps:
[0085] Step S201, collecting ship position data.
[0086] Step S202, calculating the ship and ship lock relationship information according to the ship grouping.
[0087] Step S203, calculate lock information according to lock grouping.
[0088] Step S204, batch the lock information into the database.
[0089] Step S205, count the lock information of the ship in the database.
[0090] In the embodiment of the application, the big data real-time stream processing technology Flink is used for program calculation, the Kafka message queue is used to transfer data between steps, and is used as a pipeline for data transmission in the calculation process, and Redis is used as a cache.
[0091] The embodiment of the application will be described in detail below in combination with the above steps.
[0092] Step S201, collect ship position data.
[0093] The step S201 specifically includes: collecting real-time position data of the ship, adding a time identifier and encapsulating, sending the encapsulated data to the message queue A; listening to the message queue A, preprocessing the real-time position information of the ship in the received encapsulated data; converting the real-time position information of the ship into a unified format and sending it to the message queue B.
[0094] It should be noted that the preprocessing of the encapsulated data mainly includes: data verification, data cleaning, deduplication, parsing, etc. In the step of converting the original data into a unified format, the unified format includes but is not limited to: ship unique identifier, ship name, ship type, ship longitude, ship latitude, data source (e.g. AIS, Beidou, radar, fusion signal), time point, etc.
[0095] It should be noted that, in order to avoid data loss, the real-time position data of the ship should be collected as quickly and comprehensively as possible when collecting the data for the first time.
[0096] Step S202, calculate the ship-lock relationship information according to the ship grouping.
[0097] The step S202 specifically includes: obtaining lock area data; listening to the message queue B to obtain the real-time position information of the ship in a unified format; based on the lock area data, the real-time position information of the ship is calculated according to the ship grouping to obtain the ship-lock relationship information.
[0098] It should be noted that the ship-lock relationship information at least includes: real-time position data of the ship, ship information, lock information, and ship state information, wherein the ship state information includes: just entering the lock, being in the lock, just leaving the lock, and the ship not entering the lock will be ignored.
[0099] Figure 3is a flow chart of an optional method for calculating the relationship between a ship and a ship lock according to an embodiment of the present application, as shown in Figure 3 The flow steps include:
[0100] 1. Receive a position signal;
[0101] After receiving the real-time position information of the ship from the message queue B, the encapsulated data is checked and parsed, the ship lock area information is obtained, and the conversion to a unified format is parsed;
[0102] 2. Determine whether to cache ship information;
[0103] If the result of the determination is yes, go to step 4 to determine the ship lock information, otherwise go to step 3 to cache;
[0104] 3. Cache ship information;
[0105] 4. Determine whether to cache ship lock information;
[0106] If the result of the determination is yes, go to step 9, otherwise go to step 5 to obtain the ship lock information;
[0107] 5. Obtain the ship lock information;
[0108] 6. Determine whether the current ship is located in any ship lock;
[0109] If the result of the determination is yes, go to step 7, otherwise return to step 1 to wait for the next ship position signal;
[0110] 7. Set state information 1: if it is detected that the current ship is located in a ship lock in the ship lock area, set the state information of the ship to "the ship has just entered the ship lock", and go to step 8;
[0111] 8. Cache the ship lock information;
[0112] Write the ship lock information of the current ship into the cache, and go to step 13;
[0113] 9. Determine whether the ship is in the ship lock;
[0114] If the ship lock information has been cached in the current ship packet, it means that the ship may still be in the ship lock, according to the ship position and the ship lock range, calculate whether the ship is still in the ship lock, if the result of the determination is yes, go to step 10, otherwise go to step 11;
[0115] 10. Set state information 2: if it is detected that the ship is still docked in the ship lock, set the state information of the ship to "the ship has been in the ship lock", and go to step 13;
[0116] 11. Set state information 3: if it is detected that the ship is not currently in the ship lock, set the state information of the ship as "the ship has just left the ship lock", and enter step 12 to clean the cache;
[0117] 12. Clean the cache;
[0118] When the ship leaves the ship lock, delete the cached ship lock information, and enter step 13;
[0119] 13. Generate relationship information;
[0120] Assemble the ship information, the ship lock information, the state information of the ship, and the real-time position information of the ship to generate the relationship information between the ship and the ship lock;
[0121] According to the above process, the relationship between the ship and the ship lock can be calculated based on the real-time position information of the ship and the ship lock area information according to the ship grouping, and the relationship information between the ship and the ship lock is sent to the next program to continue to calculate the ship lock data according to the ship grouping.
[0122] Step S203: Calculate the ship lock data according to the ship grouping.
[0123] The step S203 specifically includes: calculating the relationship information between the ship and the ship lock according to the ship grouping to obtain the ship lock data of the ship in the ship lock; and generating an SQL statement based on the ship lock data and sending the SQL statement to the message queue C.
[0124] Figure 4 is a schematic diagram of an optional ship lock area data layout according to an embodiment of the application, as shown in Figure 4 The ship lock can be divided into the following areas: an upstream waiting area, a downstream waiting area, and a lock chamber. It should be noted that the area data of the ship lock is composed of a set of N groups of latitude and longitude points, N is an integer greater than 3, and the latitude and longitude points in each set are sequentially connected, and the first and last points are connected to form a non-intersecting polygon with a certain area (shown by the dashed area in Figure 4 ).
[0125] Figure 5 is a flowchart of an optional method for calculating the ship lock data of the ship in the ship lock according to an embodiment of the application, as shown in Figure 5 The flowchart includes the following steps:
[0126] 1. Receive relationship information;
[0127] Wait for the relationship information between the ship and the ship lock, and the data content mainly includes: real-time position information of the ship, ship lock information, ship information, and state information of the ship;
[0128] 2. Determine whether the ship lock information is cached;
[0129] The received current ship lock information is compared with the ship lock information in the group to determine whether the current ship lock information has been cached in the group. If the result is yes, go to step 4, otherwise go to step 3 for caching;
[0130] 3. Cache ship lock information;
[0131] Cache the current ship lock information into the group;
[0132] 4. Get status information;
[0133] According to the current ship lock information, the ship state information in the ship and ship lock relationship information is extracted. The ship state information is that the ship has just entered the ship lock, or the ship has been in the ship lock, or the ship has just left the ship lock;
[0134] 5. Determine: status information;
[0135] According to different ship state information, different operations are taken: if the ship state is that the ship has just entered the ship lock, it indicates that the current ship lock has a ship entering, go to step 6 to determine whether to enter the waiting area or the chamber; if the ship state is that the ship has been in the ship lock, it indicates that the ship in the current ship lock has been in the current ship lock, go to step 11 to determine the ship passage information; if the ship state is that the ship has left the ship lock, it indicates that the ship in the current ship lock has left the waiting area, go to step 18 to determine the ship lock cache;
[0136] 6. Determine: whether to enter the waiting area or the chamber;
[0137] Because there is a gap between the ship lock area and the internal sub-area, the line cannot be completely close, and the ship position signal may just exist in the ship lock, but not in any sub-area. Moreover, the data not in the sub-area needs to be recorded, and it needs to be noted that when the ship just enters the ship lock, the first entered sub-area is the waiting area, and if it directly enters the chamber without passing through the waiting area, it is invalid data.
[0138] When a ship enters the current ship lock, determine whether the ship is in the waiting area (including: uplink waiting area and downlink waiting area) or the chamber of the current ship lock. If the result is yes, go to step 8 for further determination, otherwise go to step 7;
[0139] 7. Record complete navigation information;
[0140] Record the complete navigation information of the ship in the ship lock, including: ship speed, ship latitude and longitude, time and ship lock sub-area, etc. After saving the record, return to step 1 to wait for data;
[0141] 8. Determine: specific position of the ship;
[0142] If the ship is still in the current ship lock, the specific position of the ship in the current ship lock, i.e. the lock chamber or the waiting area, is determined. It should be noted that, since the entry area and the exit area of the lock chamber of the ship lock both have waiting areas, the "waiting area" here refers to the waiting area entered by the ship before entering the lock chamber (the specific name may be Figure 4 the uplink waiting area shown in FIG. 1B, or the downlink waiting area). The "another side waiting area" refers to the waiting area entered by the ship after leaving the lock chamber (when the "waiting area" is the uplink waiting area shown in FIG. 1B, the "another side waiting area" is the downlink waiting area; when the "waiting area" is the downlink waiting area, the "another side waiting area" is the uplink waiting area). If the specific position of the ship is the waiting area, the process proceeds to step 10 to process the ship information. If the specific position of the ship is the lock chamber, the process proceeds to step 9. Figure 4
[0143] 9. Clear the navigation information.
[0144] When the program detects that the ship is just entering the ship lock but is located in the lock chamber of the current ship lock, there are usually two possible situations. One is that the program is just started and the ship has been parked in the lock chamber of the ship lock before the program is started. The other is that the ship enters the lock chamber and then turns on the position signal transmitter on the ship. At this time, the transit data of the ship in the current ship lock is incomplete, and the corresponding navigation information in the cache of the current ship lock needs to be cleared.
[0145] In addition, when the ship passes through the current ship lock, if the cache information of the current ship lock does not include all the information of the ship entering the waiting area, the lock chamber and the other side waiting area, it means that the position signal of the ship is not received by the position collection program, resulting in the loss of the position information of the ship in the waiting area or the lock chamber, which may cause errors in the calculation process of the transit data of the ship. The corresponding navigation information in the cache of the current ship lock needs to be cleared.
[0146] 10. Process the ship information 1.
[0147] If it is detected that the state information of a ship is just entering the ship lock and the specific position is the waiting area of the current ship lock, the historical cache transit navigation information of the ship is cleared, and the cache waiting area information of the ship is processed, including the waiting area information of the current ship and the specific time point of entry. At the same time, the current ship also caches the relevant information that the ship has entered the waiting area, and then proceeds to step 7.
[0148] 11. Determine the waiting area information.
[0149] If the state of the ship is that the ship has been in the ship lock, it indicates that the ship is still passing through the ship lock. It is determined whether the ship has cached the waiting area information. If the result of the determination is yes, the process proceeds to step 12 to determine the lock chamber information. Otherwise, the process proceeds to step 6 for determination.
[0150] 12. Determine: lock chamber information;
[0151] Continue to determine whether the ship also caches the lock chamber information of the current ship lock, if the result is yes, go to step 15, otherwise go to step 13;
[0152] 13. Determine: whether to enter the lock chamber;
[0153] If the ship does not cache the lock chamber information of the current ship lock, and the current ship lock also does not cache the relevant information of the ship entering the lock chamber, determine whether the ship has entered the lock chamber of the current ship lock, if the result is yes, go to step 14 to process the ship information, otherwise go to step 7;
[0154] 14. Process ship information 2;
[0155] If the ship enters the lock chamber of the current ship lock, cache the lock chamber information of the ship, including the lock chamber information of the current ship and the specific time point of entering, at the same time, the current ship lock also records the time information of the first ship entering the lock chamber, and then go to step 7;
[0156] 15. Determine: another waiting area information;
[0157] Continue to determine whether the ship also caches the other side waiting area information of the current ship lock, if the result is yes, go to step 7, otherwise go to step 16;
[0158] 16. Determine: whether to enter another waiting area;
[0159] If the result is yes, go to step 17 to process the ship information, otherwise go to step 7;
[0160] 17. Process ship information 3;
[0161] If the ship enters the other side waiting area of the current ship lock, cache the other side waiting area information of the ship, including the other side waiting area information of the current ship and the specific time point of entering, at the same time, the current ship lock also records the time information of the first ship entering the other side waiting area, and then go to step 7;
[0162] 18. Determine: ship lock cache information;
[0163] If the ship state is that the ship leaves the ship lock, indicating that there is a ship leaving the waiting area in the current ship lock, determine whether the cache information of the current ship lock includes all the information of the ship entering the waiting area, the lock chamber and the other side waiting area, if the result is yes, go to step 19, otherwise go to step 9 for data cleaning;
[0164] 19. Determine: whether the current lock is over;
[0165] The end of the current lockage is judged regularly. The regular judgment method is: integrating the navigation data of all ships cached by the current ship lock in the current lockage, respectively counting the number of times of entering the waiting lock area, entering the lock chamber and entering the waiting lock area on the other side, if the number is consistent, it is considered that the current lockage is over, and the data calculation in step 21 is entered, otherwise the special judgment in step 20 is entered;
[0166] 20. Special judgment;
[0167] There are two methods for special judgment. If the number of ships entering the lock chamber cached by the current ship lock in the current lockage is M, and the number of ships entering the waiting lock area on the other side is N, then the first method is used for special judgment:
[0168] Method 1: If M≥1 and M=N, it is considered that the current lockage is over;
[0169] If the first method still judges that the current lockage is not over, the second method is entered:
[0170] Method 2: If N≥1, M≥3, the relationship between M and N satisfies M-N≥2, and the cumulative docking time of the last ship leaving the lock chamber since entering the ship lock exceeds the preset time, it is considered that the current lockage is over;
[0171] If the result of special judgment is that the current lockage is over, the data calculation in step 21 is entered, otherwise the step 7 is entered;
[0172] 21. Data calculation;
[0173] All ship information entering the waiting lock area cached by the current ship lock is traversed;
[0174] The time and position information of all ships entering the waiting lock area, entering the lock chamber (leaving the waiting lock area) and entering the waiting lock area on the other side (leaving the lock chamber) are calculated one by one;
[0175] The start and end docking times of all ships in the waiting lock area and the lock chamber are obtained one by one;
[0176] The detailed information of all ships passing through the current ship lock is calculated one by one, including: navigation distance, navigation time, average speed, waiting lock time, entering lock time, waiting time in lock chamber, leaving lock time, passing through lock time, up and down type and other information;
[0177] After the calculation is completed, the result data is sent to step 22 for batch preparation;
[0178] 22. Prepare batch data;
[0179] Receive result data, add SQL storage statement based on result data, and send to data batch storage sub-process.
[0180] It should be noted that the result data is the detailed information of each ship passing through the lock, including but not limited to: lock name, lock ID, ship MMSI, ship Chinese name, ship English name, ship type, ship type code, ship tonnage, waiting zone stay time, waiting zone stop time point, chamber stay time, chamber stop time point, other side waiting zone stay time, other waiting zone stop time point, passing time (not including waiting time), total passing time (including waiting time), waiting time, entering time, exiting time, navigation distance, cumulative time, average speed, passing trajectory information, and the number of same-trip ships in the lock.
[0181] Step S204, batch storing the passing information.
[0182] This step specifically includes: listening to the message queue C, splicing and caching the received SQL statements; when the number of cached data is greater than the preset number or the cumulative duration is greater than the preset duration, the spliced SQL statement is executed and the cached data is emptied.
[0183] It should be noted that this step aims to batch store the passing information, and the batch process is completed by executing the batch storage SQL statement. The configuration of the batch number and the trigger execution duration needs to consider many factors, such as the number of ship locks, the number of ships in navigation, the frequency of ship position signal transmission, database connection pool configuration information, the frequency of database table producing storage data, and database batch storage efficiency, and make reasonable evaluation.
[0184] Figure 6 is a flowchart of an optional batch storage flow computing method for passing information according to an embodiment of the present application, as shown in Figure 6 The flowchart of the flow computing method is as follows:
[0185] 1, waiting for receiving batch storage data;
[0186] The batch storage data is the SQL storage statement to be added;
[0187] 2, judge: whether it is the first SQL statement in this period;
[0188] If the result is yes, go to step 3, otherwise skip step 3 and go directly to step 4.
[0189] 3, get the prefix of the added statement and cache;
[0190] The SQL storage statement to be added contains table and added statement information. According to the table information of the SQL statement, the prefix of the added statement of the SQL statement is obtained and cached;
[0191] 4, splice SQL statement;
[0192] Splice the received SQL statement to be added with the SQL statement in the cache, and cache again;
[0193] 5, judge: whether the number of received statements reaches the preset value;
[0194] Compare the number of accumulated received SQL statements in the current period with the preset value, if the accumulated number is greater than or equal to the preset value, go to step 6 to execute the storage, otherwise skip step 6 and go to step 7 to judge the duration;
[0195] 6, execute the SQL storage statement in the cache;
[0196] The executable SQL storage statement in the cache is spliced after execution, and the cache is cleared after the storage is completed;
[0197] 7, judge: whether the duration reaches the preset duration;
[0198] Compare the accumulated time length from the addition of the first SQL storage statement to the current time point in the current period with the preset duration, if the accumulated duration is greater than or equal to the preset duration, go to step 6 to execute the storage, otherwise return to step 1 to wait for the next SQL storage statement to be added;
[0199] 8, clear the cache;
[0200] After completing the storage, the temporary data generated in the statement execution process is cleared, and the current period is ended;
[0201] 9, judge: whether the program is stopped;
[0202] If the result of the judgment is yes, go to step 10 to end the current batch storage, otherwise return to step 1 to wait for the next SQL storage statement to be added and perform the next period;
[0203] 10, end.
[0204] Step S205, count the lock information of the ship in the database.
[0205] In the embodiment of the application, the real-time position data of the ship and the navigation environment information in the ship lock area are used to accurately calculate the process data and detailed result data of the ship passing through the lock by a streaming calculation method; distributed resource management, real-time streaming calculation, message queue technology and cache technology are used to cooperate with each other, on the basis of achieving high efficiency, strong expansibility and high concurrent data processing capacity.
[0206] The ship lock region can be directly configured through a software interface, and the number and position of the ship locks are not limited, and the flexibility is high; meanwhile, the ship monitoring device does not need to be installed on site, and the hardware procurement and maintenance costs are saved.
[0207] The application will be described below in combination with another alternative embodiment.
[0208] Embodiment two
[0209] The ship lock data determination device based on the real-time position of the ship provided in this embodiment comprises a plurality of implementation units, each of which corresponds to each implementation step in the above embodiment one.
[0210] Figure 7 is a schematic diagram of an alternative ship lock data determination device based on the real-time position of the ship according to the embodiment of the application, as Figure 7 shown, the determination device can comprise: an acquisition unit 71, an acquisition unit 72, a first determination unit 73, a second determination unit 74, wherein,
[0211] The acquisition unit 71 is configured to acquire the real-time position data of each ship, and encapsulate the real-time position data according to a preset data format to obtain ship position data corresponding to each ship.
[0212] The acquisition unit 72 is configured to acquire the area information of each ship lock to obtain ship lock area data.
[0213] The first determination unit 73 is configured to determine the relationship between each ship and the ship lock based on the ship lock area data and the ship position data, taking each ship as a grouping information column.
[0214] The second determination unit 74 is configured to determine the ship lock data based on the relationship between each ship and the ship lock, taking each ship lock as a grouping information column.
[0215] The ship lock data determination device can first acquire the real-time position data of each ship through the acquisition unit 71, and encapsulate the real-time position data according to a preset data format to obtain ship position data corresponding to each ship, then acquire the area information of each ship lock through the acquisition unit 72 to obtain ship lock area data, then determine the relationship between each ship and the ship lock based on the ship lock area data and the ship position data through the first determination unit 73, taking each ship as a grouping information column, and finally determine the ship lock data based on the relationship between each ship and the ship lock through the second determination unit 74, taking each ship lock as a grouping information column.
[0216] In the embodiment of the present application, the complete navigation data and position information of each ship can be obtained by collecting real-time position data of the ship and performing data format packaging; the relative position relationship between each ship and the ship lock during the passing process of the ship can be accurately determined based on the ship lock area data and the ship position data, that is, whether the passing process of the ship is smooth can be determined, and then the ship passing data in the ship lock can be calculated based on the position relationship between the ship and the ship lock and the ship position data, thereby realizing the effect of efficient utilization of the ship passing related data, and solving the technical problems in the related art that the ship passing data cannot be calculated, resulting in low utilization rate of the ship related data.
[0217] Optionally, the acquisition unit comprises: a first acquisition module, configured to acquire N point position information of each ship lock to obtain ship lock total area information, wherein the point position information is used to locate the area range of the ship lock, and N is an integer greater than or equal to 3; a second acquisition module, configured to acquire an uplink waiting lock area, a lock chamber and a downlink waiting lock area in each ship lock within the ship lock area to obtain a ship lock sub-area set; and a determination module, configured to determine the ship lock area data based on the ship lock total area information and the ship lock sub-area set.
[0218] Optionally, the first acquisition unit comprises: a first judgment module, configured to judge whether the ship information of the current ship has been cached; a first cache module, configured to cache the ship information of the current ship to a target cache space when the ship information of the current ship has not been cached; a second judgment module, configured to judge whether the ship lock basic information has been cached when the ship information of the current ship has been cached; a third judgment module, configured to judge whether the current ship is located in any of the ship locks based on the ship lock basic information and the ship lock area data when the ship lock basic information has not been cached; a return module, configured to return the position data of the next ship when the current ship is not located in any of the ship locks; a first definition module, configured to define the state information of the current ship as the ship just entering the ship lock when the current ship is located in the target ship lock; a second cache module, configured to cache the ship lock information of the target ship lock entered by the current ship; and a first generation module, configured to generate the ship and ship lock relationship based on the ship information of the current ship, the ship lock information of the target ship lock entered by the current ship and the state information, and take each ship as the grouping information column.
[0219] Optionally, the ship passing data determination device based on the real-time position of the ship further comprises: a fourth judgment module, configured to judge whether the current ship is still in the cached ship lock when the ship lock basic information has been cached; a second definition module, configured to define the state information of the current ship as the ship in the ship lock when the current ship is still in the cached ship lock; and a third definition module, configured to define the state information of the current ship as the ship leaving the ship lock when the current ship is not in the cached ship lock.
[0220] Optionally, the second determining unit comprises: a fifth judging module, configured to judge whether the current group has cached lock information with each lock as a group information column; a third obtaining module, configured to obtain state information of the current ship in the ship-lock relationship in the case that the current group has cached lock information; a fourth obtaining module, configured to obtain ship navigation information of the current ship and a sub-area of the current ship in the current lock when the state information is that the ship has just entered the lock and it is determined that the current lock has a ship entering, wherein the ship navigation information comprises at least one of the following: ship speed, ship latitude and longitude, time and lock sub-area; a third caching module, configured to clean historical lock-passing navigation information of the current ship and cache information and time of the current ship entering a first waiting area when the sub-area of the current ship in the current lock is the waiting area, wherein the first waiting area is one of the following: an upbound waiting area and a downbound waiting area; a fourth caching module, configured to cache lock chamber information and time of the current ship entering the lock chamber from the waiting area; a fifth caching module, configured to cache information and time of the current ship entering a second waiting area from the lock chamber; a confirming module, configured to confirm that the current ship has completed the lock-passing process after confirming that the current ship has passed through the first waiting area, the lock chamber and the second waiting area in the lock; and a second generating module, configured to generate ship lock-passing data based on the cached information of the ship passing through each lock sub-area in the case that it is confirmed that the current ship has completed the lock-passing process.
[0221] Optionally, the fourth caching module comprises: a first judging submodule, configured to judge whether the current lock has cached lock chamber information of the current ship entering the lock chamber after it is confirmed that the current ship has entered the first waiting area; a second judging submodule, configured to judge whether the current ship has entered the lock chamber of the current lock when the current lock has not cached the lock chamber information of the current ship entering the lock chamber; and a first caching submodule, configured to cache the lock chamber information of the current ship entering the lock chamber and the time of entering when the current ship has entered the lock chamber of the current lock.
[0222] Optionally, the fifth caching module comprises: a third judging submodule, configured to judge whether the current lock has cached information of the current ship entering the second waiting area after it is confirmed that the current ship has cached information of the first waiting area and lock chamber information; a fourth judging submodule, configured to judge whether the current ship has entered the second waiting area from the lock chamber when the current lock has not cached the information of the current ship entering the second waiting area; and a second caching submodule, configured to cache information and time of the current ship entering the second waiting area from the lock chamber when the current ship has entered the second waiting area from the lock chamber.
[0223] Optionally, the ship lock data determination device based on the real-time position of the ship further comprises: a traversal module, configured to traverse the ship lock data to obtain the passing information of all ships entering the current ship lock, wherein the passing information comprises: the time and position of the ship entering the first waiting zone, entering the lock chamber and entering the second waiting zone, the start and end stopping time of the ship in the first waiting zone and the lock chamber; a first calculation module, configured to calculate the sailing distance, sailing time and average speed of the ship based on the passing information; a second calculation module, configured to calculate the waiting time length, entering time length, lock chamber stopping time length, exiting time length and lock passing time length of the ship to obtain the lock passing information of the ship when passing through the current ship lock; and a storage module, configured to store the lock passing information of the ship when passing through the current ship lock into the database.
[0224] The ship lock data determination device based on the real-time position of the ship can further comprise a processor and a memory, and the above-mentioned acquisition unit 71, the acquisition unit 72, the first determination unit 73, the second determination unit 74 and the like are stored in the memory as program units, and the corresponding functions are realized by the processor executing the above-mentioned program units stored in the memory.
[0225] The processor comprises a core, and the core calls the corresponding program units from the memory. The core can be one or more, and the relationship between each ship and the ship lock is determined by adjusting the core parameters to determine the ship lock data based on each ship lock as a grouping information column.
[0226] The memory can comprise a non-permanent memory in a computer readable medium, a random access memory (RAM) and / or a non-volatile memory such as a read-only memory (ROM) or a flash memory (flash RAM), and the memory comprises at least one memory chip.
[0227] The application further provides a computer program product adapted to execute the program of the following method steps when executed on a data processing device: acquiring real-time position data of each ship, and packaging the real-time position data according to a preset data format to obtain ship position data corresponding to each ship; obtaining area information of each ship lock to obtain ship lock area data; determining the relationship between each ship and the ship lock based on the ship lock area data and the ship position data, taking each ship as a grouping information column; and determining ship lock data based on the relationship between each ship and the ship lock, taking each ship lock as a grouping information column.
[0228] According to another aspect of the embodiment of the application, a computer readable storage medium is further provided, which comprises a stored computer program, wherein the computer readable storage medium controls the device where the computer readable storage medium is located to execute the ship lock data determination method based on the real-time position of the ship according to any one of the above-mentioned aspects when the computer program is running.
[0229] According to another aspect of the embodiments of the present application, an electronic device is also provided, which includes one or more processors and a memory storing one or more programs, wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to implement any of the above-mentioned methods for determining ship transit data based on real-time position of a ship.
[0230] Figure 8 is a hardware structure block diagram of an electronic device (or mobile device) for a method for determining ship transit data based on real-time position of a ship according to an embodiment of the present application, as shown in Figure 8 The electronic device can include one or more processors 802 (the processor 802 can include, but is not limited to, a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 804 for storing data, as shown in Figure 8 In addition, it can also include a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which can be included as one of the ports of the I / O interface), a network interface, a keyboard, a power supply and / or a camera. Those skilled in the art can understand that Figure 8 The structure shown in is only schematic, and does not limit the structure of the above-mentioned electronic device. For example, the electronic device can include more or fewer components than those shown in Figure 8 or have a different configuration from that shown in Figure 8 .
[0231] The above-mentioned serial numbers of the embodiments of the present application are only for description, and do not represent the advantages or disadvantages of the embodiments.
[0232] In the above-mentioned embodiments of the present application, the description of each embodiment has its own focus, and the parts not described in detail in a certain embodiment can be referred to the relevant description of other embodiments.
[0233] In the several embodiments provided in the present application, it should be understood that the disclosed technology can be implemented in other ways. Of course, the device embodiment described above is only schematic. For example, the division of the units can be a logical function division, and there can be another division manner in actual implementation, for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the units shown or discussed can be indirect coupling or communication connection through some interface, unit or module, and can be electrical or other forms.
[0234] The units described as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple units. Part or all of the units can be selected according to actual needs to achieve the purpose of the embodiment scheme.
[0235] In addition, each functional unit in each embodiment of the present application can be integrated in one processing unit, or each unit can exist physically, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of a software functional unit.
[0236] The integrated unit, if realized in the form of a software functional unit and sold or used as an independent product, can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the present application, essentially or the part that contributes to the prior art, or all or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, including a number of instructions to make a computer device (which can be a personal computer, a server or a network device, etc.) execute all or part of the steps of the method described in each embodiment of the present application. The foregoing storage medium includes: a U disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a mobile hard disk, a magnetic disk or an optical disk, and various program code storage media.
[0237] The above is only the preferred embodiment of the present application, it should be noted that for those skilled in the art, without departing from the principles of the present application, can make a number of improvements and refinements, these improvements and refinements should also be considered as the protection scope of the present application.
Claims
1. A method for determining ship lock passage data based on real-time ship position, characterized in that, include: Collect real-time position data of each vessel and encapsulate the real-time position data according to a preset data format to obtain the vessel position data corresponding to each vessel. Obtain the area information of each lock to obtain lock area data; Based on the lock area data and the vessel location data, the relationship between each vessel and the lock is determined by grouping each vessel into a single information column. The relationship between each vessel and the lock includes: vessel status information. Based on the relationship between each vessel and the lock, and using each lock as a group information column, the vessel passage data is determined, including: using each lock as a group information column, determining whether the current group has cached lock information; if the current group has cached the lock information, obtaining the current vessel's status information in the vessel-lock relationship; if the status information indicates that the vessel has just entered the lock, determining that a vessel has entered the current lock, obtaining the vessel's navigation information and the current vessel's sub-region within the current lock, wherein the vessel navigation information includes at least one of the following: vessel speed, vessel latitude and longitude, time, and lock sub-region; if the current vessel's sub-region within the current lock is pending... In the lock area, the historical lock passage information of the current vessel is cleared, and the information and entry time of the current vessel entering the first waiting area are cached. The first waiting area is one of the following: an upstream waiting area or a downstream waiting area. The lock chamber information and entry time of the current vessel after entering the lock chamber from the waiting area are cached. The information and entry time of the current vessel after entering the second waiting area from the lock chamber are cached. After confirming that the current vessel has passed through the first waiting area, the lock chamber and the second waiting area in the lock, the lock passage process of the current vessel is confirmed to be completed. If the lock passage process of the current vessel is confirmed to be completed, the lock passage data of the vessel is generated based on the cached information of the vessel passing through each lock sub-area.
2. The method for determining ship lock passage data according to claim 1, characterized in that, The steps to obtain the lock area data by acquiring the area information of each lock include: Obtain N point information for each lock to get the total lock area information, where the point information is used to locate the area range of the lock, and N is an integer greater than or equal to 3; Obtain the upstream waiting area, lock chamber, and downstream waiting area within the lock area of each lock to obtain a set of lock sub-regions; Based on the total lock area information and the set of lock sub-areas, the lock area data is determined.
3. The method for determining ship lock passage data according to claim 1, characterized in that, Based on the lock area data and the vessel location data, the step of determining the relationship between each vessel and the lock, grouped by each vessel as a information column, includes: Determine if the current vessel's information has been cached; If the ship information of the current vessel is not cached, then the ship information of the current vessel will be cached in the target cache space; If the ship information of the current ship has been cached, determine whether the lock basic information has been cached; If the lock basic information is not cached, determine whether the current vessel is located in any of the locks based on the lock basic information and the lock area data; If the current vessel is not located in any lock, return the vessel position data for waiting for the next vessel; If the current vessel is located within the target lock, the current vessel's status information is defined as the vessel having just entered the lock; Cache the lock information of the target lock that the current vessel is entering; Based on the ship information of the current vessel, the lock information of the target lock the current vessel has entered, and the status information, the relationship between the vessel and the lock is generated by grouping each vessel into a separate information column.
4. The method for determining ship lock passage data according to claim 3, characterized in that, After determining whether the lock's basic information has been cached, the process also includes: If the lock basic information has been cached, determine whether the current vessel is still in the cached lock; If the current vessel is still in the buffered lock, the current vessel's status information is defined as the vessel being in the lock; If the current vessel is not in the buffered lock, the status information of the current vessel is defined as the vessel leaving the lock.
5. The method for determining ship lock passage data according to claim 1, characterized in that, The step of caching the lock chamber information and entry time of the current vessel after entering the lock chamber from the waiting area includes: After confirming that the current vessel has entered the first waiting area, it is determined whether the current lock has cached the lock chamber information of the current vessel entering the lock chamber; If the current lock does not cache the lock chamber information of the current vessel entering the lock chamber, determine whether the current vessel has entered the lock chamber of the current lock; If the current vessel has entered the lock chamber of the current lock, then cache the lock chamber information and entry time of the current vessel.
6. The method for determining ship lock passage data according to claim 1, characterized in that, The step of caching the information of the current vessel entering the second waiting area from the lock chamber and the entry time includes: After confirming that the current vessel has cached the information of the first waiting area and the lock chamber, it is determined whether the current lock has cached the information of the current vessel entering the second waiting area; If the current lock does not cache the information of the current vessel entering the second waiting area, determine whether the current vessel has entered the second waiting area from the lock chamber; If the current vessel has already entered the second waiting area from the lock chamber, then the information of the current vessel entering the second waiting area from the lock chamber and the entry time are cached.
7. The method for determining ship lock passage data according to claim 1, characterized in that, After determining the vessel passage data based on the relationship between each vessel and the lock, with each lock as a group information column, the following is also included: By iterating through the vessel lock passage data, the passage information of all vessels entering the current lock is obtained. The passage information includes: the time and location of the vessel entering the first waiting area, the lock chamber, and the second waiting area, as well as the start and end times of the vessel's stop in the first waiting area and the lock chamber. Based on the traffic information, the vessel's travel distance, travel time, and average speed are calculated. Calculate the waiting time, entry time, lock chamber dwell time, exit time, and passage time of the vessel to obtain the vessel's passage information when passing through the current lock. Store the lock passage information of the vessel when passing through the current lock in the database.
8. A device for determining ship lock passage data based on real-time ship position, characterized in that, include: The data acquisition unit is used to collect real-time position data of each vessel and encapsulate the real-time position data according to a preset data format to obtain the vessel position data corresponding to each vessel. The acquisition unit is used to acquire the area information of each lock and obtain lock area data. The first determining unit is used to determine the relationship between each ship and the lock based on the lock area data and the ship position data, with each ship as a group information column, wherein the relationship between each ship and the lock includes: ship status information; The second determining unit is used to determine the ship passage data based on the relationship between each ship and the lock, with each lock as a group information column; The second determining unit includes: a fifth judging module, used to judge whether the current group has cached lock information, taking each lock as a group information column; a third obtaining module, used to obtain the current ship's status information in the ship-lock relationship when the current group has cached the lock information; a fourth obtaining module, used to determine that a ship has entered the current lock when the status information is that the ship has just entered the lock, and to obtain the ship navigation information of the current ship and the sub-region of the current ship in the current lock, wherein the ship navigation information includes at least one of the following: ship speed, ship latitude and longitude, time and lock sub-region; and a third caching module, used to clear the current ship's information if the sub-region of the current ship in the current lock is a waiting area. The system includes: a historical lock passage navigation information module, which caches the information and entry time of the current vessel entering the first waiting area, wherein the first waiting area is one of the following: an upstream waiting area or a downstream waiting area; a fourth caching module, which caches the lock chamber information and entry time of the current vessel after entering the lock chamber from the waiting area; a fifth caching module, which caches the information and entry time of the current vessel entering the second waiting area from the lock chamber; a confirmation module, which confirms that the current vessel has completed the lock passage process after confirming that the current vessel has passed through the first waiting area, the lock chamber, and the second waiting area within the lock; and a second generation module, which generates the vessel lock passage data based on the cached information of the vessel passing through each lock sub-area when the lock passage process is confirmed to have been completed.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored computer program, wherein, when the computer program is executed, it controls the device containing the computer-readable storage medium to perform the ship lock passage data determination method based on the real-time position of the ship as described in any one of claims 1 to 7.
10. An electronic device, characterized in that, It includes one or more processors and a memory, the memory being used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors cause the one or more processors to implement the method for determining ship lock passage data based on the real-time position of the ship as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Ship lock running state monitoring method and system, computer equipment and storage medium
CN111985358A
Ship lockage classifying and sequencing method based on positioning driving
CN116109054A