CN116054987B - Timing method of vehicle-mounted equipment and storage medium - Google Patents

Timing method of vehicle-mounted equipment and storage medium Download PDF

Info

Publication number
CN116054987B
CN116054987B CN202211248460.7A CN202211248460A CN116054987B CN 116054987 B CN116054987 B CN 116054987B CN 202211248460 A CN202211248460 A CN 202211248460A CN 116054987 B CN116054987 B CN 116054987B
Authority
CN
China
Prior art keywords
time
vehicle
mounted equipment
timer
timing
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
CN202211248460.7A
Other languages
Chinese (zh)
Other versions
CN116054987A (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.)
Harbin Kejia General Mechanical and Electrical Co Ltd
Original Assignee
Harbin Kejia General Mechanical and Electrical 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 Harbin Kejia General Mechanical and Electrical Co Ltd filed Critical Harbin Kejia General Mechanical and Electrical Co Ltd
Priority to CN202211248460.7A priority Critical patent/CN116054987B/en
Publication of CN116054987A publication Critical patent/CN116054987A/en
Application granted granted Critical
Publication of CN116054987B publication Critical patent/CN116054987B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04JMULTIPLEX COMMUNICATION
    • H04J3/00Time-division multiplex systems
    • H04J3/02Details
    • H04J3/06Synchronising arrangements
    • H04J3/0635Clock or time synchronisation in a network
    • H04J3/0638Clock or time synchronisation among nodes; Internode synchronisation
    • GPHYSICS
    • G04HOROLOGY
    • G04RRADIO-CONTROLLED TIME-PIECES
    • G04R20/00Setting the time according to the time information carried or implied by the radio signal
    • G04R20/02Setting the time according to the time information carried or implied by the radio signal the radio signal being sent by a satellite, e.g. GPS
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04JMULTIPLEX COMMUNICATION
    • H04J3/00Time-division multiplex systems
    • H04J3/02Details
    • H04J3/06Synchronising arrangements
    • H04J3/0635Clock or time synchronisation in a network
    • H04J3/0638Clock or time synchronisation among nodes; Internode synchronisation
    • H04J3/0644External master-clock

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Radar, Positioning & Navigation (AREA)
  • Remote Sensing (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Synchronisation In Digital Transmission Systems (AREA)
  • Train Traffic Observation, Control, And Security (AREA)

Abstract

A timing method and a storage medium of vehicle-mounted equipment relate to a timing method and a storage medium of vehicle-mounted equipment. The method solves the problem that the time correction time is inaccurate due to the fact that the vehicle-mounted equipment of the locomotive cannot meet the highest priority and responds to the time correction command of the time corrector. Firstly, calculating a difference value delta T=T1- (T0+Ttrans) between the time of the vehicle-mounted equipment and the time T1 of the timer according to the time T0 of the vehicle-mounted equipment acquired by the timer, wherein Ttrans is transmission delay; then, the timer sends a timing command, the difference delta T is sent to the vehicle-mounted equipment, and the vehicle-mounted equipment adjusts the time according to the time difference delta T. The timing method and the timing device are used for timing of the vehicle-mounted equipment.

Description

Timing method of vehicle-mounted equipment and storage medium
Technical Field
The application relates to a timing method of vehicle-mounted equipment and a storage medium.
Background
For the timing of locomotive-mounted equipment, the current timing method is that a timing system sends own time to equipment to be corrected, and meanwhile, the equipment to be corrected is required to respond to a timing command with the highest priority, and new time is written into a clock system in time, so that the unification of the time of the two parties is ensured. If the device being calibrated delays responding to the timing command, a time offset may result.
However, in the locomotive vehicle-mounted device, the highest priority cannot be met to respond to the timing command of the timer (the timing device special for the vehicle-mounted device), and other functions such as dual-core communication, AD sampling, key calculation, alarm and the like may have higher priorities. This results in less accurate time, even if calibrated.
Disclosure of Invention
The method solves the problem that the time correction time is inaccurate due to the fact that the vehicle-mounted equipment of the locomotive cannot meet the highest priority and responds to the time correction command of the time corrector.
A timing method of an in-vehicle apparatus, comprising the steps of:
firstly, calculating a difference value delta T=T1- (T0+Ttrans) between the time of the vehicle-mounted equipment and the time T1 of the timer according to the time T0 of the vehicle-mounted equipment acquired by the timer, wherein Ttrans is transmission delay;
then, the timer sends a timing command, the difference delta T is sent to the vehicle-mounted equipment, and the vehicle-mounted equipment adjusts the time according to the time difference delta T.
Further, before the time T0 of the in-vehicle apparatus acquired according to the timer, the timer acquires the reference time and maintains its own time operation.
Further, the reference time of the reference time acquired by the timer is the GPS reference time.
Further, the process of the timer obtaining the time T0 of the vehicle-mounted device includes the following steps:
when timing begins, the timer sends a command of acquiring time, and after receiving the command, the vehicle-mounted equipment acquires the self time and fills the self time into a reply message with fixed length;
the timer receives the response reply message with the highest priority, and achieves the time T0 for acquiring the vehicle-mounted equipment.
Further, the vehicle-mounted device cannot be interrupted in the process of acquiring the self time and filling and sending the message, so that the filling time is ensured to be the current time.
Further, the time T1 of the timer is the corresponding receiving time when the timer receives the response reply message with the highest priority.
Further, the process of adjusting the time by the vehicle-mounted device according to the time difference Δt is as follows:
the vehicle-mounted equipment responds to the timing command and adjusts the time of the vehicle-mounted equipment back and forth according to the positive and negative values of delta T.
Further, the vehicle-mounted device needs to turn off the system interrupt function in the process of adjusting the time according to the time difference value delta T.
Further, transmission delay ttrans=protocol length/communication rate.
A computer storage medium having stored therein at least one instruction that is loaded and executed by a processor to implement a timing method for an in-vehicle device.
The beneficial effects are that:
1. the application can realize accurate timing without requiring the highest priority of the vehicle-mounted equipment to respond to the timing command.
2. The application can be realized on the existing equipment only by modifying software and communication protocols, thereby not only avoiding extra expenditure, but also being very convenient to realize and having lower realization cost.
3. The application has good portability and expandability, can be expanded to the use timing function scene of embedded equipment in other industries, and has wider application scene and application prospect.
Drawings
Fig. 1 is a schematic flow chart of timing of an in-vehicle apparatus.
FIG. 2 is a schematic diagram of a timing block diagram.
Detailed Description
It should be noted that, in particular, the various embodiments of the present disclosure may be combined with each other without conflict.
The time of the vehicle-mounted equipment is obtained through the timer, and the difference delta T between the time of the vehicle-mounted equipment and the time of the timer is calculated. The difference is sent to the vehicle-mounted equipment, and the vehicle-mounted equipment adjusts the time according to the time difference, so that the vehicle-mounted equipment does not need to respond immediately.
And calculating the transmission time according to the communication interface configuration and the data length of the timer and the vehicle-mounted equipment, and compensating the transmission delay. The application is further described in connection with the following detailed description.
The first embodiment is as follows: the present embodiment will be described with reference to figure 1,
the embodiment is a timing method of a vehicle-mounted device, including the following steps:
1. the timer is provided with a GPS chip or BD chip (chip capable of acquiring Beidou satellite signals), acquires GPS or BD reference time, and maintains self-time operation.
2. When timing starts, the timer sends a command of 'acquiring time', and after receiving the command (without requiring highest priority response), the vehicle-mounted device fills the instant time T0 into a reply message with fixed length. In the process of acquiring self time and filling and sending a message, the vehicle-mounted equipment needs to close a system interrupt function and cannot be interrupted, so that the filling time is the current time.
The system interrupt function is turned off in order to allow the current operation to be continuously performed without being interrupted by other things until the system interrupt is turned on. The interrupt is the interrupt function that is turned on, and the current operation can be interrupted.
3. The timer receives the response reply message with the highest priority and records the receiving time T1.
4. The timer supports UART, CAN, USB communications, which have the characteristic of fixed transmission time when transmitting data with fixed length, and the transmission delay Ttrans can be calculated according to the configuration of the communication ports.
5. The timer acquires actual time information of the vehicle-mounted device as T0+Ttrans at the time T1, and calculates a difference value delta T=T1- (T0+Ttrans) between the time of the vehicle-mounted device and the time of the timer.
6. The timer transmits a timing command and transmits deltat to the vehicle-mounted device.
7. The vehicle-mounted device responds to the timing command (does not require immediate response) and adjusts the self time back and forth according to the positive and negative values of delta T. The time-adjusted operation requires the system interrupt function to be turned off.
8. And after the operation of the vehicle-mounted equipment is finished, replying to the timing command.
Examples
The timer is a special timing device, developed based on STM32F4XX, and has an RTC (real_Time Clock Real Time Clock) with millisecond precision in a chip. The timer structure diagram is shown in fig. 2, and comprises a power supply unit, a GPS unit, a clock unit, a communication unit and a display control unit. The power supply unit is responsible for powering all modules. The GPS unit is responsible for acquiring GPS standard time. The clock unit is responsible for maintaining local time. The communication unit is responsible for communication timing with the vehicle-mounted equipment for the serial port. The display control unit is used for displaying the current time and the GPS state and controlling the starting of the timing function. The timer acquires GPS reference time when the GPS signal exists, and writes the GPS reference time into the clock unit.
The reply time and timing command protocol format in the design of fig. 1 are the same, and only the command words are different. The specific format is as follows: protocol header (1 byte) +command word (1 byte) +protocol length (1 byte) +second time (4 bytes) +millisecond time (2 bytes) +crc check (2 bytes) +protocol trailer (1 byte), 12 bytes in total.
The serial port defaults to a configuration baud rate of 115200bps, 8 data bits, no check, 1 stop bit.
And after the time corrector acquires GPS time, connecting the vehicle-mounted equipment by using a serial port. And starting a timing function, and sending an acquisition time command to the vehicle-mounted equipment.
The vehicle-mounted equipment is provided with a millisecond-level clock system, after receiving the time sending and acquiring command, the local time T0 is read, converted into second time and millisecond time, and the second time and millisecond time are filled in a protocol and sent out, and the process cannot be interrupted.
The timer directly responds to receiving the reply data in the serial port interrupt, and records the local time T1 of the timer.
Calculate the transmission delay ttrans=the number of protocol bytes 12 (start bit length 1+data bit length 8+stop bit length 1)/baud rate 115200bps. Other device response times, code run times are very small negligible.
T1 time is converted into second time and millisecond time, and Δt=t1- (t0+ttrans) is calculated. And then sending the delta T to the vehicle-mounted equipment according to the timing command format.
And after receiving the timing command at any time, the vehicle-mounted equipment adjusts the local time according to the positive and negative values of delta T. The adjustment time cannot be interrupted.
Through the process of the complaint, on the premise of not modifying the hardware of the vehicle-mounted equipment and not modifying the event response priority of the vehicle-mounted equipment, the time synchronization of the timer and the vehicle-mounted equipment is realized, and the precision can reach millisecond level.
The second embodiment is as follows:
the present embodiment is a computer storage medium having at least one instruction stored therein, the at least one instruction being loaded and executed by a processor to implement a timing method of an in-vehicle apparatus.
It should be understood that any method, including those described herein, may be provided as a computer program product, software, or computerized method, which may include a non-transitory machine-readable medium having stored thereon instructions, which may be used to program a computer system, or other electronic device. The storage medium may include, but is not limited to, magnetic storage media, optical storage media; the magneto-optical storage medium includes: read only memory ROM, random access memory RAM, erasable programmable memory (e.g., EPROM and EEPROM), and flash memory layers; or other type of medium suitable for storing electronic instructions.
The above examples of the present application are only for describing the calculation model and calculation flow of the present application in detail, and are not limiting of the embodiments of the present application. Other variations and modifications of the above description will be apparent to those of ordinary skill in the art, and it is not intended to be exhaustive of all embodiments, all of which are within the scope of the application.

Claims (7)

1. A timing method of an in-vehicle apparatus, comprising the steps of:
first, according to the time T0 of the in-vehicle apparatus acquired by the timer, the process of acquiring the time T0 of the in-vehicle apparatus by the timer includes the steps of:
when timing starts, the timer sends a command of acquiring time, the vehicle-mounted equipment is provided with a millisecond-level clock system, after receiving the command, the vehicle-mounted equipment reads the local time T0 and converts the local time into second time and millisecond time, the vehicle-mounted equipment acquires own time and fills the own time into a reply message with fixed length, and the vehicle-mounted equipment cannot be interrupted in the process of acquiring the own time and filling and sending the message, so that the filling time is the current time;
the timer receives a response reply message with the highest priority, so as to obtain the time T0 of the vehicle-mounted equipment;
calculating a difference delta t=t1- (t0+ttrans) between the vehicle-mounted equipment time and the timer time T1, wherein Ttrans is a transmission delay; the time T1 of the timer is the corresponding receiving time when the timer receives the response reply message with the highest priority, and the time T1 is converted into second time and millisecond time;
then, the timer sends a timing command, the difference delta T is sent to the vehicle-mounted equipment, and the vehicle-mounted equipment adjusts the time according to the time difference delta T.
2. The time correction method of an in-vehicle apparatus according to claim 1, wherein the timer acquires the reference time and maintains its own time operation before the time T0 of the in-vehicle apparatus acquired by the timer.
3. The timing method of an in-vehicle apparatus according to claim 2, wherein the reference time of the timer acquisition reference time is a GPS reference time.
4. The timing method of an in-vehicle apparatus according to claim 1, wherein the process of adjusting the time of the in-vehicle apparatus according to the time difference Δt is as follows:
the vehicle-mounted equipment responds to the timing command and adjusts the time of the vehicle-mounted equipment back and forth according to the positive and negative values of delta T.
5. The timing method of an in-vehicle apparatus according to claim 4, wherein the in-vehicle apparatus needs to turn off a system interrupt function in adjusting the time according to the time difference Δt.
6. A time correction method for an in-vehicle apparatus according to claim 5, wherein the transmission delay Ttrans = protocol length/communication rate.
7. A computer storage medium having stored therein at least one instruction that is loaded and executed by a processor to implement a timing method of an in-vehicle apparatus according to one of claims 1 to 6.
CN202211248460.7A 2022-10-12 2022-10-12 Timing method of vehicle-mounted equipment and storage medium Active CN116054987B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211248460.7A CN116054987B (en) 2022-10-12 2022-10-12 Timing method of vehicle-mounted equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211248460.7A CN116054987B (en) 2022-10-12 2022-10-12 Timing method of vehicle-mounted equipment and storage medium

Publications (2)

Publication Number Publication Date
CN116054987A CN116054987A (en) 2023-05-02
CN116054987B true CN116054987B (en) 2023-12-15

Family

ID=86114326

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211248460.7A Active CN116054987B (en) 2022-10-12 2022-10-12 Timing method of vehicle-mounted equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116054987B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107329398A (en) * 2017-06-06 2017-11-07 湖南中联重科智能技术有限公司 Car-mounted terminal time keeping system and method
CN108519610A (en) * 2018-03-29 2018-09-11 武汉大学 Multi-sensor combined navigation system time synchronization and real-time data acquisition method
CN108616321A (en) * 2018-04-28 2018-10-02 广州供电局有限公司 Clock synchronizing method, device, computer equipment and the storage medium of electric energy meter
WO2021232260A1 (en) * 2020-05-20 2021-11-25 深圳元戎启行科技有限公司 Method for time synchronization of a plurality of auxiliary devices of autonomous vehicle, vehicle, computer device, and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107329398A (en) * 2017-06-06 2017-11-07 湖南中联重科智能技术有限公司 Car-mounted terminal time keeping system and method
CN108519610A (en) * 2018-03-29 2018-09-11 武汉大学 Multi-sensor combined navigation system time synchronization and real-time data acquisition method
CN108616321A (en) * 2018-04-28 2018-10-02 广州供电局有限公司 Clock synchronizing method, device, computer equipment and the storage medium of electric energy meter
WO2021232260A1 (en) * 2020-05-20 2021-11-25 深圳元戎启行科技有限公司 Method for time synchronization of a plurality of auxiliary devices of autonomous vehicle, vehicle, computer device, and storage medium

Also Published As

Publication number Publication date
CN116054987A (en) 2023-05-02

Similar Documents

Publication Publication Date Title
KR102331631B1 (en) Method, apparatus, computer equipment and storage medium for clock synchronization of watt-hour meters
JP2002539550A (en) Fieldbus message queuing method and apparatus
JP4452690B2 (en) Electronic device, control method thereof, host device and control method thereof
US7453833B2 (en) Hybrid-type data transmission apparatus and method suitable for high-performance wireless LAN
CN108366353A (en) A kind of method for synchronizing time of car-mounted terminal, car-mounted terminal and storage medium
CN116054987B (en) Timing method of vehicle-mounted equipment and storage medium
CN101150386A (en) Communication method for improving communication error and electronic device using the same
CN112448874A (en) Vehicle-mounted communication device and time synchronization method thereof
CN114510446A (en) Serial port baud rate self-adaption method, device, equipment and medium
US8422613B2 (en) Clock-synchronous communication apparatus and communication system
JP4491146B2 (en) Method and apparatus for synchronizing communication means to battery and communication means in electronic device, and battery
US20040158650A1 (en) Transmission apparatus and transmission method
CN109031368B (en) Method for reading GPS receiving output effective data by combining PPS signal
CN113133097B (en) Wireless communication method and system
CN112423386A (en) Internet of things terminal positioning method and device and related equipment
JPH026263B2 (en)
CN112099567A (en) Time calibration method, electronic device and storage medium
TWI817548B (en) Sensing system and control method thereof
CN111930437B (en) Parameter configuration method
CN209419862U (en) A kind of positioning device and equipment
CN112822069A (en) Communication method, device, equipment, system and storage medium
EP1492365A2 (en) Method for setting time in GSM mode mobile communication terminal
CN117406652A (en) Whole vehicle data processing system based on heterogeneous multi-core gateway
JP4774620B2 (en) Information communication method and information communication system
CN114650124A (en) Synchronization method and device for data transmission

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