$LastChangedDate: 27-Juil-2011 $

# CL_ev_visibility

Geometrical visibility start and end times.

## Calling Sequence

       [visi_dates] = CL_ev_visibility(cjd,mean_kep,stations,stations_masks, ...
       sim_period, [visi_min,prec,propag_model,er,mu,zonals,obla])

## Description

- Computes the periods of time (start and end times) when a satellite is visible from a given set of ground stations.

  The satellite is visible from a ground station when its elevation is over a given threshold (stations_masks).

  The satellite trajectory is computed using an analytical model (specified by propag_model).

  The results are computed in the simulation period defined by sim_period.

  The intervals returned in visi_dates define the visibility periods start and end times of the satellite by at least one ground station. It means that the visibility intervals for ground stations considered independently are concatenated.

- Notes:

  - Visibility intervals with length less than visi_min are not computed. This parameter is also used for the detection of visibility intervals. So that choosing a small value for visi_min will increase the computation time.

  - Setting planet oblateness (obla) to 0 (so that computation are done assuming a spherical planet) results in faster computation.

  - The inertial reference frame where the orbit parameters are defined is necessarily Gamma50 (Veis) as CL_mod_SidTimeG50 is used to convert positions to the rotating (planet fixed) reference frame.

  - The orbit parameters are the "classical" orbital elements.

## Parameters

cjd:

  Modified julian days from 1950.0 (TUC) (1x1)

mean_kep:

  Satellite's keplerian mean orbital elements at time cjd in Gamma50 (Veis) frame [sma;ecc;inc;pom;raan;anm] (6x1)

stations:

  Stations positions in the rotating (planet fixed) reference frame in elliptical (geodetic) coordinates [long,lat,alt] [rad,rad,m] (3xN)

stations_masks:

  Station minimum elevations (above which there can be visibility) [rad] (1xN or 1x1)

sim_period:

  Simulation time interval ([cjd_start; cjd_end]) in modified julian days from 1950.0 (TUC) (2x1)

visi_min:

  (optional) Minimum visibility duration (default is 60 seconds) [sec] (1x1)

prec:

  (optional) Computation accuracy on start/end visibility times (default is 1 second) [sec] (1x1)

propag_model:

  (optional) Propagation model: 'kep' for keplerian, 'j2' for secular J2, 'lyd' for lyddane or 'eh' for Eckstein Hechler (default is lyddane) (1x1)

er :

  (optional) Planet equatorial radius (default is %CL_eqRad) [m] (1x1)

mu:

  (optional) Gravitational constant [m^3/s^2] (default value is %CL_mu)

zonals:

  (optional) Vector of zonals coefficients J1 to Jn (troncated to J5) to be used (default is %CL_j1jn(1:5)) (1 x N)

obla :

  (optional) Planet oblateness (default is %CL_obla) (1x1)

visi_dates:

  Visibility start and end times: [cjd_visi_start ; cjd_visi_end] in modified julian days from 1950.0 (TUC) (2xM)

## Authors

- CNES - DCT/SB

## See also

- CL_gm_stationElevation

- CL_ex_lyddane

- CL_intervUnion

- CL_intervInters

- CL_intervInv

## Examples

    cjd = 21915;
    mean_kep = [7070.e3 ; 0.001 ; CL_deg2rad([98;90;10;15])];

    //stations definition
    sta1 = [CL_deg2rad(2);CL_deg2rad(70);200]; // high latitude
    sta2 = [CL_deg2rad(20);CL_deg2rad(0);400]; // equator
    stations = [sta1,sta2];
    stations_masks = [ CL_deg2rad(10) , CL_deg2rad(2) ];

    sim_period = [21915 ; 21918 ];  // 3 days

    //visibility computation
    [visi_dates] = CL_ev_visibility(cjd,mean_kep,stations, ..
    stations_masks,sim_period);

    // Plot visibility duration as function of time
    scf();
    dates_plot = 0:1/86400:3;
    ind_dates = [];
    visi = zeros(dates_plot);
    for k=1:size(visi_dates,2)
    ind = find( sim_period(1)+dates_plot > ..
    visi_dates(1,k) & sim_period(1)+dates_plot < visi_dates(2,k));
    visi(ind) = (visi_dates(2,k)-visi_dates(1,k))*1440.0;
    end
    plot2d(dates_plot*24,visi,2)

    // Histogram of visibility durations
    scf();
    histplot(20,(visi_dates(2,:)-visi_dates(1,:))*1440.0,normalization=%f)
    a=gca();
    a.title.text = "nb of visi w.r.t visi duration (minutes)";

    // Station elevations and visi start and end times on same plot
    scf();
    pas = 60.0/86400.0;
    dates = sim_period(1):pas:sim_period(2);
    [moy,osc] = CL_ex_lyddane(cjd,mean_kep,dates);
    [pos_sat_G50,vit_sat_G50] = CL_oe_kep2car(osc);
    M = CL_fr_G502terMat(dates);
    pos_sat_ter = M*pos_sat_G50;
    [elev] = CL_gm_stationElevation(pos_sat_ter,stations);
    plot2d((dates-cjd)*24,CL_rad2deg(elev(1,:)),2); //station 1
    plot2d((dates-cjd)*24,CL_rad2deg(elev(2,:)),3); //station 2
    [visi_dates_1] = CL_ev_visibility(cjd,mean_kep,stations(:,1), ..
    stations_masks(1),sim_period);
    [visi_dates_2] = CL_ev_visibility(cjd,mean_kep,stations(:,2), ..
    stations_masks(2),sim_period);
    plot((visi_dates_1(1,:)-cjd)*24, ..
    CL_rad2deg(stations_masks(1))*ones(visi_dates_1(1,:)),'bs');
    plot((visi_dates_1(2,:)-cjd)*24, ..
    CL_rad2deg(stations_masks(1))*ones(visi_dates_1(1,:)),'bs');
    plot((visi_dates_2(1,:)-cjd)*24, ..
    CL_rad2deg(stations_masks(2))*ones(visi_dates_2(1,:)),'gs');
    plot((visi_dates_2(2,:)-cjd)*24, ..
    CL_rad2deg(stations_masks(2))*ones(visi_dates_2(1,:)),'gs');

    // Same computation with obla=0 (faster)
    [visi_dates] = CL_ev_visibility(cjd,mean_kep,stations, ..
    stations_masks,sim_period,obla=0);