def update_parameters(self): try: self.body_id = config.BODIES[self.object_name] except KeyError: self.body_id = None self.type_of_object = "Spacecraft" else: self.type_of_object = "celestial_body" self.orbiting_body_name = get_telemetry("body") self.eccentricity = get_telemetry("eccentricity") self.semi_major_axis = get_telemetry("sma") self.inclination = get_telemetry("inclination") self.longitude_of_ascending_node = get_telemetry("lan") self.argument_of_periapsis = get_telemetry("argumentOfPeriapsis") self.mean_anomaly_at_epoch = get_telemetry("maae") self.true_anomaly = get_telemetry("trueAnomaly") self.apoapsis = get_telemetry("ApA") self.periapsis = get_telemetry("PeA") self.time_to_apoapsis = get_telemetry("timeToAp") self.time_to_periapsis = get_telemetry("timeToPe") self.orbital_period = get_telemetry("period") self.time_of_periapsis_passage = get_telemetry("timeOfPeriapsisPassage") self.time_to_apoapsis_dhms = utils.seconds_to_time(self.time_to_apoapsis) self.time_to_periapsis_dhms = utils.seconds_to_time(self.time_to_periapsis) self.orbital_period_hms = utils.seconds_to_time(self.orbital_period) self.time_of_periapsis_passage_hms = utils.seconds_to_time(self.time_of_periapsis_passage)
def _ten_minute_monitor(self): ''' Part of the sequence of P40 :returns: None ''' if utils.seconds_to_time(self.burn.time_until_ignition)["minutes"] < 10: self.computer.main_loop_table.remove(self._ten_minute_monitor) self.burn.execute()
def _ten_minute_monitor(self): ''' Part of the sequence of P40 :returns: None ''' if utils.seconds_to_time( self.burn.time_until_ignition)["minutes"] < 10: self.computer.main_loop_table.remove(self._ten_minute_monitor) self.burn.execute()
def execute(self): ''' Executes the program :returns: None ''' super().execute() # if TIG < 2 mins away, abort burn if utils.seconds_to_time(self.burn.time_until_ignition)["minutes"] < 2: self.computer.remove_burn() self.computer.poodoo_abort(226) return # if time to ignition if further than a hour away, display time to ignition if utils.seconds_to_time(self.burn.time_until_ignition)["hours"] > 0: utils.log("TIG > 1 hour away") self.computer.execute_verb(verb="16", noun="33") self.computer.main_loop_table.append(self._ten_minute_monitor) else: utils.log("TIG < 1 hour away, enabling burn") self.burn.execute()
def return_data(self): if not computer.next_burn: computer.program_alarm(alarm_code=115, message="No burn data loaded") return False time_until_ignition = utils.seconds_to_time(computer.next_burn.calculate_time_to_ignition()) hours = str(int(time_until_ignition["hours"])) minutes = str(int(time_until_ignition["minutes"])) seconds = str(int(time_until_ignition["seconds"])).replace(".", "") data = { 1: "-" + hours, 2: "-000" + minutes, 3: "-000" + seconds, "tooltips": [ "Time To Ignition (hhhhh)", "Time To Ignition (bbbmm)", "Time To Ignition (bbbss)", ], "is_octal": False, } return data
def return_data(self): if not computer.next_burn: computer.program_alarm(115) return False burn = computer.next_burn time_to_ignition = utils.seconds_to_time(burn.time_until_ignition) minutes_to_ignition = str(int(time_to_ignition["minutes"])).zfill(2) seconds_to_ignition = str(int(time_to_ignition["seconds"])).zfill(2) velocity = str(int(get_telemetry("orbitalVelocity"))).replace(".", "") accumulated_delta_v = str(int(burn.accumulated_delta_v)).replace(".", "") data = { 1: "-" + minutes_to_ignition + "b" + seconds_to_ignition, 2: velocity, 3: accumulated_delta_v, "is_octal": False, "tooltips": [ "Time From Ignition (mmbss minutes, seconds)", "Orbital Velocity (xxxxx m/s)", "Accumulated Δv (xxxxx m/s)", ], } return data
def return_data(self): if not computer.next_burn: computer.program_alarm(115) return False time_to_ignition = utils.seconds_to_time(computer.next_burn.time_until_ignition) minutes_to_ignition = str(int(time_to_ignition["minutes"])).zfill(2) seconds_to_ignition = str(int(time_to_ignition["seconds"])).zfill(2) delta_v = str(int(computer.next_burn.delta_v_required)) burn_duration = str(int(computer.next_burn.burn_duration)) data = { 1: "-" + minutes_to_ignition + "b" + seconds_to_ignition, 2: delta_v, 3: burn_duration, "is_octal": False, "tooltips": [ "Time To Ignition (TIG) (xxbxx mins, seconds)", "Δv (xxxxx m/s)", "Burn duration (xxxxx seconds)", ], } return data