コード例 #1
0
ファイル: impl_ecu_simple.py プロジェクト: xding/IVNS
 def __init__(self, sim_env, ecu_id, data_rate, size_sending_buffer, size_receive_buffer):
     ''' Constructor
         
         Input:  sim_env                simpy.Environment         environment in which this Bus acts
                 bus_id                 string                    id of this Bus object
                 data_rate              float                     datarate of this bus
                 avg_ecu_dist           float                     average distance between two connected ECUs
                 size_sending_buffer    float                     size of the sending buffer of this ECU
                 size_receive_buffer    float                     size of the receiving buffer of this ECU                              
         Output:   -                  
     '''
                     
     # set settings
     self.set_settings()
     if sim_env == None: return  # no instantiation    
     AbstractECU.__init__(self, sim_env, ecu_id, data_rate)
             
     # initialize 
     self.ecuHW = ECUHardware(sim_env, StdTransceiver(sim_env), StdCanController(sim_env, size_receive_buffer, size_sending_buffer), StdMicrocontroller(sim_env))
     self.ecuSW = ECUSoftware(sim_env, StdCommModule(sim_env), SimpleApplicationLayer(sim_env, ecu_id))
     
     # connect layers
     self._connect_hw_sw()          
コード例 #2
0
    def __init__(self, sim_env=None, ecu_id=None, data_rate=None):
        """ Constructor
            
            Input:    sim_env    simpy.Environment        environment of this component
                      ecu_id     string                   id of the corresponding AbstractECU
                      data_rate  float                    datarate of the ecu
            Output:   -
        """
        self._GATEWAY = True

        # set settings
        self.set_settings()
        self._connected_busses = []
        self._transceivers = []
        self._controller = []
        self._physical_layer = []
        self._datalink_layer = []
        self._trans_bus_filter_values = {}
        self._trans_bus_dep_filter_active = False
        self._bus_dep_filter_active = False
        self._filter_values = False
        self._bus_filter_values = {}  # key: Can ID value: lst allowed msg ids

        # create hardware and software
        if sim_env == None:
            return  # no instantiation
        AbstractECU.__init__(self, sim_env, uuid.uuid4(), data_rate)
        self.ecuHW = ECUHardware(
            sim_env, StdTransceiver(sim_env), StdCanController(sim_env), StdMicrocontroller(sim_env)
        )
        self.ecuSW = ECUSoftware(sim_env, StdCommModule(sim_env), SimpleApplicationLayer(sim_env, ecu_id))
        self._connect_hw_sw()
        self._override_methods(self.ecuHW.transceiver)

        # project parameters
        self.GW_TRANSITION_PROCESS = time.GW_TRANSITION_PROCESS
コード例 #3
0
ファイル: impl_can_gateway.py プロジェクト: xding/IVNS
    def __init__(self, sim_env=None, ecu_id=None, data_rate=None):
        ''' Constructor
            
            Input:    sim_env    simpy.Environment        environment of this component
                      ecu_id     string                   id of the corresponding AbstractECU
                      data_rate  float                    datarate of the ecu
            Output:   -
        '''
        self._GATEWAY = True

        # set settings
        self.set_settings()
        self._connected_busses = []
        self._transceivers = []
        self._controller = []
        self._physical_layer = []
        self._datalink_layer = []
        self._trans_bus_filter_values = {}
        self._trans_bus_dep_filter_active = False
        self._bus_dep_filter_active = False
        self._filter_values = False
        self._bus_filter_values = {}  # key: Can ID value: lst allowed msg ids

        # create hardware and software
        if sim_env == None: return  # no instantiation
        AbstractECU.__init__(self, sim_env, uuid.uuid4(), data_rate)
        self.ecuHW = ECUHardware(sim_env, StdTransceiver(sim_env),
                                 StdCanController(sim_env),
                                 StdMicrocontroller(sim_env))
        self.ecuSW = ECUSoftware(sim_env, StdCommModule(sim_env),
                                 SimpleApplicationLayer(sim_env, ecu_id))
        self._connect_hw_sw()
        self._override_methods(self.ecuHW.transceiver)

        # project parameters
        self.GW_TRANSITION_PROCESS = time.GW_TRANSITION_PROCESS