1manprojects / one_Sgp4

C# SGP4 orbit prediction Library
MIT License
62 stars 14 forks source link

Doppler shift #16

Open mhmdscin opened 5 years ago

mhmdscin commented 5 years ago

First of all thank you for your great job. would you please add a feature to calculate Doppler shift of satellites? Meanwhile any suggestion on how can I do this, is appreciated.

mhmdscin commented 5 years ago

OK I've found a simple solution. You can simply calculate the Range (distance between you and the satellite) in two different time with a very small gap(few hundred miliseconds). and then divide the difference between the 1st distance and the 2nd one by the time gap, so you would have the relative speed, finally you can calculate the Doppler shift with the formula. here is a code snip in vb.net:

        Dim tleData As Tle = ParserTLE.parseTle(Tle(1), Tle(2), Tle(0))
        Dim resultDataList As List(Of Sgp4Data) = New List(Of Sgp4Data)()
        Dim sgp4Propagator As Sgp4 = New Sgp4(tleData, Sgp4.wgsConstant.WGS_84)

        'CrDate Is the time you want to calc. the doppler Shift
        Dim startTime As EpochTime = New EpochTime(CrDate)
        Dim stopTime As EpochTime = New EpochTime(CrDate)
        sgp4Propagator.runSgp4Cal(startTime, stopTime, 1 / 60.0)
        resultDataList = sgp4Propagator.getRestults()
        Dim spherical As Point3d = SatFunctions.calcSphericalCoordinate(obsrvLocation, startTime, resultDataList((resultDataList.Count - 1) / 2))

        resultDataList.Clear()
        'tdelta is the time gap
        Dim tdelta As Integer = 100 
        CrDate = CrDate.AddMilliseconds(-1 * tdelta)
        startTime = New EpochTime(CrDate)
        stopTime = New EpochTime(CrDate)
        sgp4Propagator.runSgp4Cal(startTime, stopTime, 1 / 60.0)
        resultDataList = sgp4Propagator.getRestults()
        Dim sphrB As Point3d = SatFunctions.calcSphericalCoordinate(obsrvLocation, startTime, resultDataList(0))

        'Calc. Relative Speed
        Dim RelSpeed As Double = (spherical.x - sphrB.x) / (tdelta / 1000)
        'Frq is the Frequency of the satellite transmitter
        'and finally you have the Doppler Shift
        Dim DopplrShift As Integer = Frq * RelSpeed * 1000 / 299792458
1manprojects commented 5 years ago

Assuming the ground station is not moving itself the dopler effect can be calculated by the relative speed of the satellite to the ground station divided by the carrier wavelength.

You are however not calculating the relative speed of the satellite to its observer. The sperical.x is just one axis of the 3-dimensional space around the Earth and describes the X-position of the satellite at a given time point. You are missing the other 2 dimensions. To calculate the Current speed of the satellite you must take all three velocity vectors x_dot, y_dot, z_dot (km/s). Then you would need to calculate the current speed of the Observer on Earth in ECI (Earth-centered inertial). From here you can calculate the relative speed of the satellite with Rel_Velocity_vector = Velocity_Vector_Satellite - Velocity_Vector_Observer. The Result would be a 3-dimensional relative speed vector that can be normalized. From this relative speed, the doppler shift can be calculated.

Currently, only the x,y,z position of an observer on the ground is calculated and not the velocity of the observer itself, thus you would need to calculate the speed of the observer on the ground yourself.

In the future, these calculations could be included if I find the time to work on it.

JKamue commented 4 years ago

Are you still planning to implement this feature? I am writing a small satellite tracker on top of your library and it would be great to add the doppler calculations. This would allow me to use my software to record actual passes! Thank you for your great library by the way!

1manprojects commented 4 years ago

This Year i wont be able to implement such a feature and i cant give a timeframe wenn this could be included. Since im developing this in my free time and only work on it wenn i find the time to do so i cant even give you an estimate for such a feature.

JKamue commented 4 years ago

Totally understandable! Thank you for the time you already put into it!