Rise
The Vieneo Province
Loading...
Searching...
No Matches
Tests/OrbitYspOctober24Tests.h

Source at documentation-generation time. See Test catalog for fixture associations.

1#pragma once
2#include "YspOctober24Fixture.h"
3double YspOctober24Tests(bool waiting=false) {
4 auto pad=YspOctober24();Request r;RememberDepartureLeg(r,pad);r.ascentWait=waiting;
5 const auto climb=YspOctober24(1);const auto air=EntryPhysics::Atmosphere(climb,climb.own,climb.entryVehicle.aoa,true);
6 const double speed=Ascent::IasSpeedLimit(climb,air);
7 auto trial=climb.own;trial.v=Cross({0,0,climb.spin},trial.r)+EntryPhysics::Wind(climb,trial.r)+Unit(air.velocity)*speed;
8 Check(speed>.27&&speed<.29,"recorded 18km IAS target no longer stalls at the oscillating 225m/s estimate");
9 Check(std::abs(EntryPhysics::Atmosphere(climb,trial).ias/climb.vneKms-Ascent::CruiseIas)<1e-5,
10 "Mach-dependent ascent TAS actually reaches the intended IAS reserve");
11 LaunchPlanning::Search search;search.Begin(pad,r);int n=0;while(search.Pending()&&n++<100000)search.Work(256);
12 const auto e=search.Result();
13 std::wcout<<L"Oct24 fastest: "<<e.status<<L" meet "<<e.meetEpoch-pad.now<<L" insertion "<<e.insertionEpoch-pad.now
14 <<L" launch "<<e.launchEpoch-pad.now<<L" fuel "<<e.ascentFuel+e.transferFuel<<L"\n";
15 Check(e.valid&&!e.pending&&e.fuelEnough&&e.fastest&&e.meetEpoch-pad.now<3900,
16 "October 24 automatic launch compares the faster prograde powered station intercept");
17 return e.meetEpoch-pad.now;
18}
19void PoweredExperiment() {
20 const auto in=YspOctober24(3);Request r;r.start=Start::Now;
21 for(double seconds=300;seconds<=2400;seconds+=30) {
22 r.arrivalEpoch=in.now+seconds;auto s=Solve(in,r,false);
23 if(!s.plan.poweredTransfer.valid)continue;
24 const auto& p=s.plan.poweredTransfer;
25 std::cout<<"PROGRADE "<<seconds<<"s height "<<p.height<<" burn "<<p.burnSeconds<<" main "<<p.peakMain<<" fuel "<<s.plan.fuel<<"\n";
26 Check(!s.plan.reversesOrbit&&p.minimumKm>=100&&p.peakQ<=10&&p.peakHeat<=200&&p.peakLoad<=.95,
27 "powered station intercept retains prograde motion, clearance, pressure, heat and class load reserves");
28 const auto a=PoweredRendezvous::Reference(p,0),b=PoweredRendezvous::Reference(p,p.duration);
29 Check(Norm(a.state.r-p.departure.r)<1e-8&&Norm(a.state.v-p.departure.v)<1e-8&&
30 Norm(b.state.r-p.arrival.r)<1e-8&&Norm(b.state.v-p.arrival.v)<1e-8,
31 "finite powered trajectory matches real endpoint positions and velocities without impulses");
32 for(double t=5;t<p.duration-5;t+=5) {
33 const auto k=PoweredRendezvous::Reference(p,t),before=PoweredRendezvous::Reference(p,t-.001),after=PoweredRendezvous::Reference(p,t+.001);
34 Check(Norm((after.state.r-before.state.r)/.002-k.state.v)<1e-6&&
35 Norm((after.state.v-before.state.v)/.002-k.acceleration)<1e-6,
36 "powered path analytic velocity and acceleration agree with independent numerical derivatives");
37 }
38 return;
39 }
40 Check(false,"recorded 117km YSP state has a finite prograde powered intercept inside forty minutes");
41}