A method, device, computer equipment and medium for collecting data of a marine host

Through the combination of preset interrupt methods and multiple data buffer memory pools, the problems of data loss and buffer overflow in the signal-free area of ​​marine host data acquisition are solved, and stable and reliable collection of marine host data is achieved to ensure data integrity and Reliability provides a reliable data basis for ship navigation.

CN117608832BActive Publication Date: 2024-11-05CHINA SHIPBUILDING IND INTERNET CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202311571539.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-11-22
Publication Date
2024-11-05
Estimated Expiration
2043-11-22

AI Technical Summary

Technical Problem

Traditional marine host data acquisition methods can easily lead to data loss in signalless areas, and buffer overflow caused by too fast signals will also cause data loss, increasing the difficulty and workload of troubleshooting.

Method used

Efficiently collect host data through preset interrupt methods, and set multiple data buffer memory pools to share the pressure of bus data generation too fast, transmit data to remote servers in signaled areas, and temporarily save it to external memory in signalless areas to ensure data Not lost.

Benefits of technology

It realizes stable and reliable collection of large amounts of quickly generated host data during ship navigation, avoids data loss, provides a true, comprehensive and reliable data foundation, and provides reliable data support for subsequent data analysis and ship navigation modeling.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117608832B_ABST
    Figure CN117608832B_ABST
Patent Text Reader

Abstract

The present invention provides a method, device, computer equipment and medium for collecting data of a ship host, the method comprising: in response to establishing a bus connection with a ship host, applying for a data buffer memory pool of a preset size, and starting a drive reading interrupt to receive a ship host data stream; obtaining the size of the ship host data stream according to the ship host data stream, and applying for a memory block to be stored from the data buffer memory pool according to the size of the ship host data stream, and storing the ship host data stream in the corresponding memory block to be stored; transmitting the ship host data stream in the data buffer memory pool to a remote server in real time, so that the remote server verifies the ship data host data stream and uploads it to a preset network database. The present invention can stably and reliably collect a large amount of rapidly generated host data during the navigation process of a ship, avoid data loss, ensure the acquisition of true and comprehensive ship host data, and provide a reliable data basis for subsequent data analysis and ship navigation modeling.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of marine host data acquisition, and in particular to a marine host data acquisition method, device, computer equipment and storage medium. Background Art

[0002] The data volume of marine main engine data is large and of high importance, which is related to the overall network security of the ship. In order to ensure the safety of ship operation, data of marine main engines are usually collected during the navigation of the ship to timely detect faults or abnormalities in the operation of the main engine, and to perform maintenance and repair in a timely manner; however, due to the complex working conditions of the equipment during the operation of the ship, it often operates in areas with and without signals, which will cause network delays, communication reliability, uneven data collection quality and other problems; therefore, it is necessary to adjust and optimize the collection method of marine main engine data.

[0003] The traditional marine host data collection method does not take into account that when a ship is sailing in a signal-free area, it is very easy for the data to fail to be uploaded due to the lack of signal, thus causing the host data to be lost. Although the storage of marine host data can solve the problem of data loss when the ship is passing through a signal-free area to a certain extent, it does not solve the buffer overflow problem caused by data congestion caused by the marine host signal being too fast, and the buffer overflow will also appear as a data loss phenomenon, that is, when the data flow speed obtained by the monitoring bus exceeds the storage speed of the acquisition device, the data in the buffer will be filled with new data before it can be stored, resulting in partial data loss, which will undoubtedly increase the workload and difficulty of manual troubleshooting of host failures.

[0004] Therefore, there is an urgent need to provide a method for collecting ship host data that can stably and reliably collect ship host data, avoid the loss of ship host data, ensure the acquisition of real and comprehensive ship host data, and provide a reliable data basis for subsequent data analysis and ship navigation modeling. Summary of the invention

[0005] The purpose of the present invention is to provide a method for collecting data of a ship host, which can efficiently collect host data by means of a preset interruption method and set up multiple data buffer memory pools to share the pressure of excessive bus data generation, and transmit the data to a remote server in a signal area and temporarily save the data to an external memory in a signal-free area, so as to solve the application defect that the existing ship host data cannot be collected stably, comprehensively and reliably, and can stably and reliably collect a large amount of host data generated rapidly during the navigation of the ship, avoid data loss, ensure the acquisition of real and comprehensive ship host data, and provide a reliable data basis for subsequent data analysis and ship navigation modeling.

[0006] In order to achieve the above objectives, it is necessary to provide a marine host data acquisition method, device, computer equipment and storage medium in response to the above technical problems.

[0007] In a first aspect, an embodiment of the present invention provides a method for collecting data of a marine host, the method comprising the following steps:

[0008] In response to establishing a bus connection with the marine host, applying for a data buffer memory pool of a preset size, and starting a drive read interrupt to receive a marine host data stream; the data buffer memory pool includes at least two buffer memory pools of the same size;

[0009] According to the ship host data stream, the size of the ship host data stream is obtained, and according to the size of the ship host data stream, a memory block to be stored is applied from the data buffer memory pool, and the ship host data stream is stored in the corresponding memory block to be stored;

[0010] The ship host data stream in the data buffer memory pool is transmitted to the remote server in real time, so that the remote server verifies the ship data host data stream and uploads it to a preset network database.

[0011] Furthermore, when the communication of the remote server is interrupted or cannot receive data, the working status of the external memory is obtained, and when the working status of the external memory is normal, the ship host data stream in the data buffer memory pool is written into the external memory, and when the communication of the remote server is restored and can receive data, the ship host data stream stored in the external memory is transmitted to the remote server.

[0012] Furthermore, the step of starting the drive to read the interruption to receive the marine host data stream includes:

[0013] According to a preset interrupt mode, the marine host data stream is received through bus monitoring; the preset interrupt mode includes a trigger interrupt and a timer interrupt; the receiver output end of the bus is inverted and connected to the external interrupt pin of the control chip, and the reception enable and output enable of the bus are controlled by a newly added GPIO pin.

[0014] Furthermore, the step of applying for a memory block to be stored from the data buffer memory pool according to the size of the marine host data stream includes:

[0015] Determine whether the remaining memory amount of the currently used buffer memory pool is greater than the data stream size of the marine host;

[0016] If so, directly apply for a to-be-stored memory block with the same size as the data stream of the marine host from the currently used buffer memory pool;

[0017] If not, apply for a first memory block to be stored with the same size as the remaining memory amount from the currently used buffer memory pool, and apply for a second memory block to be stored from another buffer memory pool based on the difference between the ship host data stream size and the remaining memory amount; the sum of the memory of the first memory block to be stored and the second memory block to be stored is equal to the ship host data stream size.

[0018] Further, the step of storing the marine host data stream into the corresponding memory block to be stored comprises:

[0019] According to the clock interruption, a corresponding time signature is generated for each ship host data stream, and according to the time signature and a preset storage method, the ship host data stream is written into a corresponding cache memory pool; the preset storage method is a data storage method that is a combination of Hash and Sorted Set.

[0020] Furthermore, the step of writing the marine host data stream in the data buffer memory pool into the external memory includes:

[0021] Each ship host data stream is written into the external memory in sequence according to the corresponding time signature sequence.

[0022] In a second aspect, an embodiment of the present invention provides a marine host data acquisition device, the device comprising:

[0023] A data receiving module, for applying for a data buffer memory pool of a preset size in response to establishing a bus connection with the marine host, and starting a drive read interrupt to receive a marine host data stream;

[0024] A data cache module, used for obtaining the size of the marine host data stream according to the marine host data stream, applying for a memory block to be stored from the data buffer memory pool according to the size of the marine host data stream, and storing the marine host data stream into the corresponding memory block to be stored;

[0025] The communication transmission module is used to transmit the ship host data stream in the data buffer memory pool to the remote server in real time, so that the remote server can verify the ship data host data stream and upload it to a preset network database.

[0026] Furthermore, the data storage module is used to obtain the working status of the external memory when the remote server communication is interrupted or cannot receive data, and to write the ship host data stream in the data buffer memory pool into the external memory when the working status of the external memory is normal, and to transmit the ship host data stream stored in the external memory to the remote server when the remote server communication is restored and can receive data.

[0027] In a third aspect, an embodiment of the present invention further provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above method when executing the computer program.

[0028] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the steps of the above method when executed by a processor.

[0029] The above-mentioned present application provides a method, device, computer equipment and storage medium for collecting data of a ship host. The method realizes that in response to establishing a bus connection with a ship host, a data buffer memory pool of a preset size is applied for, and after the drive reading interrupt is turned on to receive the ship host data stream, the ship host data stream size is obtained according to the ship host data stream, and according to the ship host data stream size, a memory block to be stored is applied from the data buffer memory pool, and the ship host data stream is stored in the corresponding memory block to be stored, and the ship host data stream in the data buffer memory pool is transmitted to a remote server in real time, so that the remote server verifies the ship data host data stream and uploads it to a preset network database, and when the remote server communication is interrupted or cannot receive data, the ship host data stream in the data buffer memory pool is temporarily written to an external memory, and when the remote server communication is restored and can receive data, the ship host data stream stored in the external memory is transmitted to the remote server. Compared with the existing technology, this ship main engine data collection method can stably and reliably collect a large amount of host data generated rapidly during the ship's navigation, avoid data loss, ensure the acquisition of real and comprehensive ship main engine data, and provide a reliable data basis for subsequent data analysis and ship navigation modeling. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] Figure 1 1 is a flow chart of a method for collecting data of a marine host in an embodiment of the present invention;

[0031] Figure 2 This is a schematic diagram of controlling a newly added GPIO pin on the control chip side in an embodiment of the present invention;

[0032] Figure 3 2 is a schematic diagram of the structure of a marine host data acquisition device according to an embodiment of the present invention;

[0033] Figure 4 is another structural schematic diagram of a marine host data acquisition device according to an embodiment of the present invention;

[0034] Figure 5 It is a diagram of the internal structure of a computer device in an embodiment of the present invention. DETAILED DESCRIPTION

[0035] In order to make the purpose, technical scheme and beneficial effects of the present application clearer, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. Obviously, the embodiments described below are part of the embodiments of the present invention and are only used to illustrate the present invention, but are not used to limit the scope of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0036] The marine main engine data acquisition method provided by the present invention can be understood taking into account the current application status that existing ships are prone to data loss when passing through a signal-free area, and the buffer overflow caused by the marine main engine signal being too fast leading to data congestion will also cause partial data loss, increasing the workload and difficulty of manual troubleshooting of the main engine failure. The proposed marine main engine data acquisition method efficiently collects host data through a preset interrupt method and sets multiple data buffer memory pools to share the pressure of bus data being generated too fast, and transmits data to a remote server in a signal area and temporarily saves data to an external memory in a signal-free area. The method is efficient, comprehensive, stable and reliable, and can be applied to the host data acquisition device installed in the central control box in the middle of the ship's main engine, and is used to perform real-time information acquisition on a preset target acquisition device; the following embodiments will explain the marine main engine data acquisition method of the present invention in detail.

[0037] In one embodiment, Figure 1 As shown, a method for collecting data of a marine host is provided, comprising the following steps:

[0038] S11, in response to establishing a bus connection with the marine host, applying for a data buffer memory pool of a preset size, and enabling a driver read interrupt to receive a marine host data stream; the data buffer memory pool includes at least two buffer memory pools of the same size; wherein the bus for establishing a communication connection with the marine host preferably adopts an RS485 bus; at the same time, in order to ensure the continuity of the collected data and reduce the work of manually adjusting the serial port, the present embodiment preferably uses serial port 3 (CMO3) to connect to the marine host device, so that the host data can be stably and continuously collected and analyzed; if serial port 3 is occupied, other serial ports, such as serial port 4, can be selected in sequence; if other serial ports cannot be selected, the problem of serial port 3 being occupied can be solved by deleting the relevant items in the registry; after initializing serial port 3 and control IO, the sp485 driver can be run, and an application for allocating a data buffer memory pool of a preset size can be applied, the sp485 read interrupt can be enabled, and the data on the RS485 interface can be read;

[0039] The above-mentioned data buffer memory pool can be understood as the memory space used to cache the ship host data stream transmitted by the bus. In principle, the preset size and number of the data buffer memory pool can be set according to the actual application requirements. Taking into account the fact that in the actual process of caching the ship host data stream, it is very easy for the cache pool to overflow due to the excessive speed of bus data generation, which in turn causes some unprocessed data to be overwritten and lost, as well as the rationality of memory resource occupation, this implementation preferably applies for two 4KRAM as buffer memory pools for cyclic use of caching the ship host data stream.

[0040] At the same time, considering that the RS485 bus works in a half-duplex communication state, only one node on the bus can become the master node and be in the sending state at the same time, and all other nodes must be in the receiving state. If more than two nodes are in the sending state at the same time, it will cause a bus conflict and all senders will fail to send data. In order to avoid bus conflicts and ensure that the data flow on the bus can be obtained uninterruptedly, this embodiment preferably uses a preset interrupt mode and a newly added GPIO pin to control the sending and receiving of bus messages to ensure that data transmission on the bus is not interrupted at two levels. Specifically, the step of starting the drive to read the interrupt to receive the marine host data stream includes:

[0041] According to the preset interrupt mode, the marine host data stream is received through bus monitoring; the preset interrupt mode includes trigger interrupt and timer interrupt; the receiver output end of the bus is inverted to the external interrupt pin of the control chip, and the reception enable and output enable of the bus are controlled by the newly added GPIO pin; wherein, the marine host data stream can be understood as the operation information of each device that needs to monitor the operation status in real time according to the actual application requirements, for example, various types of information can be collected as shown in Table 1:

[0042] Table 1 Collection information types

[0043] Serial number Code Type of information collected 1 F Fuel System 2 L Lubricating oil system 3 A Compressed air system 4 C Cooling water system 5 P Exhaust system 6 S Scavenging system 7 QL Cylinder oil system 8 QC Cylinder cooling water system 9 CM Crankcase Monitoring System 10 FM ICM intelligent combustion monitoring and MAPEX piston operation reliability monitoring 11 AI Combustion air intake system 12 FI Injector status 13 CS Cylinder seal status 14 CL Cylinder lubrication status 15 CC Cylinder compression state 16 CI Cylinder ignition status 17 ES Host status information 18 PV Exhaust valve status 19 TC Cylinder top dead center compensation 20 M other

[0044] In actual applications, the specific process of receiving the required marine host data stream through real-time bus monitoring is as follows: the first level determines the timing of data transmission according to the idleness of the bus, connects each information collection device through the RS485 bus for monitoring, and adopts the method of inverting the output end of the bus receiver and connecting it to the external interrupt pin of the CPU in the design, and uses the triggering interrupt method to determine whether there is data transmission on the bus, and combines the timer interrupt to determine whether the bus is idle. If the bus is idle, the device node obtains the bus control right to send data. While sending data, it monitors while sending. If a conflict is detected, it stops sending. This can ensure that each device node has the right to send data and minimize the chance of bus conflicts, thereby improving the throughput of the entire system; the second level is to self-diagnose the operating status of the hardware in real time based on the sent and received messages. Although the bus monitoring method of the first level solves the problem of data transmission conflicts on the bus when the hardware can operate normally, it cannot guarantee data transmission when the hardware is operating abnormally. Therefore, in order to detect hardware failures in a timely manner and avoid data transmission failures caused by hardware failures, such as Figure 2 As shown in the figure, a new GPIO pin is added on the control chip side to control (Receiver Output Enable) and DE (Driver Output Enable). When DIR = 0, the receiving circuit is enabled. The transmitting circuit is disabled. DE = 0, and the bus is in a high impedance state. When DIR = 1, the receiving circuit is enabled. The sending circuit is prohibited from DE = 1, so that the sending and receiving circuits can be controlled simultaneously with one GPIO pin; based on the control method of the GPIO pin, before data transmission, when DE = 1, Set to 0 to realize the self-loop of the message sent by itself, send the message on the bus, and then receive the message sent by itself. By comparing the received message with the sent message, the chip's welding status, transceiver status, wiring status, etc. are systematically checked. If damage, open circuit, or short circuit occurs, a system fault warning is issued.

[0045] S12, according to the ship host data stream, obtain the size of the ship host data stream, and according to the size of the ship host data stream, apply for a memory block to be stored from the data buffer memory pool, and store the ship host data stream into the corresponding memory block to be stored; wherein, the size of the ship host data stream can be obtained according to the first byte of the received data stream, which will not be described in detail here; considering that the current ship host data stream may overflow when it is stored in the data buffer pool, in order to ensure that different data buffer memory pools can be effectively spliced ​​and recycled, the present application preferably pre-judges the size of the ship host data stream and then determines the application method of the memory block to be stored; specifically, the step of applying for a memory block to be stored from the data buffer memory pool according to the size of the ship host data stream includes:

[0046] Determine whether the remaining memory amount of the currently used buffer memory pool is greater than the data stream size of the marine host;

[0047] If so, directly apply for a to-be-stored memory block with the same size as the data stream of the marine host from the currently used buffer memory pool;

[0048] If not, apply for a first memory block to be stored with the same size as the remaining memory from the currently used buffer memory pool, and apply for a second memory block to be stored from another buffer memory pool according to the difference between the ship host data stream size and the remaining memory; the sum of the memory of the first memory block to be stored and the second memory block to be stored is equal to the ship host data stream size;

[0049] In practical applications, the specific process of storing the marine host data stream into the data buffer pool can be understood as follows: each time the marine host data stream is received, the size of the current data stream is first obtained from the first byte of the received data stream, and a part of the memory blocks are allocated from the memory pool according to the size of the data stream. If the remaining available memory block capacity of the current memory pool is less than the data stream size, all the remaining available memory blocks in the current memory pool are first applied for, and then another 4K buffer memory pool is immediately switched to apply for the required memory blocks. When a 4K memory pool is full of data, another 4K buffer memory pool is immediately replaced; that is, multiple buffer memory pools are used in a cyclic and alternating manner to share the excessive pressure generated by the bus data and effectively avoid the loss of collected data;

[0050] Considering that the marine host data stream is sequential, in order to ensure correct storage according to the acquisition timing, this embodiment preferably generates a time signature based on the chip built-in hardware clock RTC interrupt to perform time stamp storage for the received marine host data stream; specifically, the step of storing the marine host data stream into the corresponding memory block to be stored includes:

[0051] According to the clock interrupt, a corresponding time signature is generated for each ship host data stream, and according to the time signature and the preset storage method, the ship host data stream is written into the corresponding cache memory pool; wherein, the preset storage method can be selected according to actual needs in principle. In order to ensure that the insertion data of the time series data is fast and can support the query by timestamp range to meet the continuous high concurrent writing of the time series data, the present embodiment preferably adopts a Hash and Sorted Set combined data storage data structure with low data type complexity, non-blocking and support for query by timestamp range at the same time. By using the HashTable type, a fast query of a single key is realized to meet the single-key query requirement of the time series data, and at the same time, by using the Sorted Set type, queries by timestamp range are supported to meet the data query requirements of a single time point and a time range.

[0052] The above-mentioned Hash (hash table) is a special array. By converting other data types such as timestamps into numbers, Hash can use numbers to access the corresponding elements of the array; it can directly locate and access the corresponding value according to the specified keyword, and does not need to check each data through a loop like accessing arrays, collections and other data structures to find the required data and end the query operation; the marine host data collected in this embodiment is in time sequence, and the collection time of each data will not be exactly the same, so the timestamp can be used as a keyword, and the specific collected data can be stored as the corresponding value of the keyword; correspondingly, the method of converting the timestamp to a number is to use the most commonly used date starting point 1900-1-1 00:00:00.000 as the first day, and by subtracting the date time of the timestamp from the starting point of this date, a time difference number is obtained (this number expresses the number of days and time between the two dates), and the time difference number is used as the keyword of the Hash and converted to the index of the underlying array; when using the data after obtaining it, it is only necessary to compare the index of the underlying array with the starting point of the date 1900-1-1 Add 00:00:00.000 to get the original timestamp;

[0053] Considering that Hash does not have an ordered index for data, when a range query is required on the Hash type, it is necessary to scan all the data in the Hash set, that is, it is necessary to loop through all the underlying data and then retrieve the data back to the client for sorting in order to obtain the data within the query range on the client. Therefore, the Sorted Set type is used in combination to save the data one by one in the order of the timestamps when the data was collected, and the timestamps are used as the serial numbers of the data, and the data is stored according to the serial numbers. That is, by combining the Hash and Sorted Set types, it is possible to query data with exact timestamps on demand through Hash, and to query a batch of time-continuous data according to the timestamp range, thereby meeting the needs of data collection and analysis in practical applications.

[0054] S13, transmitting the marine host data stream in the data buffer memory pool to the remote server in real time, so that the remote server verifies the marine host data stream and uploads it to a preset network database; wherein the remote server can be understood as a ship navigation analysis server that can obtain the collected marine host data based on the network protocol, and verify, store, and analyze the marine host data;

[0055] The remote server reads the data stream of the marine host bit by bit in binary form, determines the data range according to the start mark and end mark of the data packet header of the data after receiving the data, and checks the reliability of the data by checking the data and the check code; each frame of data has a total of 10 bits of data without a check bit, including 1 byte of 8 bits of data, and a start mark and an end mark of 1 bit before and after the 8 bits of data; after adding the check bit, each frame of data has a total of 11 bits of data, and this check bit is calculated by calculating the 10 bits of data without the check bit. When the 10 bits of data without the check bit have an odd number of 1s, the check bit is 0, and vice versa, when it is an even number of 1s, the check bit is 1; this embodiment performs a reliability check by using the check code that each frame of data in the collected data has. When this check code is read, the modbus 16-bit encoding is used for verification, and the number of 1s in the 10 bits of data without the check bit is calculated to see if it is the same as the check code. When the verification is wrong, the frame of data is discarded to ensure the authenticity and reliability of the stored data.

[0056] In actual applications, the remote server saves the verified normal data in the hard disk by time naming, and stores it in a file with the suffix xxx.dat in the directory with the corresponding ship name, and converts the data into a csv format that can be viewed as a text file and also saves it in the hard disk. Every 1 minute, the data in the csv file format is uploaded to the network database according to the database requirements; in principle, the network database can be selected according to the actual application requirements. In this embodiment, the industrial database IoTDB that conforms to the open source standard is preferably selected.

[0057] This embodiment applies for a data buffer memory pool of a preset size after establishing a bus connection with the marine host, and starts a driver read interrupt to receive the marine host data stream. According to the size of the marine host data stream, a memory block to be stored is applied from the data buffer memory pool, and the marine host data stream is stored in the corresponding memory block to be stored. The marine host data stream in the data buffer memory pool is transmitted to a remote server in real time, so that the remote server verifies the marine data host data stream and uploads it to a preset network database. The technical solution can efficiently collect host data through a preset interrupt method, and share the pressure of excessive bus data generation by setting multiple data buffer memory pools, thereby ensuring stable and reliable collection of a large amount of rapidly generated host data during the navigation of the ship, and effectively avoiding the problem of data loss caused by data congestion buffer overflow.

[0058] In practical applications, the above scheme can effectively avoid the problem of data loss caused by buffer overflow due to the excessively fast data collection speed and the excessive amount of data collected by the ship host. However, considering that there may still be a risk of newly generated data being lost due to the inability to timely transmit the data in the buffer pool to the remote server when the ship passes through a signal-free area, in order to further ensure the comprehensiveness of data collection, this embodiment preferably adopts the method of temporarily saving the data to an external memory when there is no signal area or the remote server cannot receive and process the data, and transmitting the data when the remote server returns to normal time to ensure that the data is not lost; specifically, in one embodiment, the method further includes:

[0059] When the remote server communication is interrupted or cannot receive data, the working state of the external memory is obtained, and when the working state of the external memory is normal, the marine host data stream in the data buffer memory pool is written into the external memory, and when the remote server communication is restored and can receive data, the marine host data stream stored in the external memory is transmitted to the remote server;

[0060] Among them, the external memory preferably uses a storage TF card, and the corresponding external memory working status can be understood as a check result of whether the storage TF card is in a normal active state and whether the data logger status table in the TF card is normal; if the TF card is in an accessed state, there is an error, or the data logger status table CardStatus is not "Card OK", it means that the external memory working state is abnormal, that is, it cannot be written at present, and if there is an error in the TF card, or the data logger status table is abnormal, it is necessary to remind the maintenance personnel to format or replace a new storage TF card, otherwise, it can be written directly;

[0061] Specifically, the step of writing the marine host data stream in the data buffer memory pool into the external memory includes:

[0062] Write each marine host data stream into the external memory in sequence according to the corresponding time signature sequence; wherein, the specific method of storing the marine host data stream in the corresponding time signature sequence can be understood as storing each data stream in exfat format in hexadecimal format, and storing them in time sequence; when the data storage TF card is full, the data will start to be stored in a loop, and the data collected at the latest time will overwrite the earliest stored data, so that it can be ensured that even when the bus speed is very fast, data will not be lost due to other abnormal interruptions, thereby ensuring the comprehensiveness and reliability of data collection.

[0063] The embodiment of the present application establishes a bus connection with the ship host, applies for a data buffer memory pool of a preset size, and starts a drive to read the interrupt to receive the ship host data stream, obtains the ship host data stream size according to the ship host data stream, and applies for a memory block to be stored from the data buffer memory pool according to the ship host data stream size, and stores the ship host data stream into the corresponding memory block to be stored, and transmits the ship host data stream in the data buffer memory pool to the remote server in real time, so that the remote server verifies the ship host data stream and uploads it to the preset network database, and when the remote server communication is interrupted or cannot receive data, temporarily writes the ship host data stream in the data buffer memory pool to the remote server. The scheme of storing the marine host data in an external memory and transmitting the marine host data stream stored in the external memory to the remote server when the communication with the remote server is restored and the data can be received can not only efficiently collect the host data by means of preset interruption and set up multiple data buffer memory pools to share the pressure of excessive bus data, but also transmit the data to the remote server in the signal area and temporarily save the data to the external memory in the non-signal area to ensure that the collected data is not lost due to external abnormal interruption, that is, the large amount of rapidly generated host data during the ship's navigation can be efficiently, stably and reliably collected to avoid data loss, ensure the acquisition of real and comprehensive marine host data, and provide a reliable data basis for subsequent data analysis and ship navigation modeling.

[0064] It should be noted that although the steps in the above flowchart are shown in sequence according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders.

[0065] In one embodiment, Figure 3 As shown, a marine host data acquisition device is provided, the device comprising:

[0066] The data receiving module 1 is used for applying for a data buffer memory pool of a preset size in response to establishing a bus connection with the marine host, and starting a drive reading interrupt to receive a marine host data stream;

[0067] A data cache module 2, used for obtaining the size of the marine host data stream according to the marine host data stream, applying for a memory block to be stored from the data buffer memory pool according to the size of the marine host data stream, and storing the marine host data stream into the corresponding memory block to be stored;

[0068] The communication transmission module 3 is used to transmit the ship host data stream in the data buffer memory pool to the remote server in real time, so that the remote server can verify the ship host data stream and upload it to a preset network database.

[0069] In one embodiment, the apparatus further comprises:

[0070] The data storage module is used to obtain the working status of the external memory when the communication of the remote server is interrupted or cannot receive data, and to write the ship host data stream in the data buffer memory pool into the external memory when the working status of the external memory is normal, and to transmit the ship host data stream stored in the external memory to the remote server when the communication of the remote server is restored and can receive data.

[0071] It should be noted that the functional modules in the above-mentioned marine host data acquisition device are also understood as functional descriptions of the processor (control chip) in the marine host data acquisition device. In practical applications, the marine host data acquisition device is Figure 4As shown, it preferably also includes a memory, an indicator light and a bus interface connected to the processor, and a device switch, a power interface, a 4G antenna and an RS485 interface connected to the bus interface; wherein the memory includes an internal memory and an external memory; the external memory includes a TF card slot and a SIM card slot; the TF card slot is used to place a TF card, and the TF card is used to temporarily store the collected marine host data; the SIM card slot is used to place a SIM card, and the SIM card is used for network transmission with a base station signal; the indicator light indicates the working status by emitting red and green colors, green indicates normal operation, and red indicates abnormality, including a 4G working indicator light, a bus working indicator light, a system operation indicator light and a power indicator light. Among them, the 4G working indicator light is used to indicate whether the 4G antenna communication is normal and whether there is data being sent or received; the bus working indicator light is used to indicate whether the bus interface is operating normally, for example, the device connected to the bus is damaged; the system operation indicator light is used to indicate whether the acquisition device can operate normally, whether the collected data can be obtained, and whether the data can be sent; the power indicator light indicates whether the power is turned on; the bus interface is used to connect to the marine host and collect data for transmission on the bus; the RS485 interface is used to connect to the bus and send data instructions through the bus; the power interface is used to insert the power cord to power on the mainboard of the acquisition device and allow the various components plugged into the mainboard to operate stably; the 4G antenna is used to receive 4G signals through a SIM card, access the 4G network, and communicate with the remote server through the IP address of the remote server to transmit data.

[0072] The actual method of the above-mentioned marine host data acquisition device is: first connect the marine host to the bus, and connect the acquisition device to the bus through the RS485 interface, so that the marine host and the device can communicate through the bus; the acquisition device sends instructions through the bus, and the marine host sends host data after receiving the instructions, and the acquisition device receives the host data through the bus, first caches it in the memory, accesses the remote server IP through the SIM card and 4G antenna, and transmits the data in the memory to the remote server; at the same time, if the remote server is not connected or there is no time to receive data, this part of the data is temporarily written to the TF card, and when the connection with the remote server is restored or the server can receive data, the data of the TF card is transmitted to the remote server.

[0073] For the specific definition of the marine host data acquisition device, please refer to the definition of the marine host data acquisition method above, and the corresponding technical effects can also be equivalently obtained, which will not be repeated here. Each module in the above-mentioned marine host data acquisition device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0074] Figure 5 FIG. 1 shows an internal structure diagram of a computer device in an embodiment, and the computer device may specifically be a terminal or a server. Figure 5 As shown, the computer device includes a processor, a memory, a network interface, a display, a camera and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a method for collecting data from a marine host is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covered on the display screen, or a key, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.

[0075] It can be understood by those skilled in the art that Figure 5 The structure shown in the figure is only a block diagram of a part of the structure related to the present application scheme, and does not constitute a limitation on the computer device to which the present application scheme is applied. The specific computing device may include more or fewer components than shown in the figure, or combine certain components, or have the same component arrangement.

[0076] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the steps of the above method are implemented when the processor executes the computer program.

[0077] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above method are implemented.

[0078] In summary, the embodiments of the present invention provide a method, device, computer equipment and storage medium for collecting data of a ship host. The method for collecting data of a ship host realizes that after establishing a bus connection with the ship host, a data buffer memory pool of a preset size is applied for, and after starting the drive reading interrupt to receive the ship host data stream, the ship host data stream size is obtained according to the ship host data stream, and according to the ship host data stream size, a memory block to be stored is applied from the data buffer memory pool, and the ship host data stream is stored in the corresponding memory block to be stored, and the ship host data stream in the data buffer memory pool is transmitted to the remote server in real time, so that the remote server verifies the ship host data stream and uploads it to the preset network database, and when the remote server communication is interrupted or cannot receive data, The technical solution is to temporarily write the marine host data stream in the data buffer memory pool into the external memory, and when the remote server communication is restored and can receive data, transmit the marine host data stream stored in the external memory to the remote server. This method can not only efficiently collect host data by preset interruption mode and set multiple data buffer memory pools to share the pressure of excessive bus data generation, but also transmit data to the remote server in the signal area and temporarily save data to the external memory in the non-signal area to ensure that the collected data is not lost due to external abnormal interruption. That is, a large amount of host data generated rapidly during the ship's navigation can be efficiently, stably and reliably collected to avoid data loss, ensure the acquisition of real and comprehensive marine host data, and provide a reliable data basis for subsequent data analysis and ship navigation modeling.

[0079] Each embodiment in this specification is described in a progressive manner, and the parts that are directly the same or similar to each other can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. It should be noted that the technical features of the above-mentioned embodiments can be combined arbitrarily. In order to make the description concise, all possible combinations of the technical features in the above-mentioned embodiments are not described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0080] The above-mentioned embodiments only express several preferred implementation modes of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for ordinary technicians in the technical field, several improvements and substitutions can be made without departing from the technical principles of the present invention, and these improvements and substitutions should also be regarded as the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be based on the protection scope of the claims.

Claims

1. A method for collecting data from a marine host. It is characterized in that The method comprises the following steps: In response to establishing a bus connection with the marine host, applying for a data buffer memory pool of a preset size, and starting a drive read interrupt to receive a marine host data stream; the data buffer memory pool includes at least two 4K buffer memory pools; According to the ship host data stream, the size of the ship host data stream is obtained, and according to the size of the ship host data stream, a memory block to be stored is applied from the data buffer memory pool, and the ship host data stream is stored in the corresponding memory block to be stored; Transmitting the marine host data stream in the data buffer memory pool to the remote server in real time, so that the remote server verifies the marine host data stream and uploads it to a preset network database; The step of starting the drive to read the interrupt to receive the data stream of the marine host comprises: According to the preset interrupt mode, the data stream of the marine host is received through bus monitoring; the preset interrupt mode includes trigger interrupt and timer interrupt; the receiver output end of the bus is inverted and connected to the external interrupt pin of the control chip, and the reception enable and output enable of the bus are simultaneously controlled through the newly added GPIO pin, specifically including: Determine whether the bus has data transmission through the trigger interrupt, and at the same time determine whether the bus is idle according to the timer interrupt, so as to obtain bus control right to send data, and monitor conflicts when sending data, and stop sending data if conflicts are monitored; By controlling the newly added GPIO pin before data transmission, when output is enabled, the receive enable is set to 0, the message sent on the bus is received by the self-loop, and the received message is compared with the sent message to perform system inspection and fault warning on the control chip.

2. The marine host data acquisition method according to claim 1, It is characterized in that The method further comprises: When the remote server communication is interrupted or cannot receive data, the working status of the external memory is obtained, and when the working status of the external memory is normal, the ship host data stream in the data buffer memory pool is written into the external memory, and when the remote server communication is restored and can receive data, the ship host data stream stored in the external memory is transmitted to the remote server.

3. The marine host data acquisition method according to claim 1, It is characterized in that The step of applying for a memory block to be stored from the data buffer memory pool according to the size of the marine host data stream comprises: Determine whether the remaining memory amount of the currently used buffer memory pool is greater than the data stream size of the marine host; If so, directly apply for a to-be-stored memory block with the same size as the data stream of the marine host from the currently used buffer memory pool; If not, apply for a first memory block to be stored with the same size as the remaining memory amount from the currently used buffer memory pool, and apply for a second memory block to be stored from another buffer memory pool based on the difference between the ship host data stream size and the remaining memory amount; the sum of the memory of the first memory block to be stored and the second memory block to be stored is equal to the ship host data stream size.

4. The marine host data acquisition method according to claim 3, It is characterized in that The step of storing the marine host data stream into the corresponding memory block to be stored comprises: According to the clock interruption, a corresponding time signature is generated for each ship host data stream, and according to the time signature and a preset storage method, the ship host data stream is written into a corresponding cache memory pool; the preset storage method is a data storage method that is a combination of Hash and Sorted Set.

5. The marine host data acquisition method according to claim 2, It is characterized in that The step of writing the marine host data stream in the data buffer memory pool into the external memory comprises: Each ship host data stream is written into the external memory in sequence according to the corresponding time signature sequence.

6. A marine host data acquisition device, It is characterized in that The device comprises: A data receiving module, used for applying for a data buffer memory pool of a preset size in response to establishing a bus connection with the marine host, and starting a drive read interrupt to receive a data stream of the marine host; the data buffer memory pool includes at least two buffer memory pools of 4K size; A data cache module, used for obtaining the size of the marine host data stream according to the marine host data stream, applying for a memory block to be stored from the data buffer memory pool according to the size of the marine host data stream, and storing the marine host data stream into the corresponding memory block to be stored; A communication transmission module, used for transmitting the marine host data stream in the data buffer memory pool to a remote server in real time, so that the remote server verifies the marine host data stream and uploads it to a preset network database; The step of starting the drive to read the interrupt receiving the marine host data stream includes: According to the preset interrupt mode, the data stream of the marine host is received through bus monitoring; the preset interrupt mode includes trigger interrupt and timer interrupt; the receiver output end of the bus is inverted and connected to the external interrupt pin of the control chip, and the reception enable and output enable of the bus are simultaneously controlled through the newly added GPIO pin, specifically including: Determine whether the bus has data transmission through the trigger interrupt, and at the same time determine whether the bus is idle according to the timer interrupt, so as to obtain bus control right to send data, and monitor conflicts when sending data, and stop sending data if conflicts are monitored; By controlling the newly added GPIO pin before data transmission, when output is enabled, the receive enable is set to 0, the message sent on the bus is received by the self-loop, and the received message is compared with the sent message to perform system inspection and fault warning on the control chip.

7. The marine host data acquisition device according to claim 6, It is characterized in that The device also includes: The data storage module is used to obtain the working status of the external memory when the communication of the remote server is interrupted or cannot receive data, and to write the ship host data stream in the data buffer memory pool into the external memory when the working status of the external memory is normal, and to transmit the ship host data stream stored in the external memory to the remote server when the communication of the remote server is restored and can receive data.

8. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, It is characterized in that When the processor executes the computer program, the steps of the method according to any one of claims 1 to 5 are implemented.

9. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.

Citation Information

Cited By

  • A method and system for evaluating the risks of cruise ship transportation based on big data analysis

    CN119918949B