Javascript and Rocket Science

Why?

I've been writing in Js for two and a half years now, and I see examples of solving typical problems for this language almost everywhere. Draw the next online storefront, submit an asynchronous request for a backend for the next JSON. A higher level is to build a data structure for the SPA and display visual components on its basis. But Js has a full-fledged library of mathematical functions, it provides a good computational speed for a scripting language (here is a comparison of performance against Python vs Node benchmarks ), so why not try to take it one step further and solve some engineering problem with it. For example - from the space field.





Formulation of the problem

The motion of the aircraft in the central gravitational field is simulated, the Earth is a ball with a radius of 6.3711E + 6 m, the parameter of the gravitational well is 0.398E + 15 N * m 2 / kg, the motion of a material point is considered (in the next iterations, an analysis of the motion around the center of mass may appear) , the aircraft is controlled by changing the programmed angle of attack and adjusting the engine thrust.





The drag force is always directed against the aircraft velocity vector, while the lift force is directed along the normal to the velocity vector. We define the atmosphere by piecewise linear interpolation from the Standard Atmosphere GOST 4401-81.





Ordinary differential equations of motion of a point in a central gravitational field are integrated by the Euler-Cauchy method of the second order of accuracy (aka the improved Euler method).





You can look at the current state of the project here: satMod on github .





How to use?

Call the console and point it to node launcher.js





After a while, a message will appear in the console about the calculation performed, indicating the time spent in milliseconds. A csv file with the results will appear next to it. The decoding is as follows - time (s), speed (m / s), height (m), distance traveled (m), mass (kg), longitudinal and transverse accelerations from external forces (except for gravity, m / s 2 ), consumption mass (kg), number M, velocity head (Pa), coordinates of the radius vector (X, Y, m) and velocity vector (Vx, Vy, m / s) in the global coordinate system associated with the center of the Earth (or any other selected planet)





, launcher.js, - , launcher





?

, , . - , (-) , - . -3 - .





vehicleStage compositeVehicle. , -





1. vehicleStage,
2. compositeVehicle.

. " "

- . 200 7788.14 /, - 5301 . V = 7788 /, Th = 0.00 , H = 200000 , 5300 . , - , ,





t,c





V, /





Th,





H,





L,





X,





Y,





0





7788.1





0.00





200





0





0





6571100





0.5





7788.1





0.00





200





0.38





3894





6571099





( )

t,c





V, /





Th,





H,





L,





X,





Y,





5301.0





7788.1





0.00





200





0





-2428





6571100





5301.5





7788.1





0.00





200





0.14





1466





6571100





()

t,





V, /





Th,





H,





L,





X,





Y,





5300.5





7788.6





0.00





199.25





40028





-2787





6570349





5301.0





7788.6





0.00





199.25





1.07





1107





6570349





"" . "" 5300 - ( 750 ) . - , . , , Echo.





500 , , ( simple_sat.json ). 255 ( ) 150 263 /





, (~ 10g)

t,





V, /





Th,





H,





L,





aX, /c2





Q,





1255.3





3947.1





-5.36





37.4





9278





-98.53





49271





1255.8





3898.2





-5.42





37.21





9278





-98.62





49310





1256.3





3849.4





-5.47





37.03





9281





-98.6





49299





.

t,





V, /





Th,





H,





L,





aX, /c2





Q,





1361.8





168.6





-80.06





9.96





9385





-11.82





5907





1445.3





91.4





-90.00





-0.009





9385





-10.24





5114





(m = 1100 , Cxa = 0.8, S = 2.75 2, Ro = 1.15 /3)





v = \ sqrt {\ frac {mg} {0.5RoCxaS}}

0 ~ 1000 90.7 - 92.4 /, . 57 .





: . , (?).





.








All Articles