Merge e689ab9096
into 995d2ab99c
commit
4454831bed
|
@ -16,6 +16,7 @@
|
|||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "ini/iniparser.h"
|
||||
#include "util/gopt.h"
|
||||
|
@ -39,6 +40,7 @@ int main(int argc, const char *argv[]) {
|
|||
float burst_alt, ascent_rate, drag_coeff, rmswinderror;
|
||||
int descent_mode;
|
||||
int scenario_idx, n_scenarios;
|
||||
int alarm_time;
|
||||
char* endptr; // used to check for errors on strtod calls
|
||||
|
||||
wind_file_cache_t* file_cache;
|
||||
|
@ -54,7 +56,8 @@ int main(int argc, const char *argv[]) {
|
|||
gopt_option('t', GOPT_ARG, gopt_shorts('t'), gopt_longs("start_time")),
|
||||
gopt_option('i', GOPT_ARG, gopt_shorts('i'), gopt_longs("data_dir")),
|
||||
gopt_option('d', 0, gopt_shorts('d'), gopt_longs("descending")),
|
||||
gopt_option('e', GOPT_ARG, gopt_shorts('e'), gopt_longs("wind_error"))
|
||||
gopt_option('e', GOPT_ARG, gopt_shorts('e'), gopt_longs("wind_error")),
|
||||
gopt_option('a', GOPT_ARG, gopt_shorts('a'), gopt_longs("alarm"))
|
||||
));
|
||||
|
||||
if (gopt(options, 'h')) {
|
||||
|
@ -74,6 +77,7 @@ int main(int argc, const char *argv[]) {
|
|||
printf(" burst or cutdown. burst_alt and ascent_rate ignored.\n");
|
||||
printf(" -i --data_dir <dir> Input directory for wind data, defaults to current dir.\n\n");
|
||||
printf(" -e --wind_error <err> RMS windspeed error (m/s).\n");
|
||||
printf(" -a --alarm <seconds> Use alarm() to kill pred incase it hangs.\n");
|
||||
printf("The scenario file is an INI-like file giving the launch scenario. If it is\n");
|
||||
printf("omitted, the scenario is read from standard input.\n");
|
||||
exit(0);
|
||||
|
@ -84,6 +88,15 @@ int main(int argc, const char *argv[]) {
|
|||
printf("Landing Prediction version: %s\nCopyright (c) CU Spaceflight 2009\n", VERSION);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if (gopt_arg(options, 'a', &argument) && strcmp(argument, "-")) {
|
||||
alarm_time = strtol(argument, &endptr, 0);
|
||||
if (endptr == argument) {
|
||||
fprintf(stderr, "ERROR: %s: invalid alarm length\n", argument);
|
||||
exit(1);
|
||||
}
|
||||
alarm(alarm_time);
|
||||
}
|
||||
|
||||
verbosity = gopt(options, 'v');
|
||||
|
||||
|
|
|
@ -249,7 +249,12 @@ def main():
|
|||
|
||||
update_progress(gfs_percent=100, gfs_timeremaining='Done', gfs_complete=True, pred_running=True)
|
||||
|
||||
subprocess.call([pred_binary, '-i/var/www/hab/predict/gfs/', '-v', '-o'+uuid_path+'flight_path.csv', uuid_path+'scenario.ini'])
|
||||
if options.alarm:
|
||||
alarm_flags = ["-a120"]
|
||||
else:
|
||||
alarm_flags = []
|
||||
|
||||
subprocess.call([pred_binary, '-i/var/www/hab/predict/gfs/', '-v', '-o'+uuid_path+'flight_path.csv', uuid_path+'scenario.ini'] + alarm_flags)
|
||||
|
||||
update_progress(pred_running=False, pred_complete=True)
|
||||
|
||||
|
|
|
@ -95,7 +95,10 @@ function verifyModel( $pred_model, $software_available ) {
|
|||
}
|
||||
|
||||
// Now check that the timestamp is within range
|
||||
if ( $pred_model['timestamp'] > (time() + 180*3600) ) {
|
||||
if ( !isset($pred_model['timestamp']) ) {
|
||||
$return_array['valid'] = false;
|
||||
$return_array['msg'] = "Launch time missing";
|
||||
} else if ( $pred_model['timestamp'] > (time() + 180*3600) ) {
|
||||
// More than 180 hours into future
|
||||
$return_array['valid'] = false;
|
||||
$return_array['msg'] = "A prediction cannot be run for a time that is
|
||||
|
|
Ładowanie…
Reference in New Issue