Beispiel #1
0
    def estimate_path_loss(self, receiver, frequency, environment,
                           simulation_parameters):
        """

        Function to calculate the path loss between a transmitter
        and receiver.

        Parameters
        ----------
        receiver : object
            Receiving User Equipment (UE) item.
        frequency : float
            The carrier frequency for the chosen spectrum band (GHz).
        environment : string
            Either urban, suburban or rural.
        seed_value : int
            Set seed value for quasi-random number generator.
        iterations : int
            The number of stochastic iterations for the specific point.
        los_breakpoint_m : int
            The breakpoint over which propagation becomes non line of sight.

        Returns
        -------
        path_loss : float
            Estimated path loss in decibels between the transmitter
            and receiver.
        model : string
            Specifies which propagation model was used.
        strt_distance : int
            States the straight line distance in meters between the
            transmitter and receiver.
        type_of_sight : string
            Either Line of Sight or None Line of Sight.

        """
        temp_line = LineString([
            (receiver.coordinates[0], receiver.coordinates[1]),
            (self.transmitter.coordinates[0], self.transmitter.coordinates[1])
        ])

        strt_distance = temp_line.length

        ant_height = self.transmitter.ant_height
        ant_type = self.transmitter.ant_type

        if strt_distance < simulation_parameters['los_breakpoint_m']:
            type_of_sight = 'los'
        else:
            type_of_sight = 'nlos'

        path_loss, model = path_loss_calculator(
            frequency, strt_distance, ant_height, ant_type,
            simulation_parameters['building_height'],
            simulation_parameters['street_width'], environment, type_of_sight,
            receiver.ue_height, simulation_parameters['above_roof'],
            receiver.indoor, simulation_parameters['seed_value1'],
            simulation_parameters['iterations'])

        return path_loss, model, strt_distance, type_of_sight
Beispiel #2
0
def test_path_loss_calculator(frequency, distance, ant_height, ant_type,
                              building_height, street_width, settlement_type,
                              type_of_sight, ue_height, above_roof, indoor,
                              seed_value, iterations, expected):

    assert (path_loss_calculator(frequency, distance, ant_height, ant_type,
                                 building_height, street_width,
                                 settlement_type, type_of_sight, ue_height,
                                 above_roof, indoor, seed_value,
                                 iterations)) == expected
Beispiel #3
0
    def estimate_interference(self, receiver, frequency, environment,
                              simulation_parameters):
        """
        Calculate interference from other sites.

        closest_sites contains all sites, ranked based
        on distance, meaning we need to select sites 1-3 (as site 0
        is the actual site in use)

        Parameters
        ----------
        receiver : object
            Receiving User Equipment (UE) item.
        frequency : float
            The carrier frequency for the chosen spectrum band (GHz).
        environment : string
            Either urban, suburban or rural.
        seed_value : int
            Set seed value for quasi-random number generator.
        iterations : int
            The number of stochastic iterations for the specific point.

        Returns
        -------
        interference : List
            Received interference power in decibels at the receiver.
        model : string
            Specifies which propagation model was used.
        ave_distance : float
            The average straight line distance in meters between the
            interfering transmitters and receiver.
        ave_pl : string
            The average path loss in decibels between the interfering
            transmitters and receiver.

        """
        interference = []

        ave_distance = 0
        ave_pl = 0

        for interfering_transmitter in self.interfering_transmitters.values():

            temp_line = LineString([(receiver.coordinates[0],
                                     receiver.coordinates[1]),
                                    (interfering_transmitter.coordinates[0],
                                     interfering_transmitter.coordinates[1])])

            interference_strt_distance = temp_line.length

            ant_height = interfering_transmitter.ant_height
            ant_type = interfering_transmitter.ant_type

            if interference_strt_distance < simulation_parameters[
                    'los_breakpoint_m']:
                type_of_sight = 'los'
            else:
                type_of_sight = 'nlos'

            path_loss, model = path_loss_calculator(
                frequency,
                interference_strt_distance,
                ant_height,
                ant_type,
                simulation_parameters['building_height'],
                simulation_parameters['street_width'],
                environment,
                type_of_sight,
                receiver.ue_height,
                simulation_parameters['above_roof'],
                receiver.indoor,
                simulation_parameters['seed_value2'],
                simulation_parameters['iterations'],
            )

            received_interference = self.estimate_received_power(
                interfering_transmitter, receiver, path_loss)

            ave_distance += interference_strt_distance
            ave_pl += path_loss

            interference.append(received_interference)

        ave_distance = (ave_distance /
                        len(self.interfering_transmitters.values()))

        ave_pl = (ave_pl / len(self.interfering_transmitters.values()))

        return interference, model, ave_distance, ave_pl
Beispiel #4
0
def test_path_loss_calculator_errors():

    with pytest.raises(ValueError,
                       match='frequency of 0.01 is NOT within correct range'):
        path_loss_calculator(0.01, 500, 10, 'micro', 20, 20, 'urban', 'los',
                             1.5, 1, True, 42, 1)