Esempio n. 1
0
    def test_multiple_locations():
        # Obtain the coordinates of the different cities
        cities = {'Boston': (42.36, -71.06),
                  'New York': (40.71, -74.01),
                  'Los Angeles': (34.05, -118.24),
                  'Denver': (39.74, -104.99),
                  'Las Vegas': (36.20, -115.14),
                  'Seattle': (47.61, -122.33),
                  'Washington DC': (38.91, -77.04)}

        lat = [coords[0] for coords in cities.values()]
        lon = [coords[1] for coords in cities.values()]

        # Satellite coordinates (GEO, 4 E)
        lat_sat = 0
        lon_sat = -77
        h_sat = 35786 * itur.u.km

        # Compute the elevation angle between satellite and ground stations
        el = itur.utils.elevation_angle(h_sat, lat_sat, lon_sat, lat, lon)

        # Set the link parameters
        f = 22.5 * itur.u.GHz    # Link frequency
        D = 1.2 * itur.u.m       # Antenna diameters
        p = 0.1                  # Unavailability (Vals exceeded 0.1% of time)

        # Compute the atmospheric attenuation
        Ag, Ac, Ar, As, Att = itur.atmospheric_attenuation_slant_path(
            lat, lon, f, el, p, D, return_contributions=True)

        # Plot the results
        city_idx = np.arange(len(cities))
        width = 0.15

        fig, ax = plt.subplots(1, 1)
        ax.bar(city_idx, Att.value, 0.6, label='Total atmospheric Attenuation')
        ax.bar(city_idx - 1.5 * width, Ar.value, width,
               label='Rain attenuation')
        ax.bar(city_idx - 0.5 * width, Ag.value, width,
               label='Gaseous attenuation')
        ax.bar(city_idx + 0.5 * width, Ac.value, width,
               label='Clouds attenuation')
        ax.bar(city_idx + 1.5 * width, As.value, width,
               label='Scintillation attenuation')

        # Set the labels
        ticks = ax.set_xticklabels([''] + list(cities.keys()))
        for t in ticks:
            t.set_rotation(45)
        ax.set_ylabel('Atmospheric attenuation exceeded for 0.1% [dB]')

        # Format image
        ax.yaxis.grid(which='both', linestyle=':')
        ax.legend(loc='upper center', bbox_to_anchor=(0.5, 1.3), ncol=2)
        plt.tight_layout(rect=(0, 0, 1, 0.85))
Esempio n. 2
0
    def test_single_location():

        # Location of the receiver ground stations
        lat = 41.39
        lon = -71.05

        # Link parameters
        el = 60                # Elevation angle equal to 60 degrees
        f = 22.5 * itur.u.GHz  # Frequency equal to 22.5 GHz
        D = 1 * itur.u.m       # Receiver antenna diameter of 1 m
        p = 0.1                # We compute values exceeded during 0.1 % of
                               # the average year

        # Compute atmospheric parameters
        hs = itur.topographic_altitude(lat, lon)
        T = itur.surface_mean_temperature(lat, lon)
        P = itur.models.itu835.pressure(lat, hs)
        rho_p = itur.surface_water_vapour_density(lat, lon, p, hs)
        itur.models.itu835.water_vapour_density(lat, hs)
        itur.models.itu835.temperature(lat, hs)
        itur.models.itu836.total_water_vapour_content(lat, lon, p, hs)

        # Compute rain and cloud-related parameters
        itur.models.itu618.rain_attenuation_probability(
                lat, lon, el, hs)
        itur.models.itu837.rainfall_probability(lat, lon)
        itur.models.itu837.rainfall_rate(lat, lon, p)
        itur.models.itu839.isoterm_0(lat, lon)
        itur.models.itu839.rain_height(lat, lon)
        itur.models.itu840.columnar_content_reduced_liquid(
                lat, lon, p)
        itur.models.itu676.zenit_water_vapour_attenuation(
                lat, lon, p, f, h=hs)

        # Compute attenuation values
        itur.gaseous_attenuation_slant_path(f, el, rho_p, P, T)
        itur.rain_attenuation(lat, lon, f, el, hs=hs, p=p)
        itur.cloud_attenuation(lat, lon, el, f, p)
        itur.scintillation_attenuation(lat, lon, f, el, p, D)
        itur.atmospheric_attenuation_slant_path(lat, lon, f, el, p, D)
