From 53881351a8258b8f4cbccd3ed9c031fb4bf28122 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Thu, 12 Jul 2007 14:25:08 +0000 Subject: [PATCH] Added "getdphi" to do least-squares solution for Dphi. Updated Makefile.in Commented out Linux calls to usleep in sleep_msec, makes it hang. Removed duplicate code from plrr.f90. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/map65@498 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- Makefile.in | 2 +- getdphi.f90 | 18 ++++++++++++++++++ map65a.F90 | 3 +++ plrr.f90 | 15 +-------------- sec_midn.F90 | 3 ++- 5 files changed, 25 insertions(+), 16 deletions(-) create mode 100644 getdphi.f90 diff --git a/Makefile.in b/Makefile.in index 3ffe8a91c..81710f5c7 100644 --- a/Makefile.in +++ b/Makefile.in @@ -47,7 +47,7 @@ SRCS2F90 = astro0.F90 audio_init.F90 azdist0.f90 \ runqqq.F90 fivehz.F90 flushqqq.F90 \ rfile.f90 rfile3a.f90 spec.f90 map65a.F90 display.F90 \ getfile.F90 getfile2.F90 recvpkt.F90 savetf2.F90 \ - symspec.f90 sec_midn.F90 + symspec.f90 sec_midn.F90 getdphi.f90 SRCS2F77 = indexx.f gen65.f chkmsg.f \ gentone.f gencwid.f set.f db.f pctile.f sort.f ssort.f \ diff --git a/getdphi.f90 b/getdphi.f90 new file mode 100644 index 000000000..8f0e00bdb --- /dev/null +++ b/getdphi.f90 @@ -0,0 +1,18 @@ +subroutine getdphi(qphi) + + real qphi(12) + + s=0. + c=0. + do i=1,12 + th=i*30/57.2957795 + s=s+qphi(i)*sin(th) + c=c+qphi(i)*cos(th) + enddo + + dphi=57.2957795*atan2(s,c) + write(11,1010) nint(dphi) +1010 format('Best-fit Dphi =',i4,' deg') + + return + end diff --git a/map65a.F90 b/map65a.F90 index fa3f872c6..523055593 100644 --- a/map65a.F90 +++ b/map65a.F90 @@ -15,6 +15,7 @@ subroutine map65a(newdat) character decoded*22,blank*22 include 'spcom.f90' real short(3,NFFT) !SNR dt ipol for potential shorthands + real qphi(12) include 'gcom2.f90' include 'datcom.f90' data blank/' '/ @@ -249,6 +250,7 @@ subroutine map65a(newdat) write(11,1010) nkHz,ndf,npol,nutc,dt,nsync2,decoded,nkv,nqual 1010 format(i3,i5,i4,i5.4,f5.1,i4,2x,a22,i5,i4,i4) else + qphi(iloop)=sig(k,10) write(11,1010) nkHz,ndf,npol,nutc,dt,nsync2,decoded,nkv, & nqual,30*iloop write(27,1011) 30*iloop,nkHz,ndf,npol,nutc, & @@ -267,6 +269,7 @@ subroutine map65a(newdat) iloop=iloop+1 go to 2 endif + if(ndphi.eq.1 .and.iloop.eq.12) call getdphi(qphi) if(nqd.eq.1) then write(11,*) '$EOF' call flushqqq(11) diff --git a/plrr.f90 b/plrr.f90 index cb35e0695..860bab45d 100644 --- a/plrr.f90 +++ b/plrr.f90 @@ -40,17 +40,4 @@ program plrr end program plrr -! To compile: % gfortran -o plrr plrr.f90 plrr_subs.c - - -real function sec_midn() - real*8 sec8,hrtime - sec_midn=secnds(0.0) - return -end function sec_midn - -subroutine sleep_msec(n) - use dflib - call sleepqq(n) - return -end subroutine sleep_msec +! To compile: % gfortran -o plrr plrr.f90 sec_midn.F90 plrr_subs.c diff --git a/sec_midn.F90 b/sec_midn.F90 index 2f0ed1888..2f5426e1f 100644 --- a/sec_midn.F90 +++ b/sec_midn.F90 @@ -21,7 +21,8 @@ subroutine sleep_msec(n) #ifdef Win32 call sleepqq(n) #else - call usleep(min(1,1000*n)) +!m=min(1,n) +! call usleep(m) #endif return