Minor corrections to cgen65.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/map65@2537 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Joe Taylor 2012-08-29 14:09:58 +00:00
parent 978fe1a81b
commit 3c6ba78445
3 changed files with 39 additions and 33 deletions

View File

@ -1,4 +1,4 @@
subroutine cgen65(message,mode65,samfac,nsendingsh,msgsent,cwave,nwave) subroutine cgen65(message,mode65,nfast,samfac,nsendingsh,msgsent,cwave,nwave)
! Encodes a JT65 message into a wavefile. ! Encodes a JT65 message into a wavefile.
! Executes in 17 ms on opti-745. ! Executes in 17 ms on opti-745.
@ -7,7 +7,7 @@ subroutine cgen65(message,mode65,samfac,nsendingsh,msgsent,cwave,nwave)
character*22 message !Message to be generated character*22 message !Message to be generated
character*22 msgsent !Message as it will be received character*22 msgsent !Message as it will be received
character*3 cok !' ' or 'OOO' character*3 cok !' ' or 'OOO'
real*8 dt,phi,f,f0,dfgen,dphi,twopi,samfac real*8 t,dt,phi,f,f0,dfgen,dphi,twopi,samfac,tsymbol
complex cwave(NMAX) !Generated complex wave file complex cwave(NMAX) !Generated complex wave file
integer dgen(12) integer dgen(12)
integer sent(63) integer sent(63)
@ -31,7 +31,7 @@ subroutine cgen65(message,mode65,samfac,nsendingsh,msgsent,cwave,nwave)
first=.false. first=.false.
endif endif
call chkmsg(message,cok,nspecial,flip) call chkmsg(message,cok,nspecial,flip) !See if it's a shorthand
if(nspecial.eq.0) then if(nspecial.eq.0) then
call packmsg(message,dgen) !Pack message into 72 bits call packmsg(message,dgen) !Pack message into 72 bits
nsendingsh=0 nsendingsh=0
@ -41,43 +41,44 @@ subroutine cgen65(message,mode65,samfac,nsendingsh,msgsent,cwave,nwave)
call interleave63(sent,1) !Apply interleaving call interleave63(sent,1) !Apply interleaving
call graycode(sent,63,1) !Apply Gray code call graycode(sent,63,1) !Apply Gray code
nsym=126 !Symbols per transmission nsym=126 !Symbols per transmission
nsps=4096 tsymbol=4096.d0/(nfast*11025.d0) !Time per symbol
else else
nsendingsh=1 !Flag for shorthand message
nsym=32 nsym=32
nsps=16384 tsymbol=16384.d0/11025.d0
nsendingsh=1 !Flag for shorthand message
endif endif
if(mode65.eq.0) go to 900
nsps=nint(nsps*96000.d0/11025.d0)
! Set up necessary constants ! Set up necessary constants
dt=1.d0/(samfac*96000.d0) dt=1.d0/(samfac*96000.d0)
f0=118*11025.d0/1024 f0=118*11025.d0/1024
dfgen=mode65*11025.d0/4096.d0 dfgen=mode65*11025.d0/4096.d0
t=0.d0
phi=0.d0 phi=0.d0
i=0
k=0 k=0
do j=1,nsym j0=0
f=f0 ndata=nsym*96000.d0*samfac*tsymbol
if(nspecial.ne.0 .and. mod(j,2).eq.0) f=f0+10*nspecial*dfgen
if(nspecial.eq.0 .and. flip*pr(j).lt.0.0) then do i=1,ndata
k=k+1 t=t+dt
f=f0+(sent(k)+2)*dfgen j=int(t/tsymbol) + 1 !Symbol number, 1-126
if(j.ne.j0) then
f=f0
if(nspecial.ne.0 .and. mod(j,2).eq.0) f=f0+10*nspecial*dfgen
if(nspecial.eq.0 .and. flip*pr(j).lt.0.0) then
k=k+1
f=f0+(sent(k)+2)*dfgen
endif
dphi=twopi*dt*f
j0=j
endif endif
dphi=twopi*dt*f phi=phi+dphi
do ii=1,nsps if(phi.gt.twopi) phi=phi-twopi
phi=phi+dphi xphi=phi
if(phi.gt.twopi) phi=phi-twopi cwave(i)=cmplx(cos(xphi),-sin(xphi))
xphi=phi
i=i+1
! iwave(i)=32767.0*sin(xphi)
cwave(i)=cmplx(cos(xphi),-sin(xphi))
enddo
enddo enddo
cwave(nsym*nsps+1:)=0 cwave(ndata+1:)=0
nwave=nsym*nsps + 5512 nwave=ndata + 48000
call unpackmsg(dgen,msgsent) call unpackmsg(dgen,msgsent)
if(flip.lt.0.0) then if(flip.lt.0.0) then
do i=22,1,-1 do i=22,1,-1
@ -92,5 +93,5 @@ subroutine cgen65(message,mode65,samfac,nsendingsh,msgsent,cwave,nwave)
if(nspecial.eq.4) msgsent='73' if(nspecial.eq.4) msgsent='73'
endif endif
900 return return
end subroutine cgen65 end subroutine cgen65

