4 #include "ControlMap.hpp"
7 #include "util/Vector.hpp"
19 void iterate(float dt);
21 ControlMap* getControlMap();
24 void setPilotPos(float* pos);
25 void getPilotPos(float* out);
27 void getPilotAccel(float* out);
29 void setWeight(float weight);
31 void setWing(Wing* wing);
32 void setTail(Wing* tail);
33 void addVStab(Wing* vstab);
35 void addFuselage(float* front, float* back, float width);
36 int addTank(float* pos, float cap, float fuelDensity);
37 void addGear(Gear* g, float transitionTime);
38 void addThruster(Thruster* t, float mass, float* cg);
39 void addBallast(float* pos, float mass);
41 int addWeight(float* pos, float size);
42 void setWeight(int handle, float mass);
44 void setApproach(float speed, float altitude);
45 void setApproach(float speed, float altitude, float aoa);
46 void setCruise(float speed, float altitude);
48 void addApproachControl(int control, float val);
49 void addCruiseControl(int control, float val);
53 void setGearState(bool down, float dt);
56 void setFuelFraction(float frac); // 0-1, total amount of fuel
57 float getFuel(int tank); // in kg!
58 float getFuelDensity(int tank); // kg/m^3
60 void compile(); // generate point masses & such, then solve
62 // Solution output values
63 int getSolutionIterations();
64 float getDragCoefficient();
67 float getTailIncidence();
68 char* getFailureMsg();
71 struct Tank { float pos[3]; float cap; float fill;
72 float density; int handle; };
73 struct Fuselage { float front[3], back[3], width; };
74 struct GearRec { Gear* gear; Surface* surf; float wgt; float time; };
75 struct ThrustRec { Thruster* thruster;
76 int handle; float cg[3]; float mass; };
77 struct Control { int control; float val; };
78 struct WeightRec { int handle; Surface* surf; };
82 void setupState(float aoa, float speed, State* s);
85 float compileWing(Wing* w);
86 float compileFuselage(Fuselage* f);
87 void compileGear(GearRec* gr);
88 void stabilizeThrust();
89 void applyDragFactor(float factor);
90 void applyLiftRatio(float factor);
91 float clamp(float val, float min, float max);
92 float normFactor(float f);
111 Vector _surfs; // NON-wing Surfaces
113 Vector _cruiseControls;
120 Vector _approachControls;
121 State _approachState;
124 float _approachSpeed;
126 float _approachWeight;
128 int _solutionIterations;
132 float _tailIncidence;
136 }; // namespace yasim
137 #endif // _AIRPLANE_HPP