summaryrefslogtreecommitdiff
path: root/lib/ft8var/ft8_mod1.f90
blob: 435a1957ca4c724d40864255c0efaa0b62336953 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
module ft8_mod1

  save

  parameter (NPS=180000,NFR=151680,NFILT1=4000,NFILT2=3400,numcqsig=20,   &
       numdeccq=40,nummycsig=5,numdecmyc=25,nmaxthreads=24)
  real*4 dd8(nps)
  real endcorr(NFILT1/2+1)
  complex cw(nps),csync(0:6,32),csynce(0:18,32),csyncsd(0:18,32),         &
       csyncsdcq(0:57,32),csynccq(0:7,32),ctwkw(11,32),ctwkn(11,32),      &
       ctwk256(256)
  character*37 allmessages(200),msgsd76(76),msg(56),msgroot,msgincall(174)
  character lasthcall*12,mycall12_0*12,mycall12_00*12,hiscall12_0*12,     &
       hisgrid4*4,hisgrid*6 !ft8md w3sz added hisgrid
  character(len=12) :: mycall,hiscall,mybcall,hisbcall
  real allfreq(200),windowc1(0:54),windowx(0:200),pivalue,facx,twopi,     &
       facc1,dt,sumxdtt(24),avexdt,xdtincall(174)
  integer itone76(76,79),idtone76(76,58),itone56(56,79),idtone56(56,58),  &
       idtone25(25,58),allsnrs(200),apsym(58),idtonemyc(58),mcq(29),      &
       mrrr(19),m73(19),mrr73(19),naptypes(0:5,27),icos7(0:6),            &
       graymap(0:7),nappasses(0:5),nmsg,ndecodes,nlasttx,mycalllen1,      &
       msgrootlen,nfawide,nfbwide,nhaptypes(0:5,27),apsymsp(66),          &
       apsymdxns1(58),apsymdxnsrrr(77),ndxnsaptypes(0:5,27),apcqsym(77),  &
       apsymdxnsrr73(77),apsymdxns73(77),nft8cycles,ncandallthr(24),      &
       maskincallthr(25),nincallthr(24),idtonecqdxcns(58),apsymmyns1(29), &
       apsymmyns2(58),apsymmynsrr73(77),apsymmyns73(77),                  &
       nmycnsaptypes(0:5,27),apsymdxstd(58),apsymdxnsr73(77),             &
       apsymdxns732(77),apsymmynsrrr(77),idtonedxcns73(58),               &
       idtonefox73(58),idtonespec(58),nintcount
  integer*1 gen(91,174)
  logical one(0:511,0:8),lqsomsgdcd,first_osd
  logical(1) lapmyc,lagcc,lagccbail,lhound,lenabledxcsearch,              &
       lwidedxcsearch,lmultinst,lskiptx1,ltxing
  logical(1) idtone25_valid(25),idtone56_valid(56),idtone76_valid(76)
  logical(1) csyncsd_valid,csyncsdcq_valid
  data maskincallthr/0,30,45,55,65,75,85,90,95,100,105,110,115,120,125,   &
       130,135,140,145,150,155,160,165,170,175/
  data     mcq/0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0/
  data    mrrr/0,1,1,1,1,1,1,0,1,0,0,1,0,0,1,0,0,0,1/
  data     m73/0,1,1,1,1,1,1,0,1,0,0,1,0,1,0,0,0,0,1/
  data   mrr73/0,1,1,1,1,1,1,0,0,1,1,1,0,1,0,1,0,0,1/
  data   icos7/3,1,4,0,6,5,2/
  data graymap/0,1,3,2,5,6,4,7/
  data mycall12_0/'dummy'/
  data mycall12_00/'dummy'/
  data hiscall12_0/'dummy'/

