Codegen for Satellite Constructor Using TLE

3 ビュー (過去 30 日間)
Eric
Eric 2024 年 3 月 11 日
コメント済み: Eric 2024 年 3 月 11 日
On R2021b, it looks as though codegen extracts the TLE in the file and hardcodes it in some header file. The .exe that is produced no longer uses the TLE file and does not even need it present. Is there an alternate constructor to use on the 'satellite' class that allows specifying each of the TLE mean elements at run time like the one there for Keplerian elements ( in lieu of reading from the file at compile time and not being able to update TLE entries daily / monthly without recompiling ) ?

回答 (1 件)

recent works
recent works 2024 年 3 月 11 日
編集済み: Walter Roberson 2024 年 3 月 11 日
In MATLAB's Aerospace Toolbox, the satellite class typically relies on Two-Line Element (TLE) sets to initialize the satellite orbit. As of my knowledge, the toolbox didn't offer a direct method to initialize the satellite using runtime-specified TLE elements without relying on file parsing or compile-time constants. However, you can implement a workaround to achieve your goal. You can create your own class or function that accepts the TLE elements as inputs and initializes the satellite accordingly. Here's a simplified example of how you might do this:
classdef CustomSatellite
properties
TLE; % Store TLE elements
SatelliteObject; % Store the satellite object
end
methods
% Constructor
function obj = CustomSatellite(TLE)
obj.TLE = TLE;
obj.SatelliteObject = satellite(obj.TLE);
end
% Other methods as needed
end
end
Then, you can create an instance of CustomSatellite by passing the TLE elements directly:
% Example TLE elements
TLE = [
'1 25544U 98067A 22068.07910936 .00001269 00000-0 33152-4 0 9997';
'2 25544 51.6450 130.0741 0002884 67.2005 85.3189 15.48857994318422'
];
% Create CustomSatellite object
customSat = CustomSatellite(TLE);
This way, you can pass the TLE elements dynamically at runtime without relying on hardcoded values or file parsing during compilation.
  1 件のコメント
Eric
Eric 2024 年 3 月 11 日
My install at R2021b does not have a class constructor that does not require the satelliteScenario parameter, nor can I find one that accepts the contents of the TLE file as an array of strings rather than a filename of a file to read in. That is what I was looking for in the first place
I tried the classdef above with a scenario specified and it says "Unable to add satellite to the satelliteScenario because the specified TLE file is invalid", presumably since it reads the string as a filename rather than the contents. If I try to use classdef with a constructor that uses the TLE file name (rather than file contents), codegen gives me the same "??? Expression could not be reduced to a constant" that I originally was seeing without the classdef.
Are there any other satellite class constructor variants that are undocumented for R2021b?

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeCubeSat and Satellites についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by