# Need an algorithm for satellite passing through non-penumbral earth shadow

1. Dec 8, 2008

### TheFerruccio

I have a simulation with a satellite that orbits earth in 3d.

Earth's shadow, for simplification purposes (the satellite is pretty close to earth) is either on or off. There's no light diffraction here. It can be represented as a cylinder with radius ~6378km, and an axis which aligns with the sun's relative position to earth.

This shadow changes position, as I calculated, by 1 degree approximately every 87660 seconds (slightly more than 1 day). I need a function that takes the satellite's position with respect to an earth-centered inertial coordinate system, and time (t=0 has earth's shadow being perfectly horizontal with vector i), and outputs a 1 or a 0, depending on whether this satellite is in the shadow or not.

Both the satellite's position vector and the vector representing the axis of earth's shadow change with respect to time.

I have the beginnings of a solution here, but it's really short.

Basically:

if dot(satellite position vector, cylindrical shadow axis vector) > certain value
output value = 1
else
output value = 0
end

if any are curious, I am programming this in Simulink. I have a clock and the satellite R vector as inputs. I'm doing it for a thermal simulation.