5 #include "Rotorpart.hpp"
6 #include "Integrator.hpp"
7 #include "RigidBody.hpp"
8 #include "BodyEnvironment.hpp"
15 const float rho_null=1.184f; //25DegC, 101325Pa
18 friend std::ostream & operator<<(std::ostream & out, /*const*/ Rotor& r);
21 float _omega,_omegan,_omegarel,_ddt_omega,_omegarelneu;
25 float _airfoil_incidence_no_lift;
27 float _airfoil_lift_coefficient;
28 float _airfoil_drag_coefficient0;
29 float _airfoil_drag_coefficient1;
31 int _number_of_blades;
32 int _number_of_segments;
40 float _old_tilt_pitch;
42 float _downwash_factor;
49 void setNormal(float* normal);
50 //the normal vector (direction of rotormast, pointing up)
52 void setForward(float* forward);
53 //the normal vector pointing forward (for ele and ail)
54 void setForceAtPitchA(float force);
55 void setPowerAtPitch0(float value);
56 void setPowerAtPitchB(float value);
57 void setNotorque(int value);
58 void setPitchA(float value);
59 void setPitchB(float value);
60 void setMinCyclicail(float value);
61 void setMinCyclicele(float value);
62 void setMaxCyclicail(float value);
63 void setMaxCyclicele(float value);
64 void setMaxCollective(float value);
65 void setMinCollective(float value);
66 void setMinTiltYaw(float value);
67 void setMinTiltPitch(float value);
68 void setMinTiltRoll(float value);
69 void setMaxTiltYaw(float value);
70 void setMaxTiltPitch(float value);
71 void setMaxTiltRoll(float value);
72 void setTiltCenterX(float value);
73 void setTiltCenterY(float value);
74 void setTiltCenterZ(float value);
75 void setTiltYaw(float lval);
76 void setTiltPitch(float lval);
77 void setTiltRoll(float lval);
78 void setDiameter(float value);
79 void setWeightPerBlade(float value);
80 void setNumberOfBlades(float value);
81 void setRelBladeCenter(float value);
82 void setDelta3(float value);
83 void setDelta(float value);
84 void setDynamic(float value);
85 void setTranslift(float value);
86 void setC2(float value);
87 void setStepspersecond(float steps);
88 void setRPM(float value);
89 void setPhiNull(float value);
90 void setRelLenHinge(float value);
91 void setBase(float* base); // in local coordinates
92 void getPosition(float* out);
93 void setCyclicail(float lval,float rval);
94 void setCyclicele(float lval,float rval);
95 void setCollective(float lval);
96 void setRotorBalance(float lval);
97 void setAlphaoutput(int i, const char *text);
99 int getCcw() {return _ccw;};
100 void setParameter(const char *parametername, float value);
101 void setGlobalGround(double* global_ground, float* global_vel);
102 float getTorqueOfInertia();
103 int getValueforFGSet(int j,char *b,float *f);
104 void setName(const char *text);
105 void inititeration(float dt,float omegarel,float ddt_omegarel,float *rot);
107 void updateDirectionsAndPositions(float *rot);
108 void getTip(float* tip);
109 void calcLiftFactor(float* v, float rho, State *s);
110 void getDownWash(float *pos, float * v_heli, float *downwash);
111 int getNumberOfBlades(){return _number_of_blades;}
112 void setDownwashFactor(float value);
114 // Query the list of Rotorpart objects
116 Rotorpart* getRotorpart(int n);
117 void setAlpha0(float f);
118 void setAlphamin(float f);
119 void setAlphamax(float f);
120 void setTeeterdamp(float f);
121 void setMaxteeterdamp(float f);
122 void setRelLenTeeterHinge(float value);
123 void setAlpha0factor(float f);
124 void setTorque(float f);
125 void addTorque(float f);
126 float getTorque() {return _torque;}
127 float getLiftFactor();
128 float getLiftCoef(float incidence,float speed);
129 float getDragCoef(float incidence,float speed);
130 float getOmegaRel() {return _omegarel;}
131 float getOmegaRelNeu() {return _omegarelneu;}
132 void setOmegaRelNeu(float orn) {_omegarelneu=orn;}
133 float getOmegan() {return _omegan;}
134 float getTaper() { return _taper;}
135 float getChord() { return _chord;}
136 int getNumberOfParts() { return _number_of_parts;}
137 float getOverallStall()
138 {if (_stall_v2sum !=0 ) return _stall_sum/_stall_v2sum; else return 0;}
139 float getAirfoilIncidenceNoLift() {return _airfoil_incidence_no_lift;}
141 void findGroundEffectAltitude(Ground * ground_cb,State *s);
142 float *getGravDirection() {return _grav_direction;}
144 void setSharedFlapHinge(bool s);
145 void setBalance(float b);
146 float getBalance(){ return (_balance1>0)?_balance1*_balance2:_balance1;}
149 void testForRotorGroundContact (Ground * ground_cb,State *s);
150 void strncpy(char *dest,const char *src,int maxlen);
151 void interp(float* v1, float* v2, float frac, float* out);
152 float calcStall(float incidence,float speed);
153 float findGroundEffectAltitude(Ground * ground_cb,State *s,
154 float *pos0,float *pos1,float *pos2,float *pos3,
155 int iteration=0,float a0=-1,float a1=-1,float a2=-1,float a3=-1);
156 static void euler2orient(float roll, float pitch, float hdg,
158 Rotorpart* newRotorpart(/*float* pos, float *posforceattac, float *normal,
159 float* speed,float *dirzentforce, */float zentforce,float maxpitchforce,
160 float delta3,float mass,float translift,float rellenhinge,float len);
162 float _groundeffectpos[4][3];
163 float _ground_contact_pos[16][3];
164 int _num_ground_contact_pos;
165 float _ground_effect_altitude;
166 //some postions, where to calcualte the ground effect
167 float _normal[3];//the normal vector (direction of rotormast, pointing up)
168 float _normal_with_yaw_roll[3];//the normal vector (perpendicular to rotordisc)
171 float _weight_per_blade;
172 float _rel_blade_center;
173 float _tilt_center[3];
175 float _min_tilt_pitch;
176 float _min_tilt_roll;
178 float _max_tilt_pitch;
179 float _max_tilt_roll;
182 float _force_at_pitch_a;
184 float _power_at_pitch_0;
185 float _power_at_pitch_b;
190 float _rel_len_hinge;
200 float _stepspersecond;
201 char _alphaoutput[8][256];
204 float _alphamin,_alphamax,_alpha0,_alpha0factor;
205 float _teeterdamp,_maxteeterdamp;
206 float _rellenteeterhinge;
208 float _translift_maxfactor;
209 float _ground_effect_constant;
210 float _vortex_state_lift_factor;
211 float _vortex_state_c1;
212 float _vortex_state_c2;
213 float _vortex_state_c3;
214 float _vortex_state_e1;
215 float _vortex_state_e2;
216 float _vortex_state_e3;
217 float _lift_factor,_f_ge,_f_vs,_f_tl;
219 double _global_ground[4];
223 float _twist; //outer incidence = inner inner incidence + _twist
224 float _rel_len_where_incidence_is_measured;
225 float _torque_of_inertia;
226 float _rel_len_blade_start;
227 float _incidence_stall_zero_speed;
228 float _incidence_stall_half_sonic_speed;
229 float _lift_factor_stall;
230 float _stall_change_over;
231 float _drag_factor_stall;
238 float _cyclic_factor;
239 float _rotor_correction_factor;
241 bool _shared_flap_hinge;
242 float _grav_direction[3];
243 int _properties_tied;
244 bool _directions_and_postions_dirty;
246 std::ostream & operator<<(std::ostream & out, /*const*/ Rotor& r);
252 float _max_power_engine;
253 float _engine_prop_factor;
254 float _yasimdragfactor;
255 float _yasimliftfactor;
257 float _max_power_rotor_brake;
258 float _rotorgear_friction;
260 float _engine_accel_limit;
261 float _total_torque_on_engine;
263 float _target_rel_rpm;
264 float _max_rel_torque;
269 int isInUse() {return _in_use;}
270 void setInUse() {_in_use = 1;}
272 void addRotor(Rotor* rotor);
273 int getNumRotors() {return _rotors.size();}
274 Rotor* getRotor(int i) {return (Rotor*)_rotors.get(i);}
275 void calcForces(float* torqueOut);
276 void setParameter(char *parametername, float value);
277 void setEngineOn(int value);
279 void setRotorBrake(float lval);
280 void setRotorEngineMaxRelTorque(float lval);
281 void setRotorRelTarget(float lval);
282 float getYasimDragFactor() { return _yasimdragfactor;}
283 float getYasimLiftFactor() { return _yasimliftfactor;}
284 float getMaxPowerEngine() { return _max_power_engine;}
285 float getMaxPowerRotorBrake() { return _max_power_rotor_brake;}
286 float getRotorBrake() { return _rotorbrake;}
287 float getEnginePropFactor() {return _engine_prop_factor;}
288 Vector* getRotors() { return &_rotors;}
289 void initRotorIteration(float *lrot,float dt);
290 void getDownWash(float *pos, float * v_heli, float *downwash);
291 int getValueforFGSet(int j,char *b,float *f);
294 }; // namespace yasim