From c7361c66f63b8c5b6228f54b357f3c237969d48d Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Thu, 21 Jul 2016 12:38:26 +0000 Subject: [PATCH] Add APTYPE_CQHISCALL (5), returning 9 [CQ DXcall ?], 10 [CQ DXcall], and 11 [CQ DXcall DXgrid]. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@6934 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- lib/qra/qra64/main.c | 45 ++++++++++++++++++++++++++++--------------- lib/qra/qra64/qra64.c | 30 ++++++++++++++++++++++++++--- lib/qra/qra64/qra64.h | 25 +++++++++++++++++------- lib/qra64a.f90 | 5 ++--- 4 files changed, 76 insertions(+), 29 deletions(-) diff --git a/lib/qra/qra64/main.c b/lib/qra/qra64/main.c index c4ea87f4f..e5608db25 100644 --- a/lib/qra/qra64/main.c +++ b/lib/qra/qra64/main.c @@ -174,7 +174,7 @@ symbol. #define GRID_JN66 0x3AE4 // JN66 #define GRID_73 0x7ED0 // 73 -char decode_type[9][32] = { +char decode_type[12][32] = { "[? ? ?] AP0", "[CQ ? ?] AP27", "[CQ ? ] AP42", @@ -183,7 +183,10 @@ char decode_type[9][32] = { "[CALL CALL ?] AP57", "[? CALL ?] AP29", "[? CALL ] AP44", - "[CALL CALL G] AP72" + "[CALL CALL G] AP72", + "[CQ CALL ?] AP55", + "[CQ CALL ] AP70", + "[CQ CALL G] AP70" }; char apmode_type[3][32] = { "NO AP", @@ -312,15 +315,18 @@ In the case a decode is successful the return code of the qra64_decode function indicates the amount of a-priori information required to decode the received message according to this table: - rc=0 [? ? ?] AP0 - rc=1 [CQ ? ?] AP27 - rc=2 [CQ ? ] AP42 - rc=3 [CALL ? ?] AP29 - rc=4 [CALL ? ] AP44 - rc=5 [CALL CALL ?] AP57 - rc=6 [? CALL ?] AP29 - rc=7 [? CALL ] AP44 - rc=8 [CALL CALL GRID ] AP72 + rc=0 [? ? ?] AP0 + rc=1 [CQ ? ?] AP27 + rc=2 [CQ ? ] AP42 + rc=3 [CALL ? ?] AP29 + rc=4 [CALL ? ] AP44 + rc=5 [CALL CALL ?] AP57 + rc=6 [? CALL ?] AP29 + rc=7 [? CALL ] AP44 + rc=8 [CALL CALL GRID] AP72 + rc=9 [CQ CALL ?] AP55 + rc=10 [CQ CALL ] AP70 + rc=11 [CQ CALL GRID] AP70 The return code is <0 when decoding is unsuccessful @@ -334,7 +340,7 @@ a particular type decode among the above 6 cases succeded. float ebnodbest, ebnodbavg=0; int rc,k; - int ndecok[9] = { 0, 0, 0, 0, 0, 0, 0, 0, 0}; + int ndecok[12] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; int nundet = 0; int ntx = 100,ndec=0; @@ -360,9 +366,16 @@ a particular type decode among the above 6 cases succeded. printf("K1JT decoder enabled for [K1JT IV3NWV JN66]\n"); qra64_apset(codec_k1jt, CALL_K1JT,CALL_IV3NWV,GRID_JN66,APTYPE_FULL); - // IV3NWV reply to K1JT - printf("\nIV3NWV encoder sends msg: [K1JT IV3NWV JN66]\n\n"); - encodemsg_jt65(x,CALL_K1JT,CALL_IV3NWV,GRID_JN66); +// This will enable K1JT's decoder to look for calls from IV3NWV [CQ IV3NWV ?/b] msgs + printf("K1JT decoder enabled for [CQ IV3NWV ?/b/JN66]\n"); + qra64_apset(codec_k1jt, 0,CALL_IV3NWV,GRID_JN66,APTYPE_CQHISCALL); + + + // Dx station IV3NWV calls + printf("\nIV3NWV encoder sends msg: [CQ IV3NWV JN66]\n\n"); + encodemsg_jt65(x,CALL_CQ,CALL_IV3NWV,GRID_JN66); +// printf("\nIV3NWV encoder sends msg: [CQ IV3NWV]\n\n"); +// encodemsg_jt65(x,CALL_CQ,CALL_IV3NWV,GRID_BLANK); qra64_encode(codec_iv3nwv, y, x); printf("Simulating K1JT decoder up to AP72\n"); @@ -383,7 +396,7 @@ a particular type decode among the above 6 cases succeded. printf("Transimtted msgs:%d\nDecoded msgs:\n\n",ntx); - for (k=0;k<9;k++) { + for (k=0;k<12;k++) { printf("%3d with %s\n",ndecok[k],decode_type[k]); ndec += ndecok[k]; } diff --git a/lib/qra/qra64/qra64.c b/lib/qra/qra64/qra64.c index 2f35a651a..73e2a230e 100644 --- a/lib/qra/qra64/qra64.c +++ b/lib/qra/qra64/qra64.c @@ -102,6 +102,8 @@ qra64codec *qra64_init(int flags) encodemsg_jt65(pcodec->apmask_call2_ooo, 0, MASK_CALL2, MASK_GRIDFULL); encodemsg_jt65(pcodec->apmask_call1_call2, MASK_CALL1,MASK_CALL2, MASK_GRIDBIT); encodemsg_jt65(pcodec->apmask_call1_call2_grid,MASK_CALL1,MASK_CALL2, MASK_GRIDFULL); + encodemsg_jt65(pcodec->apmask_cq_call2, MASK_CQQRZ, MASK_CALL2, MASK_GRIDBIT); + encodemsg_jt65(pcodec->apmask_cq_call2_ooo, MASK_CQQRZ, MASK_CALL2, MASK_GRIDFULL); return pcodec; } @@ -125,6 +127,7 @@ int qra64_apset(qra64codec *pcodec, const int mycall, const int hiscall, const i // APTYPE_HISCALL set [? hiscall ?/blank] // APTYPE_BOTHCALLS set [mycall hiscall ?] // APTYPE_FULL set [mycall hiscall grid] +// APTYPE_CQHISCALL set [cq/qrz hiscall ?/blank] and [cq/qrz hiscall grid] // returns: // 0 on success // -1 when qra64_init was called with the QRA_NOAP flag @@ -149,6 +152,10 @@ int qra64_apset(qra64codec *pcodec, const int mycall, const int hiscall, const i case APTYPE_FULL: encodemsg_jt65(pcodec->apmsg_call1_call2_grid, mycall, hiscall, grid); break; + case APTYPE_CQHISCALL: + encodemsg_jt65(pcodec->apmsg_cq_call2, CALL_CQ, hiscall, GRID_BLANK); + encodemsg_jt65(pcodec->apmsg_cq_call2_grid, CALL_CQ, hiscall, grid); + break; default: return -2; // invalid ap type } @@ -163,7 +170,7 @@ void qra64_apdisable(qra64codec *pcodec, const int aptype) if (pcodec->apflags==QRA_NOAP) return; - if (aptypeAPTYPE_FULL) + if (aptype=APTYPE_SIZE) return; pcodec->apmsg_set[aptype] = 0; // signal the decoder not to look-up to the specified type @@ -267,7 +274,6 @@ int qra64_decode(qra64codec *pcodec, float *ebno, int *x, const float *rxen) // Attempt to decode CQ calls rc = qra64_do_decode(xdec,ix,pcodec->apmask_cqqrz, pcodec->apmsg_cqqrz); if (rc>=0) { rc = 1; goto decode_end; }; // decoded [cq/qrz ? ?] - rc = qra64_do_decode(xdec, ix, pcodec->apmask_cqqrz_ooo, pcodec->apmsg_cqqrz); if (rc>=0) { rc = 2; goto decode_end; }; // decoded [cq ? ooo] @@ -289,7 +295,7 @@ int qra64_decode(qra64codec *pcodec, float *ebno, int *x, const float *rxen) if (rc>=0) { rc = 5; goto decode_end; }; // decoded [mycall srccall ?] } - // attempt to decode [? hiscall ?] msgs + // attempt to decode [? hiscall ?/b] msgs if (pcodec->apmsg_set[APTYPE_HISCALL]) { rc = qra64_do_decode(xdec, ix, pcodec->apmask_call2, pcodec->apmsg_call2); @@ -299,6 +305,24 @@ int qra64_decode(qra64codec *pcodec, float *ebno, int *x, const float *rxen) if (rc>=0) { rc = 7; goto decode_end; }; // decoded [? hiscall ooo] } + // attempt to decode [cq/qrz hiscall ?/b/grid] msgs + if (pcodec->apmsg_set[APTYPE_CQHISCALL]) { + + rc = qra64_do_decode(xdec, ix, pcodec->apmask_cq_call2, + pcodec->apmsg_cq_call2); + if (rc>=0) { rc = 9; goto decode_end; }; // decoded [cq/qrz hiscall ?] + + rc = qra64_do_decode(xdec, ix, pcodec->apmask_cq_call2_ooo, + pcodec->apmsg_cq_call2_grid); + if (rc>=0) { rc = 11; goto decode_end; }; // decoded [cq/qrz hiscall grid] + + rc = qra64_do_decode(xdec, ix, pcodec->apmask_cq_call2_ooo, + pcodec->apmsg_cq_call2); + if (rc>=0) { rc = 10; goto decode_end; }; // decoded [cq/qrz hiscall ] + } + + + // attempt to decode [mycall hiscall grid] if (pcodec->apmsg_set[APTYPE_FULL]) { rc = qra64_do_decode(xdec, ix, pcodec->apmask_call1_call2_grid, pcodec->apmsg_call1_call2_grid); diff --git a/lib/qra/qra64/qra64.h b/lib/qra/qra64/qra64.h index 5efd4b3ee..53d7de98f 100644 --- a/lib/qra/qra64/qra64.h +++ b/lib/qra/qra64/qra64.h @@ -48,8 +48,9 @@ #define APTYPE_MYCALL 1 // [mycall ? ?/blank] #define APTYPE_HISCALL 2 // [? hiscall ?/blank] #define APTYPE_BOTHCALLS 3 // [mycall hiscall ?] -#define APTYPE_FULL 4 // [mycall hiscall grid] -#define APTYPE_SIZE (APTYPE_FULL+1) +#define APTYPE_FULL 4 // [mycall hiscall grid] +#define APTYPE_CQHISCALL 5 // [cq/qrz hiscall ?/blank] +#define APTYPE_SIZE (APTYPE_CQHISCALL+1) typedef struct { float decEsNoMetric; @@ -60,8 +61,10 @@ typedef struct { int apmsg_cqqrz[12]; // [cq/qrz ? ?/blank] int apmsg_call1[12]; // [mycall ? ?/blank] int apmsg_call2[12]; // [? hiscall ?/blank] - int apmsg_call1_call2[12]; // [mycall hiscall ?] - int apmsg_call1_call2_grid[12]; // [mycall hiscall grid] + int apmsg_call1_call2[12]; // [mycall hiscall ?] + int apmsg_call1_call2_grid[12]; // [mycall hiscall grid] + int apmsg_cq_call2[12]; // [cq hiscall ?/blank] + int apmsg_cq_call2_grid[12]; // [cq hiscall grid] // ap messages masks int apmask_cqqrz[12]; @@ -72,6 +75,8 @@ typedef struct { int apmask_call2_ooo[12]; int apmask_call1_call2[12]; int apmask_call1_call2_grid[12]; + int apmask_cq_call2[12]; + int apmask_cq_call2_ooo[12]; } qra64codec; #ifdef __cplusplus @@ -129,7 +134,10 @@ int qra64_decode(qra64codec *pcodec, float *ebno, int *x, const float *r); // rc=6 [? CALL ?] AP29 // rc=7 [? CALL ] AP45 // rc=8 [CALL CALL GRID] AP72 -// return codes in the range 1-8 indicate the amount and the type of a-priori +// rc=9 [CQ CALL ?] AP55 +// rc=10 [CQ CALL ] AP70 + +// return codes in the range 1-10 indicate the amount and the type of a-priori // information was required to decode the received message. int qra64_apset(qra64codec *pcodec, const int mycall, const int hiscall, const int grid, const int aptype); @@ -146,10 +154,12 @@ int qra64_apset(qra64codec *pcodec, const int mycall, const int hiscall, const i // APTYPE_HISCALL set [? hiscall ?/blank] // APTYPE_BOTHCALLS set [mycall hiscall ?] // APTYPE_FULL set [mycall hiscall grid] +// APTYPE_CQHISCALL set [cq/qrz hiscall ?/blank] + // returns: // 0 on success -// -1 when qra64_init was called with the QRA_NOAP flag -// -2 invalid apytpe (valid range [APTYPE_MYCALL..APTYPE_FULL] +// -1 when qra64_init was called with the QRA_NOAP flag +// -2 invalid apytpe (valid range [APTYPE_CQQRZ..APTYPE_CQHISCALL] // (APTYPE_CQQRZ [cq/qrz ? ?] is set by default ) void qra64_apdisable(qra64codec *pcodec, const int aptype); @@ -162,6 +172,7 @@ void qra64_apdisable(qra64codec *pcodec, const int aptype); // APTYPE_HISCALL disable [ ? hiscall ?/blank] // APTYPE_BOTHCALLS disable [mycall hiscall ? ] // APTYPE_FULL disable [mycall hiscall grid] +// APTYPE_CQHISCALL set [cq/qrz hiscall ?/blank] void qra64_close(qra64codec *pcodec); // Free memory allocated by qra64_init diff --git a/lib/qra64a.f90 b/lib/qra64a.f90 index d841767ca..30d291f49 100644 --- a/lib/qra64a.f90 +++ b/lib/qra64a.f90 @@ -17,7 +17,6 @@ subroutine qra64a(dd,nutc,nf1,nf2,nfqso,ntol,mycall_12,hiscall_12,hisgrid_6, & real red(NZ) real x(NFFT) complex cx(0:NH) - logical first equivalence (x,cx) data icos7/2,5,6,0,4,1,3/ !Costas 7x7 pattern data nc1z/-1/,nc2z/-1/,ng2z/-1/ @@ -104,10 +103,10 @@ subroutine qra64a(dd,nutc,nf1,nf2,nfqso,ntol,mycall_12,hiscall_12,hisgrid_6, & call packcall(mycall,nc1,ltext) call packcall(hiscall,nc2,ltext) call packgrid(hisgrid,ng2,ltext) - call packcall("CQ ",ncq,ltext) +! call packcall("CQ ",ncq,ltext) if(nc1.ne.nc1z .or. nc2.ne.nc2z .or. ng2.ne.ng2z) then - do naptype=0,4 + do naptype=0,5 call qra64_dec(s3,nc1,nc2,ng2,naptype,1,dat4,snr2,irc) enddo nc1z=nc1