5 #include "Rotorpart.hpp"
6 #include "Integrator.hpp"
7 #include "RigidBody.hpp"
8 #include "BodyEnvironment.hpp"
14 const float rho_null=1.184f; //25DegC, 101325Pa
19 float _omega,_omegan,_omegarel,_ddt_omega,_omegarelneu;
22 float _airfoil_incidence_no_lift;
24 float _airfoil_lift_coefficient;
25 float _airfoil_drag_coefficient0;
26 float _airfoil_drag_coefficient1;
34 void setNormal(float* normal);
35 //the normal vector (direction of rotormast, pointing up)
37 void setForward(float* forward);
38 //the normal vector pointing forward (for ele and ail)
39 void setForceAtPitchA(float force);
40 void setPowerAtPitch0(float value);
41 void setPowerAtPitchB(float value);
42 void setNotorque(int value);
43 void setPitchA(float value);
44 void setPitchB(float value);
45 void setMinCyclicail(float value);
46 void setMinCyclicele(float value);
47 void setMaxCyclicail(float value);
48 void setMaxCyclicele(float value);
49 void setMaxCollective(float value);
50 void setMinCollective(float value);
51 void setDiameter(float value);
52 void setWeightPerBlade(float value);
53 void setNumberOfBlades(float value);
54 void setRelBladeCenter(float value);
55 void setDelta3(float value);
56 void setDelta(float value);
57 void setDynamic(float value);
58 void setTranslift(float value);
59 void setC2(float value);
60 void setStepspersecond(float steps);
61 void setRPM(float value);
62 void setRelLenHinge(float value);
63 void setBase(float* base); // in local coordinates
64 void getPosition(float* out);
65 void setCyclicail(float lval,float rval);
66 void setCyclicele(float lval,float rval);
67 void setCollective(float lval);
68 void setAlphaoutput(int i, const char *text);
70 int getCcw() {return _ccw;};
71 void setParameter(char *parametername, float value);
72 void setGlobalGround(double* global_ground, float* global_vel);
73 float getTorqueOfInertia();
74 int getValueforFGSet(int j,char *b,float *f);
75 void setName(const char *text);
76 void inititeration(float dt,float omegarel,float ddt_omegarel,float *rot);
78 void getTip(float* tip);
79 void calcLiftFactor(float* v, float rho, State *s);
80 void getDownWash(float *pos, float * v_heli, float *downwash);
81 float getGroundEffect(float* posOut);
83 // Query the list of Rotorpart objects
85 Rotorpart* getRotorpart(int n);
86 void setAlpha0(float f);
87 void setAlphamin(float f);
88 void setAlphamax(float f);
89 void setTeeterdamp(float f);
90 void setMaxteeterdamp(float f);
91 void setRelLenTeeterHinge(float value);
92 void setAlpha0factor(float f);
93 void setTorque(float f);
94 void addTorque(float f);
95 float getTorque() {return _torque;}
96 float getLiftFactor();
97 float getLiftCoef(float incidence,float speed);
98 float getDragCoef(float incidence,float speed);
99 float getOmegaRel() {return _omegarel;}
100 float getOmegaRelNeu() {return _omegarelneu;}
101 void setOmegaRelNeu(float orn) {_omegarelneu=orn;}
102 float getOmegan() {return _omegan;}
103 float getTaper() { return _taper;}
104 float getChord() { return _chord;}
105 float getOverallStall()
106 {if (_stall_v2sum !=0 ) return _stall_sum/_stall_v2sum; else return 0;}
110 void strncpy(char *dest,const char *src,int maxlen);
111 void interp(float* v1, float* v2, float frac, float* out);
112 float calcStall(float incidence,float speed);
113 Rotorpart* newRotorpart(float* pos, float *posforceattac, float *normal,
114 float* speed,float *dirzentforce, float zentforce,float maxpitchforce,
115 float maxpitch, float minpitch, float mincyclic,float maxcyclic,
116 float delta3,float mass,float translift,float rellenhinge,float len);
118 float _normal[3];//the normal vector (direction of rotormast, pointing up)
119 float _normal_with_yaw_roll[3];//the normal vector (perpendicular to rotordisc)
122 int _number_of_blades;
123 float _weight_per_blade;
124 float _rel_blade_center;
127 float _force_at_pitch_a;
129 float _power_at_pitch_0;
130 float _power_at_pitch_b;
135 float _rel_len_hinge;
145 float _stepspersecond;
146 char _alphaoutput[8][256];
149 float _alphamin,_alphamax,_alpha0,_alpha0factor;
150 float _teeterdamp,_maxteeterdamp;
151 float _rellenteeterhinge;
153 float _translift_maxfactor;
154 float _ground_effect_constant;
155 float _vortex_state_lift_factor;
156 float _vortex_state_c1;
157 float _vortex_state_c2;
158 float _vortex_state_c3;
159 float _vortex_state_e1;
160 float _vortex_state_e2;
161 float _vortex_state_e3;
162 float _lift_factor,_f_ge,_f_vs,_f_tl;
164 double _global_ground[4];
168 float _twist; //outer incidence = inner inner incidence + _twist
169 int _number_of_segments;
170 float _rel_len_where_incidence_is_measured;
171 float _torque_of_inertia;
172 float _rel_len_blade_start;
173 float _incidence_stall_zero_speed;
174 float _incidence_stall_half_sonic_speed;
175 float _lift_factor_stall;
176 float _stall_change_over;
177 float _drag_factor_stall;
188 float _max_power_engine;
189 float _engine_prop_factor;
190 float _yasimdragfactor;
191 float _yasimliftfactor;
193 float _max_power_rotor_brake;
195 float _engine_accell_limit;
201 int isInUse() {return _in_use;}
202 void setInUse() {_in_use = 1;}
203 float compile(RigidBody* body);
204 void addRotor(Rotor* rotor);
205 int getNumRotors() {return _rotors.size();}
206 Rotor* getRotor(int i) {return (Rotor*)_rotors.get(i);}
207 void calcForces(float* torqueOut);
208 void setParameter(char *parametername, float value);
209 void setEngineOn(int value);
211 void setRotorBrake(float lval);
212 float getYasimDragFactor() { return _yasimdragfactor;}
213 float getYasimLiftFactor() { return _yasimliftfactor;}
214 float getMaxPowerEngine() { return _max_power_engine;}
215 float getMaxPowerRotorBrake() { return _max_power_rotor_brake;}
216 float getRotorBrake() { return _rotorbrake;}
217 float getEnginePropFactor() {return _engine_prop_factor;}
218 Vector* getRotors() { return &_rotors;}
219 void initRotorIteration(float *lrot,float dt);
220 void getDownWash(float *pos, float * v_heli, float *downwash);
223 }; // namespace yasim