Esempio n. 3
0
    def get_link_attenuation(self, p=0.001, method='approx'):
        if self.grstation is None:
            sys.exit(
                'Need to associate a ground station to a satellite first. Try satellite.set_reception(reception)!!!'
            )
        if self.reception is None:
            sys.exit(
                'Need to associate a reception to a satellite first. Try satellite.set_reception(reception)!!!'
            )
        if self.p is None:
            self.p = 0.001
            p = 0.001
        if self.a_tot is not None and p == self.p:
            return self.a_fs, self.reception.get_depoint_loss(
            ), self.a_g, self.a_c, self.a_r, self.a_s, self.a_t, self.a_tot
        else:
            freq = self.freq * u.GHz
            e = self.get_elevation()
            diam = self.reception.ant_size * u.m
            a_fs = FsAtt(self.get_distance(), self.freq)
            a_g, a_c, a_r, a_s, a_t = itur.atmospheric_attenuation_slant_path(
                self.grstation.site_lat,
                self.grstation.site_long,
                freq,
                e,
                p,
                diam,
                return_contributions=True,
                mode=method)
            a_tot = a_fs + self.reception.get_depoint_loss() + a_t.value

            self.a_g = a_g
            self.a_c = a_c
            self.a_r = a_r
            self.a_s = a_s
            self.a_t = a_t
            self.a_fs = a_fs
            self.a_tot = a_tot
            self.p = p

            # erasing the dependent variables that will use link atten. for different p value
            self.power_flux_density = None
            self.antenna_noise_rain = None
            self.total_noise_temp = None
            self.figure_of_merit = None
            self.c_over_n0 = None
            self.snr = None
            self.cross_pol_discrimination = None

        return a_fs, self.reception.get_depoint_loss(
        ), a_g, a_c, a_r, a_s, a_t, a_tot
Esempio n. 4
0
    def test_map_africa(self):
        # Generate a regular grid of latitude and longitudes with 0.1
        # degree resolution for the region of interest.
        lat, lon = itur.utils.regular_lat_lon_grid(lat_max=60,
                                                   lat_min=-60,
                                                   lon_max=65,
                                                   lon_min=-35,
                                                   resolution_lon=1,
                                                   resolution_lat=1)

        # Satellite coordinates (GEO, 4 E)
        lat_sat = 0
        lon_sat = 4
        h_sat = 35786 * itur.u.km

        # Compute the elevation angle between satellite and ground stations
        el = itur.utils.elevation_angle(h_sat, lat_sat, lon_sat, lat, lon)

        # Set the link parameters
        f = 22.5 * itur.u.GHz  # Link frequency
        D = 1.2 * itur.u.m  # Antenna diameters
        p = 0.1  # Unavailability (Vals exceeded 0.1% of time)

        # Compute the atmospheric attenuation
        Att = itur.atmospheric_attenuation_slant_path(lat, lon, f, el, p, D)

        # Now we show the surface mean temperature distribution
        T = itur.surface_mean_temperature(lat, lon)\
            .to(itur.u.Celsius, equivalencies=itur.u.temperature())

        # Plot the results
        try:
            m = itur.utils.plot_in_map(
                Att,
                lat,
                lon,
                cbar_text='Atmospheric attenuation [dB]',
                cmap='magma')

            # Plot the satellite location
            m.scatter(lon_sat, lat_sat, c='white', s=20)

            m = itur.utils.plot_in_map(
                T,
                lat,
                lon,
                cbar_text='Surface mean temperature [C]',
                cmap='RdBu_r')
        except RuntimeError as e:
            print(e)
Esempio n. 5
0
def atmospheric_attenuation(lat, lng, elevation, pol_skew, freq, availability,
                            dish_size, dish_eff):
    """Total attenuation due to multiple sources of atmospheric attenuation

    A wrapper to obtain the total atmospheric attenuation through ITU-Rpy.

    Args:
        lat (float): Earth station's latitude in degrees.
        lng (float): Earth station's longitude in degrees.
        elevation (float): Elevation angle in degrees.
        freq (float): Carrier frequency in Hz.
        availability (float): Target link availability within [95 to 99.999%].
        dish_size (float): Earth station's dish diameter in m.
        dish_eff (float): Dish aperture efficiency within [0, 1].

    Returns:
        float: Total atmospheric attenuation in dB.

    """
    f_ghz = freq / 1e9
    unavailability = 100 - availability
    a_g, a_c, a_r, a_s, a_t = itur.atmospheric_attenuation_slant_path(
        lat,
        lng,
        f_ghz,
        elevation,
        unavailability,
        dish_size,
        eta=dish_eff,
        tau=pol_skew,
        return_contributions=True)
    util.log_result("Rain attenuation @ {:g}%".format(unavailability),
                    "{:.2f}".format(a_r))
    util.log_result("Cloud attenuation @ {:g}%".format(unavailability),
                    "{:.2f}".format(a_c))
    util.log_result("Gaseous attenuation @ {:g}%".format(unavailability),
                    "{:.2f}".format(a_g))
    util.log_result("Tropo. scintillation @ {:g}%".format(unavailability),
                    "{:.2f}".format(a_s))
    return a_t.value
