Skip to content

Commit

Permalink
fix: 🐛 fix Vimpel TLEs
Browse files Browse the repository at this point in the history
  • Loading branch information
thkruz committed Jan 17, 2024
1 parent 251bf2e commit 6092a4b
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 4 deletions.
8 changes: 8 additions & 0 deletions src/enums/CatalogSource.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export enum CatalogSource {
USSF = 'USSF',
CELESTRAK = 'Celestrak',
UNIV_OF_MICH = 'University of Michigan',
VIMPEL = 'JSC Vimpel',
TLE_TXT = 'TLE.txt',
EXTRA_JSON = 'extra.json',
}
1 change: 1 addition & 0 deletions src/enums/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export type { CatalogSource } from './CatalogSource';
7 changes: 3 additions & 4 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,11 @@
*/

export * from 'ootk-core';
export * from './enums';
export * from './types/types';
export * from './interfaces';
export * from './coordinate';
export * from './objects';
export * from './operations';
export * from './transforms';
export * from './interfaces';
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
export * from './types/types';
export * from './utils';
23 changes: 23 additions & 0 deletions src/objects/DetailedSatellite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,17 @@
*/

import {
FormatTle,
LaunchDetails,
OperationsDetails,
OptionsParams,
Satellite,
SpaceCraftDetails,
TleLine1,
TleLine2,
} from 'ootk-core';
import { DetailedSatelliteParams } from '../types/types';
import { CatalogSource } from 'src/enums/CatalogSource';

/**
* Represents a detailed satellite object with launch, spacecraft, and operations details.
Expand Down Expand Up @@ -61,6 +65,10 @@ export class DetailedSatellite extends Satellite {
info: DetailedSatelliteParams & LaunchDetails & OperationsDetails & SpaceCraftDetails,
options?: OptionsParams,
) {
if (info.source === CatalogSource.VIMPEL) {
info = DetailedSatellite.setSccNumTo0_(info);
}

super(info, options);

this.active ??= true;
Expand All @@ -76,6 +84,21 @@ export class DetailedSatellite extends Satellite {
this.initLaunchDetails_(info);
}

private static setSccNumTo0_(info: DetailedSatelliteParams & LaunchDetails & OperationsDetails & SpaceCraftDetails) {
info.tle1 = FormatTle.setCharAt(info.tle1, 2, '0') as TleLine1;
info.tle1 = FormatTle.setCharAt(info.tle1, 3, '0') as TleLine1;
info.tle1 = FormatTle.setCharAt(info.tle1, 4, '0') as TleLine1;
info.tle1 = FormatTle.setCharAt(info.tle1, 5, '0') as TleLine1;
info.tle1 = FormatTle.setCharAt(info.tle1, 6, '0') as TleLine1;
info.tle2 = FormatTle.setCharAt(info.tle2, 2, '0') as TleLine2;
info.tle2 = FormatTle.setCharAt(info.tle2, 3, '0') as TleLine2;
info.tle2 = FormatTle.setCharAt(info.tle2, 4, '0') as TleLine2;
info.tle2 = FormatTle.setCharAt(info.tle2, 5, '0') as TleLine2;
info.tle2 = FormatTle.setCharAt(info.tle2, 6, '0') as TleLine2;

return info;
}

private initSpaceCraftDetails_(
info: DetailedSatelliteParams &
LaunchDetails & OperationsDetails &
Expand Down

0 comments on commit 6092a4b

Please sign in to comment.