예제 #1
0
    def __init__(self, sim_env):
        ''' Constructor
            
            Input:    sim_env              simpy.Environment                 environment of this component
                      MessageClass         AbstractBusMessage                class that is used for sending and receiving
            Output:   -
        '''
        AbstractCommModule.__init__(self, sim_env)       
         
        # layers
        self.transp_lay = StdTransportLayer(sim_env)  
        self.datalink_lay = StdDatalinkLayer(sim_env)  
        self.physical_lay = StdPhysicalLayer(sim_env) 
        
        # preset used
        if GeneralSpecPreset().enabled: 
            self.transp_lay = GeneralSpecPreset().transport_layer(sim_env, proj.BUS_MSG_CLASS)  
            self.datalink_lay = GeneralSpecPreset().datalink_layer(sim_env)  
            self.physical_lay = GeneralSpecPreset().physical_layer(sim_env) 

        # interconnect layers
        self.datalink_lay.physical_lay = self.physical_lay
        self.transp_lay.datalink_lay = self.datalink_lay
        self.set_settings()
        
        # Timing Variables
        self.STDCM_RECEIVE_PROCESS = time.STDCM_RECEIVE_PROCESS
        self.STDCM_SEND_PROCESS = time.STDCM_SEND_PROCESS
예제 #2
0
    def _init_layers(self, sim_env, MessageClass):
        ''' Initializes the software layers 
            
            Input:  sim_env                        simpy.Environment        environment of this component                      
                    MessageClass                   AbstractBusMessage       class of the messages  how they are sent on the CAN Bus
            Output: -                   
        '''

        # create layers
        self.physical_lay = StdPhysicalLayer(sim_env)
        self.datalink_lay = StdDatalinkLayer(sim_env)
        self.transp_lay = SegmentTransportLayer(sim_env, MessageClass)

        # interconnect layers
        self.datalink_lay.physical_lay = self.physical_lay
        self.transp_lay.datalink_lay = self.datalink_lay
예제 #3
0
    def connected_bus(self, new_bus):
        ''' if called adds a new port to this 
            gateway. This port has all three layers
            and a whole hardware equipment 
            
            Input:    new_bus    CANBus    bus to be connected to new port
            Output:    -
        '''
        if new_bus != None:

            # create whole layer package per connected Bus
            self._connected_busses.append(new_bus)

            # create layers

            # preset used
            if GeneralSpecPreset().enabled:
                self._transceivers.append(StdTransceiver(self.sim_env))
                self._controller.append(StdCanController(self.sim_env))
                self._physical_layer.append(GeneralSpecPreset().physical_layer(
                    self.sim_env))
                self._datalink_layer.append(GeneralSpecPreset().datalink_layer(
                    self.sim_env))
            else:
                self._transceivers.append(StdTransceiver(self.sim_env))
                self._controller.append(StdCanController(self.sim_env))
                self._physical_layer.append(StdPhysicalLayer(self.sim_env))
                self._datalink_layer.append(StdDatalinkLayer(self.sim_env))

            # interconnect new layers
            self._datalink_layer[-1].controller = self._controller[-1]
            self.sim_env.process(self._datalink_layer[-1].process())
            self._datalink_layer[-1].physical_lay = self._physical_layer[-1]
            self._physical_layer[-1].transceiver = self._transceivers[-1]
            self._physical_layer[
                -1].transceiver.connected_bus = self._connected_busses[-1]

            # intercept gateway methods
            self._override_methods(self._physical_layer[-1].transceiver)

            # activate filter
            if self._filter_values:  # install the fixed filter for all ecus
                self._transceivers[-1].install_filter(self._filter_values)

            if new_bus.comp_id in self._bus_filter_values:  # install the filter for special busses
                self._transceivers[-1].install_filter(
                    self._bus_filter_values[new_bus.comp_id])
예제 #4
0
    def __init__(self, sim_env, MessageClass):
        ''' Constructor
            
            Input:    sim_env              simpy.Environment                environment of this component
                      MessageClass         AbstractBusMessage            class that is used for sending and receiving
            Output:   -
        '''
        AbstractCommModule.__init__(self, sim_env, MessageClass)

        # layers
        self.physical_lay = StdPhysicalLayer(sim_env)
        self.datalink_lay = StdDatalinkLayer(sim_env)
        self.transp_lay = SegmentTransportLayer(sim_env, MessageClass)

        # connection between layers
        self.datalink_lay.physical_lay = self.physical_lay
        self.transp_lay.datalink_lay = self.datalink_lay
        self.set_settings()

        # Timing Parameter
        self.SCM_RECEIVE_PROCESS = time.SCM_RECEIVE_PROCESS
        self.SCM_SEND_PROCESS = time.SCM_SEND_PROCESS
예제 #5
0
    def __init__(self, sim_env):
        ''' Constructor
            
            Input:  sim_env        simpy.Environment        environment of this component
            Output: -
        '''
        AbstractCommModule.__init__(self, sim_env)

        # initialize layers
        self.transp_lay = FakeSegmentTransportLayer(sim_env,
                                                    proj.BUS_MSG_CLASS)
        self.datalink_lay = StdDatalinkLayer(sim_env)
        self.physical_lay = StdPhysicalLayer(sim_env)

        # preset used
        if GeneralSpecPreset().enabled:
            self.transp_lay = GeneralSpecPreset().transport_layer(
                sim_env, proj.BUS_MSG_CLASS)
            self.datalink_lay = GeneralSpecPreset().datalink_layer(sim_env)
            self.physical_lay = GeneralSpecPreset().physical_layer(sim_env)

        # connect layers
        self.datalink_lay.physical_lay = self.physical_lay
        self.transp_lay.datalink_lay = self.datalink_lay