CN106708639B - Data timing accurate recording method based on VxWorks system - Google Patents
Data timing accurate recording method based on VxWorks system Download PDFInfo
- Publication number
- CN106708639B CN106708639B CN201510777226.7A CN201510777226A CN106708639B CN 106708639 B CN106708639 B CN 106708639B CN 201510777226 A CN201510777226 A CN 201510777226A CN 106708639 B CN106708639 B CN 106708639B
- Authority
- CN
- China
- Prior art keywords
- tick
- file
- time
- data
- recording
- 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
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/07—Responding to the occurrence of a fault, e.g. fault tolerance
- G06F11/0703—Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
- G06F11/0751—Error or fault detection not based on redundancy
- G06F11/0754—Error or fault detection not based on redundancy by exceeding limits
- G06F11/0757—Error or fault detection not based on redundancy by exceeding limits by exceeding a time limit, i.e. time-out, e.g. watchdogs
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/07—Responding to the occurrence of a fault, e.g. fault tolerance
- G06F11/0703—Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
- G06F11/0766—Error or fault reporting or storing
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Debugging And Monitoring (AREA)
Abstract
The invention relates to a VxWorks system-based data timing accurate recording method, which comprises the following steps: acquiring tick deviation values of a watchdog timer period; carrying out data timing record based on a VxWorks system according to the tick deviation value; executing each mission in the black box file according to the obtained system clock; meanwhile, the time of the data recording file corresponds to the time of the black box file one by accumulating tick deviation values. According to the invention, by compensating tick deviation in the system clock process, the accurate system clock is obtained, so that the mission execution time is accurate, and the black box recording time is accurate.
Description
Technical Field
The invention relates to a VxWorks system-based data timing accurate recording method, and belongs to the technical field of embedded development.
Background
VxWorks is operating system software specially designed and developed for a real-time embedded system, and can improve functions of real-time task scheduling, interrupt management, real-time system resources, real-time inter-task communication and the like. Tornado is an integrated development environment provided for developing VxWorks application software, and can combine a user program with a VxWorks core by using an engineering management system. In the application of the watchdog timer, if a certain process is overloaded, the period of the watchdog timer is easily delayed, so that the system clock is deviated, and the time in the data recording file is also subjected to errors. The method for accurately recording the data at regular time based on the VxWorks system has obvious application value and practical significance.
The watchdog timer in VxWorks allows any C-function to be associated with a particular time delay. The watchdog timer is part of the system clock interrupt service routine. The principle of use of the watchdog timer is shown in fig. 1.
In watchdog timed applications, several control commands are required, the detailed command functions and meanings of which are described below.
The signal quantity control command and the meaning thereof mainly comprise the following steps:
① semBCreate (int options, SEM _ B _ stateinittate) allocates and initializes a binary semaphore;
② semDelete (SEM _ ID semId) terminating and releasing a semaphore;
③ semTake (SEM _ ID semId, int timeout) a semaphore;
④ semGive (SEM _ ID semId). Release a semaphore.
The commands used by the watchdog and their meanings are mainly as follows:
① wddate (), allocates and initializes a watchdog timer;
② wdDelete (), terminate and release the watchdog timer;
③ wdStart () starting a watchdog timer;
④ wdcacel (), the watchdog timer that is counting is cancelled.
The VxWorks system-based data timing accurate recording method is researched, time delay occurring in a watchdog timer is compensated, the accuracy of mission execution time and the absence of time delay in a data recording file are ensured, the test data are conveniently and correctly analyzed and processed, the smooth execution of engineering tests is facilitated, and the VxWorks system-based data timing accurate recording method has important practical significance and application value to actual engineering.
Disclosure of Invention
The invention provides a data timing accurate recording method based on a VxWorks system aiming at the weakness of time delay of a watchdog timer, which can realize a system clock and a data recording file with accurate time and ensure that the time of a black box file corresponds to the time of the data recording file one by one.
The technical scheme adopted by the invention for realizing the purpose is as follows: a data timing accurate recording method based on a VxWorks system comprises the following steps:
acquiring tick deviation values of a watchdog timer period;
carrying out data timing record based on a VxWorks system according to the tick deviation value;
executing each mission in the black box file according to the obtained system clock; meanwhile, the time of the data recording file corresponds to the time of the black box file one by accumulating tick deviation values.
The tick offset value of the watchdog timer period is obtained by subtracting the tick number at the end of the previous period from the tick number at the end of the period, and the method specifically comprises the following steps:
defining and declaring global variables: the flag bit, the tickEnd1, the tickEnd2 and the tick bias TiCkspan are all 0;
and acquiring the tick number of the current period by a VxWorks system function tick get ().
The obtaining of the tick number of the current cycle through the VxWorks system function tickGet () includes:
if the flag bit is equal to 1, the current tick number is obtained by tick get () command and assigned to tick end1, the flag bit is cleared, and tick offset Tickspan is equal to (tick end 1-tick end 2); otherwise the current tick number is obtained by the tick get () command and assigned to tick end1, flag position 1, and the periodic tick number Tickspan equals (tick end 2-tick end 1).
The data timing record based on the VxWorks system comprises the following steps:
accumulating the tick offset value in the cyclic process of the system clock, and when the accumulated sum is more than 6 ticks, additionally adding 100 milliseconds to the system clock;
in the process of data recording, only tick offset values are recorded and are not accumulated.
The one-to-one correspondence between the time of the data recording file and the time of the black box file is realized by accumulating tick offset values, which specifically comprises the following steps:
and accumulating tick offset values when the dat format of the data record file is converted into a readable txt file by adopting data post-processing software, and skipping one line in the txt file when the accumulated sum exceeds a set threshold value.
The invention has the following advantages and beneficial effects:
1. according to the invention, by compensating tick deviation in the system clock process, the accurate system clock is obtained, so that the mission execution time is accurate, and the black box recording time is accurate.
2. According to the invention, tick deviation is recorded in underwater control software, and when a dat format of a data recording file is converted into a readable txt file in data post-processing software, tick deviation value is compensated, so that accurate recording of the data recording file is ensured.
3. The VxWorks system-based data timing accurate recording method ensures accurate mission execution and accurate data recording time, can conveniently and correctly analyze and process test data, and is favorable for smooth engineering application.
Drawings
FIG. 1 is a schematic diagram of the use of a watchdog timer;
FIG. 2 is a clock compensation strategy diagram of an underwater robot control system of the present invention;
fig. 3 is a plan view of a time deviation compensation strategy in a data recording process of the underwater robot control system of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples.
A method for recording data in real time in an automatic driving unit of an underwater robot includes recording data in real time in a black box file for recording mission execution conditions and carrier power systems, control systems, energy systems, sensor equipment and the like, delaying data recording processes for recording the condition of the underwater robot equipment and control information due to inaccurate clock of the underwater robot system, recording data in a timing accurate recording process based on a VxWorks system, wherein the processes are executed in a fixed cycle, and the fixed cycle is not fixed in time due to the reason described above, and performing unscheduled time compensation, wherein the data recording process includes recording tick numbers in each cycle (tick number is the number of times of timer interruption per second, the tick default is set to 60 in VxWorks, the same hereinafter), recording tick numbers corresponding to fixed cycle time, and when actual cycle is always delayed, the corresponding tick numbers are more than tick numbers in the fixed cycle, the tick numbers are all positive, the tick numbers are accumulated, the tick numbers to be more than 6, the tick numbers corresponding to the fixed cycle time are different from the fixed cycle time, and when the tick recording processes are performed in a short cycle, the tick recording process is performed in a short cycle, the exact recording process of a short cycle, the tick recording process is determined as if the tick recording process of a tick number of a short cycle is 100 milliseconds, the tick recording process of a tick recording process is equal to 100, the tick recording process is determined as a short data is performed, the tick recording process of a short error is determined as a short process of a short time of a short process of a system, wherein the tick recording process of a tick recording process of.
The tick bias calculation is designed by subtracting the tick number at the end of the previous period from the tick number at the end of the period as follows: global variables are first defined and declared: the flag, tickEnd1 and tickEnd2 and tick bias Tickspan are all 0. Then, acquiring the tick number of the current period through a VxWorks system function tick get (), wherein the specific process of acquiring the accurate tick deviation Tickspan is as follows: if the flag bit is equal to 1, then the current tick number is obtained and assigned to tickEnd1 via the tickGet () command, the flag bit is cleared, and tick offset Tickspan is equal to (tickEnd 1-tickEnd 2), otherwise the current tick number is obtained and assigned to tickEnd1 via the tickGet () command, flag position 1, and tick number Tickspan is equal to (tickEnd 2-tickEnd 1). The above process ensures that tick offset equals tick at the end of this cycle minus tick at the end of the previous cycle, and tick at the start of this cycle cannot be subtracted from tick at the end of this cycle because tick at the end of the previous cycle is not necessarily equal to tick at the start of this cycle.
The statement for acquiring tick deviation is not required to be placed at the tail of a cycle process or a data recording process of a system clock, and only needs to be placed in the cycle process; the system clock compensation and data logging tick offset must be placed after the calculated tick offset statement in claim 2 without any other time consuming function in between.
The embodiment of the data timing accurate recording method based on the VxWorks system comprises the following steps:
the first step is as follows: the tick offset value for the watchdog timer period is obtained as follows:
global variables are first defined and declared: the flag, tickEnd1 and tickEnd2 and tick bias Tickspan are all 0. And then acquiring the tick number of the current cycle through a tick get () function, and obtaining the accurate tick deviation Tickspan through the following pseudo code statement.
If (1 ═ flag bit)
{
tickEnd1=tickGet();
Resetting the flag bit;
Tickspan=tickEnd1–tickEnd2;
}
otherwise
{
tickEnd1=tickGet();
Mark position 1;
Tickspan=tickEnd2–tickEnd1;
}
from the pseudo code, the tick offset calculation uses the tick number at the end of the cycle minus the tick number at the end of the previous cycle.
The second step is that: designing a VxWorks system-based data timing accurate recording method according to the tick deviation value of the watchdog timer period acquired in the first step, wherein the method mainly comprises the following two aspects:
(1) accumulating the deviation value in the cyclic process of the system clock, and when the accumulated sum is greater than 6 ticks, additionally adding 100 milliseconds to the system clock;
(2) in the process of data recording, only tick deviation values are recorded, and accumulation calculation is not carried out.
The third step:
(1) acquiring an accurate system clock according to the second step, wherein the mission execution in the black box file adopts the system clock, so that the execution time of each mission is accurate, and the accuracy of the time in the black box file is finally ensured;
(2) and when the sum of the accumulated values exceeds a threshold value, skipping one line in the txt file, and ensuring the time accurate recording of the data recording file.
Through the two aspects of (1) and (2), the time in the black box file and the time of the data recording file txt are obtained finally, and are accurate and can correspond to each other.
Claims (3)
1. A data timing accurate recording method based on a VxWorks system is characterized by comprising the following steps:
step 1: acquiring tick deviation values of a watchdog timer period;
step 2: carrying out data timing record based on a VxWorks system according to the tick deviation value;
the tick offset value of the watchdog timer period is obtained by subtracting the tick number at the end of the previous period from the tick number at the end of the period, and the method specifically comprises the following steps:
defining and declaring global variables: the flag bit, the tickEnd1, the tickEnd2 and the tick bias TiCkspan are all 0;
acquiring tick number of the current period through a VxWorks system function tick get (); the method comprises the following steps:
if the flag bit is equal to 1, the current tick number is obtained by tick get () command and assigned to tick end1, the flag bit is cleared, and tick offset Tickspan is equal to (tick end 1-tick end 2); otherwise the current tick number is obtained by the tick get () command and assigned to tick end1, flag position 1, and the periodic tick number Tickspan equals (tick end 2-tick end 1);
and step 3: executing each mission in the black box file according to the obtained system clock; meanwhile, the time of the data recording file corresponds to the time of the black box file one by accumulating tick deviation values.
2. The VxWorks system-based data timing accurate recording method according to claim 1, wherein the VxWorks system-based data timing recording comprises:
accumulating the tick offset value in the cyclic process of the system clock, and when the accumulated sum is more than 6 ticks, additionally adding 100 milliseconds to the system clock;
in the process of data recording, only tick offset values are recorded and are not accumulated.
3. The VxWorks system-based data timing accurate recording method according to claim 1, wherein the time of the data recording file is in one-to-one correspondence with the time of the black box file by accumulating tick offset values, specifically:
and accumulating tick offset values when the dat format of the data record file is converted into a readable txt file by adopting data post-processing software, and skipping one line in the txt file when the accumulated sum exceeds a set threshold value.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510777226.7A CN106708639B (en) | 2015-11-13 | 2015-11-13 | Data timing accurate recording method based on VxWorks system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510777226.7A CN106708639B (en) | 2015-11-13 | 2015-11-13 | Data timing accurate recording method based on VxWorks system |
Publications (2)
Publication Number | Publication Date |
---|---|
CN106708639A CN106708639A (en) | 2017-05-24 |
CN106708639B true CN106708639B (en) | 2020-05-05 |
Family
ID=58930218
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201510777226.7A Active CN106708639B (en) | 2015-11-13 | 2015-11-13 | Data timing accurate recording method based on VxWorks system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN106708639B (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111143048B (en) * | 2019-12-25 | 2022-10-28 | 西安电子工程研究所 | Radar accurate timing method based on VxWorks system clock |
CN111585556B (en) * | 2020-05-08 | 2022-06-28 | 南京南瑞继保电气有限公司 | Method for accurately controlling timing switching value output by distributed system |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1949129A (en) * | 2006-11-27 | 2007-04-18 | 杭州华为三康技术有限公司 | Time synchronizing method and device |
CN102929735A (en) * | 2012-10-19 | 2013-02-13 | 北京星网锐捷网络技术有限公司 | Clock-correcting method and equipment |
-
2015
- 2015-11-13 CN CN201510777226.7A patent/CN106708639B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1949129A (en) * | 2006-11-27 | 2007-04-18 | 杭州华为三康技术有限公司 | Time synchronizing method and device |
CN102929735A (en) * | 2012-10-19 | 2013-02-13 | 北京星网锐捷网络技术有限公司 | Clock-correcting method and equipment |
Non-Patent Citations (1)
Title |
---|
VxWorks下的多重定时器设计;刘磊等;《单片机与嵌入式系统应用》;20091231;第30-33页 * |
Also Published As
Publication number | Publication date |
---|---|
CN106708639A (en) | 2017-05-24 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US9804944B2 (en) | Data processing system | |
US10007592B2 (en) | Debugging non-deterministic embedded systems | |
CN110155377B (en) | Method and system for automatically managing satellite ground measurement and control system | |
JP5299161B2 (en) | Computer apparatus and power consumption sampling method | |
CN108897676B (en) | Flight guidance control software reliability analysis system and method based on formalization rules | |
CN106708639B (en) | Data timing accurate recording method based on VxWorks system | |
DK2781979T3 (en) | Real-time monitoring of a vehicle | |
CN102722434A (en) | Performance test method and tool aiming at Linux process scheduling | |
WO2009110725A3 (en) | Three-dimensional application program framework structure and a method for implementing an application program based on the same, and an automatic testing system based on a three-dimensional application software framework and a method therefor | |
CN103744772A (en) | Method and system for detecting task running performance | |
CN107463357B (en) | Task scheduling system, scheduling method, braking simulation system and simulation method | |
CN103593271A (en) | Method and device for chip tracking debugging of system on chip | |
CN112653533B (en) | Intelligent time service management method for complex system | |
CN103970121A (en) | Distributed automatic test framework system for satellites | |
CN102736967A (en) | Test system and method of watchdog timer | |
CN100501694C (en) | Processor availability measuring device and method | |
EP2634733A1 (en) | Operations task management system and method | |
CN101853191A (en) | Method for detecting task endless loop in operating system and operating system | |
CN104063245A (en) | Memory analysis and optimization method and system based on garbage collection | |
CN101743535A (en) | Debugging tool | |
CN109960623B (en) | Method for monitoring operation of simulator of airborne partitioned operating system | |
CN101908252A (en) | Automatic tax declaring method for cargo transportation pallet | |
CN109639275B (en) | Automatic monitoring control system of high-reliability analog-digital converter | |
Broering et al. | Applying Runtime Verification in Real-Time Systems with FreeRTOS | |
CN103425543B (en) | Program performing monitoring system |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |