Skip to content

Probable error in sgp4init function #27

@rob-groundspace

Description

@rob-groundspace

We have been using this library even though it doesn't seem to be actively maintained. I decided to test the propagation against a set of TLEs and results obtained from running SGP4prop. I found that 99.8% of tests were passing and the rest failing (283 out of 128313).

After a few hours of comparing the code with other implementations I spotted the problem. In the official C code (https://github.com/nasa/ECI/blob/2ccd1ba6f3ec2168816098c4912f449af74a0fc1/examples/sgp4Prop/fsw/src/SGP4.c#L1309) we see the following lines

if (perige < 156.0)
            {
                sfour = perige - 78.0;
                if (perige < 98.0)
                    sfour = 20.0;
                // sgp4fix use multiply for speed instead of pow
                qzms24temp = (120.0 - sfour) / satrec->radiusearthkm;
                qzms24 = qzms24temp * qzms24temp * qzms24temp * qzms24temp;
                sfour = sfour / satrec->radiusearthkm + 1.0;
            }

while in this library we have

		if perige < 156.0 {
			sfour = perige - 78.0
			if perige < 98.0 {
				sfour = 20.0
			}

			qzms24temp := (128.0 - sfour) / radiusearthkm
			qzms24 = qzms24temp * qzms24temp * qzms24temp * qzms24temp
			sfour = sfour/radiusearthkm + 1.0
		}

I think 128.0 should be 120.0

It seems this library is no longer maintained. There are some forks which seem to be used so posting this might help people who see errors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions