Usage cleanup and wait time bug fix

merge-requests/24/head
cgbsat 2019-05-11 17:45:41 +00:00
parent 79bbdab3fc
commit 5c2cca6dc8
2 changed files with 18 additions and 11 deletions

View File

@ -85,10 +85,10 @@ def main():
"--duration", "--duration",
help="Duration to schedule [hours; default 1.0]", help="Duration to schedule [hours; default 1.0]",
type=float, type=float,
default=1) default=1.0)
parser.add_argument("-m", parser.add_argument("-m",
"--min-horizon", "--min-horizon",
help="Minimum horizon [default 0]", help="Minimum horizon [default 0.0]",
type=float, type=float,
default=0.) default=0.)
parser.add_argument("-f", parser.add_argument("-f",
@ -100,9 +100,8 @@ def main():
parser.add_argument("-w", parser.add_argument("-w",
"--wait", "--wait",
help="Wait time between consecutive observations (for setup and slewing)" + help="Wait time between consecutive observations (for setup and slewing)" +
" [seconds; default: 0.0]", " [seconds; default: 0, max 3600]",
type=int, type=int,
choices=range(0, 3600),
default=0) default=0)
parser.add_argument("-n", parser.add_argument("-n",
"--dryrun", "--dryrun",
@ -138,8 +137,16 @@ def main():
# Settings # Settings
ground_station_id = args.station ground_station_id = args.station
if args.duration>0.0:
length_hours = args.duration length_hours = args.duration
else:
length_hours = 1.0
if args.wait<=0:
wait_time_seconds = 0
elif args.wait<=3600:
wait_time_seconds = args.wait wait_time_seconds = args.wait
else:
wait_time_seconds = 3600
min_horizon_arg = args.min_horizon min_horizon_arg = args.min_horizon
cache_dir = "/tmp/cache" cache_dir = "/tmp/cache"
schedule = not args.dryrun schedule = not args.dryrun

View File

@ -150,16 +150,16 @@ def overlap(satpass, scheduledpasses, wait_time_seconds):
# Loop over scheduled passes # Loop over scheduled passes
for scheduledpass in scheduledpasses: for scheduledpass in scheduledpasses:
# Test pass falls within scheduled pass # Test pass falls within scheduled pass
if tr >= scheduledpass['tr'] and ts < scheduledpass['ts']: if tr >= scheduledpass['tr'] and ts < scheduledpass['ts'] + timedelta(seconds=wait_time_seconds):
overlap = True overlap = True
# Scheduled pass falls within test pass # Scheduled pass falls within test pass
elif scheduledpass['tr'] >= tr and scheduledpass['ts'] < ts: elif scheduledpass['tr'] >= tr and scheduledpass['ts'] + timedelta(seconds=wait_time_seconds) < ts:
overlap = True overlap = True
# Pass start falls within pass # Pass start falls within pass
elif tr >= scheduledpass['tr'] and tr < scheduledpass['ts']: elif tr >= scheduledpass['tr'] and tr < scheduledpass['ts'] + timedelta(seconds=wait_time_seconds):
overlap = True overlap = True
# Pass end falls within end # Pass end falls within end
elif ts >= scheduledpass['tr'] and ts < scheduledpass['ts']: elif ts >= scheduledpass['tr'] and ts < scheduledpass['ts'] + timedelta(seconds=wait_time_seconds):
overlap = True overlap = True
if overlap: if overlap:
break break