mirror of
				https://github.com/saitohirga/WSJT-X.git
				synced 2025-10-30 20:40:28 -04:00 
			
		
		
		
	Allow q65sim toi generate multiple signals.
This commit is contained in:
		
							parent
							
								
									37cd5b3ede
								
							
						
					
					
						commit
						6877a87fe4
					
				| @ -8,6 +8,7 @@ program q65sim | |||||||
|   type(hdr) h                            !Header for .wav file |   type(hdr) h                            !Header for .wav file | ||||||
|   integer*2 iwave(NMAX)                  !Generated waveform |   integer*2 iwave(NMAX)                  !Generated waveform | ||||||
|   integer itone(85)                      !Channel symbols (values 0-65) |   integer itone(85)                      !Channel symbols (values 0-65) | ||||||
|  |   integer ntone(85,10)                   !Channel symbols for up to 10 messages | ||||||
|   integer y(63)                          !Codeword |   integer y(63)                          !Codeword | ||||||
|   integer istart                         !averaging compatible start seconds |   integer istart                         !averaging compatible start seconds | ||||||
|   integer imins                          !minutes for 15s period timestamp |   integer imins                          !minutes for 15s period timestamp | ||||||
| @ -18,18 +19,19 @@ program q65sim | |||||||
|   complex cspread(0:NMAX-1)              !Complex amplitude for Rayleigh fading  |   complex cspread(0:NMAX-1)              !Complex amplitude for Rayleigh fading  | ||||||
|   complex z |   complex z | ||||||
|   real*8 f0,dt,twopi,phi,dphi,baud,fsample,freq |   real*8 f0,dt,twopi,phi,dphi,baud,fsample,freq | ||||||
|   character msg*37,fname*17,csubmode*1,arg*12 |   character fname*17,csubmode*1,arg*12,c2*2 | ||||||
|   character msgsent*37 |   character*37 msg,msgsent,imsg(10) | ||||||
|    |    | ||||||
|   nargs=iargc() |   nargs=iargc() | ||||||
|   if(nargs.ne.10) then |   if(nargs.ne.11) then | ||||||
|      print*,'Usage:   q65sim         "msg"     A-E freq fDop DT  f1 Stp TRp Nfile SNR' |      print*,'Usage:   q65sim         "msg"     A-E freq fDop DT  f1 Stp TRp Nsig Nfile SNR' | ||||||
|      print*,'Example: q65sim "K1ABC W9XYZ EN37" A  1500 0.0 0.0 0.0  1   60   1   -26' |      print*,'Example: q65sim "K1ABC W9XYZ EN37" A  1500 0.0 0.0 0.0  1   60   1    1   -26' | ||||||
|      print*,'Example: q65sim "ST" A  1500 0.0 0.0 0.0  1   60   1   -26' |      print*,'Example: q65sim "ST" A  1500 0.0 0.0 0.0  1   60   1   -26' | ||||||
|      print*,'         fDop = Doppler spread' |      print*,'         fDop = Doppler spread' | ||||||
|      print*,'         f1   = Drift or Doppler rate (Hz/min)' |      print*,'         f1   = Drift or Doppler rate (Hz/min)' | ||||||
|      print*,'         Stp  = Step size (Hz)' |      print*,'         Stp  = Step size (Hz)' | ||||||
|      print*,'         Stp  = 0 implies no Doppler tracking' |      print*,'         Stp  = 0 implies no Doppler tracking' | ||||||
|  |      print*,'         Nsig = number of generated signals, 1 - 10' | ||||||
|      print*,'         Creates filenames which increment to permit averaging in first period' |      print*,'         Creates filenames which increment to permit averaging in first period' | ||||||
|      print*,'         If msg = ST program produces a single tone at freq' |      print*,'         If msg = ST program produces a single tone at freq' | ||||||
|      go to 999 |      go to 999 | ||||||
| @ -50,8 +52,10 @@ program q65sim | |||||||
|   call getarg(8,arg) |   call getarg(8,arg) | ||||||
|   read(arg,*) ntrperiod |   read(arg,*) ntrperiod | ||||||
|   call getarg(9,arg) |   call getarg(9,arg) | ||||||
|   read(arg,*) nfiles |   read(arg,*) nsig | ||||||
|   call getarg(10,arg) |   call getarg(10,arg) | ||||||
|  |   read(arg,*) nfiles | ||||||
|  |   call getarg(11,arg) | ||||||
|   read(arg,*) snrdb |   read(arg,*) snrdb | ||||||
| 
 | 
 | ||||||
|   if(ntrperiod.eq.15) then |   if(ntrperiod.eq.15) then | ||||||
| @ -79,22 +83,39 @@ program q65sim | |||||||
|   nsym=85                            !Number of channel symbols |   nsym=85                            !Number of channel symbols | ||||||
|   mode65=2**(ichar(csubmode) - ichar('A')) |   mode65=2**(ichar(csubmode) - ichar('A')) | ||||||
| 
 | 
 | ||||||
|   ichk=0 |    | ||||||
|   call genq65(msg,ichk,msgsent,itone,i3,n3) |   imsg(1)=msg | ||||||
|  |   if(nsig.ge.2) then | ||||||
|  |      i0=index(msg,' ') | ||||||
|  |      i0=i0 + index(msg(i0+1:),' ')-2 | ||||||
|  |      do i=1,nsig | ||||||
|  |         c2=char(ichar('A')+i-1)//char(ichar('A')+i-1) | ||||||
|  |         imsg(i)=msg(1:i0-1)//c2//msg(i0+2:) | ||||||
|  |      enddo | ||||||
|  |   endif | ||||||
| 
 | 
 | ||||||
|   j=0 |   ichk=0 | ||||||
|   do i=1,85 |   do i=1,nsig | ||||||
|      if(itone(i).gt.0) then |      msg=imsg(i) | ||||||
|         j=j+1 |      call genq65(msg,ichk,msgsent,itone,i3,n3) | ||||||
|         y(j)=itone(i)-1 |      ntone(:,i)=itone | ||||||
|      endif |  | ||||||
|   enddo |   enddo | ||||||
|   write(*,1001) y(1:13),y(1:13) | 
 | ||||||
|  |   if(nsig.eq.1) then | ||||||
|  |      j=0 | ||||||
|  |      do i=1,85 | ||||||
|  |         if(itone(i).gt.0) then | ||||||
|  |            j=j+1 | ||||||
|  |            y(j)=itone(i)-1 | ||||||
|  |         endif | ||||||
|  |      enddo | ||||||
|  |      write(*,1001) y(1:13),y(1:13) | ||||||
| 1001 format('Generated message'/'6-bit:  ',13i3/'binary: ',13b6.6) | 1001 format('Generated message'/'6-bit:  ',13i3/'binary: ',13b6.6) | ||||||
|   write(*,1002) y |      write(*,1002) y | ||||||
| 1002 format(/'Codeword:'/(20i3)) | 1002 format(/'Codeword:'/(20i3)) | ||||||
|   write(*,1003) itone |      write(*,1003) itone | ||||||
| 1003 format(/'Channel symbols:'/(20i3)) | 1003 format(/'Channel symbols:'/(20i3)) | ||||||
|  |   endif | ||||||
| 
 | 
 | ||||||
|   baud=12000.d0/nsps                 !Keying rate (6.67 baud fot 15-s sequences) |   baud=12000.d0/nsps                 !Keying rate (6.67 baud fot 15-s sequences) | ||||||
|   h=default_header(12000,npts) |   h=default_header(12000,npts) | ||||||
| @ -116,43 +137,53 @@ program q65sim | |||||||
| 
 | 
 | ||||||
|      open(10,file=trim(fname),access='stream',status='unknown') |      open(10,file=trim(fname),access='stream',status='unknown') | ||||||
|      xnoise=0. |      xnoise=0. | ||||||
|      cdat=0. |  | ||||||
|      if(snrdb.lt.90) then |      if(snrdb.lt.90) then | ||||||
|         do i=1,npts |         do i=1,npts | ||||||
|            xnoise(i)=gran()          !Generate gaussian noise |            xnoise(i)=gran()          !Generate gaussian noise | ||||||
|         enddo |         enddo | ||||||
|      endif |      endif | ||||||
|  |      cdat=0. | ||||||
| 
 | 
 | ||||||
|      bandwidth_ratio=2500.0/6000.0 |      bandwidth_ratio=2500.0/6000.0 | ||||||
|      sig=sqrt(2*bandwidth_ratio)*10.0**(0.05*snrdb) |      sig=sqrt(2*bandwidth_ratio)*10.0**(0.05*snrdb) | ||||||
|      if(snrdb.gt.90.0) sig=1.0 |      if(snrdb.gt.90.0) sig=1.0 | ||||||
|      write(*,1020) ifile,ntrperiod,f0,csubmode,snrdb,fspread,xdt,f1,nstp,trim(msgsent) |      write(*,1020) ifile,ntrperiod,f0,csubmode,snrdb,fspread,xdt,f1,nstp,trim(msgsent) | ||||||
| 1020    format(i4,i6,f7.1,2x,a1,2x,f5.1,1x,f6.2,2f6.1,i4,2x,a) | 1020 format(i4,i6,f7.1,2x,a1,2x,f5.1,1x,f6.2,2f6.1,i4,2x,a) | ||||||
|      phi=0.d0 | 
 | ||||||
|      dphi=0.d0 |      n=65.0*baud*mode65/100.0 + 0.9999 | ||||||
|      k=(xdt+0.5)*12000                   !Start audio at t=xdt+0.5 s (TR=15 and 30 s) |      nfstep=100*n | ||||||
|      if(ntrperiod.ge.60) k=(xdt+1.0)*12000   !TR 60+ at t = xdt + 1.0 s |      nf1=1500 - nfstep*nsig/2 | ||||||
|      isym0=-99 |      do n=1,nsig | ||||||
|      do i=1,npts                         !Add this signal into cdat() |         if(nsig.ge.2) then | ||||||
|         isym=i/nsps + 1 |            f0=nf1 + (n-1)*nfstep | ||||||
|         if(isym.gt.nsym) exit |            itone=ntone(:,n) | ||||||
|         if(isym.ne.isym0) then |  | ||||||
|            freq_drift=f1*i*dt/60.0 |  | ||||||
|            if(nstp.ne.0) freq_drift=freq_drift - nstp*nint(freq_drift/nstp) |  | ||||||
|                 if (msg(1:2).eq.'ST') then |  | ||||||
|                    freq = f0 + freq_drift |  | ||||||
|                 else |  | ||||||
|                    freq = f0 + freq_drift + itone(isym)*baud*mode65 |  | ||||||
|                 endif |  | ||||||
|            dphi=twopi*freq*dt |  | ||||||
|            isym0=isym |  | ||||||
|         endif |         endif | ||||||
|         phi=phi + dphi |         phi=0.d0 | ||||||
|         if(phi.gt.twopi) phi=phi-twopi |         dphi=0.d0 | ||||||
|         xphi=phi |         k=(xdt+0.5)*12000                   !Start audio at t=xdt+0.5 s (TR=15 and 30 s) | ||||||
|         z=cmplx(cos(xphi),sin(xphi)) |         if(ntrperiod.ge.60) k=(xdt+1.0)*12000   !TR 60+ at t = xdt + 1.0 s | ||||||
|         k=k+1 |         isym0=-99 | ||||||
|         if(k.ge.1) cdat(k)=cdat(k) + sig*z |         do i=1,npts                         !Add this signal into cdat() | ||||||
|  |            isym=i/nsps + 1 | ||||||
|  |            if(isym.gt.nsym) exit | ||||||
|  |            if(isym.ne.isym0) then | ||||||
|  |               freq_drift=f1*i*dt/60.0 | ||||||
|  |               if(nstp.ne.0) freq_drift=freq_drift - nstp*nint(freq_drift/nstp) | ||||||
|  |               if (msg(1:2).eq.'ST') then | ||||||
|  |                  freq = f0 + freq_drift | ||||||
|  |               else | ||||||
|  |                  freq = f0 + freq_drift + itone(isym)*baud*mode65 | ||||||
|  |               endif | ||||||
|  |               dphi=twopi*freq*dt | ||||||
|  |               isym0=isym | ||||||
|  |            endif | ||||||
|  |            phi=phi + dphi | ||||||
|  |            if(phi.gt.twopi) phi=phi-twopi | ||||||
|  |            xphi=phi | ||||||
|  |            z=cmplx(cos(xphi),sin(xphi)) | ||||||
|  |            k=k+1 | ||||||
|  |            if(k.ge.1) cdat(k)=cdat(k) + sig*z | ||||||
|  |         enddo | ||||||
|      enddo |      enddo | ||||||
|       |       | ||||||
|      if(fspread.ne.0) then                  !Apply specified Doppler spread |      if(fspread.ne.0) then                  !Apply specified Doppler spread | ||||||
|  | |||||||
| @ -35,7 +35,7 @@ program sumsim | |||||||
|   fac=1.0/nargs |   fac=1.0/nargs | ||||||
|   iwave(1:npts)=nint(fac*wave(1:npts)) |   iwave(1:npts)=nint(fac*wave(1:npts)) | ||||||
|    |    | ||||||
|   open(12,file='000000_0000.wav',access='stream',status='unknown') |   open(12,file='000001_0000.wav',access='stream',status='unknown') | ||||||
|   write(12) h,iwave(1:npts) |   write(12) h,iwave(1:npts) | ||||||
|   close(12) |   close(12) | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user