My LoRaWAN Signal Mapping MSc summer project. This is a copy of the actual repository with personal information removed.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

71 lines
1.2 KiB

"use strict";
import { normalise, clamp } from './Math.mjs';
function normalise_lat(lat) {
return normalise(lat,
{ min: -90, max: +90 },
{ min: 0, max: 1 }
);
}
function normalise_lng(lng) {
return normalise(lng,
{ min: -180, max: +180 },
{ min: 0, max: 1 }
);
}
function unnormalise_lat(nlat) {
return normalise(nlat,
{ min: 0, max: 1 },
{ min: -90, max: +90 }
);
}
function unnormalise_lng(nlng) {
return normalise(nlng,
{ min: 0, max: 1 },
{ min: -180, max: +180 }
);
}
function normalise_gateway_distance(distance) {
return clamp(normalise(distance,
{ min: 0, max: 20000 },
{ min: 0, max: 1 }
), 0, 1);
}
function unnormalise_gateway_distance(ndistance) {
return normalise(ndistance,
{ min: 0, max: 1 },
{ min: 0, max: 20000 }
);
}
function normalise_rssi(rssi) {
return clamp(normalise(rssi,
{ min: -150, max: 0 },
{ min: 0, max: 1 }
), 0, 1)
}
function unnormalise_rssi(rssi) {
return normalise(rssi,
{ min: 0, max: 1 },
{ min: -150, max: 0 }
);
}
export {
normalise_lat,
normalise_lng,
unnormalise_lat,
unnormalise_lng,
normalise_gateway_distance,
unnormalise_gateway_distance,
normalise_rssi,
unnormalise_rssi
};