! Hound OFF, MyCall is standard, DXCall is standard or empty
  data naptypes(0,1:27)/3,3,3,0,0,0,0,0,0,0,0,0,2,2,2,1,1,1,31,31,31,36,  &
       36,36,35,35,35/ ! Tx6 CQ
  data naptypes(1,1:27)/3,3,3,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,31,31,31,36,  &
       36,36,35,35,35/ ! Tx1 Grid
  data naptypes(2,1:27)/3,3,3,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,31,31,31,36,  &
       36,36,35,35,35/ ! Tx2 Report
  data naptypes(3,1:27)/3,3,3,6,6,6,5,5,5,4,4,4,0,0,0,0,0,0,31,31,31,36,  &
       36,36,35,35,35/ ! Tx3 RRreport
  data naptypes(4,1:27)/3,3,3,6,6,6,5,5,5,4,4,4,2,2,2,0,0,0,31,31,31,36,  &
       36,36,35,35,35/ ! Tx4 RRR,RR73
  data naptypes(5,1:27)/0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,1,1,1,31,31,31,36,  &
       36,36,35,35,35/ ! Tx5 73

! Hound OFF, MyCall is non-standard, DXCall is standard or empty
  data nmycnsaptypes(0,1:27)/0,0,0,0,0,0,0,0,0,0,0,0,40,40,40,1,1,1,31,   &
       31,31,36,36,36,35,35,35/             ! Tx6 CQ
  data nmycnsaptypes(1,1:27)/41,41,41,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,31,   &
       31,31,36,36,36,35,35,35/             ! Tx1 DXcall MyCall
  data nmycnsaptypes(2,1:27)/41,41,41,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,31,   &
       31,31,36,36,36,35,35,35/             ! Tx2 Report
  data nmycnsaptypes(3,1:27)/41,41,41,44,44,44,43,43,43,42,42,42,0,0,0,0, &
       0,0,31,31,31,36,36,36,35,35,35/    ! Tx3 RRreport
  data nmycnsaptypes(4,1:27)/41,41,41,44,44,44,43,43,43,42,42,42,40,40,40,&
       0,0,0,31,31,31,36,36,36,35,35,35/ ! Tx4 RRR,RR73
  data nmycnsaptypes(5,1:27)/0,0,0,0,0,0,0,0,0,0,0,0,40,40,40,1,1,1,31,31,&
       31,36,36,36,35,35,35/             ! Tx5 73

! Hound mode
  data nhaptypes(0,1:27)/0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0, &
       111,111,111/       ! Tx6 CQ, possible in idle mode if DXCall is empty
  data nhaptypes(1,1:27)/21,21,21,22,22,22,0,0,0,0,0,0,0,0,0,31,31,31,0,0,&
       0,36,36,36,0,0,0/ ! Tx1 Grid idle mode or transmitting
  data nhaptypes(2,1:27)/0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, &
       0,0,0/             ! Tx2 none
  data nhaptypes(3,1:27)/21,21,21,22,22,22,23,23,23,24,24,24,0,0,0,0,0,0, &
       0,0,0,0,0,0,0,0,0/ ! Tx3 RRreport QSO in progress or QSO is finished
  data nhaptypes(4,1:27)/0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, &
       0,0,0/             ! Tx4 none
  data nhaptypes(5,1:27)/0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, &
       0,0,0/             ! Tx5 none

!Non-standard DXCall
  data ndxnsaptypes(0,1:27)/0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,1,1,1,31,31,31, &
       36,36,36,35,35,35/             ! Tx6 CQ
  data ndxnsaptypes(1,1:27)/11,11,11,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,31,31, &
       31,36,36,36,35,35,35/          ! Tx1 Grid
  data ndxnsaptypes(2,1:27)/11,11,11,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,31,31, &
       31,36,36,36,35,35,35/          ! Tx2 Report
  data ndxnsaptypes(3,1:27)/11,11,11,14,14,14,13,13,13,12,12,12,0,0,0,0,  &
       0,0,31,31,31,36,36,36,35,35,35/ ! Tx3 RRreport
  data ndxnsaptypes(4,1:27)/11,11,11,14,14,14,13,13,13,12,12,12,2,2,2,0,  &
       0,0,31,31,31,36,36,36,35,35,35/ ! Tx4 RRR,RR73
  data ndxnsaptypes(5,1:27)/0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,1,1,1,31,31,31, &
       36,36,36,35,35,35/             ! Tx5 73
  data nintcount/0/
  data avexdt/0.0/
  data first_osd/.true./
  data idtone25_valid/25*.false./
  data idtone56_valid/56*.false./
  data idtone76_valid/76*.false./
  data csyncsd_valid/.false./
  data csyncsdcq_valid/.false./

  type odd_struct
     real freq
     real dt
     logical lstate
     character*37 msg
  end type odd_struct
  type(odd_struct) odd(130)

  type even_struct
     real freq
     real dt
     logical lstate
     character*37 msg
  end type even_struct
  type(even_struct) even(130)

  type oddcopy_struct
     real freq
     real dt
     logical lstate
     character*37 msg
  end type oddcopy_struct
  type(oddcopy_struct) oddcopy(130)

  type evencopy_struct
     real freq
     real dt
     logical lstate
     character*37 msg
  end type evencopy_struct
  type(evencopy_struct) evencopy(130)
  
  type lastrxmsg_struct
     real xdt
     logical lstate
     character*37 lastmsg
  end type lastrxmsg_struct
  type (lastrxmsg_struct) lastrxmsg(1)
  data lastrxmsg%lstate/.false./

  type callsigndtodd_struct
     real dt
     character*12 call2
  end type callsigndtodd_struct
  type (callsigndtodd_struct) calldtodd(150)

  type callsigndteven_struct
     real dt
     character*12 call2
  end type callsigndteven_struct
  type (callsigndteven_struct) calldteven(150)

  type incall_struct
     real xdt
     character*37 msg
  end type incall_struct
  type (incall_struct) incall(30)

  type evencq_struct
     real freq
     real xdt
     complex cs(0:7,79)
  end type evencq_struct
  type(evencq_struct) evencq(numcqsig,nmaxthreads) ! 24 threads

  type oddcq_struct
     real freq
     real xdt
     complex cs(0:7,79)
  end type oddcq_struct
  type(oddcq_struct) oddcq(numcqsig,nmaxthreads)

  type evenmyc_struct
     real freq
     real xdt
     complex cs(0:7,79)
  end type evenmyc_struct
  type(evenmyc_struct) evenmyc(nummycsig,nmaxthreads)

  type oddmyc_struct
     real freq
     real xdt
     complex cs(0:7,79)
  end type oddmyc_struct
  type(oddmyc_struct) oddmyc(nummycsig,nmaxthreads)

  type evenqso_struct
     real freq
     real xdt
     complex cs(0:7,79)
  end type evenqso_struct
  type(evenqso_struct) evenqso(1,nmaxthreads)

  type oddqso_struct
     real freq
     real xdt
     complex cs(0:7,79)
  end type oddqso_struct
  type(oddqso_struct) oddqso(1,nmaxthreads)

contains

  subroutine reset_ft8_mod1()
    dd8=0.
    allmessages=''
    allfreq=0.
    allsnrs=0
    ndecodes=0
    nmsg=0
    nintcount=0
    nft8cycles=0
    nlasttx=0
    sumxdtt=0.
    avexdt=0.
    lastrxmsg%lstate=.false.
    lastrxmsg%lastmsg=''
    lastrxmsg%xdt=0.
    odd%lstate=.false.
    even%lstate=.false.
    oddcopy%lstate=.false.
    evencopy%lstate=.false.
    odd%msg=''
    even%msg=''
    oddcopy%msg=''
    evencopy%msg=''
    calldteven%call2=''
    calldtodd%call2=''
    calldteven%dt=0.
    calldtodd%dt=0.
    incall%msg=''
    incall%xdt=0.
    msgroot=''
    msgincall=''
    xdtincall=0.
    nincallthr=0
    ncandallthr=0
    idtone25_valid=.false.
    idtone56_valid=.false.
    idtone76_valid=.false.
    csyncsd_valid=.false.
    csyncsdcq_valid=.false.
    first_osd=.true.
    lqsomsgdcd=.false.
    lapmyc=.false.
    lasthcall=''
    mycall12_0='dummy'
    mycall12_00='dummy'
    hiscall12_0='dummy'
  end subroutine reset_ft8_mod1

end module ft8_mod1