Added support for priority planing

This commit is contained in:
Lukáš Plevač 2023-10-02 08:46:47 +02:00
parent e629222c15
commit a151188965
6 changed files with 40 additions and 14 deletions

View File

@ -1,4 +1,4 @@
masterUrl = "http://10.0.0.8" masterUrl = "http://10.0.0.8"
apiKey = "2c4d64c8-e73c-4111-8e71-40097c7318ef"
pullInterval = 120 # in sec pullInterval = 120 # in sec
apiKey = "672bccda-6eb3-4cae-bcbf-ed398e9d3dd9"
planInterval = 1200 # in sec planInterval = 1200 # in sec

View File

@ -1,12 +1,14 @@
from pyorbital.orbital import Orbital from pyorbital.orbital import Orbital
from datetime import datetime, timedelta from datetime import datetime, timedelta
import time import time
from operator import itemgetter
import puller import puller
def plan(lat, lon, alt, tle, transmitter, receiver, name, delta = timedelta(seconds=1800), predictH = 24, horizon = 0): def plan(lat, lon, alt, tle, transmitter, receiver, priority, name, delta = timedelta(seconds=1800), predictH = 12, horizon = 5):
#prevent plan same obsevation #prevent plan same obsevation
last = datetime.utcnow() last = datetime.utcnow()
plans = []
for ob in puller.watingJobs: for ob in puller.watingJobs:
last = max(ob["start"], last) last = max(ob["start"], last)
@ -27,24 +29,43 @@ def plan(lat, lon, alt, tle, transmitter, receiver, name, delta = timedelta(seco
start = ob[0] start = ob[0]
end = ob[1] end = ob[1]
if start < last: if start <= last:
print(f"[INFO] alredy planed {name} at {start}") print(f"[INFO] alredy planed {name} at {start}")
continue continue
print(f"[INFO] planed {name} at {start}") plans.append({
"transmitter": transmitter,
puller.plan(transmitter, receiver, start, end) "receiver": receiver,
"start": start,
"end": end,
"priority": priority
})
def planAll(location): def planAll(location):
planeble = puller.getPlaneble() planeble = puller.getPlaneble()
plans = []
for transmitter in planeble: for transmitter in planeble:
plan( plans += plan(
location["lat"], location["lat"],
location["lon"], location["lon"],
location["alt"], location["alt"],
transmitter["locator"]["tle"], transmitter["locator"]["tle"],
transmitter["transmitter"], transmitter["transmitter"],
transmitter["receiver"], transmitter["receiver"],
transmitter["priority"]
transmitter["name"] transmitter["name"]
) )
plans = sorted(plans, key=itemgetter('start'))
i = 0
while i + 1 < len(plans):
if plan[i]["end"] < plan[i + 1]["start"]:
puller.plan(plan[i]["transmitter"], plan[i]["receiver"], plan[i]["start"], plan[i]["end"])
i += 1
elif plan[i]["priority"] > plan[i + 1]["priority"]:
plan.pop(i + 1)
else:
i += 1

View File

@ -25,12 +25,13 @@
$transmitter->id->set($targetId); $transmitter->id->set($targetId);
$transmitter->fetch(); $transmitter->fetch();
//get locator and nano and transmitter //get locator and name and transmitter
$res[] = [ $res[] = [
"name" => $transmitter->target->get()->name->get(), "name" => $transmitter->target->get()->name->get(),
"locator" => $transmitter->target->get()->locator->get(), "locator" => $transmitter->target->get()->locator->get(),
"transmitter" => $transmitter->id->get(), "transmitter" => $transmitter->id->get(),
"receiver" => $receiver->id->get() "receiver" => $receiver->id->get(),
"priority" => $transmitter->priority->get()
]; ];
} }
} }

View File

@ -9,7 +9,7 @@
public \wsos\database\types\reference $processPipe; // process pipe for transmitter public \wsos\database\types\reference $processPipe; // process pipe for transmitter
public \wsos\database\types\integer $centerFrequency; // in Hz public \wsos\database\types\integer $centerFrequency; // in Hz
public \wsos\database\types\integer $bandwidth; // in Hz public \wsos\database\types\integer $bandwidth; // in Hz
public \wsos\database\types\boolean $autoPlan; // can be events autoplaned? public \wsos\database\types\integer $priority; // priority of transmitter
function __construct( function __construct(
$id = null, $id = null,
@ -19,7 +19,7 @@
$dataType = null, $dataType = null,
$centerFrequency = 0, $centerFrequency = 0,
$bandwidth = 0, $bandwidth = 0,
$autoPlan = false, $priority = 0,
$processPipe = null $processPipe = null
) { ) {
parent::__construct($id); parent::__construct($id);
@ -31,7 +31,7 @@
$this->centerFrequency = new \wsos\database\types\integer($centerFrequency); $this->centerFrequency = new \wsos\database\types\integer($centerFrequency);
$this->bandwidth = new \wsos\database\types\integer($bandwidth); $this->bandwidth = new \wsos\database\types\integer($bandwidth);
$this->autoPlan = new \wsos\database\types\boolean($autoPlan); $this->priority = new \wsos\database\types\integer($priority);
} }
} }
?> ?>

View File

@ -143,6 +143,7 @@
$noaa19APT->centerFrequency->set(137100000); $noaa19APT->centerFrequency->set(137100000);
$noaa19APT->modulation->set($apt); $noaa19APT->modulation->set($apt);
$noaa19APT->antenna->set($qfh); $noaa19APT->antenna->set($qfh);
$noaa19APT->priority->set(2);
$noaa19APT->processPipe->set($aptPipe); $noaa19APT->processPipe->set($aptPipe);
$noaa19APT->commit(); $noaa19APT->commit();
@ -186,6 +187,7 @@
$noaa18APT->centerFrequency->set(137912500); $noaa18APT->centerFrequency->set(137912500);
$noaa18APT->modulation->set($apt); $noaa18APT->modulation->set($apt);
$noaa18APT->antenna->set($qfh); $noaa18APT->antenna->set($qfh);
$noaa18APT->priority->set(1);
$noaa18APT->processPipe->set($aptPipe); $noaa18APT->processPipe->set($aptPipe);
$noaa18APT->commit(); $noaa18APT->commit();
@ -229,6 +231,7 @@
$noaa15APT->centerFrequency->set(137500000); $noaa15APT->centerFrequency->set(137500000);
$noaa15APT->modulation->set($apt); $noaa15APT->modulation->set($apt);
$noaa15APT->antenna->set($qfh); $noaa15APT->antenna->set($qfh);
$noaa15APT->priority->set(0);
$noaa15APT->processPipe->set($aptPipe); $noaa15APT->processPipe->set($aptPipe);
$noaa15APT->commit(); $noaa15APT->commit();
@ -269,6 +272,7 @@
$meteor23LRPT1->centerFrequency->set(137900000); $meteor23LRPT1->centerFrequency->set(137900000);
$meteor23LRPT1->modulation->set($lrpt); $meteor23LRPT1->modulation->set($lrpt);
$meteor23LRPT1->antenna->set($qfh); $meteor23LRPT1->antenna->set($qfh);
$meteor23LRPT1->priority->set(3);
$meteor23LRPT1->processPipe->set($lrptPipe); $meteor23LRPT1->processPipe->set($lrptPipe);
$meteor23LRPT1->commit(); $meteor23LRPT1->commit();

@ -1 +1 @@
Subproject commit 467e468efd3ef05bf9c6ec884fa79235cfcd04dd Subproject commit 1b376bf6467101a1f3262f74d23118e2b19bd3ba