Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

question - other than TLE inputs #44

Open
gimzmoe opened this issue Sep 14, 2020 · 4 comments
Open

question - other than TLE inputs #44

gimzmoe opened this issue Sep 14, 2020 · 4 comments
Labels
type-question Further information is requested

Comments

@gimzmoe
Copy link

gimzmoe commented Sep 14, 2020

I'm just starting but it appears the only option for adding object is by loading TLE. Which leads me to believe the software is using SGP4 as the propagator.
I'm working a project where I simulate satellites uising numerical integration, but I propagate state vector (e.g. position, velocity) which I would like to visualize with satvis.
I'm going to keep digging but I wanted to ask if there were opther input options.
I figure worst case I create a dirty-TLE with COEs and update it from my simulation frequently.

@thkruz
Copy link

thkruz commented Dec 14, 2020

Like many other javascript satellite programs, this relies on satellite.js for SGP4 propagation.

return satellitejs.propagate(this.satrec, time).position;

You could modify that section of the code to use your propagated values instead of the output from satellite.js. I would be very interested in hearing how you are calculating the position and velocity if not using SGP4. I believe this program calculates position and velocity using SGP4 every 1 second (notionally) and then relies on a basic position + velocity * time-since-last-screen-draw , which I think is what you are calling numerical integration.

@Flowm
Copy link
Owner

Flowm commented Jan 11, 2021

The explanation and quoted section by @thkruz are exactly the place to start when another propagation method is desired.

Just one additional step:
For performance reasons the positions are calculated in advance for the next time period with a sampling interval of 30s and then interpolated with a Cesium SampledPositionProperty every Cesium clock tick:

updateSampledPosition(julianDate, samplesFwd = 240, samplesBwd = 120, interval = 30) {

So either keep the existing interpolation logic and replace the propagation in

return satellitejs.propagate(this.satrec, time).position;

or alternatively directly set the position for the individual entities (e.g. the white point at the position of the satellite) in
const point = new Cesium.PointGraphics({

      const point = new Cesium.PointGraphics({
      position: new Cesium.CallbackProperty((timeAsJulianDate) => {
        return satellitePositionPropagatorThatReturnsACesiumCartesian3Object(timeAsJulianDate),
      }, false),
      pixelSize: 10,
      color: Cesium.Color.WHITE,
    });

Sry for the slow response. Did you ever get around to add your own propagation algorithm?

@Flowm Flowm added the type-question Further information is requested label Jan 11, 2021
@parkt90
Copy link

parkt90 commented Jan 11, 2021

I'm glad to see the question. I'm confused about the parameter of samplesFwd and samplesBwd . How to set it and is it related to interval()? I hope you can answer it. Thanks.

@Flowm
Copy link
Owner

Flowm commented Jan 11, 2021

The function uses interval (in seconds) as step size between samples and calculates samplesFwd position samples forward and samplesBwd position samples backward with the referenced SGP4 propagation mechanism (through satellitejs).

With the default values this function fills the SampledPositionProperty with the satellites position ranging 60min back (120 samplesBwd * 30s) from the current simulation time and 120min forward (240 samplesFwd * 30s).
This avoids any orbit calculations as long as the simulation time is within this timeframe as it relies on the interpolation of the Cesium SampledPositionProperty for interpolation between theses sample positions. (In reality a bit less as the orbit line also uses this sampled position and is also drawn forward and backward.)

Full code of the updateSampledPosition function for reference:

updateSampledPosition(julianDate, samplesFwd = 240, samplesBwd = 120, interval = 30) {
const sampledPosition = new Cesium.SampledPositionProperty();
sampledPosition.backwardExtrapolationType = Cesium.ExtrapolationType.HOLD;
sampledPosition.forwardExtrapolationType = Cesium.ExtrapolationType.HOLD;
sampledPosition.setInterpolationOptions({
interpolationDegree: 5,
interpolationAlgorithm: Cesium.LagrangePolynomialApproximation,
});
const sampledPositionInertial = new Cesium.SampledPositionProperty(Cesium.ReferenceFrame.INERTIAL);
sampledPositionInertial.backwardExtrapolationType = Cesium.ExtrapolationType.HOLD;
sampledPositionInertial.forwardExtrapolationType = Cesium.ExtrapolationType.HOLD;
sampledPositionInertial.setInterpolationOptions({
interpolationDegree: 5,
interpolationAlgorithm: Cesium.LagrangePolynomialApproximation,
});
// Spread sampledPosition updates
const randomOffset = Math.random() * 60 * 15;
const reference = Cesium.JulianDate.addSeconds(julianDate, randomOffset, new Cesium.JulianDate());
const startTime = -samplesBwd * interval;
const stopTime = samplesFwd * interval;
for (let time = startTime; time <= stopTime; time += interval) {
const timestamp = Cesium.JulianDate.addSeconds(reference, time, new Cesium.JulianDate());
const position = this.computePositionCartesian3(timestamp);
sampledPosition.addSample(timestamp, position);
const positionInertial = this.positionInertial(timestamp);
sampledPositionInertial.addSample(timestamp, positionInertial);
// Show computed sampled position
// viewer.entities.add({
// position : position,
// point : {
// pixelSize : 8,
// color : Cesium.Color.TRANSPARENT,
// outlineColor : Cesium.Color.YELLOW,
// outlineWidth : 3
// }
// });
}
this.sampledPosition = sampledPosition;
this.sampledPositionInertial = sampledPositionInertial;
return reference;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants