Electronics > Projects, Designs, and Technical Stuff

GPSDO: PLL or MCU controlled?

<< < (10/11) > >>

Theboel:
@ illusionist
I interested in Your kalman filter implementation can You tell more about it please.

Illusionist:
Theboel, here's my Kalman filter code. I'm hardly an expert. Despite (or perhaps due to) having studied electronics, geology and chemistry at university, I've always been allergic to statistical mathematics. My code is the result of a few days' research on the internet, a.k.a. borrowing other people's solutions. I found www.kalmanfilter.net particularly easy to follow for a basic understanding.

I've added an 'Initial Guess' to the filter initialization, which I give the first reliable reading from my TIC when it's near enough to be useful (Edit: to clarify, when I have coarse-tuned the DPPS to be close enough to the PPS for the TIC to take over). It just saves the ramp-up that the filter does otherwise.

The numbers I send to the filter are the time intervals between the GPS's jittery PPS and my, more stable, derived PPS. I scale the readings as floating point in nanoseconds. The 'raw' DPPS is set to be 100ns in front of the PPS to allow adjustment with the delay line, which gives the final output.


--- Code: ---
// Single dimension Kalman filter with process variance noise

float KF_Estimate_Uncertainty;
float KF_Measurement_Uncertainty;
float KF_Q;
float KF_Gain;
float KF_Last_Estimate;
float KF_Current_Estimate;

// KF_Init(Measurement Uncertainty, Estimate Uncertainty, Process Noise Variance, Initial Guess)

void KF_Init(float SetMeasurementUncertainty, float SetEstimateUncertainty, float SetQ, float SetInitialGuess) {
KF_Measurement_Uncertainty = SetMeasurementUncertainty;
KF_Estimate_Uncertainty = SetEstimateUncertainty;
KF_Q = SetQ;
KF_Last_Estimate = SetInitialGuess;
}

float KF_UpdateEstimate(float ThisValue) {
// Gain update
KF_Gain = KF_Estimate_Uncertainty / (KF_Estimate_Uncertainty + KF_Measurement_Uncertainty);
// State update
KF_Current_Estimate = KF_Last_Estimate + KF_Gain * (ThisValue - KF_Last_Estimate);
// Extrapolate estimate uncertainty, with process noise
KF_Estimate_Uncertainty =  (1.0 - KF_Gain) * KF_Estimate_Uncertainty + abs(KF_Last_Estimate - KF_Current_Estimate) * KF_Q;
// Record estimate for next iteration
KF_Last_Estimate= KF_Current_Estimate;

return KF_Current_Estimate;
}


--- End code ---

Illusionist:
I should also add to the above:

The Kalman filter isn't started until the DPPS and PPS are close enough for the TIC to be useful. Then, I let the filter run until the returned estimates have settled (iirc to within 200ps) before I start using them to fine-tune the DPPS phase using the delay line.

After that adjustment, I let the filter settle again at its new value before entering a monitoring stage.

The monitoring stage makes single delay step adjustments to account for small changes. These keep the DPPS within 250ps of the filter-estimated PPS time. These adjustments are few and far between once the GPSDO has been running for an hour or so.

Gandalf_Sr:
Illusionist, The GPDSO design is interesting.  I sent you a PM about coming up with an open-source PCB design.

David Hess:

--- Quote from: Johnny B Good on August 23, 2019, 03:38:55 pm ---
--- Quote from: David Hess on August 22, 2019, 11:56:25 am ---Kester used to sell flux and other chemicals in 4 ounce glass bottles but they stopped like 20+ years ago.  I have a few marked as 1992.
--- End quote ---

Which rather begs the question, are they still within their BBD? >:D I take it that this stock of ancient flux of yours hasn't presented you with any issues over expired BBDs or DOM life expiry limits?
--- End quote ---

It raises the question.  Begging the question is something completely different.

The Kester 44 flux is as good as it ever was so far as I know.  The Copper-Nu has an indicator which has not changed and it works great also.  Various thinners and solvents are subject to evaporation but not degradation.


--- Quote ---Talking of soldering kit of such vintage, I was browsing the soldering section of Banggood's site just a few minutes ago (as one does) when I spotted this rather neat item (obviously no BBD issues here ;) ) :-

https://www.banggood.com/Hand-Soldering-Iron-Stand-Helping-Clamp-Magnifying-Tool-Auxiliary-Clip-Magnifier-Station-Holder-p-1017105.html?rmmds=detail-bottom-alsobought__16&cur_warehouse=CN

Which looked oh so familiar :palm:  Familiar indeed because I already have one to hand which has mostly been gathering dust on the shelf of a roller blind cupboard (never ever closed, btw) in my office/man-cave/workshop for the past two to three decades. :-[ If I didn't already possess the exact same aid, I would have placed an order with Banggood right there and then!!!
--- End quote ---

I have one of those that is at least that old.  I reinforced the alligator clips where they insert into the holders with brass tubing to keep them from bending when the screws are tightened and made some more clips like that in different sizes.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

There was an error while thanking
Thanking...
Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod