implement per receiver HZ tracking, rejig display

hzcorr
bert hubert 2019-09-18 14:17:41 +02:00
parent b31b499f1b
commit efa4ae6fdc
3 changed files with 67 additions and 16 deletions

View File

@ -14,7 +14,7 @@ function maketable(str, arr)
enter().
append("tr");
var columns = ["sv", "best-tle", "norad", "iod", "aodc/e", "eph-age-m", "latest-disco", "time-disco", "sisa", "delta_hz_corr", "health", "tle-dist", "alma-dist", "delta-utc", "delta-gps", "sources", "db", "elev", "last-seen-s"];
var columns = ["sv", "best-tle", "iod", "aodc/e", "eph-age-m", "latest-disco", "time-disco", "sisa", "health", "tle-dist", "alma-dist", "delta-utc", "delta-gps", "sources", "db", "delta_hz_corr","prres", "elev", "last-seen-s"];
// append the header row
thead.append("tr")
@ -64,6 +64,17 @@ function maketable(str, arr)
ret.value="";
}
else if(column == "eph-age-m") {
if(row["gnssid"]==0 && Math.abs(row[column]) > 120 && row["last-seen-s"] < 120)
ret.color="orange";
if(row["gnissid"]==2 && Math.abs(row[column]) > 60 && row["last-seen-s"] < 120)
ret.color="orange";
if(Math.abs(row[column]) >120 && row["last-seen-s"] < 120)
ret.color="#ff4444";
if(Math.abs(row[column]) > 4*60 && row["last-seen-s"] < 120)
ret.color="#ff2222";
if(row[column] != null) {
var b = moment.duration(-row[column], 'm');
ret.value = b.humanize(true);
@ -73,7 +84,7 @@ function maketable(str, arr)
}
else if(row[column] != null && (column == "delta_hz_corr" || column =="delta_hz")) {
ret.value = row[column].toFixed(0);
ret.value = row[column];
}
else if((column == "tle-dist")) {
if(row["best-tle-dist"] != null)
@ -100,6 +111,9 @@ function maketable(str, arr)
var b = moment.duration(row[column], 's');
ret.value = b.humanize();
}
else if(column == "best-tle") {
ret.value = "<small>"+row[column]+"</small>";
}
else if(column == "gpshealth" && row[column] != null) {
if(row[column]==0)
ret.value = "ok";
@ -109,11 +123,11 @@ function maketable(str, arr)
}
}
else if(column == "latest-disco" && row[column] != null)
ret.value = ((100*row[column]).toFixed(2))+" cm";
ret.value = ((100*row[column]).toFixed(1))+" cm";
else if(column == "time-disco" && row[column] != null)
ret.value = row[column].toFixed(2)+" ns";
ret.value = row[column].toFixed(1)+" ns";
else if(column == "health") {
ret.value = row[column];
ret.value = "<small>"+row[column]+"</small>";
if(row["healthissue"] == 1) {
ret.color="orange";
}
@ -124,10 +138,6 @@ function maketable(str, arr)
else {
ret.value= row[column];
}
if(column == "eph-age-m" && row[column] > 60 && row["last-seen-s"] < 120)
ret.color="orange";
if(column == "eph-age-m" && row[column] > 4*60 && row["last-seen-s"] < 120)
ret.color="#ff2222";
if(column == "sisa" && parseInt(row[column]) > 312)
ret.color="#ffaaaa";
@ -182,6 +192,22 @@ function update()
o.elev = o.elev + o.perrecv[k].elev.toFixed(0)+" ";
else
o.elev = o.elev + "? ";
if(o.delta_hz_corr == null)
o.delta_hz_corr ="";
if(o.perrecv[k].delta_hz_corr != null)
o.delta_hz_corr = o.delta_hz_corr + o.perrecv[k].delta_hz_corr.toFixed(0)+" ";
else
o.delta_hz_corr = o.delta_hz_corr + "_ ";
if(o.prres == null)
o.prres ="";
if(o.perrecv[k].prres != null)
o.prres = o.prres + o.perrecv[k].prres.toFixed(1)+" ";
else
o.prres = o.prres + "_ ";
}
});

View File

@ -139,6 +139,12 @@ try
oldgm4s[nmm.gi().gnsssv()] = gm;
}
if(wtype == 1) {
cout << " iodnav " << gm.iodnav <<" t0e "<< gm.t0e*60 <<" " << ephAge(gm.t0e*60, gm.tow);
}
if(wtype == 2 || wtype == 3) {
cout << " iodnav " << gm.iodnav;
}
if(wtype == 1 || wtype == 2 || wtype == 3) {
iodstream << nmm.localutcseconds()<<" " << nmm.gi().gnssid() <<" "<< nmm.gi().gnsssv() << " " << gm.iodnav << " " << gm.t0e*60 <<" " << ephAge(gm.t0e*60, gm.tow);
if(wtype == 3)

View File

@ -235,6 +235,7 @@ struct SVPerRecv
int el{-1}, azi{-1}, db{-1};
time_t deltaHzTime{-1};
double deltaHz{-1};
double prres{-1};
time_t t; // last seen
};
@ -284,7 +285,7 @@ struct SVStat
map<uint64_t, SVPerRecv> perrecv;
double latestDisco{-1}, timeDisco{-1000};
double latestDisco{-1}, latestDiscoAge{-1}, timeDisco{-1000};
map<int, SVIOD> iods;
void addGalileoWord(std::basic_string_view<uint8_t> page);
@ -613,23 +614,28 @@ std::string humanTime(int gnssid, int wn, int tow)
std::optional<double> getHzCorrection(time_t now, int src, unsigned int gnssid, unsigned int sigid, const svstats_t svstats)
{
std::optional<double> allHzCorr;
double alltot=0;
int allcount=0;
// cout<<"getHzCorrection called for src "<<src<<" gnss "<<gnssid <<" sigid "<< sigid <<endl;
for(const auto& s: svstats) {
if(s.first.gnss != gnssid)
continue;
if(s.first.sigid != sigid)
continue;
if(auto iter = s.second.perrecv.find(src); now - iter->second.deltaHzTime < 60) {
if(auto iter = s.second.perrecv.find(src); iter != s.second.perrecv.end() && now - iter->second.deltaHzTime < 60) {
// cout<<" Found entry for SV "<<s.first.gnss<<","<<s.first.sv<<","<<s.first.sigid<<" from src "<<iter->first<<", deltaHz: "<<iter->second.deltaHz<< " age " << now - iter->second.deltaHzTime<<" db "<<iter->second.db<<endl;
alltot+=iter->second.deltaHz;
allcount++;
}
}
if(allcount > 3)
if(allcount > 3) {
allHzCorr = alltot/allcount;
// cout<<"Returning "<<*allHzCorr<<endl;
}
else
; // cout<<"Not enough data"<<endl;
return allHzCorr;
}
@ -1154,6 +1160,9 @@ try
if((s.first.gnss == 0 || s.first.gnss == 2) && s.second.completeIOD())
getCoordinates(latestTow(s.first.gnss, svstats), s.second.liveIOD(), & sat);
if(s.first.gnss == 3 && s.second.oldBeidouMessage.sow >= 0 && s.second.oldBeidouMessage.sqrtA != 0) {
getCoordinates(latestTow(s.first.gnss, svstats), s.second.oldBeidouMessage, &sat);
}
if(sat.x) {
Point our = g_srcpos[pr.first].pos;
@ -1165,7 +1174,7 @@ try
det["db"] = pr.second.db;
det["last-seen-s"] = time(0) - pr.second.t;
det["prres"] = pr.second.prres;
if(time(0) - pr.second.deltaHzTime < 60) {
det["delta_hz"] = pr.second.deltaHz;
@ -1184,6 +1193,7 @@ try
if(s.second.latestDisco >=0) {
item["latest-disco"]= s.second.latestDisco;
item["latest-disco-age"]= s.second.latestDiscoAge;
}
if(s.second.timeDisco > -100 && s.second.timeDisco < 100) {
item["time-disco"]= s.second.timeDisco;
@ -1246,6 +1256,7 @@ try
g_svstats[id].perrecv[nmm.sourceid()].db = nmm.rd().db();
g_svstats[id].perrecv[nmm.sourceid()].el = nmm.rd().el();
g_svstats[id].perrecv[nmm.sourceid()].azi = nmm.rd().azi();
g_svstats[id].perrecv[nmm.sourceid()].prres = nmm.rd().prres();
Point sat{0,0,0};
//cout<<"Got recdata for "<<id.gnss<<","<<id.sv<<","<<id.sigid<<": count="<<g_svstats.count(id)<<endl;
@ -1419,7 +1430,7 @@ try
getCoordinates(ent.second.tow, ent.second.prevIOD.second, &oldp);
if(ent.second.prevIOD.second.t0e < ent.second.liveIOD().t0e) {
double hours = ((ent.second.liveIOD().t0e - ent.second.prevIOD.second.t0e)/3600.0);
double hours = (1.0*(ent.second.liveIOD().t0e - ent.second.prevIOD.second.t0e)/3600.0); // XXX week jump
double disco = Vector(p, oldp).length();
// cout<<id.first<<","<<id.second<<" discontinuity after "<< hours<<" hours: "<< disco <<endl;
idb.addValue(id, "iod-actual", ent.second.getIOD());
@ -1427,7 +1438,15 @@ try
if(hours < 4) {
idb.addValue(id, "eph-disco", disco);
idb.addValue(id, nanoTime(id.gnss, ent.second.wn, ent.second.tow), "eph-disco2",
{{"meters", disco},
{"seconds", hours*3600.0},
{"oldx", oldp.x}, {"oldy", oldp.y}, {"oldz", oldp.z},
{"x", p.x}, {"y", p.y}, {"z", p.z},
{"oid", 1.0*ent.second.getIOD()},
{"oldoid", 1.0*ent.second.prevIOD.first}});
g_svstats[id].latestDisco= disco;
g_svstats[id].latestDiscoAge= hours*3600;
}
else
g_svstats[id].latestDisco= -1;