View File

@ -9,7 +9,7 @@ program mapsim
complex cwave(NMAX) !Generated complex waveform (no noise) complex cwave(NMAX) !Generated complex waveform (no noise)
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 msg0*22,message*22,msgsent*22,arg*8,fname*14,mode*2 character msg0*22,message*22,msgsent*22,arg*8,fname*13,mode*2
nargs=iargc() nargs=iargc()
if(nargs.ne.9) then if(nargs.ne.9) then
@ -51,6 +51,8 @@ program mapsim
mode65=1 mode65=1
if(mode(1:1).eq.'B') mode65=2 if(mode(1:1).eq.'B') mode65=2
if(mode(1:1).eq.'C') mode65=4 if(mode(1:1).eq.'C') mode65=4
nfast=1
if(mode(2:2).eq.'2') nfast=2
open(12,file='msgs.txt',status='old') open(12,file='msgs.txt',status='old')
write(*,1000) write(*,1000)
@ -68,7 +70,7 @@ program mapsim
call noisegen(d4,NMAX) !Generate Gaussuian noise call noisegen(d4,NMAX) !Generate Gaussuian noise
if(msg0.ne.' ') then if(msg0.ne.' ') then
call cgen65(message,mode65,samfac,nsendingsh,msgsent,cwave,nwave) call cgen65(message,mode65,nfast,samfac,nsendingsh,msgsent,cwave,nwave)
endif endif
rewind 12 rewind 12
@ -77,7 +79,8 @@ program mapsim
if(msg0.eq.' ') then if(msg0.eq.' ') then
read(12,1004) message read(12,1004) message
1004 format(a22) 1004 format(a22)
call cgen65(message,mode65,samfac,nsendingsh,msgsent,cwave,nwave) call cgen65(message,mode65,nfast,samfac,nsendingsh,msgsent, &
cwave,nwave)
endif endif
if(npol.lt.0) pol=(isig-1)*180.0/nsigs if(npol.lt.0) pol=(isig-1)*180.0/nsigs
@ -89,7 +92,7 @@ program mapsim
snrdbx=snrdb snrdbx=snrdb
if(snrdb.ge.-1.0) snrdbx=-15.0 - 15.0*(isig-1.0)/nsigs if(snrdb.ge.-1.0) snrdbx=-15.0 - 15.0*(isig-1.0)/nsigs
sig=sqrt(2.2*2500.0/96000.0) * 10.0**(0.05*snrdbx) sig=sqrt(2.2*2500.0/96000.0) * 10.0**(0.05*snrdbx)
write(*,1020) isig,0.001*f,snrdbx,nint(pol),message write(*,1020) isig,0.001*f,snrdbx,nint(pol),msgsent
1020 format(i3,f8.3,f7.1,i5,2x,a22) 1020 format(i3,f8.3,f7.1,i5,2x,a22)
phi=0. phi=0.

View File

@ -1,4 +1,4 @@
//-------------------------------------------------------------- MainWindow //--------------------------------------------------------------- MainWindow
#include "mainwindow.h" #include "mainwindow.h"
#include "ui_mainwindow.h" #include "ui_mainwindow.h"
#include "devsetup.h" #include "devsetup.h"
@ -981,6 +981,8 @@ void MainWindow::on_actionOpen_next_in_directory_triggered() //Open Next
} }
for (i = 0; i < list.size()-1; ++i) { for (i = 0; i < list.size()-1; ++i) {
if(i==list.size()-2) m_loopall=false; if(i==list.size()-2) m_loopall=false;
qDebug() << len << m_path;
if(list.at(i)==m_path.right(len)) { if(list.at(i)==m_path.right(len)) {
int n=m_path.length(); int n=m_path.length();
QString fname=m_path.replace(n-len,len,list.at(i+1)); QString fname=m_path.replace(n-len,len,list.at(i+1));