Calculate Satellite TLE from Satellite Object

조회 수: 78 (최근 30일)
David Huynh
David Huynh 2023년 4월 19일
댓글: Adam 2025년 7월 17일
I would like to create a Walker Delta constellation using the walkerDelta function (this I can do following the online example). I would then like to take the satellite objects and calculate the corresponding TLE data and output them to a file. I have not been able to find a function that takes a satellite object and computes the corresponding TLE data, other than this poorly reviewed submission. Is there a built-in way to do this with the Aerospace toolbox?

채택된 답변

chicken vector
chicken vector 2023년 4월 19일
편집: chicken vector 2023년 4월 20일
The reason why you haven't found a method is because it doesn't make sense physically.
TLE are data format that condense information about a satellite, such as the epoch of launch, the catalogue number and other designators.
You also have properties depending on the effects of perturbations on the orbit (B*). In LEO, perturbations are mainly due to drag, which strictly depends on the satellite intrinsic properties, such as the area-to-mass ratio.
An other parameter included in TLEs is the number of revolutions that the satellite has performed since insertion into orbit.
All these features makes it impossibile to construct TLE that make sense for fictitious satellites that don't exist in reality.
If you really want to generate some TLE, you could extrapolate the orbital parameters from the simulations and fill in blank the other characteristic, but I am relatively sure you won't find a working function for that.
If you are okay with dealing with fake TLE, you can use the following to generate them.
Feel free to modify the parameters as you prefer.
% Constellation from openExample('aero/ModelGalileoConstellAsWalkerDeltaConstellExample'):
sc = satelliteScenario;
sat = walkerDelta(sc, 29599.8e3, 56, 24, 3, 1, ArgumentOfLatitude=15, Name="Galileo");
% Initialise:
N = length(sat);
TLE = cell(N,1);
% Loop over satellites to extract TLEs:
for j = 1 : N
TLE{j} = getTLE(sc.Satellites(j));
end
% Generate TLE from satellite:
function TLE = getTLE(satellite)
%% Line 1:
% ID:
ID = num2str(satellite.ID, '%05.f');
% Time:
now = datetime;
currentYear = year(now);
yearStart = [num2str(currentYear) '-01-01'];
yearDigits = yearStart(3:4);
currentEpoch = convertTo(now, 'epochtime', 'Epoch', yearStart) / 86400;
epoch = num2str(currentEpoch, '%012.08f');
% Rocket launch:
RocketLaunches2022 = 180;
launchNumber = num2str(round((RocketLaunches2022 * currentEpoch) / 360), '%03.f');
% Line 1:
lineData = ['1 ' ID 'S ' yearDigits launchNumber 'A ' yearDigits epoch ' +.00000000 +00000-0 +00000-0 0 000'];
firstLine = [lineData checksum(lineData)];
%% Line 2:
% Orbital data:
i = num2str(satellite.orbitalElements.Inclination, '%08.04f');
OM = num2str(satellite.orbitalElements.RightAscensionOfAscendingNode, '%08.04f');
e = num2str(satellite.orbitalElements.Eccentricity * 1e7, '%07.f');
om = num2str(satellite.orbitalElements.ArgumentOfPeriapsis, '%08.04f');
th = num2str(satellite.orbitalElements.TrueAnomaly, '%08.04f');
n = num2str(86400 / satellite.orbitalElements.Period, '%011.08f');
% Line 2:
lineData = ['2 ' ID ' ' i ' ' OM ' ' e ' ' om ' ' th ' ' n '00000'];
secondLine = [lineData checksum(lineData)];
TLE = [firstLine;secondLine];
end
% Compute checksum for last line digit:
function cs = checksum(line)
digits = strrep(line, '-', '1');
signs = {'+','A','S',' ','0','.'};
for j = 1 : length(signs)
digits = erase(digits, signs{j});
end
sum = 0;
for j = 1 : length(digits)
sum = sum + str2num(digits(j));
end
sum = num2str(sum);
cs = sum(end);
end
Result:
TLE{N/2 + 1}
ans =
2×69 char array
'1 00013S 23055A 23109.00000000 +.00000000 +00000-0 +00000-0 0 0007'
'2 00013 056.0000 120.0000 0000000 000.0000 210.0000 01.70478493000006'
  댓글 수: 3
chicken vector
chicken vector 2023년 4월 20일
My pleasure
Adam
Adam 2025년 7월 17일
For whatever reason the convertTo function returns int64, which means the currentEpoch becomes int64 and cannot return epochs that have fractional day components. If you convert to double before dividing by 86400, then you get the expected result.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Reference Applications에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by