Beispiel #1
0
    def __init__(self, cfg):
        """
        extract input as self variable
        initialize NATS standalone server, retrieve NATS interfaces as self variable
        get simulation constant

        Parameters
        ----------
        cfg : dictionary
            inputs to VCAS simulation
            
            'fp_file' :  str
                directory tp flight plan file for NATS simulation
            'mfl_file' : str
                directory to mfl file for NATS simulation
            'cmd_file' : str
                directory to text command as .csv file
            'data_file' : srt
                directory to actual trajectory data as .csv file
            'sim_time' : int/float
                total simulation duration
        """
        self.fp_file = cfg['fp_file']
        self.mfl_file = cfg['mfl_file']
        self.cmd_file = cfg['cmd_file']
        self.sim_time = cfg['sim_time']
        self.track_file = cfg['data_file']
        self.real = pd.read_csv(cfg['data_file'])

        NatsEnvironment.start_jvm(nats_home=None)
        self.NATS_SIMULATION_STATUS_PAUSE = NatsEnvironment.get_nats_constant(
            'GNATS_SIMULATION_STATUS_PAUSE')
        self.NATS_SIMULATION_STATUS_ENDED = NatsEnvironment.get_nats_constant(
            'GNATS_SIMULATION_STATUS_ENDED')

        natsStandalone = NatsEnvironment.get_nats_standalone()

        self.simulationInterface = natsStandalone.getSimulationInterface()

        self.entityInterface = natsStandalone.getEntityInterface()
        self.controllerInterface = self.entityInterface.getControllerInterface(
        )
        self.pilotInterface = self.entityInterface.getPilotInterface()

        self.environmentInterface = natsStandalone.getEnvironmentInterface()

        self.equipmentInterface = natsStandalone.getEquipmentInterface()
        self.aircraftInterface = self.equipmentInterface.getAircraftInterface()

        if self.simulationInterface is None:
            natsStandalone.stop()
            raise RuntimeError("Can't get SimulationInterface")

        self.simulationInterface.clear_trajectory()
    def __init__(self, cfg):
        """

        Parameters
        ----------
        cfg : dictionary
            inputs to Aviation Risk simulation
            
            'fp_file' :  str
                directory tp flight plan file for NATS simulation
            'mfl_file' : str
                directory to mfl file for NATS simulation
            'data_file' : str
                required data for accident simulation and risk estimation
            'model_file' : srt
                directory to pre-trained model
            'sim_time' : int/float
                total simulation duration
        """
        self.fp_file = cfg['fp_file']
        self.mfl_file = cfg['mfl_file']
        self.data = cfg['data_file']
        self.case = self.data + 'case.pickle'
        self.refer = self.data + 'refer.pickle'
        self.model = cfg['model_file']
        self.sim_time = cfg['sim_time']


        NatsEnvironment.start_jvm(nats_home=None)
        self.NATS_SIMULATION_STATUS_PAUSE = NatsEnvironment.get_nats_constant('NATS_SIMULATION_STATUS_PAUSE')
        self.NATS_SIMULATION_STATUS_ENDED = NatsEnvironment.get_nats_constant('NATS_SIMULATION_STATUS_ENDED')

        natsStandalone = NatsEnvironment.get_nats_standalone()

        self.simulationInterface = natsStandalone.getSimulationInterface()

        self.entityInterface = natsStandalone.getEntityInterface()
        self.controllerInterface = self.entityInterface.getControllerInterface()
        self.pilotInterface = self.entityInterface.getPilotInterface()

        self.environmentInterface = natsStandalone.getEnvironmentInterface()

        self.equipmentInterface = natsStandalone.getEquipmentInterface()
        self.aircraftInterface = self.equipmentInterface.getAircraftInterface()

        if self.simulationInterface is None:
            natsStandalone.stop()
            raise RuntimeError("Can't get SimulationInterface")

        self.simulationInterface.clear_trajectory()