Skip to content

Commit

Permalink
Added conversion to Alpha-5 TLE format for rffit
Browse files Browse the repository at this point in the history
Signed-off-by: Michał Drzał <[email protected]>
  • Loading branch information
Michał Drzał authored and cbassa committed Dec 24, 2024
1 parent 06ef291 commit 6ef425d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
7 changes: 5 additions & 2 deletions rffit.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ void format_tle(orbit_t orb,char *line1,char *line2)
int i,csum;
char sbstar[]=" 00000-0",bstar[13];
char csumstr[2];
char satstr[6];

// Format Bstar term
if (fabs(orb.bstar)>1e-9) {
Expand All @@ -120,8 +121,10 @@ void format_tle(orbit_t orb,char *line1,char *line2)
sbstar[4] = bstar[5]; sbstar[5] = bstar[6]; sbstar[6] = bstar[8]; sbstar[7] = bstar[10]; sbstar[8] = '\0';
}
// Print lines
sprintf(line1,"1 %05dU %2d%012.8f .00000000 00000-0 %8s 0 0",orb.satno,orb.ep_year-2000,orb.ep_day,sbstar);
sprintf(line2,"2 %05d %8.4f %8.4f %07.0f %8.4f %8.4f %11.8f 0",orb.satno,DEG(orb.eqinc),DEG(orb.ascn),1E7*orb.ecc,DEG(orb.argp),DEG(orb.mnan),orb.rev);
number_to_alpha5(orb.satno,satstr);
satstr[5]='\0';
sprintf(line1,"1 %05sU %2d%012.8f .00000000 00000-0 %8s 0 0",satstr,orb.ep_year-2000,orb.ep_day,sbstar);
sprintf(line2,"2 %05s %8.4f %8.4f %07.0f %8.4f %8.4f %11.8f 0",satstr,DEG(orb.eqinc),DEG(orb.ascn),1E7*orb.ecc,DEG(orb.argp),DEG(orb.mnan),orb.rev);

// Compute checksums
for (i=0,csum=0;i<strlen(line1);i++) {
Expand Down
1 change: 1 addition & 0 deletions satutl.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ static long i_read(char *str, int start, int stop);
static double d_read(char *str, int start, int stop);

// Fixed mapping
// Only capital letters and numbers are used in Alpha-5. The letters “I” and “O” are omitted to avoid confusion with the numbers “1” and “0”.
const char mapping[] = "0123456789ABCDEFGHJKLMNPQRSTUVWXYZ";

// Function to convert alpha5 format to number
Expand Down

0 comments on commit 6ef425d

Please sign in to comment.