| 
									
										
										
										
											2019-11-04 14:38:00 -05:00
										 |  |  | subroutine multimode_decoder(ss,id2,params,nfsample)
 | 
					
						
							| 
									
										
										
										
											2018-02-08 21:28:33 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  |   !$ use omp_lib
 | 
					
						
							|  |  |  |   use prog_args
 | 
					
						
							|  |  |  |   use timer_module, only: timer
 | 
					
						
							| 
									
										
										
										
											2019-12-12 20:35:16 -05:00
										 |  |  |   use js8a_decode
 | 
					
						
							| 
									
										
										
										
											2019-09-05 14:07:24 -04:00
										 |  |  |   use js8b_decode
 | 
					
						
							|  |  |  |   use js8c_decode
 | 
					
						
							| 
									
										
										
										
											2019-11-06 16:00:16 -05:00
										 |  |  |   use js8e_decode
 | 
					
						
							| 
									
										
										
										
											2019-12-09 14:00:23 -05:00
										 |  |  |   use js8i_decode
 | 
					
						
							| 
									
										
										
										
											2018-02-08 21:28:33 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  |   include 'jt9com.f90'
 | 
					
						
							|  |  |  |   include 'timer_common.inc'
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-12 20:35:16 -05:00
										 |  |  |   type, extends(js8a_decoder) :: counting_js8a_decoder
 | 
					
						
							| 
									
										
										
										
											2018-02-08 21:28:33 -05:00
										 |  |  |      integer :: decoded
 | 
					
						
							| 
									
										
										
										
											2019-12-12 20:35:16 -05:00
										 |  |  |   end type counting_js8a_decoder
 | 
					
						
							| 
									
										
										
										
											2018-02-08 21:28:33 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-05 14:07:24 -04:00
										 |  |  |   type, extends(js8b_decoder) :: counting_js8b_decoder
 | 
					
						
							| 
									
										
										
										
											2018-02-08 21:28:33 -05:00
										 |  |  |      integer :: decoded
 | 
					
						
							| 
									
										
										
										
											2019-09-05 14:07:24 -04:00
										 |  |  |   end type counting_js8b_decoder
 | 
					
						
							| 
									
										
										
										
											2018-02-08 21:28:33 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-05 14:07:24 -04:00
										 |  |  |   type, extends(js8c_decoder) :: counting_js8c_decoder
 | 
					
						
							| 
									
										
										
										
											2018-02-08 21:28:33 -05:00
										 |  |  |      integer :: decoded
 | 
					
						
							| 
									
										
										
										
											2019-09-05 14:07:24 -04:00
										 |  |  |   end type counting_js8c_decoder
 | 
					
						
							| 
									
										
										
										
											2018-02-08 21:28:33 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-06 16:00:16 -05:00
										 |  |  |   type, extends(js8e_decoder) :: counting_js8e_decoder
 | 
					
						
							| 
									
										
										
										
											2018-02-08 21:28:33 -05:00
										 |  |  |      integer :: decoded
 | 
					
						
							| 
									
										
										
										
											2019-11-06 16:00:16 -05:00
										 |  |  |   end type counting_js8e_decoder
 | 
					
						
							| 
									
										
										
										
											2018-02-08 21:28:33 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-09 14:00:23 -05:00
										 |  |  |   type, extends(js8i_decoder) :: counting_js8i_decoder
 | 
					
						
							|  |  |  |      integer :: decoded
 | 
					
						
							|  |  |  |   end type counting_js8i_decoder
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-08 21:28:33 -05:00
										 |  |  |   real ss(184,NSMAX)
 | 
					
						
							| 
									
										
										
										
											2019-11-04 14:38:00 -05:00
										 |  |  |   logical baddata,newdat65,newdat9,single_decode,bVHF,bad0,newdat,trydecode
 | 
					
						
							|  |  |  |   integer*2 id0(NTMAX*12000)
 | 
					
						
							|  |  |  |   integer*2 id2(NTMAX*12000)
 | 
					
						
							| 
									
										
										
										
											2018-02-08 21:28:33 -05:00
										 |  |  |   type(params_block) :: params
 | 
					
						
							| 
									
										
										
										
											2018-08-05 11:33:30 -04:00
										 |  |  |   character(len=20) :: datetime
 | 
					
						
							|  |  |  |   character(len=12) :: mycall, hiscall
 | 
					
						
							|  |  |  |   character(len=6) :: mygrid, hisgrid
 | 
					
						
							| 
									
										
										
										
											2018-02-08 21:28:33 -05:00
										 |  |  |   save
 | 
					
						
							| 
									
										
										
										
											2019-12-12 20:35:16 -05:00
										 |  |  |   type(counting_js8a_decoder)  :: my_js8a
 | 
					
						
							| 
									
										
										
										
											2019-09-05 14:07:24 -04:00
										 |  |  |   type(counting_js8b_decoder) :: my_js8b
 | 
					
						
							|  |  |  |   type(counting_js8c_decoder) :: my_js8c
 | 
					
						
							| 
									
										
										
										
											2019-11-06 16:00:16 -05:00
										 |  |  |   type(counting_js8e_decoder) :: my_js8e
 | 
					
						
							| 
									
										
										
										
											2019-12-09 14:00:23 -05:00
										 |  |  |   type(counting_js8i_decoder) :: my_js8i
 | 
					
						
							| 
									
										
										
										
											2018-02-08 21:28:33 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-05 11:33:30 -04:00
										 |  |  |   !cast C character arrays to Fortran character strings
 | 
					
						
							|  |  |  |   datetime=transfer(params%datetime, datetime)
 | 
					
						
							|  |  |  |   mycall=transfer(params%mycall,mycall)
 | 
					
						
							|  |  |  |   hiscall=transfer(params%hiscall,hiscall)
 | 
					
						
							|  |  |  |   mygrid=transfer(params%mygrid,mygrid)
 | 
					
						
							|  |  |  |   hisgrid=transfer(params%hisgrid,hisgrid)
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-08 21:28:33 -05:00
										 |  |  |   ! initialize decode counts
 | 
					
						
							| 
									
										
										
										
											2019-09-05 14:07:24 -04:00
										 |  |  |   my_js8a%decoded = 0
 | 
					
						
							|  |  |  |   my_js8b%decoded = 0
 | 
					
						
							|  |  |  |   my_js8c%decoded = 0
 | 
					
						
							| 
									
										
										
										
											2019-11-06 16:00:16 -05:00
										 |  |  |   my_js8e%decoded = 0
 | 
					
						
							| 
									
										
										
										
											2019-12-09 14:00:23 -05:00
										 |  |  |   my_js8i%decoded = 0
 | 
					
						
							| 
									
										
										
										
											2018-02-08 21:28:33 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  |   single_decode=iand(params%nexp_decode,32).ne.0
 | 
					
						
							|  |  |  |   bVHF=iand(params%nexp_decode,64).ne.0
 | 
					
						
							|  |  |  |   if(mod(params%nranera,2).eq.0) ntrials=10**(params%nranera/2)
 | 
					
						
							|  |  |  |   if(mod(params%nranera,2).eq.1) ntrials=3*10**(params%nranera/2)
 | 
					
						
							|  |  |  |   if(params%nranera.eq.0) ntrials=0
 | 
					
						
							|  |  |  |   
 | 
					
						
							| 
									
										
										
										
											2018-10-20 09:04:03 -04:00
										 |  |  | 10  nfail=0
 | 
					
						
							| 
									
										
										
										
											2018-08-05 11:33:30 -04:00
										 |  |  |   if(params%nmode.eq.8) then
 | 
					
						
							| 
									
										
										
										
											2018-10-20 09:04:03 -04:00
										 |  |  |     n30z=0
 | 
					
						
							|  |  |  |     nwrap=0
 | 
					
						
							|  |  |  |     nfox=0
 | 
					
						
							| 
									
										
										
										
											2018-08-05 11:33:30 -04:00
										 |  |  |   endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-19 10:13:10 -05:00
										 |  |  |   write(*,1012) params%nsubmode, params%nsubmodes
 | 
					
						
							|  |  |  | 1012 format('<DecodeStarted>',2i4)
 | 
					
						
							| 
									
										
										
										
											2019-11-04 14:38:00 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-09 14:00:23 -05:00
										 |  |  |   if(params%nmode.eq.8 .and. (params%nsubmode.eq.8 .or. iand(params%nsubmodes, 16).eq.16)) then
 | 
					
						
							|  |  |  | ! We're in JS8 mode I
 | 
					
						
							|  |  |  |      call timer('decjs8i ',0)
 | 
					
						
							|  |  |  |      newdat=params%newdat
 | 
					
						
							|  |  |  |      write(*,*) '<DecodeDebug> mode I decode started'
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |      ! copy the relevant frames for decoding
 | 
					
						
							|  |  |  |      pos = max(0,params%kposI)
 | 
					
						
							|  |  |  |      sz = max(0,params%kszI)
 | 
					
						
							|  |  |  |      id0=0
 | 
					
						
							|  |  |  |      id0(1:sz+1)=id2(pos+1:pos+sz+1)
 | 
					
						
							|  |  |  |      
 | 
					
						
							|  |  |  |      call my_js8i%decode(js8i_decoded,id0,params%nQSOProgress,params%nfqso,  &
 | 
					
						
							|  |  |  |           params%nftx,newdat,params%nutc,params%nfa,params%nfb,              &
 | 
					
						
							|  |  |  |           params%nexp_decode,params%ndepth,logical(params%nagain),           &
 | 
					
						
							|  |  |  |           logical(params%lft8apon),logical(params%lapcqonly),params%napwid,  &
 | 
					
						
							|  |  |  |           mycall,mygrid,hiscall,hisgrid)
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |      write(*,*) '<DecodeDebug> mode I decode finished'
 | 
					
						
							|  |  |  |      
 | 
					
						
							|  |  |  |      call timer('decjs8i ',1)
 | 
					
						
							|  |  |  |   endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-04 14:38:00 -05:00
										 |  |  |   if(params%nmode.eq.8 .and. (params%nsubmode.eq.4 .or. iand(params%nsubmodes, 8).eq.8)) then
 | 
					
						
							| 
									
										
										
										
											2019-11-06 16:00:16 -05:00
										 |  |  | ! We're in JS8 mode E
 | 
					
						
							|  |  |  |      call timer('decjs8e ',0)
 | 
					
						
							| 
									
										
										
										
											2019-09-05 14:07:24 -04:00
										 |  |  |      newdat=params%newdat
 | 
					
						
							| 
									
										
										
										
											2019-11-19 10:13:10 -05:00
										 |  |  |      write(*,*) '<DecodeDebug> mode E decode started'
 | 
					
						
							| 
									
										
										
										
											2019-11-04 14:38:00 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  |      ! copy the relevant frames for decoding
 | 
					
						
							| 
									
										
										
										
											2019-11-12 09:34:54 -05:00
										 |  |  |      pos = max(0,params%kposE)
 | 
					
						
							|  |  |  |      sz = max(0,params%kszE)
 | 
					
						
							| 
									
										
										
										
											2019-11-04 14:38:00 -05:00
										 |  |  |      id0=0
 | 
					
						
							|  |  |  |      id0(1:sz+1)=id2(pos+1:pos+sz+1)
 | 
					
						
							| 
									
										
										
										
											2019-11-29 20:46:18 -05:00
										 |  |  |      
 | 
					
						
							| 
									
										
										
										
											2019-11-12 09:34:54 -05:00
										 |  |  |      call my_js8e%decode(js8e_decoded,id0,params%nQSOProgress,params%nfqso,  &
 | 
					
						
							| 
									
										
										
										
											2019-09-05 14:07:24 -04:00
										 |  |  |           params%nftx,newdat,params%nutc,params%nfa,params%nfb,              &
 | 
					
						
							|  |  |  |           params%nexp_decode,params%ndepth,logical(params%nagain),           &
 | 
					
						
							|  |  |  |           logical(params%lft8apon),logical(params%lapcqonly),params%napwid,  &
 | 
					
						
							|  |  |  |           mycall,mygrid,hiscall,hisgrid)
 | 
					
						
							| 
									
										
										
										
											2019-11-19 10:13:10 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  |      write(*,*) '<DecodeDebug> mode E decode finished'
 | 
					
						
							|  |  |  |      
 | 
					
						
							| 
									
										
										
										
											2019-11-06 16:00:16 -05:00
										 |  |  |      call timer('decjs8e ',1)
 | 
					
						
							| 
									
										
										
										
											2019-09-05 14:07:24 -04:00
										 |  |  |   endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-04 14:38:00 -05:00
										 |  |  |   if(params%nmode.eq.8 .and. (params%nsubmode.eq.2 .or. iand(params%nsubmodes, 4).eq.4)) then
 | 
					
						
							| 
									
										
										
										
											2019-09-05 14:07:24 -04:00
										 |  |  | ! We're in JS8 mode C
 | 
					
						
							|  |  |  |      call timer('decjs8c ',0)
 | 
					
						
							|  |  |  |      newdat=params%newdat
 | 
					
						
							| 
									
										
										
										
											2019-11-19 10:13:10 -05:00
										 |  |  |      write(*,*) '<DecodeDebug> mode C decode started'
 | 
					
						
							| 
									
										
										
										
											2019-11-04 14:38:00 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  |      ! copy the relevant frames for decoding
 | 
					
						
							| 
									
										
										
										
											2019-11-12 09:34:54 -05:00
										 |  |  |      pos = max(0,params%kposC)
 | 
					
						
							|  |  |  |      sz = max(0,params%kszC)
 | 
					
						
							| 
									
										
										
										
											2019-11-04 14:38:00 -05:00
										 |  |  |      id0=0
 | 
					
						
							|  |  |  |      id0(1:sz+1)=id2(pos+1:pos+sz+1)
 | 
					
						
							|  |  |  |      
 | 
					
						
							| 
									
										
										
										
											2019-11-12 09:34:54 -05:00
										 |  |  |      call my_js8c%decode(js8c_decoded,id0,params%nQSOProgress,params%nfqso,  &
 | 
					
						
							| 
									
										
										
										
											2019-09-05 14:07:24 -04:00
										 |  |  |           params%nftx,newdat,params%nutc,params%nfa,params%nfb,              &
 | 
					
						
							|  |  |  |           params%nexp_decode,params%ndepth,logical(params%nagain),           &
 | 
					
						
							|  |  |  |           logical(params%lft8apon),logical(params%lapcqonly),params%napwid,  &
 | 
					
						
							|  |  |  |           mycall,mygrid,hiscall,hisgrid)
 | 
					
						
							| 
									
										
										
										
											2019-11-19 10:13:10 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  |      write(*,*) '<DecodeDebug> mode C decode finished'
 | 
					
						
							|  |  |  |      
 | 
					
						
							| 
									
										
										
										
											2019-09-05 14:07:24 -04:00
										 |  |  |      call timer('decjs8c ',1)
 | 
					
						
							|  |  |  |   endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-04 14:38:00 -05:00
										 |  |  |   if(params%nmode.eq.8 .and. (params%nsubmode.eq.1 .or. iand(params%nsubmodes, 2).eq.2)) then
 | 
					
						
							| 
									
										
										
										
											2019-09-05 14:07:24 -04:00
										 |  |  | ! We're in JS8 mode B
 | 
					
						
							|  |  |  |      call timer('decjs8b ',0)
 | 
					
						
							|  |  |  |      newdat=params%newdat
 | 
					
						
							| 
									
										
										
										
											2019-11-19 10:13:10 -05:00
										 |  |  |      write(*,*) '<DecodeDebug> mode B decode started'
 | 
					
						
							| 
									
										
										
										
											2019-11-04 14:38:00 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  |      ! copy the relevant frames for decoding
 | 
					
						
							| 
									
										
										
										
											2019-11-12 09:34:54 -05:00
										 |  |  |      pos = max(0,params%kposB)
 | 
					
						
							|  |  |  |      sz = max(0,params%kszB)
 | 
					
						
							| 
									
										
										
										
											2019-11-04 14:38:00 -05:00
										 |  |  |      id0=0
 | 
					
						
							|  |  |  |      id0(1:sz+1)=id2(pos+1:pos+sz+1)
 | 
					
						
							|  |  |  |      
 | 
					
						
							| 
									
										
										
										
											2019-11-12 09:34:54 -05:00
										 |  |  |      call my_js8b%decode(js8b_decoded,id0,params%nQSOProgress,params%nfqso,  &
 | 
					
						
							| 
									
										
										
										
											2019-09-05 14:07:24 -04:00
										 |  |  |           params%nftx,newdat,params%nutc,params%nfa,params%nfb,              &
 | 
					
						
							|  |  |  |           params%nexp_decode,params%ndepth,logical(params%nagain),           &
 | 
					
						
							|  |  |  |           logical(params%lft8apon),logical(params%lapcqonly),params%napwid,  &
 | 
					
						
							|  |  |  |           mycall,mygrid,hiscall,hisgrid)
 | 
					
						
							| 
									
										
										
										
											2019-11-19 10:13:10 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  |      write(*,*) '<DecodeDebug> mode B decode finished'
 | 
					
						
							|  |  |  |      
 | 
					
						
							| 
									
										
										
										
											2019-09-05 14:07:24 -04:00
										 |  |  |      call timer('decjs8b ',1)
 | 
					
						
							|  |  |  |   endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-04 14:38:00 -05:00
										 |  |  |   if(params%nmode.eq.8 .and. (params%nsubmode.eq.0 .or. iand(params%nsubmodes, 1).eq.1)) then
 | 
					
						
							| 
									
										
										
										
											2019-09-05 14:07:24 -04:00
										 |  |  | ! We're in JS8 mode A
 | 
					
						
							|  |  |  |      call timer('decjs8a ',0)
 | 
					
						
							| 
									
										
										
										
											2018-02-08 21:28:33 -05:00
										 |  |  |      newdat=params%newdat
 | 
					
						
							| 
									
										
										
										
											2019-11-19 10:13:10 -05:00
										 |  |  |      write(*,*) '<DecodeDebug> mode A decode started'
 | 
					
						
							| 
									
										
										
										
											2019-11-04 14:38:00 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  |      ! copy the relevant frames for decoding
 | 
					
						
							| 
									
										
										
										
											2019-11-12 09:34:54 -05:00
										 |  |  |      pos = max(0,params%kposA)
 | 
					
						
							|  |  |  |      sz = max(0,params%kszA)
 | 
					
						
							| 
									
										
										
										
											2019-11-04 14:38:00 -05:00
										 |  |  |      id0=0
 | 
					
						
							|  |  |  |      id0(1:sz+1)=id2(pos+1:pos+sz+1)
 | 
					
						
							|  |  |  |      
 | 
					
						
							| 
									
										
										
										
											2019-11-12 09:34:54 -05:00
										 |  |  |      call my_js8a%decode(js8a_decoded,id0,params%nQSOProgress,params%nfqso,  &
 | 
					
						
							| 
									
										
										
										
											2018-02-08 21:28:33 -05:00
										 |  |  |           params%nftx,newdat,params%nutc,params%nfa,params%nfb,              &
 | 
					
						
							|  |  |  |           params%nexp_decode,params%ndepth,logical(params%nagain),           &
 | 
					
						
							| 
									
										
										
										
											2018-03-05 14:49:51 -05:00
										 |  |  |           logical(params%lft8apon),logical(params%lapcqonly),params%napwid,  &
 | 
					
						
							| 
									
										
										
										
											2018-08-05 11:33:30 -04:00
										 |  |  |           mycall,mygrid,hiscall,hisgrid)
 | 
					
						
							| 
									
										
										
										
											2019-11-19 10:13:10 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  |      write(*,*) '<DecodeDebug> mode A decode finished'
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-05 14:07:24 -04:00
										 |  |  |      call timer('decjs8a ',1)
 | 
					
						
							| 
									
										
										
										
											2018-02-08 21:28:33 -05:00
										 |  |  |   endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-19 10:13:10 -05:00
										 |  |  |   write(*,*) '<DecodeDebug> finished'
 | 
					
						
							|  |  |  |   call flush(6)
 | 
					
						
							| 
									
										
										
										
											2018-02-08 21:28:33 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-19 10:13:10 -05:00
										 |  |  |   ndecoded = my_js8a%decoded + my_js8b%decoded + my_js8c%decoded + my_js8e%decoded
 | 
					
						
							| 
									
										
										
										
											2019-11-19 10:39:27 -05:00
										 |  |  |   !call sleep_msec(3000)
 | 
					
						
							| 
									
										
										
										
											2019-11-19 10:13:10 -05:00
										 |  |  |   write(*,1010) ndecoded
 | 
					
						
							|  |  |  | 1010 format('<DecodeFinished>',i4)
 | 
					
						
							| 
									
										
										
										
											2018-02-08 21:28:33 -05:00
										 |  |  |   call flush(6)
 | 
					
						
							|  |  |  |   return
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | contains
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-21 14:01:56 -04:00
										 |  |  |   subroutine js8_decoded (sync,snr,dt,freq,decoded,nap,qual,submode)
 | 
					
						
							| 
									
										
										
										
											2018-02-08 21:28:33 -05:00
										 |  |  |     implicit none
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     real, intent(in) :: sync
 | 
					
						
							|  |  |  |     integer, intent(in) :: snr
 | 
					
						
							|  |  |  |     real, intent(in) :: dt
 | 
					
						
							|  |  |  |     real, intent(in) :: freq
 | 
					
						
							| 
									
										
										
										
											2018-03-05 14:49:51 -05:00
										 |  |  |     character(len=37), intent(in) :: decoded
 | 
					
						
							| 
									
										
										
										
											2019-09-05 14:07:24 -04:00
										 |  |  |     character c1*12,c2*12,g2*4,w*4
 | 
					
						
							| 
									
										
										
										
											2019-11-17 02:14:20 -05:00
										 |  |  |     integer i0,i1,i2,i3,i4,i5,n30,nwrap,n
 | 
					
						
							| 
									
										
										
										
											2018-02-08 21:28:33 -05:00
										 |  |  |     integer, intent(in) :: nap 
 | 
					
						
							|  |  |  |     real, intent(in) :: qual 
 | 
					
						
							| 
									
										
										
										
											2019-10-21 14:01:56 -04:00
										 |  |  |     integer, intent(in) :: submode
 | 
					
						
							|  |  |  |     character*3 m
 | 
					
						
							| 
									
										
										
										
											2018-02-08 21:28:33 -05:00
										 |  |  |     character*2 annot
 | 
					
						
							| 
									
										
										
										
											2018-03-05 14:49:51 -05:00
										 |  |  |     character*37 decoded0
 | 
					
						
							|  |  |  |     logical isgrid4,first,b0,b1,b2
 | 
					
						
							|  |  |  |     data first/.true./
 | 
					
						
							|  |  |  |     save
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     isgrid4(w)=(len_trim(w).eq.4 .and.                                        &
 | 
					
						
							|  |  |  |          ichar(w(1:1)).ge.ichar('A') .and. ichar(w(1:1)).le.ichar('R') .and.  &
 | 
					
						
							|  |  |  |          ichar(w(2:2)).ge.ichar('A') .and. ichar(w(2:2)).le.ichar('R') .and.  &
 | 
					
						
							|  |  |  |          ichar(w(3:3)).ge.ichar('0') .and. ichar(w(3:3)).le.ichar('9') .and.  &
 | 
					
						
							|  |  |  |          ichar(w(4:4)).ge.ichar('0') .and. ichar(w(4:4)).le.ichar('9'))
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if(first) then
 | 
					
						
							|  |  |  |        n30z=0
 | 
					
						
							|  |  |  |        nwrap=0
 | 
					
						
							|  |  |  |        nfox=0
 | 
					
						
							|  |  |  |        first=.false.
 | 
					
						
							|  |  |  |     endif
 | 
					
						
							|  |  |  |     
 | 
					
						
							|  |  |  |     decoded0=decoded
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-08 21:28:33 -05:00
										 |  |  |     annot='  ' 
 | 
					
						
							|  |  |  |     if(nap.ne.0) then
 | 
					
						
							| 
									
										
										
										
											2018-03-05 14:49:51 -05:00
										 |  |  |        write(annot,'(a1,i1)') 'a',nap
 | 
					
						
							|  |  |  |        if(qual.lt.0.17) decoded0(22:22)='?'
 | 
					
						
							| 
									
										
										
										
											2018-02-08 21:28:33 -05:00
										 |  |  |     endif
 | 
					
						
							| 
									
										
										
										
											2018-03-05 14:49:51 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-21 14:01:56 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  |     m = ' ~ '
 | 
					
						
							|  |  |  |     if(submode.eq.0) m=' A '
 | 
					
						
							|  |  |  |     if(submode.eq.1) m=' B '
 | 
					
						
							|  |  |  |     if(submode.eq.2) m=' C '
 | 
					
						
							| 
									
										
										
										
											2019-11-06 16:00:16 -05:00
										 |  |  |     if(submode.eq.4) m=' E '
 | 
					
						
							| 
									
										
										
										
											2019-12-09 14:00:23 -05:00
										 |  |  |     if(submode.eq.8) m=' I '
 | 
					
						
							| 
									
										
										
										
											2019-10-21 14:01:56 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-05 14:49:51 -05:00
										 |  |  |     i0=index(decoded0,';')
 | 
					
						
							| 
									
										
										
										
											2019-10-21 14:01:56 -04:00
										 |  |  |     if(i0.le.0) write(*,1000) params%nutc,snr,dt,nint(freq),m,decoded0(1:22),annot
 | 
					
						
							|  |  |  | 1000 format(i6.6,i4,f5.1,i5,a3,1x,a22,1x,a2)
 | 
					
						
							|  |  |  |     if(i0.gt.0) write(*,1001) params%nutc,snr,dt,nint(freq),m,decoded0
 | 
					
						
							|  |  |  | 1001 format(i6.6,i4,f5.1,i5,a3,1x,a37)
 | 
					
						
							| 
									
										
										
										
											2018-03-05 14:49:51 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  |     i1=index(decoded0,' ')
 | 
					
						
							|  |  |  |     i2=i1 + index(decoded0(i1+1:),' ')
 | 
					
						
							|  |  |  |     i3=i2 + index(decoded0(i2+1:),' ')
 | 
					
						
							|  |  |  |     if(i1.ge.3 .and. i2.ge.7 .and. i3.ge.10) then
 | 
					
						
							|  |  |  |        c1=decoded0(1:i1-1)//'            '
 | 
					
						
							|  |  |  |        c2=decoded0(i1+1:i2-1)
 | 
					
						
							|  |  |  |        g2=decoded0(i2+1:i3-1)
 | 
					
						
							| 
									
										
										
										
											2018-08-05 11:33:30 -04:00
										 |  |  |        b0=c1.eq.mycall
 | 
					
						
							|  |  |  |        if(c1(1:3).eq.'DE ' .and. index(c2,'/').ge.2) b0=.true.
 | 
					
						
							|  |  |  |        if(len(trim(c1)).ne.len(trim(mycall))) then
 | 
					
						
							|  |  |  |           i4=index(trim(c1),trim(mycall))
 | 
					
						
							|  |  |  |           i5=index(trim(mycall),trim(c1))
 | 
					
						
							| 
									
										
										
										
											2018-03-05 14:49:51 -05:00
										 |  |  |           if(i4.ge.1 .or. i5.ge.1) b0=.true.
 | 
					
						
							|  |  |  |        endif
 | 
					
						
							|  |  |  |        b1=i3-i2.eq.5 .and. isgrid4(g2)
 | 
					
						
							|  |  |  |        b2=i3-i2.eq.1
 | 
					
						
							|  |  |  |        if(b0 .and. (b1.or.b2) .and. nint(freq).ge.1000) then
 | 
					
						
							|  |  |  |           n=params%nutc
 | 
					
						
							|  |  |  |           n30=(3600*(n/10000) + 60*mod((n/100),100) + mod(n,100))/30
 | 
					
						
							|  |  |  |           if(n30.lt.n30z) nwrap=nwrap+5760    !New UTC day, handle the wrap
 | 
					
						
							|  |  |  |           n30z=n30
 | 
					
						
							|  |  |  |           n30=n30+nwrap
 | 
					
						
							|  |  |  |           nfox=nfox+1
 | 
					
						
							|  |  |  |        endif
 | 
					
						
							|  |  |  |     endif
 | 
					
						
							|  |  |  |     
 | 
					
						
							| 
									
										
										
										
											2018-02-08 21:28:33 -05:00
										 |  |  |     call flush(6)
 | 
					
						
							| 
									
										
										
										
											2018-10-20 09:04:03 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-05 14:07:24 -04:00
										 |  |  |     return
 | 
					
						
							|  |  |  |   end subroutine js8_decoded
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   subroutine js8a_decoded (this,sync,snr,dt,freq,decoded,nap,qual)
 | 
					
						
							| 
									
										
										
										
											2019-12-12 20:35:16 -05:00
										 |  |  |     use js8a_decode
 | 
					
						
							| 
									
										
										
										
											2019-09-05 14:07:24 -04:00
										 |  |  |     implicit none
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-12 20:35:16 -05:00
										 |  |  |     class(js8a_decoder), intent(inout) :: this
 | 
					
						
							| 
									
										
										
										
											2019-09-05 14:07:24 -04:00
										 |  |  |     real, intent(in) :: sync
 | 
					
						
							|  |  |  |     integer, intent(in) :: snr
 | 
					
						
							|  |  |  |     real, intent(in) :: dt
 | 
					
						
							|  |  |  |     real, intent(in) :: freq
 | 
					
						
							|  |  |  |     character(len=37), intent(in) :: decoded
 | 
					
						
							|  |  |  |     integer, intent(in) :: nap 
 | 
					
						
							|  |  |  |     real, intent(in) :: qual 
 | 
					
						
							| 
									
										
										
										
											2019-11-06 16:00:16 -05:00
										 |  |  |     integer :: submode
 | 
					
						
							| 
									
										
										
										
											2019-09-05 14:07:24 -04:00
										 |  |  |     save
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-06 16:00:16 -05:00
										 |  |  |     submode=0
 | 
					
						
							|  |  |  |     call js8_decoded(sync, snr, dt, freq, decoded, nap, qual, submode)
 | 
					
						
							| 
									
										
										
										
											2019-09-05 14:07:24 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-08 21:28:33 -05:00
										 |  |  |     select type(this)
 | 
					
						
							| 
									
										
										
										
											2019-12-12 20:35:16 -05:00
										 |  |  |     type is (counting_js8a_decoder)
 | 
					
						
							| 
									
										
										
										
											2018-02-08 21:28:33 -05:00
										 |  |  |        this%decoded = this%decoded + 1
 | 
					
						
							|  |  |  |     end select
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     return
 | 
					
						
							| 
									
										
										
										
											2019-09-05 14:07:24 -04:00
										 |  |  |   end subroutine js8a_decoded
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   subroutine js8b_decoded (this,sync,snr,dt,freq,decoded,nap,qual)
 | 
					
						
							|  |  |  |     use js8b_decode
 | 
					
						
							|  |  |  |     implicit none
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     class(js8b_decoder), intent(inout) :: this
 | 
					
						
							|  |  |  |     real, intent(in) :: sync
 | 
					
						
							|  |  |  |     integer, intent(in) :: snr
 | 
					
						
							|  |  |  |     real, intent(in) :: dt
 | 
					
						
							|  |  |  |     real, intent(in) :: freq
 | 
					
						
							|  |  |  |     character(len=37), intent(in) :: decoded
 | 
					
						
							|  |  |  |     integer, intent(in) :: nap 
 | 
					
						
							|  |  |  |     real, intent(in) :: qual 
 | 
					
						
							| 
									
										
										
										
											2019-11-06 16:00:16 -05:00
										 |  |  |     integer :: submode
 | 
					
						
							| 
									
										
										
										
											2019-09-05 14:07:24 -04:00
										 |  |  |     save
 | 
					
						
							|  |  |  |     
 | 
					
						
							| 
									
										
										
										
											2019-11-06 16:00:16 -05:00
										 |  |  |     submode=1
 | 
					
						
							|  |  |  |     call js8_decoded(sync, snr, dt, freq, decoded, nap, qual, submode)
 | 
					
						
							| 
									
										
										
										
											2019-09-05 14:07:24 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  |     select type(this)
 | 
					
						
							|  |  |  |     type is (counting_js8b_decoder)
 | 
					
						
							|  |  |  |        this%decoded = this%decoded + 1
 | 
					
						
							|  |  |  |     end select
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     return
 | 
					
						
							|  |  |  |   end subroutine js8b_decoded
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   subroutine js8c_decoded (this,sync,snr,dt,freq,decoded,nap,qual)
 | 
					
						
							|  |  |  |     use js8c_decode
 | 
					
						
							|  |  |  |     implicit none
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     class(js8c_decoder), intent(inout) :: this
 | 
					
						
							|  |  |  |     real, intent(in) :: sync
 | 
					
						
							|  |  |  |     integer, intent(in) :: snr
 | 
					
						
							|  |  |  |     real, intent(in) :: dt
 | 
					
						
							|  |  |  |     real, intent(in) :: freq
 | 
					
						
							|  |  |  |     character(len=37), intent(in) :: decoded
 | 
					
						
							|  |  |  |     integer, intent(in) :: nap 
 | 
					
						
							|  |  |  |     real, intent(in) :: qual 
 | 
					
						
							| 
									
										
										
										
											2019-11-06 16:00:16 -05:00
										 |  |  |     integer :: submode
 | 
					
						
							| 
									
										
										
										
											2019-09-05 14:07:24 -04:00
										 |  |  |     save
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-06 16:00:16 -05:00
										 |  |  |     submode=2
 | 
					
						
							|  |  |  |     call js8_decoded(sync, snr, dt, freq, decoded, nap, qual, submode)
 | 
					
						
							| 
									
										
										
										
											2019-09-05 14:07:24 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  |     select type(this)
 | 
					
						
							|  |  |  |     type is (counting_js8c_decoder)
 | 
					
						
							|  |  |  |        this%decoded = this%decoded + 1
 | 
					
						
							|  |  |  |     end select
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     return
 | 
					
						
							|  |  |  |   end subroutine js8c_decoded
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-06 16:00:16 -05:00
										 |  |  |   subroutine js8e_decoded (this,sync,snr,dt,freq,decoded,nap,qual)
 | 
					
						
							|  |  |  |     use js8e_decode
 | 
					
						
							| 
									
										
										
										
											2019-09-05 14:07:24 -04:00
										 |  |  |     implicit none
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-06 16:00:16 -05:00
										 |  |  |     class(js8e_decoder), intent(inout) :: this
 | 
					
						
							| 
									
										
										
										
											2019-09-05 14:07:24 -04:00
										 |  |  |     real, intent(in) :: sync
 | 
					
						
							|  |  |  |     integer, intent(in) :: snr
 | 
					
						
							|  |  |  |     real, intent(in) :: dt
 | 
					
						
							|  |  |  |     real, intent(in) :: freq
 | 
					
						
							|  |  |  |     character(len=37), intent(in) :: decoded
 | 
					
						
							|  |  |  |     integer, intent(in) :: nap 
 | 
					
						
							|  |  |  |     real, intent(in) :: qual 
 | 
					
						
							| 
									
										
										
										
											2019-11-06 16:00:16 -05:00
										 |  |  |     integer :: submode
 | 
					
						
							| 
									
										
										
										
											2019-09-05 14:07:24 -04:00
										 |  |  |     save
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-06 16:00:16 -05:00
										 |  |  |     submode=4
 | 
					
						
							|  |  |  |     call js8_decoded(sync, snr, dt, freq, decoded, nap, qual, submode)
 | 
					
						
							| 
									
										
										
										
											2019-09-05 14:07:24 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  |     select type(this)
 | 
					
						
							| 
									
										
										
										
											2019-11-06 16:00:16 -05:00
										 |  |  |     type is (counting_js8e_decoder)
 | 
					
						
							| 
									
										
										
										
											2019-09-05 14:07:24 -04:00
										 |  |  |        this%decoded = this%decoded + 1
 | 
					
						
							|  |  |  |     end select
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     return
 | 
					
						
							| 
									
										
										
										
											2019-11-06 16:00:16 -05:00
										 |  |  |   end subroutine js8e_decoded
 | 
					
						
							| 
									
										
										
										
											2018-02-08 21:28:33 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-09 14:00:23 -05:00
										 |  |  |   subroutine js8i_decoded (this,sync,snr,dt,freq,decoded,nap,qual)
 | 
					
						
							|  |  |  |     use js8i_decode
 | 
					
						
							|  |  |  |     implicit none
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     class(js8i_decoder), intent(inout) :: this
 | 
					
						
							|  |  |  |     real, intent(in) :: sync
 | 
					
						
							|  |  |  |     integer, intent(in) :: snr
 | 
					
						
							|  |  |  |     real, intent(in) :: dt
 | 
					
						
							|  |  |  |     real, intent(in) :: freq
 | 
					
						
							|  |  |  |     character(len=37), intent(in) :: decoded
 | 
					
						
							|  |  |  |     integer, intent(in) :: nap 
 | 
					
						
							|  |  |  |     real, intent(in) :: qual 
 | 
					
						
							|  |  |  |     integer :: submode
 | 
					
						
							|  |  |  |     save
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     submode=8
 | 
					
						
							|  |  |  |     call js8_decoded(sync, snr, dt, freq, decoded, nap, qual, submode)
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     select type(this)
 | 
					
						
							|  |  |  |     type is (counting_js8i_decoder)
 | 
					
						
							|  |  |  |        this%decoded = this%decoded + 1
 | 
					
						
							|  |  |  |     end select
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     return
 | 
					
						
							|  |  |  |   end subroutine js8i_decoded
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-08 21:28:33 -05:00
										 |  |  | end subroutine multimode_decoder
 |