4 #include "ControlMap.hpp"
20 void iterate(float dt);
21 void consumeFuel(float dt);
23 ControlMap* getControlMap();
26 void setPilotPos(float* pos);
27 void getPilotPos(float* out);
29 void getPilotAccel(float* out);
31 void setWeight(float weight);
33 void setWing(Wing* wing);
34 void setTail(Wing* tail);
35 void addVStab(Wing* vstab);
37 void addRotor(Rotor* Rotor);
38 int getNumRotors() {return _rotors.size();}
39 Rotor* getRotor(int i) {return (Rotor*)_rotors.get(i);}
41 void addFuselage(float* front, float* back, float width,
42 float taper=1, float mid=0.5);
43 int addTank(float* pos, float cap, float fuelDensity);
44 void addGear(Gear* g);
45 void addThruster(Thruster* t, float mass, float* cg);
46 void addBallast(float* pos, float mass);
48 int addWeight(float* pos, float size);
49 void setWeight(int handle, float mass);
51 void setApproach(float speed, float altitude);
52 void setApproach(float speed, float altitude, float aoa);
53 void setCruise(float speed, float altitude);
55 void setElevatorControl(int control);
56 void addApproachControl(int control, float val);
57 void addCruiseControl(int control, float val);
63 void setFuelFraction(float frac); // 0-1, total amount of fuel
64 float getFuel(int tank); // in kg!
65 float getFuelDensity(int tank); // kg/m^3
66 float getTankCapacity(int tank);
68 void compile(); // generate point masses & such, then solve
70 void stabilizeThrust();
72 // Solution output values
73 int getSolutionIterations();
74 float getDragCoefficient();
77 float getTailIncidence();
78 float getApproachElevator() { return _approachElevator.val; }
79 char* getFailureMsg();
82 struct Tank { float pos[3]; float cap; float fill;
83 float density; int handle; };
84 struct Fuselage { float front[3], back[3], width, taper, mid; };
85 struct GearRec { Gear* gear; Surface* surf; float wgt; };
86 struct ThrustRec { Thruster* thruster;
87 int handle; float cg[3]; float mass; };
88 struct Control { int control; float val; };
89 struct WeightRec { int handle; Surface* surf; };
93 void setupState(float aoa, float speed, State* s);
96 float compileWing(Wing* w);
97 float compileRotor(Rotor* w);
98 float compileFuselage(Fuselage* f);
99 void compileGear(GearRec* gr);
100 void applyDragFactor(float factor);
101 void applyLiftRatio(float factor);
102 float clamp(float val, float min, float max);
103 void addContactPoint(float* pos);
104 void compileContactPoints();
105 float normFactor(float f);
106 void updateGearState();
109 ControlMap _controls;
124 Vector _contacts; // non-gear ground contact points
126 Vector _surfs; // NON-wing Surfaces
130 Vector _cruiseControls;
137 Vector _approachControls;
138 State _approachState;
141 float _approachSpeed;
143 float _approachWeight;
145 int _solutionIterations;
149 float _tailIncidence;
150 Control _approachElevator;
154 }; // namespace yasim
155 #endif // _AIRPLANE_HPP