X-Git-Url: https://zdv2.bktei.com/gitweb/EVA-2020-02.git/blobdiff_plain/8b52ffcaab047d950f2c0818680f3347d55dce70..42c1f429b56d0835afe5516b10aaae0f23fe96a7:/exec/bkgpslog?ds=inline diff --git a/exec/bkgpslog b/exec/bkgpslog index 0dd7f5d..99238ed 100755 --- a/exec/bkgpslog +++ b/exec/bkgpslog @@ -950,8 +950,8 @@ magicBufferSleepPID() { ### PID Control factors K_P=1; # Gain for compensating buffer round lag - T_I="$((4*BUFFER_TTL_NS))"; # Consider this number of past nanoseconds to eliminate error - T_D="$((1*BUFFER_TTL_NS))"; # Predict value this number of nanoseconds into the future + T_I="$(((4)*BUFFER_TTL_NS/(1)))"; # Consider this number of past nanoseconds to eliminate error + T_D="$(((1)*BUFFER_TTL_NS/(1)))"; # Predict value this number of nanoseconds into the future # Calculate Error, errNS, in nanoseconds ## Get current time @@ -982,6 +982,11 @@ magicBufferSleepPID() { # Calculate errRate in nanoseconds per nanosecond errRate="$(( errNS / BUFFER_TTL_NS ))" && vbm "errRate:$errRate"; # errRatex10e3="$(( ( errNSx10e3 ) / BUFFER_TTL_NS ))" && vbm "errRatex10e3:$errRatex10e3"; + + # Debug + vbm "errNS :$errNS"; + vbm "errResetTerm:$((errReset/T_I))"; + vbm "errRateTerm :$((errRate*T_D))"; # Calculate PID control signal ## ADJ = K_P * (errNS + errReset/T_I + errRate*T_D)