Skip to content

Commit

Permalink
Version 3.0.1.
Browse files Browse the repository at this point in the history
  • Loading branch information
ezze committed Mar 14, 2019
2 parents 9e134c2 + 708d8db commit dadca4f
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 17 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
## Changelog

### 3.0.1 (2019-03-14)

- Unnecessary calculations in `sgp4` function are reduced (#47).
- `vkmpersec` calculation is moved to constants (#50).
- `degreesToRadians` function is used in docs instead of `deg2rad` constant (#53).
- Typos' fixes (#54).

### 3.0.0 (2018-11-26)

- Node.js 4 support is dropped (breaking change).
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ var positionEci = positionAndVelocity.position,

// Set the Observer at 122.03 West by 36.96 North, in RADIANS
var observerGd = {
longitude: -122.0308 * deg2rad,
latitude: 36.9613422 * deg2rad,
longitude: satellite.degreesToRadians(-122.0308),
latitude: satellite.degreesToRadians(36.9613422),
height: 0.370
};

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "satellite.js",
"version": "3.0.0",
"version": "3.0.1",
"description": "SGP4/SDP4 calculation library",
"main": "lib/index.js",
"jsnext:main": "dist/satellite.es.js",
Expand Down
1 change: 1 addition & 0 deletions src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export const minutesPerDay = 1440.0;
export const mu = 398600.5; // in km3 / s2
export const earthRadius = 6378.137; // in km
export const xke = 60.0 / Math.sqrt((earthRadius * earthRadius * earthRadius) / mu);
export const vkmpersec = (earthRadius * xke) / 60.0;
export const tumin = 1.0 / xke;
export const j2 = 0.00108262998905;
export const j3 = -0.00000253215306;
Expand Down
26 changes: 13 additions & 13 deletions src/propagation/sgp4.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
twoPi,
earthRadius,
xke,
vkmpersec,
j2,
j3oj2,
x2o3,
Expand Down Expand Up @@ -135,8 +136,6 @@ export default function sgp4(satrec, tsince) {

const temp4 = 1.5e-12;

const vkmpersec = (earthRadius * xke) / 60.0;

// --------------------- clear sgp4 error flag -----------------
satrec.t = tsince;
satrec.error = 0;
Expand Down Expand Up @@ -277,7 +276,7 @@ export default function sgp4(satrec, tsince) {
nodep,
argpp,
mp,
opsmode: satrec.operationmod,
opsmode: satrec.operationmode,
};

const dpperResult = dpper(satrec, dpperParameters);
Expand Down Expand Up @@ -383,6 +382,17 @@ export default function sgp4(satrec, tsince) {

const mrt = (rl * (1.0 - (1.5 * temp2 * betal * satrec.con41)))
+ (0.5 * temp1 * satrec.x1mth2 * cos2u);

// sgp4fix for decaying satellites
if (mrt < 1.0) {
// printf("// decay condition %11.6f \n",mrt);
satrec.error = 6;
return {
position: false,
velocity: false,
};
}

su -= 0.25 * temp2 * satrec.x7thm1 * sin2u;
const xnode = nodep + (1.5 * temp2 * cosip * sin2u);
const xinc = xincp + (1.5 * temp2 * cosip * sinip * cos2u);
Expand Down Expand Up @@ -417,16 +427,6 @@ export default function sgp4(satrec, tsince) {
z: ((mvt * uz) + (rvdot * vz)) * vkmpersec,
};

// sgp4fix for decaying satellites
if (mrt < 1.0) {
// printf("// decay condition %11.6f \n",mrt);
satrec.error = 6;
return {
position: false,
velocity: false,
};
}

return {
position: r,
velocity: v,
Expand Down
2 changes: 1 addition & 1 deletion src/propagation/sgp4init.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ export default function sgp4init(satrec, options) {

if (omeosq >= 0.0 || satrec.no >= 0.0) {
satrec.isimp = 0;
if ((rp < 220.0 / earthRadius) + 1.0) {
if (rp < (220.0 / earthRadius + 1.0)) {
satrec.isimp = 1;
}
sfour = ss;
Expand Down
3 changes: 3 additions & 0 deletions test/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
mu,
earthRadius,
xke,
vkmpersec,
tumin,
j2,
j3,
Expand Down Expand Up @@ -74,6 +75,7 @@ describe('Library export', () => {
constantsEs.mu.should.equal(mu);
constantsEs.earthRadius.should.equal(earthRadius);
constantsEs.xke.should.equal(xke);
constantsEs.vkmpersec.should.equal(vkmpersec);
constantsEs.tumin.should.equal(tumin);
constantsEs.j2.should.equal(j2);
constantsEs.j3.should.equal(j3);
Expand Down Expand Up @@ -116,6 +118,7 @@ describe('Library export', () => {
constants.mu.should.equal(mu);
constants.earthRadius.should.equal(earthRadius);
constants.xke.should.equal(xke);
constants.vkmpersec.should.equal(vkmpersec);
constants.tumin.should.equal(tumin);
constants.j2.should.equal(j2);
constants.j3.should.equal(j3);
Expand Down

0 comments on commit dadca4f

Please sign in to comment.