Hi Magnus You are correct in a way. The code is more complicated than it should have been.
The first row with comment “corr for time” is the I-term. The second row that integrates the frequency offset is the P-term and could have been just proportional to the time offset I understand now (I have thought of it before but totally forgot it). As I choosed to work with integers I have to scale the values to avoid truncation errors (that I still get with large time constants ☹. Probably it would be better to use floating point calculations. Lars >Från: Magnus Danielson >Hej Lars, >Impressive build in all it's simplicity. >Your filtering equations look strange. Rather than having a PI loop it looks like both the P and I branch integrates. I'm also unclear about the loop gain changes by the pre-filter averager. >Will have to look more at your code. >Cheers, >Magnus >>On 12/02/14 23:10, Lars Walenius wrote: >> I have just changed all my Swedish comments in my source code and attached >> it. I also copied the text to a Word-file so everybody can see it without >> the Arduino Environment. > The Control loop (“PI-loop”) is more or less just two lines that you find > approximately in the middle of the file (page 13 in Word-file). Check the two > lines with comment: Corr for time respectively Corr for frequency. _______________________________________________ time-nuts mailing list -- time-nuts@febo.com To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts and follow the instructions there.