Merged master 8748
This commit is contained in:
@@ -0,0 +1,175 @@
|
||||
program wsprdpsksim
|
||||
|
||||
! Generate simulated data for a 2-minute "WSPR-DPSK" mode. Output is saved
|
||||
! to a *.c2 or *.wav file.
|
||||
|
||||
use wavhdr
|
||||
include 'wsprdpsk_params.f90' !Set various constants
|
||||
parameter (NMAX=120*12000)
|
||||
type(hdr) hwav !Header for .wav file
|
||||
character arg*12,fname*16
|
||||
character msg*22,msgsent*22
|
||||
complex c0(0:NMAX/NDOWN-1)
|
||||
complex c(0:NMAX/NDOWN-1)
|
||||
complex c0wav(0:NMAX-1)
|
||||
complex cwav(0:NMAX-1)
|
||||
real*8 fMHz
|
||||
integer imessage(NN)
|
||||
integer*2 iwave(NMAX) !Generated full-length waveform
|
||||
|
||||
! Get command-line argument(s)
|
||||
nargs=iargc()
|
||||
if(nargs.ne.8) then
|
||||
print*,'Usage: wsprdpsksim "message" f0 DT fsp del nwav nfiles snr'
|
||||
print*,'Example: wsprdpsksim "K1ABC FN42 30" 50 0.0 0.1 1.0 1 10 -33'
|
||||
go to 999
|
||||
endif
|
||||
call getarg(1,msg) !Message to be transmitted
|
||||
call getarg(2,arg)
|
||||
read(arg,*) f0 !Freq relative to WSPR-band center (Hz)
|
||||
call getarg(3,arg)
|
||||
read(arg,*) xdt !Time offset from nominal (s)
|
||||
call getarg(4,arg)
|
||||
read(arg,*) fspread !Watterson frequency spread (Hz)
|
||||
call getarg(5,arg)
|
||||
read(arg,*) delay !Watterson delay (ms)
|
||||
call getarg(6,arg)
|
||||
read(arg,*) nwav !1 for *.wav file, 0 for *.c2 file
|
||||
call getarg(7,arg)
|
||||
read(arg,*) nfiles !Number of files
|
||||
call getarg(8,arg)
|
||||
read(arg,*) snrdb !SNR_2500
|
||||
|
||||
twopi=8.0*atan(1.0)
|
||||
pi=twopi/2.0
|
||||
fs=12000.0/NDOWN
|
||||
dt=1.0/fs !Sample interval (s)
|
||||
tt=NSPS*dt !Duration of "itone" symbols (s)
|
||||
baud=1.0/tt !Keying rate for "itone" symbols (baud)
|
||||
txt=NZ*dt !Transmission length (s)
|
||||
bandwidth_ratio=2500.0/(fs/2.0)
|
||||
sig=sqrt(bandwidth_ratio) * 10.0**(0.05*snrdb)
|
||||
if(snrdb.gt.90.0) sig=1.0
|
||||
txt=NN*NSPS0/12000.0
|
||||
|
||||
call genwsprdpsk(msg,msgsent,imessage) !Encode the message, get itone
|
||||
imessage=2*imessage-1
|
||||
write(*,1000) f0,xdt,txt,snrdb,fspread,delay,nfiles,msgsent
|
||||
1000 format('f0:',f9.3,' DT:',f6.2,' txt:',f6.1,' SNR:',f6.1, &
|
||||
' fspread:',f6.1,' delay:',f6.1,' nfiles:',i3,2x,a22)
|
||||
|
||||
|
||||
beta=1.0 ! excess bandwidth
|
||||
if(nwav.eq.0) then
|
||||
df=fs/(NMAX/NDOWN) !
|
||||
c=0
|
||||
bw=(1+beta)*baud/2.0
|
||||
bf=(1-beta)*baud/2.0
|
||||
iw=bw/df
|
||||
if=bf/df
|
||||
c(0:if-1)=1.0
|
||||
if(iw.gt.if) then
|
||||
do i=if,iw
|
||||
c(i)=((1.0+cos(pi*(i-if)/(iw-if)))/2.0)**0.5
|
||||
enddo
|
||||
endif
|
||||
c(NMAX/NDOWN-1:NMAX/NDOWN-iw:-1)=c(1:iw)
|
||||
|
||||
istart=xdt/dt
|
||||
c0=0.0
|
||||
do i=1,NN
|
||||
c0(istart+(i-1)*200)=imessage(i)
|
||||
enddo
|
||||
call four2a(c0,NMAX/NDOWN,1,1,1)
|
||||
c0=c0*conjg(c)
|
||||
ic=f0/df
|
||||
c0=cshift(c0,ic)
|
||||
call four2a(c0,NMAX/NDOWN,1,-1,1)
|
||||
xx=sum(abs(c0(istart:istart+NN*200-1)**2))/(NN*200)
|
||||
c0=c0/sqrt(xx)
|
||||
|
||||
call sgran()
|
||||
do ifile=1,nfiles
|
||||
c=c0
|
||||
if( fspread .ne. 0.0 .or. delay .ne. 0.0 ) then
|
||||
call watterson(c,NMAX/NDOWN,fs,delay,fspread)
|
||||
endif
|
||||
c=c*sig
|
||||
if(snrdb.lt.90) then
|
||||
do i=0,NMAX/NDOWN-1 !Add gaussian noise at specified SNR
|
||||
xnoise=gran()
|
||||
ynoise=gran()
|
||||
c(i)=c(i) + cmplx(xnoise,ynoise)
|
||||
enddo
|
||||
endif
|
||||
snrtest=sum(abs(c(istart:istart+NN*200-1)**2))/(NN*200)/2.0-1.0
|
||||
write(*,*) 'sample SNR: ',10*log10(snrtest)+10*log10(0.4/2.5)
|
||||
write(fname,1100) ifile
|
||||
1100 format('000000_',i4.4,'.c2')
|
||||
open(10,file=fname,status='unknown',access='stream')
|
||||
fMHz=10.1387d0
|
||||
nmin=2
|
||||
write(10) fname,nmin,fMHz,c !Save to *.c2 file
|
||||
close(10)
|
||||
enddo
|
||||
else
|
||||
fs=12000.0
|
||||
df=fs/NMAX
|
||||
dt=1/fs
|
||||
bandwidth_ratio=2500.0/(fs/2.0)
|
||||
sig=sqrt(2*bandwidth_ratio) * 10.0**(0.05*snrdb)
|
||||
if(snrdb.gt.90.0) sig=1.0
|
||||
cwav=0
|
||||
bw=(1+beta)*baud/2.0
|
||||
bf=(1-beta)*baud/2.0
|
||||
iw=bw/df
|
||||
if=bf/df
|
||||
cwav(0:if-1)=1.0
|
||||
if(iw.gt.if) then
|
||||
do i=if,iw
|
||||
cwav(i)=((1.0+cos(pi*(i-if)/(iw-if)))/2.0)**0.5
|
||||
enddo
|
||||
endif
|
||||
cwav(NMAX-1:NMAX-iw:-1)=cwav(1:iw)
|
||||
|
||||
istart=xdt/dt
|
||||
c0wav=0.0
|
||||
do i=1,NN
|
||||
c0wav(istart+(i-1)*200*NDOWN)=imessage(i)
|
||||
enddo
|
||||
call four2a(c0wav,NMAX,1,1,1)
|
||||
c0wav=c0wav*conjg(cwav)
|
||||
ic=f0/df
|
||||
c0wav=cshift(c0wav,-ic)
|
||||
call four2a(c0wav,NMAX,1,-1,1)
|
||||
xx=sum(abs(c0wav(istart:istart+NN*200*NDOWN-1))**2)/(NN*200*NDOWN)
|
||||
c0wav=c0wav/sqrt(xx)
|
||||
write(*,*) 'Peak power: ',maxval(abs(c0wav)**2)
|
||||
write(*,*) 'Average power: ',sum(abs(c0wav(istart:istart+NN*200*NDOWN-1))**2)/(NN*200*NDOWN)
|
||||
call sgran()
|
||||
do ifile=1,nfiles
|
||||
cwav=c0wav
|
||||
if( fspread .ne. 0.0 .or. delay .ne. 0.0 ) then
|
||||
call watterson(cwav,NMAX,fs,delay,fspread)
|
||||
endif
|
||||
cwav=cwav*sig
|
||||
if(snrdb.lt.90) then
|
||||
do i=1,NMAX !Add gaussian noise at specified SNR
|
||||
xnoise=gran()
|
||||
iwave(i)=100*(real(cwav(i-1)) + xnoise)
|
||||
enddo
|
||||
endif
|
||||
snrtest=sum(real(iwave(istart:istart+NN*200*NDOWN-1)**2)/(NN*200*NDOWN))/100.0**2-1
|
||||
write(*,*) 'sample SNR: ',10*log10(snrtest)+10*log10(6.0/2.5)
|
||||
hwav=default_header(12000,NMAX)
|
||||
write(fname,1102) ifile
|
||||
1102 format('000000_',i4.4,'.wav')
|
||||
open(10,file=fname,status='unknown',access='stream')
|
||||
write(10) hwav,iwave !Save to *.wav file
|
||||
close(10)
|
||||
enddo
|
||||
endif
|
||||
write(*,1110) ifile,xdt,f0,snrdb,fname
|
||||
1110 format(i4,f7.2,f8.2,f7.1,2x,a16)
|
||||
|
||||
999 end program wsprdpsksim
|
||||
@@ -1,126 +0,0 @@
|
||||
// KISS Interface for posting spots to PSK Reporter web site
|
||||
// Implemented by Edson Pereira PY2SDR
|
||||
//
|
||||
// Reports will be sent in batch mode every 5 minutes.
|
||||
|
||||
#include "psk_reporter.h"
|
||||
|
||||
#include <QHostInfo>
|
||||
#include <QTimer>
|
||||
|
||||
#include "MessageClient.hpp"
|
||||
|
||||
#include "moc_psk_reporter.cpp"
|
||||
|
||||
PSK_Reporter::PSK_Reporter(MessageClient * message_client, QObject *parent) :
|
||||
QObject {parent},
|
||||
m_messageClient {message_client},
|
||||
reportTimer {new QTimer {this}},
|
||||
m_sequenceNumber {0}
|
||||
{
|
||||
m_header_h = "000Allllttttttttssssssssiiiiiiii";
|
||||
|
||||
// We use 50E2 and 50E3 for link Id
|
||||
m_rxInfoDescriptor_h = "0003002C50E200040000"
|
||||
"8002FFFF0000768F" // 2. Rx Call
|
||||
"8004FFFF0000768F" // 4. Rx Grid
|
||||
"8008FFFF0000768F" // 8. Rx Soft
|
||||
"8009FFFF0000768F" // 9. Rx Antenna
|
||||
"0000";
|
||||
|
||||
m_txInfoDescriptor_h = "0002003C50E30007"
|
||||
"8001FFFF0000768F" // 1. Tx Call
|
||||
"800500040000768F" // 5. Tx Freq
|
||||
"800600010000768F" // 6. Tx snr
|
||||
"800AFFFF0000768F" // 10. Tx Mode
|
||||
"8003FFFF0000768F" // 3. Tx Grid
|
||||
"800B00010000768F" // 11. Tx info src
|
||||
"00960004"; // Report time
|
||||
|
||||
|
||||
m_randomId_h = QString("%1").arg(qrand(),8,16,QChar('0'));
|
||||
|
||||
QHostInfo::lookupHost("report.pskreporter.info", this, SLOT(dnsLookupResult(QHostInfo)));
|
||||
|
||||
connect(reportTimer, SIGNAL(timeout()), this, SLOT(sendReport()));
|
||||
reportTimer->start(5*60*1000); // 5 minutes;
|
||||
}
|
||||
|
||||
void PSK_Reporter::setLocalStation(QString call, QString gridSquare, QString antenna, QString programInfo)
|
||||
{
|
||||
m_rxCall = call;
|
||||
m_rxGrid = gridSquare;
|
||||
m_rxAnt = antenna;
|
||||
m_progId = programInfo;
|
||||
}
|
||||
|
||||
void PSK_Reporter::addRemoteStation(QString call, QString grid, QString freq, QString mode, QString snr, QString time )
|
||||
{
|
||||
QHash<QString,QString> spot;
|
||||
spot["call"] = call;
|
||||
spot["grid"] = grid;
|
||||
spot["snr"] = snr;
|
||||
spot["freq"] = freq;
|
||||
spot["mode"] = mode;
|
||||
spot["time"] = time;
|
||||
m_spotQueue.enqueue(spot);
|
||||
}
|
||||
|
||||
void PSK_Reporter::sendReport()
|
||||
{
|
||||
if (m_spotQueue.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
QString report_h;
|
||||
|
||||
// Header
|
||||
QString header_h = m_header_h;
|
||||
header_h.replace("tttttttt", QString("%1").arg(QDateTime::currentDateTime().toTime_t(),8,16,QChar('0')));
|
||||
header_h.replace("ssssssss", QString("%1").arg(++m_sequenceNumber,8,16,QChar('0')));
|
||||
header_h.replace("iiiiiiii", m_randomId_h);
|
||||
|
||||
// Receiver information
|
||||
QString rxInfoData_h = "50E2llll";
|
||||
rxInfoData_h += QString("%1").arg(m_rxCall.length(),2,16,QChar('0')) + m_rxCall.toUtf8().toHex();
|
||||
rxInfoData_h += QString("%1").arg(m_rxGrid.length(),2,16,QChar('0')) + m_rxGrid.toUtf8().toHex();
|
||||
rxInfoData_h += QString("%1").arg(m_progId.length(),2,16,QChar('0')) + m_progId.toUtf8().toHex();
|
||||
rxInfoData_h += QString("%1").arg(m_rxAnt.length(),2,16,QChar('0')) + m_rxAnt.toUtf8().toHex();
|
||||
rxInfoData_h += "0000";
|
||||
rxInfoData_h.replace("50E2llll", "50E2" + QString("%1").arg(rxInfoData_h.length()/2,4,16,QChar('0')));
|
||||
|
||||
// Sender information
|
||||
QString txInfoData_h = "50E3llll";
|
||||
while (!m_spotQueue.isEmpty()) {
|
||||
QHash<QString,QString> spot = m_spotQueue.dequeue();
|
||||
txInfoData_h += QString("%1").arg(spot["call"].length(),2,16,QChar('0')) + spot["call"].toUtf8().toHex();
|
||||
txInfoData_h += QString("%1").arg(spot["freq"].toLongLong(),8,16,QChar('0'));
|
||||
txInfoData_h += QString("%1").arg(spot["snr"].toInt(),8,16,QChar('0')).right(2);
|
||||
txInfoData_h += QString("%1").arg(spot["mode"].length(),2,16,QChar('0')) + spot["mode"].toUtf8().toHex();
|
||||
txInfoData_h += QString("%1").arg(spot["grid"].length(),2,16,QChar('0')) + spot["grid"].toUtf8().toHex();
|
||||
txInfoData_h += QString("%1").arg(1,2,16,QChar('0')); // REPORTER_SOURCE_AUTOMATIC
|
||||
txInfoData_h += QString("%1").arg(spot["time"].toInt(),8,16,QChar('0'));
|
||||
}
|
||||
txInfoData_h += "0000";
|
||||
txInfoData_h.replace("50E3llll", "50E3" + QString("%1").arg(txInfoData_h.length()/2,4,16,QChar('0')));
|
||||
report_h = header_h + m_rxInfoDescriptor_h + m_txInfoDescriptor_h + rxInfoData_h + txInfoData_h;
|
||||
//qDebug() << "Sending Report TX: ";
|
||||
|
||||
report_h.replace("000Allll", "000A" + QString("%1").arg(report_h.length()/2,4,16,QChar('0')));
|
||||
QByteArray report = QByteArray::fromHex(report_h.toUtf8());
|
||||
|
||||
// Send data to PSK Reporter site
|
||||
if (!m_pskReporterAddress.isNull()) {
|
||||
m_messageClient->send_raw_datagram (report, m_pskReporterAddress, 4739);
|
||||
}
|
||||
}
|
||||
|
||||
void PSK_Reporter::dnsLookupResult(QHostInfo info)
|
||||
{
|
||||
if (!info.addresses().isEmpty()) {
|
||||
m_pskReporterAddress = info.addresses().at(0);
|
||||
// qDebug() << "PSK Reporter IP: " << m_pskReporterAddress;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
#ifndef WSJTX_CONFIG_H__
|
||||
#define WSJTX_CONFIG_H__
|
||||
|
||||
#define WSJTX_VERSION_MAJOR @WSJTX_VERSION_MAJOR@
|
||||
#define WSJTX_VERSION_MINOR @WSJTX_VERSION_MINOR@
|
||||
#define WSJTX_VERSION_PATCH @WSJTX_VERSION_PATCH@
|
||||
|
||||
#cmakedefine CMAKE_INSTALL_DATAROOTDIR "@CMAKE_INSTALL_DATAROOTDIR@"
|
||||
#cmakedefine CMAKE_INSTALL_DOCDIR "@CMAKE_INSTALL_DOCDIR@"
|
||||
#cmakedefine CMAKE_INSTALL_DATADIR "@CMAKE_INSTALL_DATADIR@"
|
||||
#cmakedefine CMAKE_PROJECT_NAME "@CMAKE_PROJECT_NAME@"
|
||||
#cmakedefine PROJECT_MANUAL "@PROJECT_MANUAL@"
|
||||
#cmakedefine PROJECT_HOMEPAGE "@PROJECT_HOMEPAGE@"
|
||||
#cmakedefine PROJECT_MANUAL_DIRECTORY_URL "@PROJECT_MANUAL_DIRECTORY_URL@"
|
||||
#cmakedefine PROJECT_SAMPLES_URL "@PROJECT_SAMPLES_URL@"
|
||||
|
||||
#cmakedefine01 WSJT_SHARED_RUNTIME
|
||||
#cmakedefine01 WSJT_QDEBUG_TO_FILE
|
||||
#cmakedefine01 WSJT_QDEBUG_IN_RELEASE
|
||||
#cmakedefine01 WSJT_TRACE_CAT
|
||||
#cmakedefine01 WSJT_TRACE_CAT_POLLS
|
||||
#cmakedefine01 WSJT_HAMLIB_TRACE
|
||||
#cmakedefine01 WSJT_HAMLIB_VERBOSE_TRACE
|
||||
#cmakedefine01 WSJT_SOFT_KEYING
|
||||
#cmakedefine01 WSJT_ENABLE_EXPERIMENTAL_FEATURES
|
||||
#cmakedefine01 WSJT_RIG_NONE_CAN_SPLIT
|
||||
|
||||
#define WSJTX_STRINGIZE1(x) #x
|
||||
#define WSJTX_STRINGIZE(x) WSJTX_STRINGIZE1(x)
|
||||
|
||||
/* consistent UNICODE behaviour */
|
||||
#ifndef UNICODE
|
||||
# undef _UNICODE
|
||||
#else
|
||||
# ifndef _UNICODE
|
||||
# define _UNICODE
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,57 +0,0 @@
|
||||
subroutine genqra64(msg0,ichk,msgsent,itone,itype)
|
||||
|
||||
! Encodes a QRA64 message to yield itone(1:84)
|
||||
|
||||
use packjt
|
||||
character*22 msg0
|
||||
character*22 message !Message to be generated
|
||||
character*22 msgsent !Message as it will be received
|
||||
integer itone(84)
|
||||
character*3 cok !' ' or 'OOO'
|
||||
logical old_qra_sync
|
||||
integer dgen(13)
|
||||
integer sent(63)
|
||||
integer icos7(0:6)
|
||||
data icos7/2,5,6,0,4,1,3/ !Defines a 7x7 Costas array
|
||||
save
|
||||
|
||||
if(msg0(1:1).eq.'@') then
|
||||
read(msg0(2:5),*,end=1,err=1) nfreq
|
||||
go to 2
|
||||
1 nfreq=1000
|
||||
2 itone(1)=nfreq
|
||||
write(msgsent,1000) nfreq
|
||||
1000 format(i5,' Hz')
|
||||
else
|
||||
message=msg0
|
||||
do i=1,22
|
||||
if(ichar(message(i:i)).eq.0) then
|
||||
message(i:)=' '
|
||||
exit
|
||||
endif
|
||||
enddo
|
||||
|
||||
do i=1,22 !Strip leading blanks
|
||||
if(message(1:1).ne.' ') exit
|
||||
message=message(i+1:)
|
||||
enddo
|
||||
|
||||
call chkmsg(message,cok,nspecial,flip)
|
||||
call packmsg(message,dgen,itype) !Pack message into 72 bits
|
||||
call unpackmsg(dgen,msgsent) !Unpack to get message sent
|
||||
if(ichk.ne.0) go to 999 !Return if checking only
|
||||
call qra64_enc(dgen,sent) !Encode using QRA64
|
||||
|
||||
nsync=10
|
||||
inquire(file='old_qra_sync',exist=old_qra_sync)
|
||||
if(old_qra_sync) nsync=1
|
||||
|
||||
itone(1:7)=nsync*icos7 !Insert 7x7 Costas array in 3 places
|
||||
itone(8:39)=sent(1:32)
|
||||
itone(40:46)=nsync*icos7
|
||||
itone(47:77)=sent(33:63)
|
||||
itone(78:84)=nsync*icos7
|
||||
endif
|
||||
|
||||
999 return
|
||||
end subroutine genqra64
|
||||
Reference in New Issue
Block a user