Esempio n. 6
0
    def test_single_location_vs_p():
        # Ground station coordinates (Boston)
        lat_GS = 42.3601
        lon_GS = -71.0942

        # Satellite coordinates (GEO, 77 W)
        lat_sat = 0
        lon_sat = -77
        h_sat = 35786 * itur.u.km

        # Compute the elevation angle between satellite and ground station
        el = itur.utils.elevation_angle(h_sat, lat_sat, lon_sat,
                                        lat_GS, lon_GS)

        f = 22.5 * itur.u.GHz    # Link frequency
        D = 1.2 * itur.u.m       # Antenna diameters

        # Define unavailabilities vector in logarithmic scale
        p = np.logspace(-1.5, 1.5, 100)

        A_g, A_c, A_r, A_s, A_t = \
            itur.atmospheric_attenuation_slant_path(
                    lat_GS, lon_GS, f, el, p, D, return_contributions=True)

        # Plot the results using matplotlib
        f, ax = plt.subplots(1, 1)
        ax.semilogx(p, A_g.value, label='Gaseous attenuation')
        ax.semilogx(p, A_c.value, label='Cloud attenuation')
        ax.semilogx(p, A_r.value, label='Rain attenuation')
        ax.semilogx(p, A_s.value, label='Scintillation attenuation')
        ax.semilogx(p, A_t.value, label='Total atmospheric attenuation')

        ax.set_xlabel('Percentage of time attenuation value is exceeded [%]')
        ax.set_ylabel('Attenuation [dB]')
        ax.grid(which='both', linestyle=':')
        plt.legend()
# Satellite coordinates (GEO, 77 W)
lat_sat = 0
lon_sat = -77
h_sat = 35786 * itur.u.km

# Compute the elevation angle between satellite and ground station
el = itur.utils.elevation_angle(h_sat, lat_sat, lon_sat, lat_GS, lon_GS)

f = 22.5 * itur.u.GHz    # Link frequency
D = 1.2 * itur.u.m       # Antenna diameters
p = 1

f = np.logspace(-0.2, 2, 100) * itur.u.GHz

Ag, Ac, Ar, As, A =\
    itur.atmospheric_attenuation_slant_path(lat_GS, lon_GS, f, el, p, D,
                                            return_contributions=True)

# Plot the results
fig, ax = plt.subplots(1, 1)
ax.loglog(f, Ag, label='Gaseous attenuation')
ax.loglog(f, Ac, label='Cloud attenuation')
ax.loglog(f, Ar, label='Rain attenuation')
ax.loglog(f, As, label='Scintillation attenuation')
ax.loglog(f, A, label='Total atmospheric attenuation')

ax.xaxis.set_major_formatter(ScalarFormatter())
ax.yaxis.set_major_formatter(ScalarFormatter())
ax.set_xlabel('Frequency [GHz]')
ax.set_ylabel('Atmospheric attenuation [dB]')
ax.grid(which='both', linestyle=':')
plt.legend()
Esempio n. 8
0
    def ITU_loss(self,
                 frequency,
                 link,
                 location=[41.39, -71.05],
                 percentage=0.1):

        # calculate the matching dish diameter -  assume efficiency of 65%
        if link == 'downlink':
            effective_diameter = (scipy.constants.c /
                                  (np.pi * frequency)) * np.sqrt(
                                      10**(self.gs_rx_antenna_gain / 10) /
                                      0.65) * itur.u.m
        else:
            effective_diameter = (scipy.constants.c /
                                  (np.pi * frequency)) * np.sqrt(
                                      10**(self.gs_tx_antenna_gain / 10) /
                                      0.65) * itur.u.m

        elevation = self.elevation

        # convert frequency to GHz
        frequency_ghz = (frequency / 1e9) * itur.u.GHz

        # Compute atmospheric parameters
        hs = itur.topographic_altitude(41.39, -71.05)
        T = itur.surface_mean_temperature(41.39, -71.05)
        P = itur.models.itu835.pressure(41.39, hs)
        rho_p = itur.surface_water_vapour_density(location[0], location[1],
                                                  percentage, hs)
        rho_sa = itur.models.itu835.water_vapour_density(location[0], hs)
        T_sa = itur.models.itu835.temperature(location[0], hs)
        V = itur.models.itu836.total_water_vapour_content(
            location[0], location[1], percentage, hs)

        # Compute rain and cloud-related parameters
        R_prob = itur.models.itu618.rain_attenuation_probability(
            location[0], location[1], elevation, hs)
        R_pct_prob = itur.models.itu837.rainfall_probability(
            location[0], location[1])
        R001 = itur.models.itu837.rainfall_rate(location[0], location[1],
                                                percentage)
        h_0 = itur.models.itu839.isoterm_0(location[0], location[1])
        h_rain = itur.models.itu839.rain_height(location[0], location[1])
        L_red = itur.models.itu840.columnar_content_reduced_liquid(
            location[0], location[1], percentage)
        A_w = itur.models.itu676.zenit_water_vapour_attenuation(location[0],
                                                                location[1],
                                                                percentage,
                                                                frequency_ghz,
                                                                h=hs)

        # Compute attenuation values
        A_g = itur.gaseous_attenuation_slant_path(frequency_ghz, elevation,
                                                  rho_p, P, T)
        A_r = itur.rain_attenuation(location[0],
                                    location[1],
                                    frequency_ghz,
                                    elevation,
                                    hs=hs,
                                    p=percentage)
        A_c = itur.cloud_attenuation(location[0], location[1], elevation,
                                     frequency_ghz, percentage)
        A_s = itur.scintillation_attenuation(location[0], location[1],
                                             frequency_ghz, elevation,
                                             percentage, effective_diameter)
        A_t = itur.atmospheric_attenuation_slant_path(location[0], location[1],
                                                      frequency_ghz, elevation,
                                                      percentage,
                                                      effective_diameter)

        # rain attenuation plus all other attenuations
        rain = A_r
        atmosphere = A_g + A_c + A_s
        return float(rain.value), float(atmosphere.value)
    gs_name = args.gs_name
    gs_lat = args.gs_lat
    gs_lon = args.gs_lon

    # Ground station coordinates (Blacksburg, Hume)
    lat_GS = 37.206831
    lon_GS = -80.419138

    f = args.freq / 1e9 * u.GHz  #Link frequency
    D = 0.1 * u.m  # Antenna diameters
    p = args.exceedance
    el = np.linspace(1, 90, 100)
    #el[0] = 1e-10

    Ag, Ac, Ar, As, A =\
        itur.atmospheric_attenuation_slant_path(gs_lat, gs_lon, f, el, p, D,
                                                return_contributions=True)

    # Plot the results
    xinch = 7
    yinch = 4
    fig1 = plt.figure(1, figsize=(xinch, yinch / .8))
    ax = fig1.add_subplot(1, 1, 1)
    #ax.plot(el, Ag, label='Gaseous attenuation')
    ax.plot(el, Ac, label='Cloud attenuation')
    #ax.plot(el, Ar, label='Rain attenuation')
    #ax.plot(el, As, label='Scintillation attenuation')
    #ax.plot(el, A, label='Total atmospheric attenuation')
    title_str = 'Worst Case ({:1.1f}%) Cloud Attenuation vs Elevation'.format(
        p)
    ax.xaxis.set_major_formatter(ScalarFormatter())
    ax.yaxis.set_major_formatter(ScalarFormatter())
