public void TitanIILaunch() { Vector3d r0 = new Vector3d(rearth, 0, 0); Vector3d v0 = new Vector3d(0, 0, 0); Pontryagin p = new Pontryagin(type: ProbType.MULTIBURN, mu: mu); double inc = 90; double heading = Math.Asin(Math.Cos(inc * UtilMath.Deg2Rad) / Math.Cos(0)); // clockwise from north Console.WriteLine("heading = " + heading); p.AddArc(type: ArcType.BURN, r0: r0, v0: v0, pv0: new Vector3d(0, Math.Cos(heading), Math.Sin(heading)), pr0: Vector3d.zero, m0: 149600 + 3580, dt0: 1, isp: 297, thrust: 2 * 1096.8 * 1000, max_bt: 156); p.AddArc(type: ArcType.BURN, r0: r0, v0: v0, pv0: new Vector3d(0, Math.Cos(heading), Math.Sin(heading)), pr0: Vector3d.zero, m0: 28400 + 3580, dt0: 0, isp: 316, thrust: 445 * 1000); Console.WriteLine(p.arcs[0].pv0); //p.terminal5constraint(new Vector3d(r185, 0, 0), new Vector3d(0, 0, v185)); p.flightangle4constraint(r185, v185, 0, inc * UtilMath.Deg2Rad); p.Optimize(0); for (int i = 0; i < 27; i++) { Console.WriteLine(p.y0[i]); } double[] z = new double[27]; p.optimizationFunction(p.y0, z, null); Console.WriteLine("---zeros start---"); for (int i = 0; i < 27; i++) { Console.WriteLine(z[i]); } Console.WriteLine("---zeros done---"); double[] yf = new double[26]; p.multipleIntegrate(p.y0, yf); Console.WriteLine("--- yf start---"); for (int i = 0; i < 26; i++) { Console.WriteLine(yf[i]); } Console.WriteLine("--- yf end---"); Console.WriteLine(new Vector3d(yf[13], yf[14], yf[15]) * p.r_scale); Console.WriteLine(new Vector3d(yf[16], yf[17], yf[18]) * p.v_scale); double tf = p.y0[26] * p.t_scale; for (int i = 0; i <= 20; i++) { Console.WriteLine(p.solution.m(tf / 20 * i)); } Console.WriteLine(p.solution.r(tf)); Console.WriteLine(p.solution.v(tf)); Assert.Equal(1, 0); }
public void multpleIntegrateComplex() { Pontryagin p = new Pontryagin(type: ProbType.COASTBURN, mu: mu); double[] y0 = { 1, 0, 0, 0, 1, 0, -0.00794206131892028, -0.921437990960034, 0.388444272035955, -0.0249880816482411, -0.0079420613189204, 0.000443419057124364, 32740, 0.916851279873005, -0.399228920038652, -7.56664470074416e-27, 0.399228920038653, 0.916851279873009, -4.78371853721768e-27, 0.010574128246995, -0.853926456601413, 0.356322653686804, 0.18249592267875, 0.302938323862286, -0.15467163789007, 32740, -0.410675683157609, 0.514092715632044 }; double[] yf = new double[26]; p.AddArc(ArcType.COAST, r0: new Vector3d(r185, 0, 0), v0: new Vector3d(0, v185, 0), m0: 32740, pv0: Vector3d.zero, pr0: Vector3d.zero, dt0: 0); p.AddArc(type: ArcType.BURN, r0: new Vector3d(r185, 0, 0), v0: new Vector3d(0, v185, 0), m0: 32740, pv0: Vector3d.zero, pr0: Vector3d.zero, dt0: 0, isp: 316, thrust: 232.7 * 1000); p.Normalize(); p.multipleIntegrate(y0, yf); double[] yfexp = { 0.916851279873006, -0.399228920038652, 0, 0.399228920038653, 0.916851279873009, 0, 0.010574128246995, -0.853926456601413, 0.356322653686804, 0.182495922678749, 0.302938323862286, -0.15467163789007, 32740, 0.994701157874287, -0.0747993082881341, 0.0747993082881341, -0.102784710382227, -0.723648653663255, 0.723648653663275, 0.00201415851335627, -0.918310454613756, 0.387151869029871, -0.0830532176870933, -0.090110977826096, 0.0356709463649161, 282.160771396965 }; for (int i = 0; i < 26; i++) { Assert.Equal(0, yf[i] - yfexp[i], 3); } }