26 : aircraft_name(fdm->GetAircraft()->GetAircraftName())
27{
28 FGStateSpace ss(fdm);
29 ss.x.add(new FGStateSpace::Vt);
30 ss.x.add(new FGStateSpace::Alpha);
31 ss.x.add(new FGStateSpace::Theta);
32 ss.x.add(new FGStateSpace::Q);
33
34
35 auto engine0 = fdm->GetPropulsion()->GetEngine(0);
36 FGThruster * thruster0 = engine0->GetThruster();
37
38 if (thruster0->GetType()==FGThruster::ttPropeller)
39 {
40 ss.x.add(new FGStateSpace::Rpm0);
41
42
43 int numEngines = fdm->GetPropulsion()->GetNumEngines();
44 if (numEngines>1) ss.x.add(new FGStateSpace::Rpm1);
45 if (numEngines>2) ss.x.add(new FGStateSpace::Rpm2);
46 if (numEngines>3) ss.x.add(new FGStateSpace::Rpm3);
47 if (numEngines>4) {
48 std::cerr << "more than 4 engines not currently handled" << std::endl;
49 }
50 }
51 ss.x.add(new FGStateSpace::Beta);
52 ss.x.add(new FGStateSpace::Phi);
53 ss.x.add(new FGStateSpace::P);
54 ss.x.add(new FGStateSpace::Psi);
55 ss.x.add(new FGStateSpace::R);
56 ss.x.add(new FGStateSpace::Latitude);
57 ss.x.add(new FGStateSpace::Longitude);
58 ss.x.add(new FGStateSpace::Alt);
59
60 ss.u.add(new FGStateSpace::ThrottleCmd);
61 ss.u.add(new FGStateSpace::DaCmd);
62 ss.u.add(new FGStateSpace::DeCmd);
63 ss.u.add(new FGStateSpace::DrCmd);
64
65
66 ss.y = ss.x;
67
68 x0 = ss.x.get();
69 u0 = ss.u.get();
70 y0 = x0;
71
72 fdm->SuspendIntegration();
73 ss.linearize(x0, u0, y0, A, B, C, D);
74 fdm->ResumeIntegration();
75
76 x_names = ss.x.getName();
77 u_names = ss.u.getName();
78 y_names = ss.y.getName();
79 x_units = ss.x.getUnit();
80 u_units = ss.u.getUnit();
81 y_units = ss.y.getUnit();
82}