Esempio n. 10
0
    def test_single_location_vs_f():
        # Ground station coordinates (Boston)
        lat_GS = 42.3601
        lon_GS = -71.0942

        ################################################
        # First case: Attenuation vs. frequency        #
        ################################################

        # Satellite coordinates (GEO, 77 W)
        lat_sat = 0
        lon_sat = -77
        h_sat = 35786 * itur.u.km

        # Compute the elevation angle between satellite and ground station
        el = itur.utils.elevation_angle(h_sat, lat_sat, lon_sat,
                                        lat_GS, lon_GS)

        f = 22.5 * itur.u.GHz    # Link frequency
        D = 1.2 * itur.u.m       # Antenna diameters
        p = 1

        f = np.logspace(-0.2, 2, 100) * itur.u.GHz

        Ag, Ac, Ar, As, A =\
            itur.atmospheric_attenuation_slant_path(lat_GS, lon_GS, f,
                                                    el, p, D,
                                                    return_contributions=True)

        # Plot the results
        fig, ax = plt.subplots(1, 1)
        ax.loglog(f, Ag, label='Gaseous attenuation')
        ax.loglog(f, Ac, label='Cloud attenuation')
        ax.loglog(f, Ar, label='Rain attenuation')
        ax.loglog(f, As, label='Scintillation attenuation')
        ax.loglog(f, A, label='Total atmospheric attenuation')

        ax.set_xlabel('Frequency [GHz]')
        ax.set_ylabel('Atmospheric attenuation [dB]')
        ax.grid(which='both', linestyle=':')
        plt.legend()

        ################################################
        # Second case: Attenuation vs. elevation angle #
        ################################################

        f = 22.5 * itur.u.GHz
        el = np.linspace(5, 90, 100)

        Ag, Ac, Ar, As, A =\
            itur.atmospheric_attenuation_slant_path(lat_GS, lon_GS,
                                                    f, el, p, D,
                                                    return_contributions=True)

        # Plot the results
        fig, ax = plt.subplots(1, 1)
        ax.plot(el, Ag, label='Gaseous attenuation')
        ax.plot(el, Ac, label='Cloud attenuation')
        ax.plot(el, Ar, label='Rain attenuation')
        ax.plot(el, As, label='Scintillation attenuation')
        ax.plot(el, A, label='Total atmospheric attenuation')

        ax.set_xlabel('Elevation angle [deg]')
        ax.set_ylabel('Atmospheric attenuation [dB]')
        ax.grid(which='both', linestyle=':')
        plt.legend()
Esempio n. 11
0
# Satellite coordinates (GEO, 4 E)
lat_sat = 0
lon_sat = -77
h_sat = 35786 * itur.u.km

# Compute the elevation angle between satellite and ground stations
el = itur.utils.elevation_angle(h_sat, lat_sat, lon_sat, lat, lon)

# Set the link parameters
f = 22.5 * itur.u.GHz  # Link frequency
D = 1.2 * itur.u.m  # Antenna diameters
p = 0.1  # Unavailability (Values exceeded 0.1% of time)

# Compute the atmospheric attenuation
Ag, Ac, Ar, As, Att = itur.atmospheric_attenuation_slant_path(
    lat, lon, f, el, p, D, return_contributions=True)

# Plot the results
city_idx = np.arange(len(cities))
width = 0.15

fig, ax = plt.subplots(1, 1)
ax.bar(city_idx, Att.value, 0.6, label='Total atmospheric Attenuation')
ax.bar(city_idx - 1.5 * width, Ar.value, width, label='Rain attenuation')
ax.bar(city_idx - 0.5 * width, Ag.value, width, label='Gaseous attenuation')
ax.bar(city_idx + 0.5 * width, Ac.value, width, label='Clouds attenuation')
ax.bar(city_idx + 1.5 * width,
       As.value,
       width,
       label='Scintillation attenuation')
Esempio n. 12
0
print(
    '  - Rain height                                 [ITU-R P.839]   {0:.1f}'.
    format(h_rain))
print(
    '  - Columnar content of reduced liquid (p={0}%) [ITU-R P.840]   {1:.1f}'.
    format(p, L_red))
print(
    '  - Zenit water vapour attenuation (p={0}%)     [ITU-R P.676]   {1:.1f}'.
    format(p, A_w))

# Compute attenuation values
A_g = itur.gaseous_attenuation_slant_path(f, el, rho_p, P, T)
A_r = itur.rain_attenuation(lat, lon, f, el, hs=hs, p=p)
A_c = itur.cloud_attenuation(lat, lon, el, f, p)
A_s = itur.scintillation_attenuation(lat, lon, f, el, p, D)
A_t = itur.atmospheric_attenuation_slant_path(lat, lon, f, el, p, D)

print(('\n\nAttenuation values exceeded for p={0}% of the average year '
       'for a link with el={1} deg, f={2}, \nD={3} and '
       'receiver ground station located at coordinates ({4}, {5})').format(
           p, el, f, D, lat, lon))

print(
    '  - Rain attenuation                            [ITU-R P.618]   {0:.1f}'.
    format(A_r))
print(
    '  - Gaseous attenuation                         [ITU-R P.676]   {0:.1f}'.
    format(A_g))
print(
    '  - Clouds attenuation                          [ITU-R P.840]   {0:.1f}'.
    format(A_c))