Link between Earth and Mars I am trying to the calculate the link budget for link between a ground station on Earth (with a particular latitude and longitude) and a rover at a particular location on the surface of Mars, either directly or through a satellite on Mars. Now, if I need to determine the link availability between the rover and the ground station, the first step is to determine weather I have a line of sight between the ground station and the rover.
For this, the first step is to determine whether Mars is above our horizon or not and if so, for how long. This can be easily done using packages such as PyEphem or Novas.
The next step would be to determine if the rover is actually facing Earth or is on the other side of Mars. It is this second step that I need to determine with reasonable accuracy, but have not been able to figure out how to so far.
Later on I would need to include the satellites in the link path as well, but for now, I need to determine if I can get a straight line of sight communication between the rover on Mars and ground station on Earth.
Any sort of help will be appreciated.
 A: Your geometrical considerations are the least part of your woes. To calculate LOS length and availability you can use NAIF SPICE toolkit from NASA's JPL. Basically, it all boils down to putting several constraints on the elevation angles (both on the Mars and Earth sides of the link - because of local terrain - which is very important, and also because of extra attenuation loss on the signal's path). In doing this, you have to account for propagation time.
To calculate link budget there are a few other inputs you have to know:


*

*frequency used for the uplink and downlink;

*diameter of the high-gain dishes on the rover and for instance at Goldstone (in fact, actual gains are needed);

*noise figures for the receivers;

*losses in the tract;

*pointing error;

*peak power for the transmitters;

*polarization loss;

*type of modulation and error correction used.


You'd want to know tropospheric humidity along the LOS in Earth's atmosphere, some assessment of possible propagation loss from dust on Mars (hence, reference atmosphere like Mars-GRAM 2010 with some statistical margin); noise from the background and mighty noise sources (like the Sun) possibly near the LOS.
