Add flexible command-line options for mapsim.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/map65@2534 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Joe Taylor 2012-08-28 16:03:30 +00:00
parent da1a91424f
commit a7d778ad96

View File

@ -7,40 +7,71 @@ program mapsim
complex cwave(NMAX) complex cwave(NMAX)
complex z,zx,zy complex z,zx,zy
real*8 fcenter,fsample,samfac,f,dt,twopi,phi,dphi real*8 fcenter,fsample,samfac,f,dt,twopi,phi,dphi
character message*22,msgsent*22,arg*8 character message*22,msgsent*22,arg*8,fname*14,mode*2
nargs=iargc() nargs=iargc()
if(nargs.ne.2) then if(nargs.ne.9) then
print*,'Usage: mapsim "message" pol' print*,'Usage: mapsim level "message" mode f1 f2 nsigs pol SNR nfiles'
print*,'Example: 25 "CQ K1ABC FN42" B -22 33 20 45 -20 1'
go to 999 go to 999
endif endif
call getarg(1,message) call getarg(1,arg)
call getarg(2,arg) read(arg,*) rmsdb
read(arg,*) pol rms=10.0**(0.05*rmsdb)
call getarg(2,message)
open(10,file='000000_0000.iq',access='stream',status='unknown') call getarg(3,mode)
open(11,file='000000_0000.tf2',access='stream',status='unknown') call getarg(4,arg)
read(arg,*) f1
call noisegen(d4,NMAX) call getarg(5,arg)
mode65=2 read(arg,*) f2
samfac=1.d0 call getarg(6,arg)
call cgen65(message,mode65,samfac,nsendingsh,msgsent,cwave,nwave) read(arg,*) nsigs
call getarg(7,arg)
read(arg,*) npol
call getarg(8,arg)
read(arg,*) snrdb
pol=npol
call getarg(9,arg)
read(arg,*) nfiles
fcenter=144.125d0 fcenter=144.125d0
fsample=96000.d0 fsample=96000.d0
dt=1.d0/fsample
twopi=8.d0*atan(1.d0) twopi=8.d0*atan(1.d0)
rad=360.0/twopi rad=360.0/twopi
samfac=1.d0
mode65=1
if(mode(1:1).eq.'B') mode65=2
if(mode(1:1).eq.'C') mode65=4
write(*,1000)
1000 format(' N freq S/N pol Message'/ &
'-----------------------------------------------')
do ifile=1,nfiles
nmin=ifile-1
if(mode(2:2).eq.' ') nmin=2*nmin
write(fname,1002) nmin
1002 format('000000_',i4.4,'00')
open(10,file=fname//'.iq',access='stream',status='unknown')
open(11,file=fname//'.tf2',access='stream',status='unknown')
call noisegen(d4,NMAX)
call cgen65(message,mode65,samfac,nsendingsh,msgsent,cwave,nwave)
do isig=1,nsigs
if(npol.lt.0) pol=(isig-1)*180.0/nsigs
a=cos(pol/rad) a=cos(pol/rad)
b=sin(pol/rad) b=sin(pol/rad)
dt=1.d0/fsample ! f=-23000 + 3000*(isig-1)
f=1000.0*(f1 + (isig-1)*(f2-f1)/(nsigs-1.0))
do isig=1,20
f=-23000 + 3000*(isig-1)
dphi=twopi*f*dt + 0.5*twopi dphi=twopi*f*dt + 0.5*twopi
! snrdb=-(19.0 + (isig-1)/2.0) snrdbx=snrdb
snrdb=-20.0 if(snrdb.ge.-1.0) snrdbx=-15.0 - 15.0*(isig-1.0)/nsigs
sig=sqrt(2.0*2500.0/96000.0) * 10.0**(0.05*snrdb) sig=sqrt(2.2*2500.0/96000.0) * 10.0**(0.05*snrdbx)
write(*,1020) isig,0.001*f,snrdbx,nint(pol),message
1020 format(i3,f8.3,f7.1,i5,2x,a22)
phi=0. phi=0.
i0=fsample*(3.5d0+0.05d0*(isig-1)) i0=fsample*(3.5d0+0.05d0*(isig-1))
@ -61,17 +92,19 @@ program mapsim
enddo enddo
enddo enddo
s=31.6
do i=1,NMAX do i=1,NMAX
id4(1,i)=nint(s*d4(1,i)) id4(1,i)=nint(rms*d4(1,i))
id4(2,i)=nint(s*d4(2,i)) id4(2,i)=nint(rms*d4(2,i))
id4(3,i)=nint(s*d4(3,i)) id4(3,i)=nint(rms*d4(3,i))
id4(4,i)=nint(s*d4(4,i)) id4(4,i)=nint(rms*d4(4,i))
id2(1,i)=id4(1,i) id2(1,i)=id4(1,i)
id2(2,i)=id4(2,i) id2(2,i)=id4(2,i)
enddo enddo
write(10) fcenter,id2 write(10) fcenter,id2
write(11) fcenter,id4 write(11) fcenter,id4
close(10)
close(11)
enddo
999 end program mapsim 999 end program mapsim