add checkboxes so you can select what you want to see

hzcorr
bert hubert 2019-09-22 17:48:02 +02:00
parent 88a79489c0
commit 79067714b0
3 changed files with 144 additions and 27 deletions

View File

@ -14,7 +14,7 @@ function maketable(str, arr)
enter().
append("tr");
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"];
var columns = ["sv", "best-tle", "iod", "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")
@ -163,28 +163,13 @@ function maketable(str, arr)
var sats={};
var lastseen=null;
function update()
function updateSats()
{
var seconds = 2;
clearTimeout(repeat);
repeat=setTimeout(update, 1000.0*seconds);
if(lastseen != null)
d3.select("#freshness").html(lastseen.fromNow());
d3.json("global.json", function(d) {
d3.select('#facts').html("Galileo-UTC offset: <b>"+d["utc-offset-ns"].toFixed(2)+"</b> ns, Galileo-GPS offset: <b>"+d["gps-offset-ns"].toFixed(2)+"</b> ns, GPS UTC offset: <b>"+d["gps-utc-offset-ns"].toFixed(2)+"</b>. "+d["leap-seconds"]+"</b> leap seconds");
lastseen = moment(1000*d["last-seen"]);
d3.select("#freshness").html(lastseen.fromNow());
});
d3.json("svs.json", function(d) {
// put data in an array
sats=d;
var arr=[];
Object.keys(d).forEach(function(e) {
var o = d[e];
var arr=[];
setButtonSettings();
Object.keys(sats).forEach(function(e) {
var o = sats[e];
o.sv=e;
o.sources="";
o.db="";
@ -233,7 +218,26 @@ function update()
var livearr=[], stalearr=[];
for(n = 0 ; n < arr.length; n++)
{
// if(arr[n]["gnssid"]) continue;
let wantIt = false;
if(d3.select("#GalE1").property("checked") && arr[n].gnssid==2 && arr[n].sigid == 1)
wantIt = true;
if(d3.select("#GalE5b").property("checked") && arr[n].gnssid==2 && arr[n].sigid == 5)
wantIt = true;
if(d3.select("#GPSL1CA").property("checked") && arr[n].gnssid==0 && arr[n].sigid == 0)
wantIt = true;
if(d3.select("#GPSL2C").property("checked") && arr[n].gnssid==0 && arr[n].sigid == 4)
wantIt = true;
if(d3.select("#BeiDouB1I").property("checked") && arr[n].gnssid==3 && arr[n].sigid == 0)
wantIt = true;
if(d3.select("#BeiDouB2I").property("checked") && arr[n].gnssid==3 && arr[n].sigid == 2)
wantIt = true;
if(d3.select("#GlonassL1").property("checked") && arr[n].gnssid==6 && arr[n].sigid == 0)
wantIt = true;
if(d3.select("#GlonassL2").property("checked") && arr[n].gnssid==6 && arr[n].sigid == 2)
wantIt = true;
if(!wantIt)
continue;
if(arr[n]["last-seen-s"] < 600)
livearr.push(arr[n]);
else
@ -242,10 +246,66 @@ function update()
maketable("#svs", livearr);
maketable("#svsstale", stalearr);
}
function update()
{
var seconds = 20;
clearTimeout(repeat);
repeat=setTimeout(update, 1000.0*seconds);
if(lastseen != null)
d3.select("#freshness").html(lastseen.fromNow());
d3.json("global.json", function(d) {
d3.select('#facts').html("Galileo-UTC offset: <b>"+d["utc-offset-ns"].toFixed(2)+"</b> ns, Galileo-GPS offset: <b>"+d["gps-offset-ns"].toFixed(2)+"</b> ns, GPS UTC offset: <b>"+d["gps-utc-offset-ns"].toFixed(2)+"</b>. "+d["leap-seconds"]+"</b> leap seconds");
lastseen = moment(1000*d["last-seen"]);
d3.select("#freshness").html(lastseen.fromNow());
});
d3.json("svs.json", function(d) {
// put data in an array
sats=d;
updateSats();
});
}
function getButtonSettings(name, def)
{
let itemName = "want"+name;
let value = localStorage.getItem(itemName);
if(value == null) {
console.log("Defaulting "+itemName+" to "+def);
localStorage.setItem(itemName, def);
}
// else
// console.log("Found "+itemName+" set to '"+value+"'");
d3.select("#"+name).property("checked", localStorage.getItem(itemName)=="true");
}
function setButtonSetting(name)
{
// console.log("Storing button state want"+name+" as "+d3.select("#"+name).property("checked"));
localStorage.setItem("want"+name, d3.select("#"+name).property("checked"));
}
var modes=["GalE1", "GalE5b", "GPSL1CA", "GPSL2C", "BeiDouB1I", "BeiDouB2I", "GlonassL1", "GlonassL2"];
function setButtonSettings()
{
modes.forEach(function(d) {
setButtonSetting(d);
});
}
getButtonSettings("GalE1", true);
modes.forEach(function(d) {
getButtonSettings(d, false);
});;
repeat=update();

View File

@ -42,6 +42,18 @@ tr:nth-child(odd) {background: #FFF}
</style>
<body>
Last update: <span id="freshness"></span>. More information about this Galileo/GPS/BeiDou/Glonass open source monitor can be found <a href="https://github.com/ahupowerdns/galmon/blob/master/README.md#galmon">here</a>. Live map <a href="geo">here!</a>. Contact <a href="https://ds9a.nl/">me</a> if you want access to the Grafana dashboard.<br/>
<center>
<hr/>
<input type="checkbox" id="GalE1" onclick="updateSats();"> <label for="GalE1">Galileo E1</label> &nbsp;
<input type="checkbox" id="GalE5b" onclick="updateSats();"> <label for="GalE5b">Galileo E5b</label> &nbsp;
<input type="checkbox" id="BeiDouB1I" onclick="updateSats();"> <label for="BeiDouB1I">BeiDou B1I</label> &nbsp;
<input type="checkbox" id="BeiDouB2I" onclick="updateSats();"> <label for="BeiDouB2I">BeiDou B2I</label> &nbsp;
<input type="checkbox" id="GlonassL1" onclick="updateSats();"> <label for="GlonassL1">Glonass L1</label> &nbsp;
<input type="checkbox" id="GlonassL2" onclick="updateSats();"> <label for="GlonassL2">Glonass L2</label> &nbsp;
<input type="checkbox" id="GPSL1CA" onclick="updateSats();"> <label for="GPSL1CA">GPS L1C/A</label> &nbsp;
<input type="checkbox" id="GPSL2C" onclick="updateSats();"> <label for="GPSL2C">GPS L2C</label>
</center>
<hr/>
<table id="svs"></table>
<hr>
<p>
@ -50,7 +62,7 @@ tr:nth-child(odd) {background: #FFF}
Stale:<br/>
<table id="svsstale"></table>
<p>
This table shows live output from four Galileo/GPS/BeiDou/GLONASS receivers hosted in Nootdorp, The Netherlands and California, United States.
This table shows live output from four Galileo/GPS/BeiDou/GLONASS receivers hosted in Nootdorp, The Netherlands and California, United States, Tonga, Brazil, Singapore, Austria ans Uruguay.
It is very much a work in progress, and will not be available at all times. Extremely rough code is on
<a href="https://github.com/ahuPowerDNS/galmon">GitHub</a>.

View File

@ -57,6 +57,30 @@ double utcFromGPS(int wn, double tow)
return (315964800 + wn * 7*86400 + tow - 18);
}
static double utcFromGST(int wn, double tow)
{
return (935280000.0 + wn * 7*86400 + tow - 18);
}
// GALILEO ONLY!!
template<typename T>
void doOrbitDump(int gnss, int sv, int wn, const T& oldEph, const T& newEph, int time_start, int time_end)
{
ofstream orbitcsv("orbit."+to_string(gnss)+"."+to_string(sv)+"."+to_string(oldEph.iodnav)+"-"+to_string(newEph.iodnav)+".csv");
orbitcsv << "timestamp x y z oldx oldy oldz\n";
orbitcsv << fixed;
for(int t = time_start; t < time_end; t += 30) {
Point p, oldp;
getCoordinates(t, newEph, &p);
getCoordinates(t, oldEph, &oldp);
time_t posix = utcFromGST(wn, t);
orbitcsv << posix <<" "
<<p.x<<" " <<p.y<<" "<<p.z<<" "
<<oldp.x<<" " <<oldp.y<<" "<<oldp.z<<"\n";
}
}
int main(int argc, char** argv)
try
@ -68,10 +92,10 @@ try
tles.parseFile("gps-ops.txt");
tles.parseFile("beidou.txt");
bool skipGPS{false};
bool skipBeidou{false};
bool skipGPS{true};
bool skipBeidou{true};
bool skipGalileo{false};
bool skipGlonass{false};
bool skipGlonass{true};
ofstream almanac("almanac.txt");
ofstream iodstream("iodstream.csv");
@ -139,6 +163,27 @@ try
}
oldgm4s[nmm.gi().gnsssv()] = gm;
int sv = nmm.gi().gnsssv();
if(gmwtypes[{sv,1}].iodnav == gmwtypes[{sv,2}].iodnav &&
gmwtypes[{sv,2}].iodnav == gmwtypes[{sv,3}].iodnav &&
gmwtypes[{sv,3}].iodnav == gmwtypes[{sv,4}].iodnav) {
cout <<" have complete ephemeris at " << gm.iodnav;
if(!oldEph[sv].sqrtA)
oldEph[sv] = gm;
else if(oldEph[sv].iodnav != gm.iodnav) {
cout<<" disco! "<< oldEph[sv].iodnav << " - > "<<gm.iodnav <<", "<< (gm.getT0e() - oldEph[sv].getT0e())/3600.0 <<" hours-jump insta-age "<<ephAge(gm.tow, gm.getT0e())/3600.0<<" hours";
Point oldPoint, newPoint;
getCoordinates(gm.tow, oldEph[sv], &oldPoint);
getCoordinates(gm.tow, gm, &newPoint);
Vector jump(oldPoint, newPoint);
cout<<" distance "<< jump.length() << " ("<<jump.x<<", "<<jump.y <<", "<<jump.z<<")";
auto oldAtomic = oldEph[sv].getAtomicOffset(gm.tow);
auto newAtomic = gm.getAtomicOffset(gm.tow);
cout<<" clock-jump "<<oldAtomic.first - newAtomic.first<<" ns ";
doOrbitDump(2, sv, gm.wn, oldEph[sv], gm, gm.tow - 3*3600, gm.tow + 3*3600);
oldEph[sv]=gm;
}
}
}
if(wtype == 1) {
cout << " iodnav " << gm.iodnav <<" t0e "<< gm.t0e*60 <<" " << ephAge(gm.t0e*60, gm.tow);