Error loading TLE file into satellite object

8 visualizaciones (últimos 30 días)
jose nuñez
jose nuñez el 24 de En. de 2024
Comentada: Andrew Mihalik el 23 de Jul. de 2024
I'm creating a GPS scenario loading current TLE into the satellite object with following commands:
% Create Scenario
startTime = datetime('now', 'Format', 'yyyy-MM-dd HH:mm:ss');
stopTime = startTime;
sampleTime = 1; % secs
sc = satelliteScenario(startTime,stopTime,sampleTime);
% Load TLE
websave('tledata.tle', 'https://celestrak.org/NORAD/elements/gp.php?GROUP=gps-ops&FORMAT=tle');
% Put satellites into the scenario
sats = satellite(sc,'tledata.tle');
But I obtain following error:
Error using satelliteScenario/satellite>throwExceptions
Unable to add satellite to the satelliteScenario.
Error in satelliteScenario/satellite
Caused by:
Incorrect size for expression 'time.fmt': expected [1x0] but found [1x19].
Has anyone an idea on what's going on? TLE file seems to be OK.
  1 comentario
Andrew Mihalik
Andrew Mihalik el 23 de Jul. de 2024
Hello, if we assume I ran the following code:
sc = satelliteScenario;
StartTime_datestring= '2024-07-22 17:52:39'
StopTime_datestring= '2024-08-23 17:52:39'
Can anyone explain why, then, this code executes correctly and without error:
StartTime_datetime=datetime(StartTime_datestring,'InputFormat','yyyy-MM-dd HH:mm:ss');
StopTime_datetime=datetime(StopTime_datestring,'InputFormat','yyyy-MM-dd HH:mm:ss');
sc.StartTime=StartTime_datetime
sc.StopTime=StopTime_datetime
But this code:
StartTime_datetime=datetime(StartTime_datestring,'Format','yyyy-MM-dd HH:mm:ss');
StopTime_datetime=datetime(StopTime_datestring,'Format','yyyy-MM-dd HH:mm:ss');
sc.StartTime=StartTime_datetime
sc.StopTime=StopTime_datetime
creates an error saying Incorrect size for expression 'time.fmt': expected [1x0] but found [1x19].

Iniciar sesión para comentar.

Respuesta aceptada

Varun
Varun el 29 de En. de 2024
Hi Jose,
Looks like the error is related to the size of the 'time.fmt' field in the TLE file. The expected size is [1x0], but the error indicates that it found [1x19].
I debugged the code and found that the error is occurring due to the first line because of using ‘Format’ name-value pair in the ‘datetime’ function:
startTime = datetime('now', 'Format', 'yyyy-MM-dd HH:mm:ss');
To resolve this error, you can simply replace this line with the following line which is independent of ‘Format’ name-value pair:
startTime = datetime('now');
Please refer to the following documentations to learn more:
Hope it helps.
  2 comentarios
jose nuñez
jose nuñez el 30 de En. de 2024
thanks for your clarification!
Andrew Mihalik
Andrew Mihalik el 23 de Jul. de 2024
Hello, if we assume I ran the following code:
sc = satelliteScenario;
StartTime_datestring= '2024-07-22 17:52:39'
StopTime_datestring= '2024-08-23 17:52:39'
Can anyone explain why, then, this code executes correctly and without error:
StartTime_datetime=datetime(StartTime_datestring,'InputFormat','yyyy-MM-dd HH:mm:ss');
StopTime_datetime=datetime(StopTime_datestring,'InputFormat','yyyy-MM-dd HH:mm:ss');
sc.StartTime=StartTime_datetime
sc.StopTime=StopTime_datetime
But this code:
StartTime_datetime=datetime(StartTime_datestring,'Format','yyyy-MM-dd HH:mm:ss');
StopTime_datetime=datetime(StopTime_datestring,'Format','yyyy-MM-dd HH:mm:ss');
sc.StartTime=StartTime_datetime
sc.StopTime=StopTime_datetime
creates an error saying Incorrect size for expression 'time.fmt': expected [1x0] but found [1x19].

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Satellite Mission Analysis en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2023b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by