Skip to content

Commit

Permalink
Add example for running SatSim in NodeJS.
Browse files Browse the repository at this point in the history
  • Loading branch information
mixxen committed May 1, 2024
1 parent 0dce3ea commit 5f909e3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
18 changes: 18 additions & 0 deletions app/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { Universe, applyIau2006XysDataPatch } from "../src/index.js";
import { JulianDate } from "cesium";

applyIau2006XysDataPatch(); // required when running in nodejs

const universe = new Universe();
const start = JulianDate.now();
const end = JulianDate.addSeconds(start, 60*60, new JulianDate());
universe.update(start);
console.log('starting simulation at', start.toString());

// Run the simulation from start to end
for (let t = start.clone(); JulianDate.compare(t, end) < 0; t = JulianDate.addSeconds(t, 60, new JulianDate())) {
universe.update(t);
console.log(universe._earth.transform.toString());
}

console.log('simulation complete at', end.toString());
2 changes: 1 addition & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default {
sourcePrefix: ''
},
resolve: {
fallback: { "https": false, "zlib": false, "http": false, "url": false },
fallback: { "https": false, "zlib": false, "http": false, "url": false, "fs": false },
mainFiles: ['index', 'Cesium'],
// add satsim as an alias to the root directory
alias: {
Expand Down

0 comments on commit 5f909e3

Please sign in to comment.