Method, system, device and storage medium for improving clock accuracy of embedded system

By establishing the relationship between temperature and crystal oscillator clock error and using a thermodynamic simulation model to calculate the crystal oscillator temperature and perform time compensation, the problem of reduced frequency accuracy caused by temperature changes in embedded systems is solved and time accuracy is improved.

CN112487729BActive Publication Date: 2024-09-13FOSHAN POLYTECHNIC
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202011190425.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-10-30
Publication Date
2024-09-13
Estimated Expiration
2040-10-30

AI Technical Summary

Technical Problem

The frequency accuracy of clock crystal oscillators in embedded systems decreases due to temperature changes, causing time errors and fluctuations, making it difficult to meet the needs of systems with high time accuracy requirements.

Method used

By obtaining the frequency error of the clock crystal oscillator at different temperatures, the corresponding relationship between temperature and crystal oscillator clock error is established, the thermodynamic simulation model is used to estimate the crystal oscillator temperature, and time compensation is calculated and performed to correct the crystal oscillator frequency deviation.

Benefits of technology

Significantly improves the clock accuracy of embedded systems and reduces time errors and fluctuations caused by temperature changes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112487729B
    Figure CN112487729B
Patent Text Reader

Abstract

The present invention discloses a method, system, device and storage medium for improving the clock accuracy of an embedded system, wherein the method for improving the clock accuracy of an embedded system comprises the following steps: step S1, obtaining the frequency error g of the clock crystal oscillator at different temperatures, and establishing a corresponding relationship between the temperature and the crystal oscillator clock error g; step S2, calculating the temperature of the clock crystal oscillator according to the internal temperature of the SOC; step S3, calculating the time compensation of the embedded system. The method, system, device and storage medium for improving the clock accuracy of an embedded system proposed in the technical solution can effectively avoid the problem that the frequency accuracy of the crystal oscillator is affected by temperature changes, resulting in large system time errors and large fluctuations, so as to overcome the shortcomings of the prior art.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of electronic technology and thermodynamics technology, and in particular to a method, system, device and storage medium for improving the clock accuracy of an embedded system. Background Art

[0002] At present, the embedded system SOC (or MCU) needs to use a clock crystal oscillator when working to provide the system with a clock, play a role in timing, synchronization and quantization frequency, etc. However, the SOC of embedded products generates a lot of heat when working, and the clock crystal oscillator is extremely sensitive to temperature, especially if the clock crystal oscillator is placed close to the SOC, it will be more affected by the heat of the SOC. The clock crystal oscillator has different frequencies at different temperatures, resulting in a large frequency deviation, which affects the precise timing.

[0003] In view of the above-mentioned accuracy problem, most existing improvement solutions select high-precision crystal oscillators as clock sources, but it is difficult to meet the system requirements with high time accuracy.

[0004] Specifically, the absolute accuracy of ordinary crystal oscillator frequency can reach 50 parts per million (50PPM), and the accuracy of advanced ones is even higher. If the error of the crystal oscillator at room temperature is 20PPM, then the error in one day is:

[0005] ΔT=20ppm×32768×24×3600 / 32768=1.728 (s)

[0006] The cumulative error per week is 12.1s. Moreover, the error varies with temperature at different temperatures. Such a large time error and fluctuation is still unacceptable for embedded systems or products that require high time accuracy. Summary of the invention

[0007] The purpose of the present invention is to propose a method, system, device and storage medium for improving the clock accuracy of an embedded system, which can effectively avoid the problem that the frequency accuracy of the crystal oscillator is affected by temperature changes, causing large system time errors and fluctuations, so as to overcome the shortcomings of the prior art.

[0008] To achieve this object, the present invention adopts the following technical solutions:

[0009] The method for improving the clock accuracy of an embedded system comprises the following steps:

[0010] Step S1: Obtain the frequency error g of the clock crystal oscillator at different temperatures, and establish a corresponding relationship between the temperature and the crystal oscillator clock error g;

[0011] Step S2: Calculate the temperature of the clock crystal oscillator according to the internal temperature of the SOC;

[0012] Step S3: Calculate the time compensation of the embedded system.

[0013] Preferably, the step S1 specifically includes:

[0014] According to the clock crystal specification, obtain the clock crystal at different temperatures T JZ The error g under the condition is fitted by curve, and the error g and temperature T are obtained. JZ The relationship is:

[0015] g=aT JZ 2 +bT JZ +c

[0016] Where a, b, and c are constants.

[0017] Preferably, the step S2 specifically includes:

[0018] Step S201: Establishing a thermodynamic simulation model:

[0019] Take the X-axis as an example to create a grid.

[0020]

[0021] in, Γ=k / C, C is the specific heat of the solid or fluid, k is the heat transfer coefficient of the solid or fluid, ρ is the density of the solid or fluid, u is the fluid velocity vector, t is the time, n represents the center point of the i-th unit body, and S is the total heat generation;

[0022] Step S202: setting the initial conditions and boundary conditions of the thermodynamic simulation model, wherein the initial condition is the temperature of the simulation environment and the boundary condition is -40 to 80°C;

[0023] Step S203: Meshing the thermodynamic simulation model, wherein the mesh size of the first air region is 8-12 mm, the mesh size perpendicular to the PCB board is 0.1-0.2 mm, the mesh size parallel to the PCB board is 0.5-1.5 mm, and the mesh size of the second air region is 0.2-10 mm;

[0024] Step S204: Substitute the boundary condition values ​​into the thermodynamic simulation model and use the simulation software to obtain the SOC temperature T SOC , crystal temperature T JZ , and use the univariate linear regression analysis method to obtain the crystal oscillator temperature T JZ 、Ambient temperature T HJ With SOC temperature T SOC The linear equation is:

[0025] T JZ =k 1 T SOC +k2

[0026] T HJ =k 3 T SOC +k 4

[0027] Among them, k 1 , k 2 , k 3 , k 4 are all constants, obtained from simulation data and regression analysis.

[0028] Preferably, the step S3 specifically includes:

[0029] Step S301: Calculate the compensation time of the embedded system in the shutdown state:

[0030] When booting, the program reads the SOC temperature T SOC , substitute the following formula to obtain the ambient temperature T HJ :

[0031] T HJ =k 3 T SOC +k 4

[0032] Let T JZ =T HJ , substitute into the following formula to obtain the crystal oscillator error value g:

[0033] g=aT JZ 2 +bT JZ +c

[0034] Each time you shut down, record the shutdown time value τ 1 , the time recorded when the machine is turned on is τ 2 ;

[0035] The compensation time value is t bc =(τ 2 -τ 1 )g;

[0036] The temperature error time compensation formula of the crystal oscillator in the shutdown state is:

[0037] t dqbc =t dq +t bc =t dq +(τ 2 -τ 1 )

[0038] Among them, t dq is the current time, t bc is the compensation time, tdqbc The time after compensation;

[0039] Step S302: Calculate the compensation time of the embedded system in the working state:

[0040] Read the SOC temperature T every minute after powering on SOC , and T SOC Substitute the following formula:

[0041] T JZ =k 1 T SOC +k 2

[0042] g=aT JZ 2 +bT JZ +c

[0043] Get the crystal temperature T JZ And the crystal oscillator error value g;

[0044] The compensation time value is t bc =(τ 2 -τ 1 )g;

[0045] The compensation time t bc Stored in array A[t bc1 ......t bcn ], time compensation is performed after array A is full or before the system is shut down;

[0046] The compensation time is obtained by summing up the compensation time array A:

[0047] t sum =t bc1 +t bc2 +…+t bcn

[0048] The modification time after compensation is:

[0049] t dqbc =t dq +t sum

[0050] After the time compensation is completed, array A is cleared;

[0051] Enter the next compensation cycle or record the shutdown time τ 1 , perform shutdown action.

[0052] A system for improving the clock accuracy of an embedded system, including a temperature and crystal oscillator clock error establishment module, a crystal oscillator temperature calculation module and a time compensation calculation module;

[0053] The temperature and crystal oscillator clock error establishing module is used to obtain the frequency error g of the clock crystal oscillator at different temperatures and establish the corresponding relationship between the temperature and the crystal oscillator clock error g;

[0054] The crystal oscillator temperature calculation module is used to calculate the temperature of the clock crystal oscillator according to the internal temperature of the SOC;

[0055] The time compensation calculation module is used to calculate the time compensation of the embedded system.

[0056] Preferably, the temperature and crystal oscillator clock error establishing module is specifically used to obtain the crystal oscillator at different temperatures T according to the specification of the crystal oscillator. JZ The error g under the condition is fitted by curve, and the error g and temperature T are obtained. JZ The relationship is:

[0057] g=aT JZ 2 +bT JZ +c

[0058] Where a, b, and c are constants.

[0059] Preferably, the crystal oscillator temperature calculation module includes a model building unit, a condition setting unit, a grid division unit and a simulation operation unit;

[0060] The model building unit is used to build a grid taking the X-axis direction as an example.

[0061]

[0062] in, Γ=k / C, C is the specific heat of the solid or fluid, k is the heat transfer coefficient of the solid or fluid, ρ is the density of the solid or fluid, u is the fluid velocity vector, t is the time, n represents the center point of the i-th unit body, and S is the total heat generation;

[0063] The condition setting unit is used to set the initial condition and boundary condition of the thermodynamic simulation model, wherein the initial condition is the temperature of the simulation environment and the boundary condition is -40 to 80°C;

[0064] The grid division unit is used to perform grid division on the thermodynamic simulation model, wherein the grid size of the first air region is 8-12 mm, the grid size perpendicular to the PCB board direction is 0.1-0.2 mm, the grid size parallel to the PCB board direction is 0.5-1.5 mm, and the grid size of the second air region is 0.2-10 mm;

[0065] The simulation operation unit is used to substitute the boundary condition values ​​into the thermodynamic simulation model and obtain the SOC temperature T by simulation. SOC , crystal temperature TJZ , and use the univariate linear regression analysis method to obtain the crystal oscillator temperature T JZ 、Ambient temperature T HJ With SOC temperature T SOC The linear equation is:

[0066] T JZ =k 1 T SOC +k 2

[0067] T HJ =k 3 T SOC +k 4

[0068] Among them, k 1 , k 2 , k 3 , k 4 are all constants and can be obtained from simulation data and regression analysis.

[0069] Preferably, the time compensation calculation module includes a shutdown state compensation time calculation unit and a working state compensation time calculation unit;

