CN111275846B - Data record generation method and device, electronic equipment and storage medium - Google Patents

Data record generation method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN111275846B
CN111275846B CN201811472933.5A CN201811472933A CN111275846B CN 111275846 B CN111275846 B CN 111275846B CN 201811472933 A CN201811472933 A CN 201811472933A CN 111275846 B CN111275846 B CN 111275846B
Authority
CN
China
Prior art keywords
data
frame
data frame
current
moment
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201811472933.5A
Other languages
Chinese (zh)
Other versions
CN111275846A (en
Inventor
王洪军
李树千
卓颖
薛伟光
张涛
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
BYD Co Ltd
Original Assignee
BYD Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by BYD Co Ltd filed Critical BYD Co Ltd
Priority to CN201811472933.5A priority Critical patent/CN111275846B/en
Publication of CN111275846A publication Critical patent/CN111275846A/en
Application granted granted Critical
Publication of CN111275846B publication Critical patent/CN111275846B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G07CHECKING-DEVICES
    • G07CTIME OR ATTENDANCE REGISTERS; REGISTERING OR INDICATING THE WORKING OF MACHINES; GENERATING RANDOM NUMBERS; VOTING OR LOTTERY APPARATUS; ARRANGEMENTS, SYSTEMS OR APPARATUS FOR CHECKING NOT PROVIDED FOR ELSEWHERE
    • G07C5/00Registering or indicating the working of vehicles
    • G07C5/008Registering or indicating the working of vehicles communicating information to a remotely located station
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0608Saving storage space on storage systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0655Vertical data movement, i.e. input-output transfer; data movement between one or more hosts and one or more storage devices
    • G06F3/0656Data buffering arrangements
    • GPHYSICS
    • G07CHECKING-DEVICES
    • G07CTIME OR ATTENDANCE REGISTERS; REGISTERING OR INDICATING THE WORKING OF MACHINES; GENERATING RANDOM NUMBERS; VOTING OR LOTTERY APPARATUS; ARRANGEMENTS, SYSTEMS OR APPARATUS FOR CHECKING NOT PROVIDED FOR ELSEWHERE
    • G07C5/00Registering or indicating the working of vehicles
    • G07C5/08Registering or indicating performance data other than driving, working, idle, or waiting time, with or without registering driving, working, idle or waiting time
    • G07C5/0841Registering performance data

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • General Engineering & Computer Science (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a method and a device for generating data records, electronic equipment and a storage medium, wherein the method comprises the following steps: acquiring a first frame data frame for caching; acquiring a current data frame to be stored at the current moment, wherein the current data frame is a data frame which is not a first frame; judging whether the current data frame changes relative to the previous data frame at the previous moment; if the current data frame changes relative to the previous data frame, extracting the changed numerical value and the position of the numerical value in the current data frame; and generating a framing data record to be stored by using the first frame of data frame, the obtained numerical value at each moment and the position of the numerical value in the current data frame. In the process of generating the data record, after unchanged data in the data frame at the adjacent moment is stored for one time, only the changed data and the position of the changed data are stored, and the acquired complete data is not required to be stored, so that the storage space is effectively saved, and the requirement on hardware equipment is reduced.

Description

Data record generation method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and an apparatus for generating a data record, an electronic device, and a storage medium.
Background
With the rapid development of the internet of vehicles, more and more data are required to realize remote monitoring, and the vehicle-mounted terminal collects data on a bus of the whole vehicle, performs framing according to a certain rule, and uploads the data to the server according to a specified frequency. However, due to the limitation of the collection and uploading frequency, some data requiring high real-time performance cannot meet the analysis requirements, so that the vehicle-mounted terminal is required to have a local storage function, and the requirements of realizing remote monitoring of most data and uploading the original data of the specified ID under a specific condition can be met, and the data can be copied through a USB.
In the related technology, the vehicle-mounted terminal local data storage scheme is based on all IDs on the CAN network and is stored locally in the vehicle-mounted terminal after framing according to the sending sequence, and the specific storage method is as follows: timestamp + ID1+ data + timestamp + ID2+ data + ·. However, such a data format requires a large local storage space, and for unchanged data, the terminal may store the data for multiple times, which wastes the storage space and increases the requirement for hardware devices.
Disclosure of Invention
The present invention is directed to solving, at least to some extent, one of the technical problems in the related art.
Therefore, a first object of the present invention is to provide a method for generating a data record, which can effectively process data, save storage space and save hardware cost.
A second object of the present invention is to provide a data record generating apparatus.
A third object of the invention is to propose an electronic device.
A fourth object of the invention is to propose a non-transitory computer-readable storage medium.
In order to achieve the above object, an embodiment of a first aspect of the present invention provides a method for generating a data record, including the following steps:
acquiring a first frame data frame for caching;
acquiring a current data frame to be stored at the current moment, wherein the current data frame is a data frame which is not a first frame;
judging whether the current data frame changes relative to the previous data frame at the previous moment;
if the current data frame changes relative to the previous data frame, extracting the changed numerical value and the position of the numerical value in the current data frame;
and generating a framing data record to be stored by using the first frame of data frame, the numerical value obtained at each moment and the position of the numerical value in the current data frame.
According to an embodiment of the present invention, after obtaining the first frame data frame for buffering, the method further includes:
extracting the time stamp of the first frame data frame from the first frame data frame, and taking the time stamp of the first frame data frame as a basic time stamp;
and after the current data frame at the current moment is obtained, extracting a timestamp from the current data frame, obtaining a time offset between the timestamp of the current data frame and the basic timestamp, and carrying the time offset in the framing data record.
According to an embodiment of the present invention, the generating a framing data record to be stored by using the value and the position of the value in the current data frame includes:
for each moment, combining the numerical value and the position of the numerical value in the current data frame to obtain a data combination of each moment;
and combining the data combinations at each moment in sequence from the first frame data frame to generate the framing data record.
According to an embodiment of the present invention, said carrying the time offset in the framing data record includes:
carrying the time offset of the current data frame at each moment in the data combination at each moment; and the time offset of the current data frame is determined according to the time stamp of the current data frame and the time stamp of the first frame data frame.
According to an embodiment of the present invention, before the combining the data combinations at each time in the order from the first frame data frame to obtain the group frame data record, the method further includes:
judging whether the number of the data combinations reaches a preset number, if so, executing the step of combining the data combinations at each moment according to the sequence from the first frame data frame to generate the framing data record;
and if the number of the data combinations does not reach the preset number, acquiring a first time interval between the current data frame and the first frame data frame, and if the first time interval is greater than or equal to the first preset time interval, executing the step of combining the data combinations at each moment from the first frame data frame according to the sequence to generate the framing data record.
According to an embodiment of the present invention, after generating the framing data record to be stored, further comprising:
judging the data volume of the current existing data record, and covering the existing framing data record when the data volume exceeds a preset data volume threshold;
alternatively, a second time interval between the oldest existing data record and the latest existing data record is obtained, and control overrides the existing framed data record if the second time interval reaches a second predetermined time interval.
According to an embodiment of the present invention, the framing data record further includes: identification information of a network port, the method further comprising:
and extracting identification information of the network port from the framing data records, and determining a target storage space corresponding to the framing data records according to the identification information.
According to an embodiment of the present invention, after determining the storage space corresponding to the group of frame data records, the method further includes:
and judging the storage position of the framing data record on the target storage space according to the generation time of the framing data record, and storing the framing data record to the storage position.
According to an embodiment of the present invention, before the determining whether the current data frame changes from a previous data frame at a previous time, the method further includes:
extracting the identification information from the data frame after receiving the data frame;
before the step of judging whether the current data frame changes relative to the previous data frame at the previous moment, the method further includes:
and determining the identification information of the current data frame, which is the same as the identification information of the previous data frame and the first data frame.
In the method for generating a data record provided in the embodiment of the first aspect of the present invention, in the process of generating a data record, after data that has not changed in a data frame at an adjacent time is stored once, only changed data and the position of the changed data are stored, and the acquired complete data does not need to be stored, so that the storage space is effectively saved, and the requirement on hardware equipment is reduced.
The embodiment of the second aspect of the present invention provides a data record generating device, including:
the device comprises an acquisition module, a buffer module and a storage module, wherein the acquisition module is used for acquiring a first frame data frame for caching and acquiring a current data frame to be stored at the current moment, and the current data frame is a non-first frame data frame;
the judging module is used for judging whether the current data frame changes relative to the previous data frame at the previous moment;
the extraction module is used for extracting a changed numerical value and the position of the numerical value in the current data frame when the current data frame changes relative to the previous data frame;
and the generating module is used for generating a framing data record to be stored by utilizing the first frame data frame, the numerical value acquired at each moment and the position of the numerical value in the current data frame.
In the device for generating a data record provided by the embodiment of the second aspect of the present invention, in the process of generating a data record, after the generation module stores unchanged data in a data frame at an adjacent time for one time, only the changed data and the position of the changed data determined by the determination module by the extraction module are stored, and the complete data acquired by the acquisition module does not need to be stored, so that the storage space is effectively saved, and the requirement on hardware equipment is reduced.
An embodiment of a third aspect of the present invention provides an electronic device, including a memory, a processor;
wherein the processor executes a program corresponding to the executable program code by reading the executable program code stored in the memory, so as to implement the data record generation method in the first aspect.
A fourth aspect of the present invention provides a non-transitory computer-readable storage medium, on which a computer program is stored, which when executed by a processor implements the method for generating a data record as described in the first aspect.
Drawings
FIG. 1 is a flow chart of a method for generating a data record in an embodiment of the present disclosure;
FIG. 2 is a flow chart of obtaining a time offset in a method of generating a data record in another embodiment of the present disclosure;
FIG. 3 is a flow chart of generating a data record in a method of generating a data record in another embodiment of the present disclosure;
FIG. 4 is a flow chart of data framing in a method for generating a data record according to an embodiment of the present disclosure;
FIG. 5 is a flow chart of data storage overlay in a method for generating a data record according to an embodiment of the present disclosure;
FIG. 6 is a flow chart of data storage overlay in a method for generating data records according to another embodiment of the present disclosure;
FIG. 7 is a diagram illustrating a process of local storage of data records in an embodiment of the present disclosure;
FIG. 8 is a block diagram of an apparatus for generating data records according to an embodiment of the present disclosure;
fig. 9 is a block diagram of an electronic device in an embodiment of the disclosure.
Detailed Description
Reference will now be made in detail to embodiments of the present invention, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the drawings are illustrative and intended to be illustrative of the invention and are not to be construed as limiting the invention.
FIG. 1 is a flow chart of a method for generating a data record according to an embodiment of the present disclosure. As shown in fig. 1, the method for generating a data record according to an embodiment of the present invention includes the following steps:
s101: and obtaining a first frame data frame for caching.
The vehicle-mounted terminal can collect data frames from a communication bus of the whole vehicle, and it should be noted that the data frames can be received according to a preset period, and the preset period can be preset or manually set when the vehicle leaves a factory; reception may also be started upon instruction. And the first frame data frame received by the vehicle-mounted terminal is the first frame data frame. And when the first frame data frame is received, buffering.
For example, when the data frame is received according to a preset period, the first frame data frame of each period is the first frame data frame, and the preset period is 1 day, and the receiving interval is 1 second. And when the time is 00 hours, 00 minutes and 00 seconds, the vehicle-mounted terminal receives the data frame, and the data frame at the moment is the first frame data frame in the current period. Further, every 1 second, the in-vehicle terminal receives the data frame of the current time corresponding to the interval time, and ends the period until 24 hours, 59 minutes and 59 seconds, and enters the next period.
When the data frame starts to be received according to the instruction, the vehicle-mounted terminal receives the instruction for starting to receive the data frame, and the data frame received for the first time is the first frame data frame. Further, the vehicle-mounted terminal receives the data frame according to a preset time interval until the vehicle-mounted terminal receives an instruction of stopping receiving.
S102: and acquiring a current data frame to be stored at the current moment, wherein the current data frame is a data frame which is not a first frame.
After receiving the first frame of data frame, the vehicle-mounted terminal can continuously receive the data frame to be stored at each subsequent moment.
S103: and judging whether the current data frame changes relative to the previous data frame at the previous moment.
After receiving the current data frame, the vehicle-mounted terminal judges whether the current data frame and the previous data frame at the previous moment relative to the current data frame are changed.
It should be noted that the current data frame is only the current data frame at the current time, and it becomes the previous data frame with respect to the next time. Such as: after receiving the first frame data frame, receiving a data frame A at a time t1, and receiving a data frame B at a time t2, wherein the time t1 is less than the time t 2; if the time t1 is taken as the current time, the data frame A is the current data frame, the first frame data frame is the previous data frame, if the time t2 is taken as the current time, the data frame B is the current data frame, and the data frame A is the previous data frame.
If the current data frame at the current moment is judged to be changed relative to the previous data frame at the previous moment, executing the step S104; if the current data frame at the current moment is not changed from the previous data frame at the previous moment, the process returns to step S102.
S104: the changed value and the position of the value in the current data frame are extracted.
When the current data frame at the current moment changes relative to the previous data frame at the previous moment, the changed value is extracted, and the position of the changed value in the current data frame is recorded. Such as: the previous data frame is 0001020304050607, and the current data frame is 0001020322222222, the current data frame is changed from the previous data frame, wherein if the data in the current data frame is changed from the data in the previous data frame, the changed position is marked as 1, otherwise, the changed position is marked as 0. Comparing the current data frame with the previous data frame, the changed position (i.e. the changed byte) of the current data frame is 00001111, and the changed value is 22222.
S105: and generating a framing data record to be stored by using the first frame of data frame, the obtained numerical value at each moment and the position of the numerical value in the current data frame.
In the process of generating the data to be stored, the first frame data frame, the value obtained at each moment and the position of the value in the current data frame may be combined according to the sequence of receiving the data frames or according to a predetermined rule, so as to generate a data record to be stored.
In some embodiments, the method in embodiments of the present invention, further comprising the steps, as shown in fig. 2:
s201: and extracting the time stamp of the first frame data frame from the first frame data frame, and taking the time stamp of the first frame data frame as a basic time stamp.
After the vehicle-mounted terminal receives the first frame of data frame, the time stamp of the first frame of data frame can be extracted from the first frame of data frame, and the time stamp of the first frame of data frame is used as the basic time stamp so as to determine the accurate time for receiving the first frame of data.
S202: and after the current data frame at the current moment is obtained, extracting the timestamp from the current data frame, obtaining the time offset between the timestamp of the current data frame and the basic timestamp, and carrying the time offset in the data record.
After a data frame at a certain moment is received, extracting a timestamp from the data frame at the moment, calculating a time offset between the timestamp of the data frame at the moment and a basic timestamp of a first frame data frame, and carrying the time offset in a data record, namely when the time in the data frame at the moment is stored, only the time offset relative to the first frame data frame needs to be stored, and the data with the same timestamp as the first frame data frame does not need to be stored again. Such as: the timestamp (basic timestamp) of the first frame data frame is 00 minutes 00 seconds 00 milliseconds at 00 hours of 20 months in 2018, and the timestamp of the current data frame at the current time is 100 milliseconds at 00 minutes 00 seconds at 20 days 00 hours of 20 months in 2018, so that the offset between the timestamp of the first data frame at the current time and the timestamp of the first frame data frame is 100 milliseconds (64 is converted into hexadecimal), when the timestamp in the current data frame at the current time is recorded, the specific timestamp can be known only by recording the offset, other unchanged time data do not need to be recorded again, and the storage space is saved.
In some embodiments, the data records to be stored may be generated in the order in which the data frames are received, as shown in fig. 3, the method comprising:
s301: and aiming at each moment, combining the numerical value and the position of the numerical value in the current data frame to obtain the data combination of each moment.
In some embodiments, when a current data frame at a current time changes from a previous data frame at a previous time, a value of the change in the current data frame and a position of the value in the current data frame are combined to obtain a data combination at the current time, such as: the previous data frame is 0001020304050607, and the current data frame is 0001020322222222, then the change position (i.e. change byte) of the current data frame relative to the previous data frame is 00001111, which is converted into hexadecimal 0F, and the change value is 22222222, so that the data combination of the current data frame at the current time is 0F 22222222. It should be understood that the data frames at other time instances can refer to the above description to obtain the data combination at each time instance.
S302: and combining the data combinations at each moment in sequence from the first frame of data frame to generate a data record.
And when the data combination of the current moment and/or the data combinations of other moments are obtained, namely from the first frame of data frame, sequentially combining the data combinations of each moment according to the sequence to generate the data record.
In order to distinguish data at different time instants, a time offset of a data frame at each time instant may be added to the data combination, for example: when the time offset of the first data frame at the current time with respect to the first frame data frame is 100 ms (converted to 64 hexadecimal), the data combination of the current data frame becomes 640F22222, or 0F 2222264, and so on.
In some embodiments, in the process of generating the data record by sequentially combining the data combinations at each time from the first frame data frame according to the sequence, if the data combinations of the data frames at different times reach a preset number, the data combinations at each time are combined according to the sequence, so as to generate the group frame data record. If the number of the data combinations of the data frames at different moments does not reach the preset number, calculating a first time interval between the current data frame at the current moment and the first frame data frame in the period, and if the first time interval is greater than or equal to the first preset time interval, combining the data combinations at each moment according to the sequence from the first frame data frame to generate a group frame data record.
As shown in fig. 4, the method for generating a data record includes the following steps:
s401: data frames are collected.
S402: and recording the basic value of the first frame time stamp.
S403: judging the data change position (namely change byte) of the non-first frame;
s404: the change bytes and change data are framed.
S405: judging whether the number of the recorded framing data pieces meets 30; if 30 are satisfied, execute step S407; if 30 pieces are not satisfied, step S406 is executed or step S403 is returned to.
S406: judging whether a first time interval between a current data frame at the current moment and a first data frame in the period is greater than or equal to 30 seconds; if the first time interval is greater than or equal to 30 seconds, step S407 is performed, otherwise, execution returns to step S403.
S407: and finishing framing data recording and storing the framing data locally.
In some embodiments, since it is not possible to store all data indefinitely, the data needs to be overwritten when it is stored to a certain amount. In this embodiment, the coverage work can be implemented in the following manner:
the first mode is as follows: after the data records to be stored are generated, if the data volume of the current existing data records exceeds a preset data volume threshold, covering the existing framing data records, and if the preset data volume threshold is 100, and if the data volume of the existing framing data records reaches 100, sequentially covering the 100 previously stored group frame data records by using the 100 subsequently obtained group frame data records, so as to perform data covering storage. Specifically, as shown in fig. 5, after completing the group frame data recording, if the data amount of the group frame data recording exceeds 100 (i.e. the preset data amount threshold), the 101 th group frame data recording is buffered, and the 1 st group frame data recording in the previous 100 group frame data recording is covered by the 101 th group frame data recording, further, the 2 nd group frame data recording in the previous 100 group frame data recording is covered by the 102 th group frame data recording, and so on. And after the storage of the 101 st group frame data record is finished, taking the 101 st group frame data record as a new 1 st group frame data record, thereby finishing the data covering operation.
The second mode is as follows: acquiring a second time interval between the earliest existing framing data record and the latest existing framing data record, if the second time interval reaches a second preset time interval, controlling to cover the earliest existing framing data record, if the second preset time interval is 15 days, if the storage time of the first existing framing data record in the storage space is just 15 days different from the storage time of the last framing data record, covering the 1 st day framing data record with the 16 th day framing data record after finishing storing the 16 th day framing data record, further covering the 2 nd day framing data record with the 17 th day framing data record, and the like, and performing covering storage of data. Specifically, as shown in fig. 6, after completing the framing data record, if the data record is stored for 15 days (i.e. the second preset time interval), the framing data record of the 16 th day is buffered, and the framing data record of the 16 th day is used to cover the framing data record of the 1 st day, further, the framing data record of the 17 th day is used to cover the framing data record of the 2 nd day, and so on, the data is stored in a covering manner.
In some embodiments, since the data storage space in the in-vehicle terminal includes a plurality of storage spaces, such as: in order to clearly identify the storage space corresponding to the generated data record, the data frame further includes identification information of a network port, it should be understood that the storage space corresponding to the data record can be known through the identification information of the network port, and further, the generated data record includes the identification information of the network port. Extracting identification information from the data frame after receiving the data frame; and determining the identification information of the current data frame, which is the same as the identification information of the previous data frame and the first data frame, so as to ensure that the current data frame, the previous data frame and the first data frame are all the data information of the same part in the same network.
Because a plurality of folders are stored in the storage space, a plurality of subfolders correspond to each folder. In order to ensure that the data records can be stored in the corresponding storage space each time, the storage position of the data record on the target storage space can be judged according to the generation time of the data record, and the data record can be stored in the storage position.
As shown in fig. 7, the storage space includes a plurality of folders such as a power net, a comfort net, and other nets. The files of the power network are provided with a plurality of files such as 0x344, 0x264 and other IDs. Under the data folder with the ID of 0x344, a plurality of subfolders in days are included, and the names of the subfolders are VIN (vehicle identification code) -CAN port (network identification port) -ID-XX day data. When the data ID is 0x344, the storage location of the data CAN be determined according to the information of the CAN port, the ID, and the time.
The following examples illustrate the specific implementation:
firstly, the method comprises the following steps: when the whole vehicle is powered on, the modules of all the CAN networks generate CAN messages, and the vehicle-mounted terminal identifies which CAN network the ID belongs to. Taking ID as 0x344 as an example, 0x344 is a power network, a first frame data frame of the power network is 0001020304050607, the corresponding time of the first frame data frame is 100 milliseconds at 00 hours, 00 minutes and 00 seconds at 20 days 00 hours in 2018, a current data frame is 0001020322222222, the corresponding time of the current frame data frame is 200 milliseconds at 00 hours, 00 minutes and 00 seconds at 20 days 00 hours in 2018, and at this time, the vehicle-mounted terminal needs to record and calculate:
1. time base value: 00 min 00 s at 5/20/00 h in 2018, converted to 00004507 hex. In practical applications, the recording time can only be accurate to the order of seconds, but the data reception interval can reach the order of milliseconds. To facilitate accurate recording, the time at which the first frame of data is received is recorded by recording the offset of the time at which the data frame is received from the base time.
2. CAN port (CAN network) where the ID is located: 01.
3. the time offset of the first frame data frame is 100 ms and the transition to hexadecimal is 64.
4. The time offset of the current data frame is 200 ms, which translates to hexadecimal C8.
5. The change positions of the current data frame are as follows: 00001111, converted to hexadecimal 0F.
6. The change data of the current data frame is: 22222222.
therefore, the data stored by the vehicle-mounted terminal is 010x34400004507640001020304050607C80F 22222222. the rest can be done in the same way until 30 pieces of data are filled, and the framing process of the data is finished. If 30 data are not stored in the vehicle, the vehicle is shut down, the vehicle-mounted terminal can time, and when the current time from the first frame of data frame of the frame to the time is 30s, framing can be completed, so that the vehicle-mounted terminal is prevented from waiting for data receiving and storing all the time.
In addition, the data of other CAN networks are framed according to the same rule.
II, secondly: after one frame (30 CAN data) is stored, the next frame is framed, and finally, the unit naming file is carried out according to the day, wherein the naming rule is VIN-CAN port-ID-time (day).
Thirdly, the method comprises the following steps: because all data cannot be stored indefinitely, when the data is full, the data is required to be replaced according to the day, namely 15 days of data are required to be stored, when the data on the 16 th day is stored, the data needs to be cached, and after the data on the 16 th day is stored, the data on the 1 st day is replaced, so that the data is stored in an overlaying manner.
In summary, in the method for generating a data record provided in this embodiment, firstly, framing is performed according to the ID as a unit, and one frame has only one ID, so that one ID does not need to be stored every time a piece of CAN data is received, thereby saving the byte space occupied by the ID; secondly, the timestamp is not stored when each CAN data is received, and only the offset of the time base value of the first frame is stored, so that a large amount of space occupied by the timestamp is saved; finally, each piece of data is not stored, but the changed specific data is judged, and the changed data is stored, so that the purpose of saving space is achieved, and the requirement on hardware equipment is lowered.
In order to implement the method of the above embodiment, the invention further provides a data record generating device. Fig. 8 is a block diagram of a data record generating apparatus according to an embodiment of the present disclosure. As shown in fig. 8, the data record generating apparatus includes:
an obtaining module 801, configured to obtain a first frame data frame for caching, and obtain a current data frame to be stored at a current time, where the current data frame is a data frame that is not a first frame;
a determining module 802, configured to determine whether a current data frame changes from a previous data frame at a previous time;
an extracting module 803, configured to extract a changed value and a position of the value in the current data frame when the current data frame changes from a previous data frame;
a generating module 804, configured to generate a framing data record to be stored by using the first frame of data frame, the obtained value at each time, and the position of the value in the current data frame.
In some embodiments, the obtaining module 801 is further configured to extract a timestamp of the first frame data frame from the first frame data frame, and use the timestamp of the first frame data frame as a basic timestamp;
the extracting module 803 is further configured to extract a timestamp from the current data frame after the current data frame at the current time is obtained, obtain a time offset between the timestamp of the current data frame and the base timestamp, and carry the time offset in the framing data record.
In some embodiments, the generating module 804 is further configured to combine, for each time instant, the numerical value and the position of the numerical value in the current data frame to obtain a data combination for each time instant;
combining the data combinations at each moment in sequence from the first frame data frame to generate a group frame data record
In some embodiments, the extracting module 803 is further configured to carry a time offset of the current data frame at each time in the data combination at each time; the time offset of the current data frame is determined according to the time stamp of the current data frame and the time stamp of the first frame of data frame.
In some embodiments, the determining module 802 is further configured to determine whether the number of data combinations reaches a preset number;
a generating module 804, configured to, if the preset number is reached, combine data combinations at each time in order from a first frame data frame to generate a group frame data record;
and if the number of the data combinations does not reach the preset number, acquiring a first time interval between the current data frame and the first frame data frame, and if the first time interval is greater than or equal to the first preset time interval, combining the data combinations at each moment according to the sequence from the first frame data frame to generate a group of frame data records.
In some embodiments, the determining module 802 is further configured to determine a data amount of the currently existing data record, and when the data amount exceeds a preset data amount threshold, overwrite the existing framing data record;
alternatively, a second time interval between the oldest existing data record and the latest existing data record is obtained, and control overrides the existing framing data record if the second time interval reaches a second predetermined time interval.
In some embodiments, the data record generated by the generating module 804 further includes: identification information of the network port;
the extracting module 803 is further configured to extract the identification information of the network port from the data record, and determine a target storage space corresponding to the data record according to the identification information.
In some embodiments, after the extracting module 803 determines the storage space corresponding to the data record, the determining module 802 is further configured to determine the storage location of the data record on the target storage space according to the generation time of the data record, and store the data record on the storage location.
In some embodiments, the determining module 802 determines whether the current data frame has changed from the previous data frame at the previous time,
an extracting module 803, further configured to extract the identification information from the data frame every time the data frame is received;
and determining the identification information of the current data frame, which is the same as the identification information of the previous data frame and the first data frame.
It should be understood that the above-mentioned apparatus is used for executing the method in the above-mentioned embodiments, and the implementation principle and technical effect of the apparatus are similar to those described in the above-mentioned method, and the working process of the apparatus may refer to the corresponding process in the above-mentioned method, and is not described herein again.
In order to implement the foregoing embodiment, the present invention further provides an electronic device, and fig. 9 is a block diagram of the electronic device in an embodiment disclosed in the present invention, and as shown in fig. 9, the electronic device includes a memory 901 and a processor 902; wherein the processor 902 runs a program corresponding to the executable program code by reading the executable program code stored in the memory 901, for implementing the steps of the above method.
To implement the method of the above embodiment, the present invention also provides a non-transitory computer-readable storage medium having stored thereon a computer program that, when executed by a processor, implements the steps of the above method.
In the description of the present invention, it is to be understood that the terms "central," "longitudinal," "lateral," "length," "width," "thickness," "upper," "lower," "front," "rear," "left," "right," "vertical," "horizontal," "top," "bottom," "inner," "outer," "clockwise," "counterclockwise," "axial," "radial," "circumferential," and the like are used in the orientations and positional relationships indicated in the drawings for convenience in describing the invention and to simplify the description, and are not intended to indicate or imply that the referenced devices or elements must have a particular orientation, be constructed and operated in a particular orientation, and are therefore not to be considered limiting of the invention.
Furthermore, the terms "first", "second" and "first" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of the present invention, "a plurality" means two or more unless specifically defined otherwise.
In the present invention, unless otherwise expressly stated or limited, the terms "mounted," "connected," "secured," and the like are to be construed broadly and can, for example, be fixedly connected, detachably connected, or integrally formed; can be mechanically or electrically connected; either directly or indirectly through intervening media, either internally or in any other relationship. The specific meanings of the above terms in the present invention can be understood by those skilled in the art according to specific situations.
In the present invention, unless otherwise expressly stated or limited, the first feature "on" or "under" the second feature may be directly contacting the first and second features or indirectly contacting the first and second features through an intermediate. Also, a first feature "on," "over," and "above" a second feature may be directly or diagonally above the second feature, or may simply indicate that the first feature is at a higher level than the second feature. A first feature being "under," "below," and "beneath" a second feature may be directly under or obliquely under the first feature, or may simply mean that the first feature is at a lesser elevation than the second feature.
In the description herein, references to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, the schematic representations of the terms used above are not necessarily intended to refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, various embodiments or examples and features of different embodiments or examples described in this specification can be combined and combined by one skilled in the art without contradiction.
Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention, and that variations, modifications, substitutions and alterations can be made to the above embodiments by those of ordinary skill in the art within the scope of the present invention.

Claims (9)

1. A method of generating a data record, comprising the steps of:
acquiring a first frame data frame for caching, extracting a timestamp of the first frame data frame from the first frame data frame after the first frame data frame is acquired for caching, and taking the timestamp of the first frame data frame as a basic timestamp;
acquiring a current data frame to be stored at the current moment, wherein the current data frame is a data frame which is not a first frame, extracting a timestamp from the current data frame after the current data frame at the current moment is acquired, and acquiring a time offset between the timestamp of the current data frame and the basic timestamp;
judging whether the current data frame changes relative to the previous data frame at the previous moment;
if the current data frame changes relative to the previous data frame, extracting the changed numerical value and the position of the numerical value in the current data frame;
generating a framing data record to be stored by using the first frame data frame, the numerical value obtained at each moment and the position of the numerical value in the current data frame, wherein the time offset is carried in the framing data record;
generating a framing data record to be stored by using the numerical value and the position of the numerical value in the current data frame, including:
for each moment, combining the numerical value and the position of the numerical value in the current data frame to obtain a data combination of each moment, and carrying the time offset of the current data frame at each moment in the data combination of each moment; the time offset of the current data frame is determined according to the time stamp of the current data frame and the time stamp of the first frame data frame;
and combining the data combinations at each moment in sequence from the first frame of data frame to generate the framing data record, wherein the framing data carries an ID.
2. The method according to claim 1, wherein before the step of combining the data combinations at each time in the order from the first frame data frame to obtain the group frame data record, the method further comprises:
judging whether the number of the data combinations reaches a preset number, if so, executing the step of combining the data combinations at each moment according to the sequence from the first frame data frame to generate the framing data record;
and if the number of the data combinations does not reach the preset number, acquiring a first time interval between the current data frame and the first frame data frame, and if the first time interval is greater than or equal to the first preset time interval, executing the step of combining the data combinations at each moment from the first frame data frame according to the sequence to generate the framing data record.
3. A method of generating data records according to any of claims 1-2, further comprising, after generating the framed data record to be stored:
judging the data volume of the current existing framing data record, and covering the existing framing data record when the data volume exceeds a preset data volume threshold;
alternatively, a second time interval between the oldest existing data record and the latest existing data record is obtained, and control overrides the existing framed data record if the second time interval reaches a second predetermined time interval.
4. A method for generating a data record according to any of claims 1-2, wherein the framing data record further comprises: identification information of a network port, the method further comprising:
and extracting identification information of the network port from the framing data records, and determining a target storage space corresponding to the framing data records according to the identification information.
5. The method of claim 4, wherein after determining the storage space corresponding to the framed data record, further comprising:
and judging the storage position of the framing data record on the target storage space according to the generation time of the framing data record, and storing the framing data record to the storage position.
6. The method of claim 4, wherein before determining whether the current data frame changes from a previous data frame at a previous time, the method further comprises:
extracting the identification information from the data frame after receiving the data frame;
before the step of judging whether the current data frame changes relative to the previous data frame at the previous moment, the method further includes:
and determining the identification information of the current data frame, which is the same as the identification information of the previous data frame and the first data frame.
7. An apparatus for generating a data record, comprising:
the acquisition module is used for acquiring a first frame data frame for caching and acquiring a current data frame to be stored at the current moment, wherein the current data frame is a data frame which is not a first frame, extracting a timestamp of the first frame data frame from the first frame data frame after the first frame data frame is acquired for caching, taking the timestamp of the first frame data frame as a basic timestamp, extracting the timestamp from the current data frame after the current data frame at the current moment is acquired, and acquiring a time offset between the timestamp of the current data frame and the basic timestamp;
the judging module is used for judging whether the current data frame changes relative to the previous data frame at the previous moment;
the extraction module is used for extracting a changed numerical value and the position of the numerical value in the current data frame when the current data frame changes relative to the previous data frame;
a generating module, configured to generate a framing data record to be stored by using the first frame data frame, the obtained numerical value at each time, and a position of the numerical value in the current data frame, where the time offset is carried in the framing data record; generating a framing data record to be stored by using the numerical value and the position of the numerical value in the current data frame, including: for each moment, combining the numerical value and the position of the numerical value in the current data frame to obtain a data combination of each moment, and carrying the time offset of the current data frame at each moment in the data combination of each moment; the time offset of the current data frame is determined according to the time stamp of the current data frame and the time stamp of the first frame data frame; and combining the data combinations at each moment in sequence from the first frame of data frame to generate the framing data record, wherein the framing data carries an ID.
8. An electronic device comprising a memory, a processor;
wherein the processor executes a program corresponding to the executable program code by reading the executable program code stored in the memory for implementing the data record generating method according to any one of claims 1 to 6.
9. A non-transitory computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, implements a method of generating a data record according to any one of claims 1 to 6.
CN201811472933.5A 2018-12-04 2018-12-04 Data record generation method and device, electronic equipment and storage medium Active CN111275846B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811472933.5A CN111275846B (en) 2018-12-04 2018-12-04 Data record generation method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811472933.5A CN111275846B (en) 2018-12-04 2018-12-04 Data record generation method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN111275846A CN111275846A (en) 2020-06-12
CN111275846B true CN111275846B (en) 2022-01-07

Family

ID=70999913

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811472933.5A Active CN111275846B (en) 2018-12-04 2018-12-04 Data record generation method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111275846B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113132637B (en) * 2021-04-19 2023-04-07 Oppo广东移动通信有限公司 Image processing method, image processing chip, application processing chip and electronic equipment
CN113407554A (en) * 2021-06-28 2021-09-17 武汉黎赛科技有限责任公司 Data processing method and device, electronic equipment and storage medium

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4481889B2 (en) * 2005-06-28 2010-06-16 キヤノン株式会社 Data recording apparatus and method, program, and recording medium
JP5060876B2 (en) * 2007-08-30 2012-10-31 株式会社日立製作所 Storage system and storage system power consumption reduction method
CN201125792Y (en) * 2007-12-14 2008-10-01 西安申科电子研究所 Automobile fault prompter
EP2736759B1 (en) * 2011-07-26 2018-09-05 Gogoro Inc. Apparatus, method and article for providing vehicle diagnostic data
CN102930614B (en) * 2011-08-11 2015-08-26 北京交大思诺科技有限公司 Integrated mobile unit register and recording method
CN105045530B (en) * 2015-06-30 2018-02-16 株洲南车时代电气股份有限公司 A kind of data recording and storing method
CN106502823A (en) * 2016-09-29 2017-03-15 北京许继电气有限公司 data cloud backup method and system
CN106708440A (en) * 2016-12-26 2017-05-24 深圳市科陆电子科技股份有限公司 Electric energy meter and data storage method for load curve of electric energy meter
CN108874644B (en) * 2018-06-06 2021-12-24 平安科技(深圳)有限公司 Data monitoring method and device, computer equipment and storage medium

Also Published As

Publication number Publication date
CN111275846A (en) 2020-06-12

Similar Documents

Publication Publication Date Title
CN111275846B (en) Data record generation method and device, electronic equipment and storage medium
CN102244758A (en) Video-recording-file-based data acquisition method and equipment
CN111372209B (en) Signaling data processing method, device, equipment and medium
CA2572580A1 (en) Multi-user motor vehicle telemetric system and method
CN111061752B (en) Data processing method and device and electronic equipment
CN103744627A (en) Method and system for compressing and storing data collected in real time
CN105426123B (en) Data managing method, acquisition station and equipment monitoring system
CN110362598B (en) Data query method and device, storage medium and electronic equipment
CN107046691B (en) LTE wireless network rapid site selection method
CN111158999B (en) Formatting time calculation method and device
CN100544281C (en) A kind of method of in wireless telecommunication system, obtaining information snap
CN111143317A (en) Log storage method, device and equipment and readable storage medium
CN111291035B (en) Method and device for slicing data and related products
CN113570749A (en) Method for determining station operation time, station operation system and readable storage medium
CN110362548B (en) Log extraction method and related equipment
CN112016025B (en) Data acquisition method and device and terminal equipment
JP6012869B2 (en) Information management system, information management apparatus, information management method, and program
CN104424236A (en) Storage method and device in data acquisition
CN112419698B (en) Electric energy meter data transmission method, system and device based on distribution line message specification
CN114118440A (en) Model iteration method, model iteration device, electronic equipment and computer readable storage medium
CN110213396B (en) Dynamic decision method and system for automatically allocating addresses to node equipment of Internet of things of airport
CN112422618A (en) Position sensing data reporting method, device and system
CN110555011B (en) Application audit failure identification method, device and system and readable storage medium
CN102412625B (en) Remote signaling data acquisition method and device
CN114963552B (en) Water heater starting control method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant