2017-07-08 14:06:48 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								module ft8_decode
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2017-10-30 20:47:08 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  parameter (MAXFOX=1000)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  character*12 c2fox(MAXFOX)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  character*4  g2fox(MAXFOX)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  integer nsnrfox(MAXFOX)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  integer nfreqfox(MAXFOX)
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-19 17:01:38 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  integer n30fox(MAXFOX)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  integer n30z
							 | 
						
					
						
							
								
									
										
										
										
											2017-10-30 20:47:08 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  integer nfox
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-20 10:11:08 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2017-07-08 14:06:48 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  type :: ft8_decoder
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								     procedure(ft8_decode_callback), pointer :: callback
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								   contains
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								     procedure :: decode
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  end type ft8_decoder
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  abstract interface
							 | 
						
					
						
							
								
									
										
										
										
											2017-07-22 17:12:48 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     subroutine ft8_decode_callback (this,sync,snr,dt,freq,decoded,nap,qual)
							 | 
						
					
						
							
								
									
										
										
										
											2017-07-08 14:06:48 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								       import ft8_decoder
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								       implicit none
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								       class(ft8_decoder), intent(inout) :: this
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								       real, intent(in) :: sync
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								       integer, intent(in) :: snr
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								       real, intent(in) :: dt
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								       real, intent(in) :: freq
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-19 20:01:06 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								       character(len=37), intent(in) :: decoded
							 | 
						
					
						
							
								
									
										
										
										
											2017-07-22 17:12:48 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								       integer, intent(in) :: nap 
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								       real, intent(in) :: qual 
							 | 
						
					
						
							
								
									
										
										
										
											2017-07-08 14:06:48 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     end subroutine ft8_decode_callback
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  end interface
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								contains
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-04 00:46:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  subroutine decode(this,callback,iwave,nQSOProgress,nfqso,nftx,newdat,  &
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-06 11:43:52 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								       nutc,nfa,nfb,nzhsym,ndepth,emedelay,ncontest,nagain,lft8apon,     &
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								       lapcqonly,napwid,mycall12,hiscall12,ldiskdat)
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-16 10:27:22 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    use iso_c_binding, only: c_bool, c_int
							 | 
						
					
						
							
								
									
										
										
										
											2017-07-08 14:06:48 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    use timer_module, only: timer
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-16 10:27:22 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    use shmem, only: shmem_lock, shmem_unlock
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2017-10-30 21:30:14 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    include 'ft8/ft8_params.f90'
							 | 
						
					
						
							
								
									
										
										
										
											2017-07-08 14:06:48 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    class(ft8_decoder), intent(inout) :: this
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    procedure(ft8_decode_callback) :: callback
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-13 15:05:37 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    parameter (MAXCAND=300,MAX_EARLY=100)
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-16 12:11:56 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    real*8 tsec,tseq
							 | 
						
					
						
							
								
									
										
										
										
											2017-07-08 14:06:48 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    real s(NH1,NHSYM)
							 | 
						
					
						
							
								
									
										
										
										
											2017-08-26 16:30:47 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    real sbase(NH1)
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-05 11:59:48 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    real candidate(3,MAXCAND)
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-06 10:38:24 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    real dd(15*12000),dd1(15*12000)
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-05 14:40:55 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    logical, intent(in) :: lft8apon,lapcqonly,nagain
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-06 11:54:28 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    logical newdat,lsubtract,ldupe,lrefinedt
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-12 15:07:56 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    logical*1 ldiskdat
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-06 10:38:24 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    logical lsubtracted(MAX_EARLY)
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-03 10:48:51 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    character*12 mycall12,hiscall12
							 | 
						
					
						
							
								
									
										
										
										
											2017-07-08 14:06:48 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    integer*2 iwave(15*12000)
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-03 10:48:51 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    integer apsym2(58),aph10(10)
							 | 
						
					
						
							
								
									
										
										
										
											2018-07-25 15:19:57 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    character datetime*13,msg37*37
							 | 
						
					
						
							
								
									
										
										
										
											2018-07-04 16:20:12 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    character*37 allmessages(100)
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-16 12:11:56 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    character*12 ctime
							 | 
						
					
						
							
								
									
										
										
										
											2017-07-20 21:08:36 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    integer allsnrs(100)
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-13 15:05:37 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    integer itone(NN)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    integer itone_save(NN,MAX_EARLY)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    real f1_save(MAX_EARLY)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    real xdt_save(MAX_EARLY)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-04-17 10:56:24 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    save s,dd,dd1,ndec_early,itone_save,f1_save,xdt_save,lsubtracted,allmessages
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    
							 | 
						
					
						
							
								
									
										
										
										
											2017-07-08 14:06:48 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    this%callback => callback
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    write(datetime,1001) nutc        !### TEMPORARY ###
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								1001 format("000000_",i6.6)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-14 11:40:42 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    if(ndepth.eq.1 .and. nzhsym.lt.50) then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								       ndec_early=0
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								       return
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    endif
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if(ndepth.eq.1 .and. nzhsym.eq.50) then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								       dd=iwave
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    endif
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-03 10:48:51 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    call ft8apset(mycall12,hiscall12,ncontest,apsym2,aph10)
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-14 11:40:42 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-04-17 10:56:24 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    if(nzhsym.le.47) then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								       dd=iwave
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								       dd1=dd
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    endif
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-05 15:37:31 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    if(nzhsym.eq.41) then
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-13 15:05:37 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								       ndecodes=0
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								       allmessages='                                     '
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								       allsnrs=0
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    else
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								       ndecodes=ndec_early
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    endif
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-02 13:17:32 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    if(nzhsym.eq.47 .and. ndec_early.eq.0) then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								       dd1=dd
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								       go to 800
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    endif
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-06 10:38:24 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    if(nzhsym.eq.47 .and. ndec_early.ge.1) then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								       lsubtracted=.false.
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-06 11:54:28 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								       lrefinedt=.true.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								       if(ndepth.le.2) lrefinedt=.false.
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-06 10:38:24 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								       call timer('sub_ft8b',0)
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-13 15:05:37 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								       do i=1,ndec_early
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-06 10:38:24 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								          if(xdt_save(i)-0.5.lt.0.396) then
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-12 13:00:42 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								             call subtractft8(dd,itone_save(1,i),f1_save(i),xdt_save(i),  &
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                  lrefinedt)
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-06 10:38:24 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								             lsubtracted(i)=.true.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          endif
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-16 12:11:56 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								          call timestamp(tsec,tseq,ctime)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          if(.not.ldiskdat .and. tseq.ge.14.3d0) then !Bail out before done
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-12 13:00:42 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								             call timer('sub_ft8b',1)
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-12 15:36:03 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								             dd1=dd
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-19 14:46:41 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								             go to 800
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-12 13:00:42 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								          endif
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-06 10:38:24 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								       enddo
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								       call timer('sub_ft8b',1)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								       dd1=dd
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								       go to 900
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    endif
							 | 
						
					
						
							
								
									
										
										
										
											2020-12-26 09:46:19 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    if(nzhsym.eq.50 .and. ndec_early.ge.1 .and. .not.nagain) then
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-06 10:38:24 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								       n=47*3456
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								       dd(1:n)=dd1(1:n)
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-06 19:02:41 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								       dd(n+1:)=iwave(n+1:)
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-06 10:38:24 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								       call timer('sub_ft8c',0)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								       do i=1,ndec_early
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          if(lsubtracted(i)) cycle
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-24 16:18:42 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								          call subtractft8(dd,itone_save(1,i),f1_save(i),xdt_save(i),.true.)
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-13 15:05:37 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								       enddo
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-06 10:38:24 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								       call timer('sub_ft8c',1)
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-13 15:05:37 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    endif
							 | 
						
					
						
							
								
									
										
										
										
											2017-08-02 14:05:37 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    ifa=nfa
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    ifb=nfb
							 | 
						
					
						
							
								
									
										
										
										
											2020-12-26 09:46:19 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    if(nzhsym.eq.50 .and. nagain) then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								       dd=iwave
							 | 
						
					
						
							
								
									
										
										
										
											2020-12-25 12:31:02 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								       ifa=nfqso-20
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								       ifb=nfqso+20
							 | 
						
					
						
							
								
									
										
										
										
											2017-08-02 14:05:37 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    endif
							 | 
						
					
						
							
								
									
										
										
										
											2017-07-20 21:08:36 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2017-07-12 21:49:39 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								! For now:
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-14 11:40:42 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								! ndepth=1: 1 pass, bp  
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-06 11:54:28 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								! ndepth=2: subtraction, 3 passes, bp+osd (no subtract refinement) 
							 | 
						
					
						
							
								
									
										
										
										
											2017-08-31 20:16:38 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								! ndepth=3: subtraction, 3 passes, bp+osd
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-17 08:51:37 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    npass=3
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-14 11:40:42 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    if(ndepth.eq.1) npass=1
							 | 
						
					
						
							
								
									
										
										
										
											2017-07-12 21:49:39 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    do ipass=1,npass
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-08 12:03:52 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      newdat=.true.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      syncmin=1.3
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-15 13:56:35 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      if(ndepth.le.2) syncmin=1.6
							 | 
						
					
						
							
								
									
										
										
										
											2017-07-12 21:49:39 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      if(ipass.eq.1) then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        lsubtract=.true.
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-17 08:51:37 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        ndeep=ndepth
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        if(ndepth.eq.3) ndeep=2
							 | 
						
					
						
							
								
									
										
										
										
											2017-08-22 00:14:51 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      elseif(ipass.eq.2) then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        n2=ndecodes
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        if(ndecodes.eq.0) cycle
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        lsubtract=.true.
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-17 08:51:37 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        ndeep=ndepth
							 | 
						
					
						
							
								
									
										
										
										
											2017-08-22 00:14:51 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      elseif(ipass.eq.3) then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        if((ndecodes-n2).eq.0) cycle
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-08 12:03:52 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        lsubtract=.true. 
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-09 09:38:48 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        ndeep=ndepth
							 | 
						
					
						
							
								
									
										
										
										
											2017-07-12 21:49:39 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      endif 
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      call timer('sync8   ',0)
							 | 
						
					
						
							
								
									
										
										
										
											2018-08-08 16:05:21 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      maxc=MAXCAND
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-05 14:40:55 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      call sync8(dd,ifa,ifb,syncmin,nfqso,maxc,s,candidate,   &
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-05 11:59:48 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								           ncand,sbase)
							 | 
						
					
						
							
								
									
										
										
										
											2017-07-12 21:49:39 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      call timer('sync8   ',1)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      do icand=1,ncand
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        sync=candidate(3,icand)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        f1=candidate(1,icand)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        xdt=candidate(2,icand)
							 | 
						
					
						
							
								
									
										
										
										
											2017-08-26 16:30:47 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        xbase=10.0**(0.1*(sbase(nint(f1/3.125))-40.0))
							 | 
						
					
						
							
								
									
										
										
										
											2020-04-17 10:56:24 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        msg37='                                     '
							 | 
						
					
						
							
								
									
										
										
										
											2017-07-12 21:49:39 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        call timer('ft8b    ',0)
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-19 11:27:57 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        call ft8b(dd,newdat,nQSOProgress,nfqso,nftx,ndeep,nzhsym,lft8apon,  &
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-05 11:59:48 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								             lapcqonly,napwid,lsubtract,nagain,ncontest,iaptype,mycall12,   &
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-19 11:27:57 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								             hiscall12,f1,xdt,xbase,apsym2,aph10,nharderrors,dmin,          &
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								             nbadcrc,iappass,msg37,xsnr,itone)
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-05 11:59:48 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        call timer('ft8b    ',1)
							 | 
						
					
						
							
								
									
										
										
										
											2017-07-16 17:08:09 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        nsnr=nint(xsnr) 
							 | 
						
					
						
							
								
									
										
										
										
											2017-07-18 15:22:20 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        xdt=xdt-0.5
							 | 
						
					
						
							
								
									
										
										
										
											2017-07-20 15:15:00 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        hd=nharderrors+dmin
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        if(nbadcrc.eq.0) then
							 | 
						
					
						
							
								
									
										
										
										
											2017-08-09 15:22:54 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								           ldupe=.false.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								           do id=1,ndecodes
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-17 10:53:52 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								              if(msg37.eq.allmessages(id)) ldupe=.true.
							 | 
						
					
						
							
								
									
										
										
										
											2017-08-09 15:22:54 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								           enddo
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								           if(.not.ldupe) then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								              ndecodes=ndecodes+1
							 | 
						
					
						
							
								
									
										
										
										
											2018-07-04 16:20:12 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								              allmessages(ndecodes)=msg37
							 | 
						
					
						
							
								
									
										
										
										
											2017-08-09 15:22:54 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								              allsnrs(ndecodes)=nsnr
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-13 15:05:37 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								              f1_save(ndecodes)=f1
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-14 10:15:37 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								              xdt_save(ndecodes)=xdt+0.5
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-13 15:05:37 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								              itone_save(1:NN,ndecodes)=itone
							 | 
						
					
						
							
								
									
										
										
										
											2017-08-09 15:22:54 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								           endif
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								           if(.not.ldupe .and. associated(this%callback)) then
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								              qual=1.0-(nharderrors+dmin)/60.0 ! scale qual to [0.0,1.0]
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-06 11:43:52 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								              if(emedelay.ne.0) xdt=xdt+2.0
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-19 20:01:06 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								              call this%callback(sync,nsnr,xdt,f1,msg37,iaptype,qual)
							 | 
						
					
						
							
								
									
										
										
										
											2017-07-20 15:15:00 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								           endif
							 | 
						
					
						
							
								
									
										
										
										
											2017-07-14 16:02:01 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        endif
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-16 12:11:56 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        call timestamp(tsec,tseq,ctime)
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-12 15:07:56 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        if(.not.ldiskdat .and. nzhsym.eq.41 .and.                        &
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-19 14:46:41 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								             tseq.ge.13.4d0) go to 800                 !Bail out before done
							 | 
						
					
						
							
								
									
										
										
										
											2020-04-17 10:56:24 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      enddo  ! icand
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								   enddo  ! ipass
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-16 12:11:56 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-10 16:26:42 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								800 ndec_early=0
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-13 15:05:37 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								   if(nzhsym.lt.50) ndec_early=ndecodes
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								   
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-06 10:38:24 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								900 return
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-13 15:05:37 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								end subroutine decode
							 | 
						
					
						
							
								
									
										
										
										
											2017-07-08 14:06:48 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-16 12:11:56 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								subroutine timestamp(tsec,tseq,ctime)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  real*8 tsec,tseq
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  character*12 ctime
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  integer itime(8)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  call date_and_time(values=itime)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  tsec=3600.d0*(itime(5)-itime(4)/60.d0) + 60.d0*itime(6) +      &
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								       itime(7) + 0.001d0*itime(8)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  tsec=mod(tsec+2*86400.d0,86400.d0)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  tseq=mod(itime(7)+0.001d0*itime(8),15.d0)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if(tseq.lt.10.d0) tseq=tseq+15.d0
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  sec=itime(7)+0.001*itime(8)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  write(ctime,1000) itime(5)-itime(4)/60,itime(6),sec
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								1000 format(i2.2,':',i2.2,':',f6.3)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if(ctime(7:7).eq.' ') ctime(7:7)='0'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								end subroutine timestamp
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2017-07-08 14:06:48 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								end module ft8_decode
							 |