[0070] The shutdown state compensation time calculation unit is used to calculate the compensation time of the embedded system in the shutdown state;

[0071] Specifically, after powering on, the program reads the SOC temperature T SOC , substitute the following formula to obtain the ambient temperature T HJ :

[0072] T HJ =k 3 T SOC +k 4

[0073] Let T JZ =T HJ , substitute into the following formula to obtain the crystal oscillator error value g:

[0074] g=aT JZ 2 +bT JZ +c

[0075] Each time you shut down, record the shutdown time value τ 1 , the time recorded when the machine is turned on is τ 2 ;

[0076] The temperature in the shutdown state cannot be obtained. The ambient temperature is calculated by booting up the machine, and it is considered that the ambient temperature at this time is the ambient temperature in the shutdown stage.

[0077] The compensation time value is tbc =(τ 2 -τ 1 )g;

[0078] The temperature error time compensation formula of the crystal oscillator in the shutdown state is:

[0079] t dqbc =t dq +t bc =t dq +(τ 2 -τ 1 )

[0080] Among them, t dq is the current time, t bc is the compensation time, t dqbc The time after compensation;

[0081] The working state compensation time calculation unit is used to calculate the compensation time of the embedded system in the working state;

[0082] Specifically, the SOC temperature T is read every minute after power-on. SOC , and T SOC Substitute the following formula:

[0083] T JZ =k 1 T SOC +k 2

[0084] g=aT JZ 2 +bT JZ +c

[0085] Get the crystal temperature T JZ And the crystal oscillator error value g;

[0086] The compensation time value is t bc =(τ 2 -τ 1 )g;

[0087] The compensation time t bc Stored in array A[t bc1 ......t bcn ], time compensation is performed after array A is full or before the system is shut down;

[0088] The compensation time is obtained by summing up the compensation time array A:

[0089] t sum =t bc1 +t bc2 +…+t bcn

[0090] The modification time after compensation is:

[0091] t dqbc =t dq +t sum

[0092] After the time compensation is completed, array A is cleared;

[0093] Enter the next compensation cycle or record the shutdown time τ 1 , perform shutdown action.

[0094] The device comprises a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps in the above-mentioned method for improving the clock accuracy of an embedded system when executing the computer program.

[0095] A storage medium stores a plurality of instructions, wherein the instructions are suitable for being loaded by a processor to execute the steps in the above-mentioned method for improving the clock accuracy of an embedded system.

[0096] Beneficial effects of the present invention:

[0097] This technical solution obtains the clock deviation value of the clock crystal oscillator at different temperatures, that is, the relationship between the crystal oscillator error and its temperature, through the temperature deviation curve data of the crystal oscillator specification book; then, the real-time temperature value of the SOC is read by the internal temperature sensor of the SOC, and the function of the SOC core temperature and the temperature value of the clock crystal oscillator is obtained through thermal simulation according to the thermodynamic model and the total power, heat dissipation area and material of the embedded product, the distance between the SOC and the crystal oscillator, and the heat dissipation structure of the system; finally, the temperature value of the clock crystal oscillator is calculated through the function, and the relationship between the clock crystal oscillator frequency deviation value and the temperature is compared to obtain the frequency deviation value of the clock crystal oscillator at this temperature, accumulate a certain error time, and correct the clock value regularly to solve the error accumulation problem caused by the crystal oscillator frequency deviation, so as to significantly improve the clock accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

[0098] The accompanying drawings further illustrate the present invention, but the contents in the accompanying drawings do not constitute any limitation to the present invention.

[0099] Figure 1 The present invention is a flow chart of a method for improving the clock accuracy of an embedded system.

[0100] Figure 2 The present invention is a schematic diagram of a system for improving the clock accuracy of an embedded system. DETAILED DESCRIPTION

[0101] Since the SOC of embedded products generates a lot of heat when working, the clock crystal is extremely sensitive to temperature. Especially if the clock crystal is placed close to the SOC, it will be more affected by the heat of the SOC. The frequency of the clock crystal is different at different temperatures, resulting in a large frequency deviation, which affects the precise timing.

[0102] In order to solve the problem that the frequency accuracy of the crystal oscillator is affected by temperature, resulting in large system time error and fluctuation, the present invention provides a method for improving the clock accuracy of an embedded system, comprising the following steps:

[0103] Step S1: Obtain the frequency error g of the clock crystal at different temperatures, and establish a corresponding relationship between the temperature and the crystal oscillator clock error g;

[0104] Step S2: Calculate the temperature of the clock crystal oscillator according to the internal temperature of the SOC;

[0105] Step S3: Calculate the time compensation of the embedded system.

[0106] The technical solution of the present invention is further described below with reference to the accompanying drawings and through specific implementation methods.

[0107] The present invention mainly improves the time accuracy of embedded systems or products without network timing. According to the deviation value of the crystal oscillator at different temperatures, the relationship between the internal temperature value of the SOC and the temperature value of the crystal oscillator is calculated using the internal temperature sensor of the SOC and the thermodynamic theorem. By adding an algorithm to the embedded system, the temperature of the SOC is associated with the temperature deviation data of the crystal oscillator, the deviation of the current time temperature is calculated, and the deviation of the clock is compensated regularly, thereby improving the time accuracy.

[0108] To further illustrate, the step S1 specifically includes:

[0109] According to the clock crystal specification, obtain the clock crystal at different temperatures T JZ The error g under the condition is fitted by curve, and the error g and temperature T are obtained. JZ The relationship is:

[0110] g=aT JZ 2 +bT JZ +c

[0111] Wherein a, b, and c are constants, for example, a=-0.0258, b=1.1247, and c=-15.215, but not limited thereto.

[0112] To further illustrate, the step S2 specifically includes:

[0113] Step S201: Establishing a thermodynamic simulation model:

[0114] Take the X-axis as an example to create a grid.

[0115] Unit volume: V p =δxδyδz,

[0116] X-axis area: A x =δyδz,

[0117] The mass conservation equation in the x-axis direction is:

[0118]

[0119] The energy conservation equation in the x-axis direction is:

[0120]

[0121] The mass conservation equation for the finite volume method is:

[0122]

[0123] Therefore, the mass conservation equation of the finite volume method is:

[0124]

[0125] For the energy conservation equation of the finite volume method, we have

[0126] Transient Term:

[0127]

[0128] Transfer Item:

[0129]

[0130] Due to T hxf =T p :ρ hxf =ρ p ; T lxf =T lx ρ lxf =ρ lx

[0131] so

[0132]

[0133] Controls:

[0134]

[0135] Heat source term:

[0136]

[0137] Therefore, the energy conservation equation of the finite volume method is:

[0138]

[0139] Divide both sides of the above equation by Vp and solve the mass conservation equation to get:

[0140]

[0141] make Γ=k / C, we get

[0142]

[0143] This equation can also be expressed as:

[0144]

[0145] Derived from a single grid equation (I 2 -I 1 +1) grid equations, then:

[0146]

[0147] Where C is the specific heat of the solid or fluid, k is the heat transfer coefficient of the solid or fluid, ρ is the density of the solid or fluid, u is the fluid velocity vector, t is time, n represents the center point of the i-th unit body, and S is the total heat generation;

[0148] Step S202: setting the initial conditions and boundary conditions of the thermodynamic simulation model, wherein the initial condition is the temperature of the simulation environment and the boundary condition is -40 to 80°C;

[0149] Step S203, meshing the thermodynamic simulation model, wherein the mesh size of the first air region is 8-12 mm, the mesh size perpendicular to the PCB board is 0.1-0.2 mm, the mesh size parallel to the PCB board is 0.5-1.5 mm, and the mesh size of the second air region is 0.2-10 mm;

[0150] Step S204: Substitute the boundary condition values ​​into the thermodynamic simulation model and use thermal simulation software to obtain the SOC temperature T SOC , crystal temperature T JZ , and use the univariate linear regression analysis method to obtain the crystal oscillator temperature T JZ 、Ambient temperature T HJ With SOC temperature T SOC The linear equation is:

[0151] T JZ =k 1 T SOC +k 2

[0152] T HJ =k 3 T SOC +k 4

[0153] Among them, k 1 , k 2 , k 3 , k 4 are all constants.

[0154] In one embodiment of the present technical solution, step S201 can use Flotherm simulation software to establish a thermodynamic simulation model, and the thermodynamic simulation model includes solids and fluids. It should be noted that in the present technical solution, the solids are mainly MPU, crystal oscillator, PCB, DDR3, heat sink, etc., and the fluid is air.

[0155] In step S202 of the technical solution, the initial condition is the initial temperature of the air, that is, the temperature of the environment. The boundary condition is the regional boundary of the air, that is, the upper and lower limits of the ambient temperature. The technical solution sets the initial condition to the temperature of the simulation environment and the boundary condition to -40 to 80°C, which is conducive to improving the effectiveness of the thermodynamic simulation model.

[0156] In step S203 of the technical solution, the thermodynamic simulation model is meshed. In order to ensure the calculation accuracy and efficiency, the mesh size of the first air region with a large area and uniform material is set to 8-12 mm, preferably 10 mm. For electrical devices (solids), local mesh refinement is used to obtain a higher precision temperature value, wherein the mesh size perpendicular to the PCB board direction is set to 0.1-0.2 mm, preferably 0.2 mm; the mesh size parallel to the PCB board direction is set to 0.5-1.5 mm, more preferably 1 mm; the second air region around the solid uses a transitional mesh with a variation of 0.2-10 mm.

[0157] In one embodiment of the present technical solution, in step S204, the boundary condition values ​​are substituted into the thermodynamic simulation model, and the simulation results obtained by the simulation software are as follows:

[0158] Ambient temperature / ℃ Crystal temperature / ℃ SOC temperature / ℃ -40 4 14.5 -30 12.7 23.1 -20 21.3 31.4 -10 30.1 40.1 0 38.8 48.7 10 47.4 57.3 20 56.1 65.8 30 64.7 74.3 40 73.3 82.8 50 82 91.3 60 90.7 99.9 70 99.4 108.5 80 108.1 117.1

[0159] According to the data in the above table, using the univariate linear regression analysis method, we can get k 1 =1.0143, k 2 =-10.65, k 3 =1.1701, k 4 =-56.939.

[0160] To further illustrate, the step S3 specifically includes:

[0161] Step S301: Calculate the compensation time of the embedded system in the shutdown state:

[0162] When most embedded systems are turned off or in sleep mode, the crystal oscillator clock still works through a backup battery or gold capacitor. Since the temperature in the shutdown state cannot be obtained, the ambient temperature is calculated by booting up, and the crystal oscillator temperature at this time is considered to be the ambient temperature in the shutdown stage.

[0163] When booting, the program reads the SOC temperature T SOC , substitute the following formula to obtain the ambient temperature T HJ :

[0164] T HJ =k 3 T SOC +k 4

[0165] Let T JZ =T HJ , substitute into the following formula to obtain the crystal oscillator error value g:

[0166] g=aT JZ 2 +bT JZ +c

[0167] Each time you shut down, record the shutdown time value τ 1 , the time recorded when the machine is turned on is τ 2 ;

[0168] The temperature in the shutdown state cannot be obtained. The ambient temperature is calculated by booting up the machine, and it is considered that the ambient temperature at this time is the ambient temperature in the shutdown stage.

[0169] The compensation time value is t bc =(τ 2 -τ 1 )g;

[0170] The temperature error time compensation formula of the crystal oscillator in the shutdown state is:

[0171] t dqbc =t dq +t bc =t dq +(τ 2 -τ 1 )

[0172] Among them, t dq is the current time, t bc is the compensation time, t dqbc The time after compensation;

[0173] Step S302: Calculate the compensation time of the embedded system in the working state:

[0174] Read the SOC temperature T every minute after powering on SOC , and T SOC Substitute the following formula:

[0175] T JZ =k 1 T SOC +k 2

[0176] g=aT JZ 2 +bT JZ +c

[0177] Get the crystal temperature T JZ And the crystal oscillator error value g;

[0178] The compensation time value is t bc =(τ 2 -τ 1 )g;

[0179] The compensation time t bc Stored in array A[t bc1 ......t bcn ], time compensation is performed after array A is full or before the system is shut down;

[0180] The compensation time is obtained by summing up the compensation time array A:

[0181] t sum =t bc1 +t bc2 +…+t bcn

[0182] The modification time after compensation is:

[0183] t dqbc =t dq +t sum

[0184] After the time compensation is completed, array A is cleared; the next compensation cycle is entered or the shutdown time τ is recorded. 1 , perform shutdown action.

[0185] In one embodiment of the present technical solution, k 1 =1.0143, k 2 =-10.65, k 3 =1.1701, k 4 =-56.939, then the specific steps of step S302 are:

[0186] Read the SOC temperature T every minute after powering on SOC , and TSOC Substitute the following formula:

[0187] T JZ =1.0143*T SOC -10.65

[0188] g=-0.0258*T JZ 2 +1.1247*T JZ -15.21

[0189] Get the crystal temperature T JZ And the crystal oscillator error value g;

[0190] The compensation time value is t bc =(τ 2 -τ 1 )g = 60g;

[0191] The compensation time t bc Stored in array A[t bc1 ......t bcn ], time compensation is performed after array A is full or before the system is shut down;

[0192] The compensation time is obtained by summing the compensation time array A:

[0193] t sum =t bc1 +t bc2 +…+t bcn

[0194] The modification time after compensation is:

[0195] t dqbc =t dq +t sum

[0196] After the time compensation is completed, array A is cleared;

[0197] Enter the next compensation cycle or record the shutdown time τ 1 , perform shutdown action.

[0198] In one embodiment of the present technical solution, if:

[0199] Boot time τ 2 =12:00:00, shutdown time τ 1 =10:00:00

[0200] Current time t dq =12:00:20, SOC temperature T SOC =50℃

[0201] Calculate the ambient temperature T HJ =1.1701*T SOC -56.939=1.566℃

[0202] In the shutdown state, the crystal temperature is equal to the ambient temperature T JZ =T HJ =1.566℃

[0203] Find the error value:

[0204] g=-0.0258*T JZ 2 +1.1247*T JZ -15.215 = -13.5 ppm

[0205] The time correction compensation time is:

[0206] t bc =(τ 2 -τ 1 )g=(12:00:00.00-10:00:00.00)*(-13.5ppm)=-0.0972s

[0207] The corrected time after compensation is:

[0208] t dqbc =t dq +t bc =12:00:20.0000-0.0972s=12:00:19.9028.

[0209] In another embodiment of the present technical solution, it is assumed that T SOC =100℃, and the temperature is stable, and the width of array A is 100, then:

[0210] T JZ =1.0143*T SOC -10.65=90.78

[0211] g=-0.0258*T JZ 2 +1.1247*T JZ -15.21 = -125.7277 ppm

[0212] t bc =60g=60*(-125.7277ppm)=-7,543.6620ppm

[0213] Array A is [-7,543.6620, -7,543.6620…-7,543.6620]

[0214] When array A is full, the current time t dq =18:10:80.0000

[0215] The total compensation time is:

[0216] t sum =t bc1 +t bc2 +...+t bcn =100*(-7,543.6620ppm)=-0.7543s

[0217] The corrected time after compensation is:

[0218] t dqbc =t dq +t sum =18:10:50.0000-0.7543=18:10:49.2457.

[0219] The technical solution also proposes a system for improving the clock accuracy of an embedded system, including a temperature and crystal oscillator clock error establishment module, a crystal oscillator temperature calculation module and a time compensation calculation module;

[0220] The temperature and crystal oscillator clock error establishing module is used to obtain the frequency error g of the clock crystal oscillator at different temperatures and establish the corresponding relationship between the temperature and the crystal oscillator clock error g;

[0221] The crystal oscillator temperature calculation module is used to calculate the temperature of the clock crystal oscillator according to the internal temperature of the SOC;

[0222] The time compensation calculation module is used to calculate the time compensation of the embedded system.

[0223] Further, the temperature and crystal oscillator clock error establishment module is specifically used to obtain the clock crystal oscillator at different temperatures T according to the specification of the clock crystal oscillator. JZ The error g under the condition is fitted by curve, and the error g and temperature T are obtained. JZ The relationship is:

[0224] g=aT JZ 2 +bT JZ +c

[0225] Where a, b, and c are constants.

[0226] It is further explained that the crystal oscillator temperature calculation module includes a model building unit, a condition setting unit, a grid division unit and a simulation operation unit;

[0227] The model building unit is used to build a grid taking the X-axis direction as an example.

[0228] Unit volume: V p =δxδyδz,

[0229] X-axis area: A x =δyδz,

[0230] The mass conservation equation in the x-axis direction is:

[0231]

[0232] The energy conservation equation in the x-axis direction is:

[0233]

[0234] The mass conservation equation for the finite volume method is:

[0235]

[0236] Therefore, the mass conservation equation of the finite volume method is:

[0237]

[0238] For the energy conservation equation of the finite volume method, we have

[0239] Transient Term:

[0240]

[0241] Transfer Item:

[0242]

[0243] Due to T hxf =T p ρ hxf =ρ p ; T lxf =T lx ρ lxf =ρ lx

[0244] so

[0245]

[0246] Controls:

[0247]

[0248] Heat source term:

[0249]

[0250] Therefore, the energy conservation equation of the finite volume method is:

[0251]

[0252] Divide both sides of the above equation by Vp and solve the mass conservation equation to get:

[0253]

[0254] make Γ=k / C, we get

[0255]

[0256] This equation can also be expressed as:

[0257]

[0258] Derived from a single grid equation (I 2 -I 1 +1) grid equations, then:

[0259]

[0260] Where C is the specific heat of the solid or fluid, k is the heat transfer coefficient of the solid or fluid, ρ is the density of the solid or fluid, u is the fluid velocity vector, t is time, n represents the center point of the i-th unit body, and S is the total heat generation;

[0261] The condition setting unit is used to set the initial condition and boundary condition of the thermodynamic simulation model, wherein the initial condition is the temperature of the simulation environment and the boundary condition is -40 to 80°C;

[0262] The grid division unit is used to perform grid division on the thermodynamic simulation model, wherein the grid size of the first air region is 8-12 mm, the grid size perpendicular to the PCB board direction is 0.1-0.2 mm, the grid size parallel to the PCB board direction is 0.5-1.5 mm, and the grid size of the second air region is 0.2-10 mm;

[0263] The simulation operation unit is used to substitute the boundary condition values ​​into the thermodynamic simulation model and obtain the SOC temperature T through the thermal simulation software. SOC , crystal temperature T JZ , and use the univariate linear regression analysis method to obtain the crystal oscillator temperature T JZ 、Ambient temperature T HJ With SOC temperature T SOC The linear equation is:

[0264] T JZ =k 1 T SOC +k 2

[0265] THJ =k 3 T SOC +k 4

[0266] Among them, k 1 , k 2 , k 3 , k 4 are all constants.

[0267] It is further explained that the time compensation calculation module includes a shutdown state compensation time calculation unit and a working state compensation time calculation unit;

[0268] The shutdown state compensation time calculation unit is used to calculate the compensation time of the embedded system in the shutdown state;

[0269] Specifically, the program reads the SOC temperature T when the computer is turned on. SOC , substitute the following formula to obtain the ambient temperature T HJ And the crystal error value g:

[0270] T HJ =k 3 T SOC +k 4

[0271] Let T JZ =T HJ , substitute into the following formula to obtain the crystal oscillator error value g:

[0272] g=aT JZ 2 +bT JZ +c

[0273] Each time you shut down, record the shutdown time value τ 1 , the time recorded when the machine is turned on is τ 2 ;

[0274] The temperature in the shutdown state cannot be obtained. The ambient temperature is calculated by booting up the machine, and it is considered that the ambient temperature at this time is the ambient temperature in the shutdown stage.

[0275] The compensation time value is t bc =(τ 2 -τ 1 )g;

[0276] The temperature error time compensation formula of the crystal oscillator in the shutdown state is:

[0277] t dqbc =t dq +t bc =t dq +(τ 2 -τ 1 )

[0278] Among them, t dq is the current time, t bc is the compensation time, t dqbc The time after compensation;

[0279] The working state compensation time calculation unit is used to calculate the compensation time of the embedded system in the working state:

[0280] Read the SOC temperature T every minute after powering on SOC , and T SOC Substitute the following formula:

[0281] T JZ =k 1 T SOC +k 2

[0282] g=aT JZ 2 +bT Z +c

[0283] Get the crystal temperature T JZ And the crystal oscillator error value g;

[0284] The compensation time value is t bc =(τ 2 -τ 1 )g;

[0285] The compensation time t bc Stored in array A[t bc1 ......t bcn ], time compensation is performed after array A is full or before the system is shut down;

[0286] The compensation time is obtained by summing the compensation time array A:

[0287] t sum =t bc1 +t bc2 +…+t bcn

[0288] The modification time after compensation is:

[0289] t dqbc =t dq +t sum

[0290] After the time compensation is completed, array A is cleared; the next compensation cycle is entered or the shutdown time τ1 is recorded and the shutdown action is performed.

[0291] Furthermore, the technical solution also proposes a device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps in the above-mentioned method for improving the clock accuracy of an embedded system when executing the computer program.

[0292] Furthermore, the technical solution also proposes a storage medium, which stores a plurality of instructions, and the instructions are suitable for loading by a processor to execute the steps in the above-mentioned method for improving the clock accuracy of an embedded system.

[0293] The technical principle of the present invention is described above in conjunction with specific embodiments. These descriptions are only for explaining the principle of the present invention and cannot be interpreted as limiting the scope of protection of the present invention in any way. Based on the explanations herein, those skilled in the art can associate other specific implementations of the present invention without paying creative labor, and these methods will fall within the scope of protection of the present invention.

Claims

1. A method for improving the clock accuracy of an embedded system, characterized in that: The following steps are involved: Step S1: Obtain the frequency error g of the clock crystal oscillator at different temperatures, and establish a corresponding relationship between the crystal oscillator temperature and the crystal oscillator clock error g; Step S2: Calculate the temperature of the clock crystal oscillator according to the internal temperature of the SOC; Step S3: Calculate the time compensation of the embedded system; The step S2 specifically includes: Step S201: Establishing a thermodynamic simulation model: The grid is established along the X axis, and the grid equation is: in, Γ=k / C, C is the specific heat of the solid or fluid, k is the heat transfer coefficient of the solid or fluid, ρ is the density of the solid or fluid, u is the fluid velocity vector, t is the time, n represents the center point of the i-th unit body, and S is the total heat generation; Step S202: setting initial conditions and boundary conditions of the thermodynamic simulation model; Step S203: meshing the thermodynamic simulation model; Step S204: Substitute the boundary condition values ​​into the thermodynamic simulation model and use the simulation software to obtain the SOC temperature T SOC , crystal temperature T JZ and ambient temperature T HJ , and use the univariate linear regression analysis method to obtain the crystal oscillator temperature T JZ 、Ambient temperature T HJ With SOC temperature T SOC The linear equation is: T JZ =k1T SOC +k2 T HJ =k3T SOC +k4 Among them, k1, k2, k3, and k4 are all constants, obtained based on simulation data and regression analysis; The step S3 specifically includes: Step S301: Calculate the compensation time of the embedded system in the shutdown state: When booting, the program reads the SOC temperature T SOC , substitute the following formula to obtain the ambient temperature T HJ : T HJ =k3T SOC +k4 Let T JZ =T HJ , Substitute into the following formula to obtain the crystal oscillator error value g: g = aT JZ 2 +bT JZ +c Each time the power is turned off, the shutdown time value τ1 is recorded, and the time recorded when the power is turned on is τ2. a, b, and c are constants. The compensation time value is t bc =(τ2-τ1)g; The temperature error time compensation formula of the crystal oscillator in the shutdown state is: t dqbc =t dq +t bc =t dq +(τ2-τ1)g Among them, t dq is the current time, t bc is the compensation time, t dqbc The time after compensation; Step S302: Calculate the compensation time of the embedded system in the working state: Read the SOC temperature T every minute after powering on SOC , and T SOC Substitute the following formula: T JZ =k1T SOC +k2 g=aT JZ 2 +bT JZ +c Get the crystal temperature T JZ And the crystal oscillator error value g; The compensation time value is t bc =(τ2-τ1)g; The compensation time t bc Stored in array A[t bc1 ......t bcn ], time compensation is performed after array A is full or before the system is shut down; Sum the compensation time array A and obtain the compensation time: t sum =t bc1 +t bc2 +...+t bcn The modification time after compensation is: t dqbc =t dq +t sum After the time compensation is completed, array A is cleared; the next compensation cycle is entered or the shutdown time τ1 is recorded and the shutdown action is performed.

2. The method for improving the clock accuracy of an embedded system according to claim 1, characterized in that: The step S1 specifically includes: According to the clock crystal specification, obtain the clock crystal at different temperatures T JZ The error g under the condition is fitted by curve, and the error g and temperature T are obtained. JZ The relationship is: g=aT JZ 2 +bT JZ +c Where a, b, and c are constants.

3. The method for improving the clock accuracy of an embedded system according to claim 1, characterized in that: Step S202: setting the initial conditions and boundary conditions of the thermodynamic simulation model, wherein the initial condition is the temperature of the simulation environment and the boundary condition is -40 to 80°C; Step S203: Meshing the thermodynamic simulation model, wherein the mesh size of the first air region is 8-12 mm, the mesh size perpendicular to the PCB board is 0.1-0.2 mm, the mesh size parallel to the PCB board is 0.5-1.5 mm, and the mesh size of the second air region is 0.2-10 mm.

4. A system for improving the clock accuracy of an embedded system, characterized by: It includes a temperature and crystal oscillator clock error establishment module, a crystal oscillator temperature calculation module and a time compensation calculation module; The temperature and crystal oscillator clock error establishing module is used to obtain the frequency error g of the clock crystal oscillator at different temperatures and establish the corresponding relationship between the crystal oscillator temperature and the crystal oscillator clock error g; The crystal oscillator temperature calculation module is used to calculate the temperature of the clock crystal oscillator according to the internal temperature of the SOC; The time compensation calculation module is used to calculate the time compensation of the embedded system; The crystal oscillator temperature calculation module includes a model building unit, a condition setting unit, a grid division unit and a simulation operation unit; The model building unit is used to build a grid along the X-axis, and the grid equation is: in, Γ=k / C, C is the specific heat of the solid or fluid, k is the heat transfer coefficient of the solid or fluid, ρ is the density of the solid or fluid, u is the fluid velocity vector, t is the time, n represents the center point of the i-th unit body, and S is the total heat generation; The condition setting unit is used to set the initial conditions and boundary conditions of the thermodynamic simulation model; The grid division unit is used to perform grid division on the thermodynamic simulation model; The simulation operation unit is used to substitute the boundary condition values ​​into the thermodynamic simulation model and obtain the SOC temperature T through the simulation software. SOC , crystal temperature T JZ and ambient temperature T HJ , and use the univariate linear regression analysis method to obtain the crystal oscillator temperature T JZ 、Ambient temperature T HJ With SOC temperature T SOC The linear equation is: T JZ =k1T SOC +k2 T HJ =k3T SOC +k4 Among them, k1, k2, k3, and k4 are all constants; The time compensation calculation module includes a shutdown state compensation time calculation unit and a working state compensation time calculation unit; The shutdown state compensation time calculation unit is used to calculate the compensation time of the embedded system in the shutdown state; Specifically, the program reads the SOC temperature T when the computer is turned on. SOC , substitute the following formula to obtain the ambient temperature T HJ : T HJ =k3T SOC +k4 Let T JZ =T HJ , Substitute into the following formula to obtain the crystal oscillator error value g: g = aT JZ 2 +bT JZ +c Each time the power is turned off, the shutdown time value τ1 is recorded, and the time recorded when the power is turned on is τ2. a, b, and c are constants. The temperature in the shutdown state cannot be obtained. The ambient temperature is calculated by booting up the machine, and it is considered that the ambient temperature at this time is the ambient temperature in the shutdown stage. The compensation time value is t bc =(τ2-τ1)g; The temperature error time compensation formula of the crystal oscillator in the shutdown state is: t dqbc =t dq +t bc =t dq +(τ2-τ1)g Among them, t dq is the current time, t bc is the compensation time, t dqbc The time after compensation; The working state compensation time calculation unit is used to calculate the compensation time of the embedded system in the working state; Specifically, the SOC temperature T is read every minute after powering on. SOC , and T SOC Substitute the following formula: T JZ =k1T SOC +k2 g=aT JZ 2 +bT JZ +c Get the crystal temperature T JZ And the crystal oscillator error value g; The compensation time value is t bc =(τ2-τ1)g; The compensation time t bc Stored in array A[t bc1 ......t bcn ], time compensation is performed after array A is full or before the system is shut down; The compensation time is obtained by summing up the compensation time array A: t sum =t bc1 +t bc2 +...+t bcn The modification time after compensation is: t dqbc =t dq +t sum After the time compensation is completed, array A is cleared; Enter the next compensation cycle or record the shutdown time τ1 and perform the shutdown action.

5. The system for improving clock accuracy of an embedded system according to claim 4, characterized in that: The temperature and crystal oscillator clock error establishment module is specifically used to obtain the crystal oscillator at different temperatures T according to the crystal oscillator specification. JZ The error g under the condition is fitted by curve, and the error g and temperature T are obtained. JZ The relationship is: g=aT JZ 2 +bT JZ +c Where a, b, and c are constants.

6. The system for improving clock accuracy of an embedded system according to claim 4, characterized in that: The condition setting unit is used to set the initial condition and boundary condition of the thermodynamic simulation model, wherein the initial condition is the temperature of the simulation environment and the boundary condition is -40 to 80°C; The grid division unit is used to grid the thermodynamic simulation model, wherein the grid size of the first air area is 8-12 mm, the grid size perpendicular to the PCB board direction is 0.1-0.2 mm, the grid size parallel to the PCB board direction is 0.5-1.5 mm, and the grid size of the second air area is 0.2-10 mm.

7. A device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps in the method for improving the clock accuracy of an embedded system as claimed in any one of claims 1 to 3 when executing the computer program.

8. A storage medium, characterized in that: The storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor to execute the steps of the method for improving the clock accuracy of an embedded system as claimed in any one of claims 1 to 3.

Citation Information

Patent Citations

  • Energy conservation time synchronization method of wireless temperature detecting net

    CN103096458A

  • Adaptive time synchronization method based on temperature compensation

    CN108449791A

  • A design method of stress compensation film for AT-cut temperature compensated crystal oscillator

    CN109543320A

  • Pseudorange calculation method and terminal

    WO2019019044A1