Skip to content

Commit

Permalink
ANTEX: PCV with azimuth, full freq range, ANTEX 2, SINEX metadata
Browse files Browse the repository at this point in the history
Improve the ANTEX support.

* Support PCV with azimuth. Was just NOAZI. Use linear interpolation
  between azimuth points, as well as the zenith. Satellite PCV still
  only supports NOAZI as that is most common, but all the support is
  there to extend this to vary with azimuth

* Support ZEN1, ZEN2, DZEN, and DAZI. The PHV size is also now
  variable so the smallest size array is allocated. There was a fixed
  azimuth length of 19. It now correctly handles variations of these
  parameters. Require some more memory management, to free these.

* Support the full range of frequencies, across systems. Was just GPS
  and NFREQ. The usage of the antmodel() etc functions needed to
  change. There were returning a NFREQ array with the offsets, but
  that did not work with multiple systems with different frequencies
  mapped to the frequency same indices - these functions are now
  single frequency functions.

* Support PCO and PCV interpolation between frequency entries, with
  heuristics to avoid extrapolation of noisy data, and avoid
  interpolation across frequency bands (which may well be implemented
  with separate antenna elements e.g. stacked elements).

* Add support for ANTEX 2 which avoids much redundancy. This required
  the PRN to SVN mapping in the SINEX satellite meta data.

* Add minimal SINEX satellite meta data support, just for the PRN to
  SVN mappings. Adding the file-satmetafile option.

* Support for the console apps.

* Support for the qt apps, adding the satellite meta data file to the
  GUI.

* Some windows app support, untested, and not yet the satellite meta
  data file for ANTEX 2 which needs adding to the GUI.
  • Loading branch information
ourairquality committed Nov 22, 2024
1 parent 4c4dd25 commit 6bf6d0b
Show file tree
Hide file tree
Showing 16 changed files with 1,794 additions and 695 deletions.
84 changes: 50 additions & 34 deletions app/consapp/rtkrcv/rtkrcv.c
Original file line number Diff line number Diff line change
Expand Up @@ -362,41 +362,54 @@ static int readcmd(const char *file, char *cmd, int type)
fclose(fp);
return 1;
}
/* read antenna file ---------------------------------------------------------*/
static void readant(vt_t *vt, prcopt_t *opt, nav_t *nav)
{
const pcv_t pcv0={0};
pcvs_t pcvr={0},pcvs={0};
pcv_t *pcv;
gtime_t time=timeget();
int i;

trace(3,"readant:\n");

opt->pcvr[0]=opt->pcvr[1]=pcv0;
if (!*filopt.rcvantp) return;

if (readpcv(filopt.rcvantp,&pcvr)) {
for (i=0;i<2;i++) {
if (!*opt->anttype[i]) continue;
if (!(pcv=searchpcv(0,opt->anttype[i],time,&pcvr))) {
vt_printf(vt,"no antenna %s in %s",opt->anttype[i],filopt.rcvantp);
continue;
}
opt->pcvr[i]=*pcv;
/* Read antenna file ---------------------------------------------------------*/
static void readant(vt_t *vt, prcopt_t *opt, nav_t *nav) {
trace(3, "readant:\n");

const pcv_t pcv0 = {0};
opt->pcvr[0] = opt->pcvr[1] = pcv0;

if (*filopt.rcvantp) {
gtime_t time = timeget();
pcvs_t pcvr = {0};
if (readpcv(filopt.rcvantp, 2, &pcvr)) {
for (int i = 0; i < 2; i++) {
if (!*opt->anttype[i]) continue;
pcv_t *pcv = searchpcv(0, opt->anttype[i], time, NULL, &pcvr);
if (!pcv) {
vt_printf(vt, "no antenna %s in %s", opt->anttype[i], filopt.rcvantp);
continue;
}
}
else vt_printf(vt,"antenna file open error %s",filopt.rcvantp);

if (readpcv(filopt.satantp,&pcvs)) {
for (i=0;i<MAXSAT;i++) {
if (!(pcv=searchpcv(i+1,"",time,&pcvs))) continue;
nav->pcvs[i]=*pcv;
copy_pcv(&opt->pcvr[i], pcv);
}
free_pcvs(&pcvr);
} else
vt_printf(vt, "antenna file open error %s", filopt.rcvantp);
}

if (*filopt.satantp) {
satsvns_t satsvns = {0};
if (*filopt.satmeta && !readsinex(filopt.satmeta, &satsvns))
vt_printf(vt, "error : reading sat meta sinex %s", filopt.satmeta);

pcvs_t pcvs = {0};
if (readpcv(filopt.satantp, 1, &pcvs)) {
gtime_t time = timeget();
for (int i = 0; i < MAXSAT; i++) {
pcv_t *pcv = searchpcv(i + 1, "", time, &satsvns, &pcvs);
if (!pcv) {
char id[8];
satno2id(i + 1, id);
vt_printf(vt, "no satellite %s pcv in %s", id, filopt.satantp);
continue;
}
}
else vt_printf(vt,"antenna file open error %s",filopt.satantp);

free(pcvr.pcv); free(pcvs.pcv);
copy_pcv(&nav->pcvs[i], pcv);
}
free_pcvs(&pcvs);
} else
vt_printf(vt, "antenna file open error %s", filopt.satantp);
free(satsvns.satsvn);
}
}
/* start rtk server ----------------------------------------------------------*/
static int startsvr(vt_t *vt)
Expand Down Expand Up @@ -440,7 +453,7 @@ static int startsvr(vt_t *vt)
pos[1]=nmeapos[1]*D2R;
pos[2]=nmeapos[2];
pos2ecef(pos,npos);

/* read antenna file */
readant(vt,&prcopt,&svr.nav);

Expand Down Expand Up @@ -523,6 +536,9 @@ static void stopsvr(vt_t *vt)
#endif
if (solopt[0].geoid>0) closegeoid();

for (int i = 0; i < 2; i++) free_pcv(&prcopt.pcvr[i]);
for (int i = 0; i < MAXSAT; i++) free_pcv(&svr.nav.pcvs[i]);

vt_printf(vt,"stop rtk server\n");
}
/* print time ----------------------------------------------------------------*/
Expand Down
60 changes: 48 additions & 12 deletions app/qtapp/appcmn_qt/navi_post_opt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ OptDialog::OptDialog(QWidget *parent, int opts)
fileOptions.geoid[0] = '\0';
fileOptions.iono[0] = '\0';
fileOptions.rcvantp[0] = '\0';
fileOptions.satmeta[0] = '\0';
fileOptions.satantp[0] = '\0';
fileOptions.solstat[0] = '\0';
fileOptions.stapos[0] = '\0';
Expand Down Expand Up @@ -200,6 +201,7 @@ OptDialog::OptDialog(QWidget *parent, int opts)
fileCompleter->setModel(fileModel);
ui->lEStationPositionFile->setCompleter(fileCompleter);
ui->lEAntennaPcvFile->setCompleter(fileCompleter);
ui->lESatelliteMetaFile->setCompleter(fileCompleter);
ui->lESatellitePcvFile->setCompleter(fileCompleter);
ui->lEDCBFile->setCompleter(fileCompleter);
ui->lEGeoidDataFile->setCompleter(fileCompleter);
Expand All @@ -220,7 +222,14 @@ OptDialog::OptDialog(QWidget *parent, int opts)
acStationPositionFileView->setToolTip(tr("View File"));
acStationPositionFileView->setEnabled(false);

// satllite PCV line edit actions
// Satellite meta data line edit actions
QAction *acSatelliteMetaFileSelect = ui->lESatelliteMetaFile->addAction(QIcon(":/buttons/folder"), QLineEdit::TrailingPosition);
acSatelliteMetaFileSelect->setToolTip(tr("Select File"));
QAction *acSatelliteMetaFileView = ui->lESatelliteMetaFile->addAction(QIcon(":/buttons/doc"), QLineEdit::TrailingPosition);
acSatelliteMetaFileView->setToolTip(tr("View File"));
acSatelliteMetaFileView->setEnabled(false);

// satellite PCV line edit actions
QAction *acSatellitePcvFileSelect = ui->lESatellitePcvFile->addAction(QIcon(":/buttons/folder"), QLineEdit::TrailingPosition);
acSatellitePcvFileSelect->setToolTip(tr("Select File"));
QAction *acSatellitePcvFileView = ui->lESatellitePcvFile->addAction(QIcon(":/buttons/doc"), QLineEdit::TrailingPosition);
Expand Down Expand Up @@ -271,6 +280,8 @@ OptDialog::OptDialog(QWidget *parent, int opts)
connect(ui->buttonBox, &QDialogButtonBox::rejected, this, &OptDialog::reject);
connect(ui->btnLoad, &QPushButton::clicked, this, &OptDialog::loadSettings);
connect(ui->btnSave, &QPushButton::clicked, this, &OptDialog::saveSettings);
connect(acSatelliteMetaFileSelect, &QAction::triggered, this, &OptDialog::selectSatelliteMetaFile);
connect(acSatelliteMetaFileView, &QAction::triggered, this, &OptDialog::viewSatelliteMetaFile);
connect(acAntennaPcvFileSelect, &QAction::triggered, this, &OptDialog::selectAntennaPcvFile);
connect(acAntennaPcvFileView, &QAction::triggered, this, &OptDialog::viewAntennaPcvFile);
connect(ui->lEAntennaPcvFile, &QLineEdit::textChanged, this, [acAntennaPcvFileView, this]()
Expand Down Expand Up @@ -504,6 +515,23 @@ void OptDialog::selectReferencePosition()
setPosition(ui->cBReferencePositionType->currentIndex(), edit, p);
}
//---------------------------------------------------------------------------
void OptDialog::viewSatelliteMetaFile()
{
if (ui->lESatelliteMetaFile->text().isEmpty()) return;

textViewer->read(ui->lESatelliteMetaFile->text());

textViewer->show();
}
//---------------------------------------------------------------------------
void OptDialog::selectSatelliteMetaFile()
{
QString filename = QFileDialog::getOpenFileName(this, tr("Satellite Meta Data Sinex File"), ui->lESatelliteMetaFile->text(), tr("Sinex File (*.snx);All (*.*)"));

if (!filename.isEmpty())
ui->lESatelliteMetaFile->setText(QDir::toNativeSeparators(filename));
}
//---------------------------------------------------------------------------
void OptDialog::viewSatellitePcvFile()
{
if (ui->lESatellitePcvFile->text().isEmpty()) return;
Expand Down Expand Up @@ -650,13 +678,14 @@ void OptDialog::updateOptions()
QLineEdit *editu[] = {ui->lERoverPosition1, ui->lERoverPosition2, ui->lERoverPosition3 };
QLineEdit *editr[] = {ui->lEReferencePosition1, ui->lEReferencePosition2, ui->lEReferencePosition3 };
pcvs_t pcvr;
pcv_t *pcv, pcv0;
pcv_t pcv0;
gtime_t time = timeget();

memset(&pcvr, 0, sizeof(pcvs_t));
memset(&pcv0, 0, sizeof(pcv_t));

// file options
strncpy(fileOptions.satmeta, qPrintable(ui->lESatelliteMetaFile->text()), MAXSTRPATH-1);
strncpy(fileOptions.satantp, qPrintable(ui->lESatellitePcvFile->text()), MAXSTRPATH-1);
strncpy(fileOptions.rcvantp, qPrintable(ui->lEAntennaPcvFile->text()), MAXSTRPATH-1);
strncpy(fileOptions.stapos, qPrintable(ui->lEStationPositionFile->text()), MAXSTRPATH-1);
Expand Down Expand Up @@ -797,24 +826,27 @@ void OptDialog::updateOptions()
}

processingOptions.pcvr[0] = processingOptions.pcvr[1] = pcv0; // initialize antenna PCV
if ((ui->cBRoverAntennaPcv->isChecked() || ui->cBReferenceAntennaPcv->isChecked()) && !readpcv(fileOptions.rcvantp, &pcvr)) {
if ((ui->cBRoverAntennaPcv->isChecked() || ui->cBReferenceAntennaPcv->isChecked()) && !readpcv(fileOptions.rcvantp, 2, &pcvr)) {
QMessageBox::warning(this, tr("Error"), tr("Antenna file read error: \"%1\"").arg(fileOptions.rcvantp));
return;
}
if (ui->cBRoverAntennaPcv->isChecked() && (processingOptions.anttype[0] != QStringLiteral("*"))) {
if ((pcv = searchpcv(0, processingOptions.anttype[0], time, &pcvr)))
processingOptions.pcvr[0] = *pcv;
pcv_t *pcv = searchpcv(0, processingOptions.anttype[0], time, NULL, &pcvr);
if (pcv)
copy_pcv(&processingOptions.pcvr[0], pcv);
else
QMessageBox::warning(this, tr("Error"), tr("No rover antenna PCV: \"%1\"").arg(processingOptions.anttype[0]));
}
if (ui->cBReferenceAntennaPcv->isChecked()&& (processingOptions.anttype[1] != QStringLiteral("*"))) {
if ((pcv = searchpcv(0, processingOptions.anttype[1], time, &pcvr)))
processingOptions.pcvr[1] = *pcv;
pcv_t *pcv = searchpcv(0, processingOptions.anttype[1], time, NULL, &pcvr);
if (pcv)
copy_pcv(&processingOptions.pcvr[1], pcv);
else
QMessageBox::warning(this, tr("Error"), tr("No reference station antenna PCV: \"%1\"").arg(processingOptions.anttype[1]));
}
if (ui->cBRoverAntennaPcv->isChecked() || ui->cBReferenceAntennaPcv->isChecked())
free(pcvr.pcv);
if (ui->cBRoverAntennaPcv->isChecked() || ui->cBReferenceAntennaPcv->isChecked()) {
free_pcvs(&pcvr);
}
fillExcludedSatellites(&processingOptions, ui->lEExcludedSatellites->text());
processingOptions.maxaveep = ui->sBMaxAveEp->value();
processingOptions.initrst = ui->cBInitRestart->isChecked();
Expand Down Expand Up @@ -1041,6 +1073,7 @@ void OptDialog::load(const QString &file)
ui->sBMaxSolutionStd->setValue(solopt.maxsolstd);

// file options
ui->lESatelliteMetaFile->setText(filopt.satmeta);
ui->lESatellitePcvFile->setText(filopt.satantp);
ui->lEAntennaPcvFile->setText(filopt.rcvantp);
ui->lEStationPositionFile->setText(filopt.stapos);
Expand Down Expand Up @@ -1215,6 +1248,7 @@ void OptDialog::save(const QString &file)
strncpy(solOpts.sep, qPrintable(ui->lEFieldSeperator->text()), 63);
solOpts.maxsolstd = ui->sBMaxSolutionStd->value();

strncpy(filopt.satmeta, qPrintable(ui->lESatelliteMetaFile->text()), MAXSTRPATH-1);
strncpy(filopt.satantp, qPrintable(ui->lESatellitePcvFile->text()), MAXSTRPATH-1);
strncpy(filopt.rcvantp, qPrintable(ui->lEAntennaPcvFile->text()), MAXSTRPATH-1);
strncpy(filopt.stapos, qPrintable(ui->lEStationPositionFile->text()), MAXSTRPATH-1);
Expand Down Expand Up @@ -1388,6 +1422,7 @@ void OptDialog::saveOptions(QSettings &settings)
settings.setValue("prcopt/outsingle", processingOptions.outsingle);
settings.setValue("solopt/maxsolstd", ui->sBMaxSolutionStd->value());

settings.setValue("setting/satmetafile", ui->lESatelliteMetaFile->text());
settings.setValue("setting/satpcvfile", ui->lESatellitePcvFile->text());
settings.setValue("setting/antpcvfile", ui->lEAntennaPcvFile->text());
settings.setValue("setting/staposfile", ui->lEStationPositionFile->text());
Expand Down Expand Up @@ -1533,6 +1568,7 @@ void OptDialog::loadOptions(QSettings &settings)
ui->sBBaselineLen->setValue(settings.value("prcopt/baseline1", 0.0).toDouble());
ui->sBBaselineSig->setValue(settings.value("prcopt/baseline2", 0.0).toDouble());

ui->lESatelliteMetaFile->setText(settings.value("setting/satmetafile", "").toString());
ui->lESatellitePcvFile->setText(settings.value("setting/satpcvfile", "").toString());
ui->lEAntennaPcvFile->setText(settings.value("setting/antpcvfile", "").toString());
readAntennaList();
Expand Down Expand Up @@ -1906,7 +1942,7 @@ void OptDialog::readAntennaList()
QString currentRoverAntenna, currentReferenceAntenna;
int i;

if (!readpcv(qPrintable(ui->lEAntennaPcvFile->text()), &pcvs)) return;
if (!readpcv(qPrintable(ui->lEAntennaPcvFile->text()), 2, &pcvs)) return;

/* Save currently defined antennas */
currentRoverAntenna = ui->cBRoverAntenna->currentText();
Expand All @@ -1920,7 +1956,7 @@ void OptDialog::readAntennaList()
ui->cBRoverAntenna->addItem("*"); ui->cBReferenceAntenna->addItem("*");

for (int i = 0; i < pcvs.n; i++) {
if (pcvs.pcv[i].sat) continue;
if (pcvs.pcv[i].sat || pcvs.pcv[i].svn) continue;
if ((p = strchr(pcvs.pcv[i].type, ' '))) *p = '\0';
if (i > 0 && !strcmp(pcvs.pcv[i].type, pcvs.pcv[i - 1].type)) continue;
ui->cBRoverAntenna->addItem(pcvs.pcv[i].type);
Expand All @@ -1933,7 +1969,7 @@ void OptDialog::readAntennaList()
i = ui->cBReferenceAntenna->findText(currentReferenceAntenna);
ui->cBReferenceAntenna->setCurrentIndex(i == -1 ? 0 : i);

free(pcvs.pcv);
free_pcvs(&pcvs);
}
//---------------------------------------------------------------------------
void OptDialog::showKeyDialog()
Expand Down
2 changes: 2 additions & 0 deletions app/qtapp/appcmn_qt/navi_post_opt.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ protected slots:
void selectPanelFont();
void selectSolutionFont();
void selectGeoidDataFile();
void viewSatelliteMetaFile();
void selectSatelliteMetaFile();
void viewSatellitePcvFile();
void selectSatellitePcvFile();
void selectLocalDirectory();
Expand Down
Loading

0 comments on commit 6bf6d0b

Please sign in to comment.