Debian Codegraph @

src/FDM/JSBSim/models/propulsion/FGRotor.h

raw symbols SCIP
1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2
3 Header: FGRotor.h
4 Author: T. Kreitler
5 Date started: 08/24/00
6
7 ------------- Copyright (C) 2010 T. Kreitler ([email protected]) -------------
8
9 This program is free software; you can redistribute it and/or modify it under
10 the terms of the GNU Lesser General Public License as published by the Free Software
11 Foundation; either version 2 of the License, or (at your option) any later
12 version.
13
14 This program is distributed in the hope that it will be useful, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
17 details.
18
19 You should have received a copy of the GNU Lesser General Public License along with
20 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
21 Place - Suite 330, Boston, MA 02111-1307, USA.
22
23 Further information about the GNU Lesser General Public License can also be found on
24 the world wide web at http://www.gnu.org.
25
26 HISTORY
27 --------------------------------------------------------------------------------
28 01/01/10 T.Kreitler test implementation
29 01/10/11 T.Kreitler changed to single rotor model
30 03/06/11 T.Kreitler added brake, clutch, and experimental free-wheeling-unit
31 02/05/12 T.Kreitler brake, clutch, and FWU now in FGTransmission class
32
33 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
34 SENTRY
35 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
36
37 #ifndef FGROTOR_H
38 #define FGROTOR_H
39
40 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
41 INCLUDES
42 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
43
44 #include "FGThruster.h"
45 #include "FGTransmission.h"
46
47 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
48 FORWARD DECLARATIONS
49 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
50
51 namespace JSBSim {
52
53 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
54 CLASS DOCUMENTATION
55 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
56
57 /** Models a helicopter rotor.
58
59
60 <h3>Configuration File Format</h3>
61 @code
62 <rotor name="{string}">
63 <diameter unit="{LENGTH}"> {number} </diameter>
64 <numblades> {number} </numblades>
65 <gearratio> {number} </gearratio>
66 <nominalrpm> {number} </nominalrpm>
67 <minrpm> {number} </minrpm>
68 <maxrpm> {number} </maxrpm>
69 <chord unit="{LENGTH}"> {number} </chord>
70 <liftcurveslope Xunit="1/RAD"> {number} </liftcurveslope>
71 <twist unit="{ANGLE}"> {number} </twist>
72 <hingeoffset unit="{LENGTH}"> {number} </hingeoffset>
73 <flappingmoment unit="{MOMENT}"> {number} </flappingmoment>
74 <massmoment Xunit="SLUG*FT"> {number} </massmoment>
75 <polarmoment unit="{MOMENT}"> {number} </polarmoment>
76 <inflowlag> {number} </inflowlag>
77 <tiplossfactor> {number} </tiplossfactor>
78 <maxbrakepower unit="{POWER}"> {number} </maxbrakepower>
79 <gearloss unit="{POWER}"> {number} </gearloss>
80 <gearmoment unit="{MOMENT}"> {number} </gearmoment>
81
82 <controlmap> {MAIN|TAIL|TANDEM} </controlmap>
83 <ExternalRPM> {number} </ExternalRPM>
84
85 <groundeffectexp> {number} </groundeffectexp>
86 <groundeffectshift unit="{LENGTH}"> {number} </groundeffectshift>
87
88 </rotor>
89
90 // LENGTH means any of the supported units, same for ANGLE and MOMENT.
91 // Xunit-attributes are a hint for currently unsupported units, so
92 // values must be provided accordingly.
93
94 @endcode
95
96 <h3>Configuration Parameters:</h3>
97
98 Brief description and the symbol frequently found in the literature.
99
100 <pre>
101 \<diameter> - Rotor disk diameter (2x R).
102 \<numblades> - Number of blades (b).
103 \<gearratio> - Ratio of (engine rpm) / (rotor rpm), usually > 1.
104 \<nominalrpm> - RPM at which the rotor usally operates.
105 \<minrpm> - Lowest RPM used in the model, optional and defaults to 1.
106 \<maxrpm> - Largest RPM used in the model, optional and defaults to 2 x nominalrpm.
107 \<chord> - Blade chord, (c).
108 \<liftcurveslope> - Slope of curve of section lift against section angle of attack,
109 per rad (a).
110 \<twist> - Blade twist from root to tip, (theta_1).
111 \<hingeoffset> - Rotor flapping-hinge offset (e).
112 \<flappingmoment> - Flapping moment of inertia (I_b).
113 \<massmoment> - Blade mass moment. Mass of a single blade times the blade's
114 cg-distance from the hub, optional.
115 \<polarmoment> - Moment of inertia for the whole rotor disk, optional.
116 \<inflowlag> - Rotor inflow time constant, sec. Smaller values yield to quicker
117 responses (typical values for main rotor: 0.1 - 0.2 s).
118 \<tiplossfactor> - Tip-loss factor. The Blade fraction that produces lift.
119 Value usually ranges between 0.95 - 1.0, optional (B).
120
121 \<maxbrakepower> - Rotor brake, 20-30 hp should work for a mid size helicopter.
122 \<gearloss> - Friction in gear, 0.2% to 3% of the engine power, optional (see notes).
123 \<gearmoment> - Approximation for the moment of inertia of the gear (and engine),
124 defaults to 0.1 * polarmoment, optional.
125
126 \<controlmap> - Defines the control inputs used (see notes).
127
128 \<ExternalRPM> - Links the rotor to another rotor, or an user controllable property.
129
130 Experimental properties
131
132 \<groundeffectexp> - Exponent for ground effect approximation. Values usually range from 0.04
133 for large rotors to 0.1 for smaller ones. As a rule of thumb the effect
134 vanishes at a height 2-3 times the rotor diameter.
135 formula used: exp ( - groundeffectexp * (height+groundeffectshift) )
136 Omitting or setting to 0.0 disables the effect calculation.
137 \<groundeffectshift> - Further adjustment of ground effect, approx. hub height or slightly above
138 (This lessens the influence of the ground effect).
139
140 </pre>
141
142 <h3>Notes:</h3>
143
144 <h4>- Controls -</h4>
145
146 The behavior of the rotor is controlled/influenced by following inputs.<ul>
147 <li> The power provided by the engine. This is handled by the regular engine controls.</li>
148 <li> The collective control input. This is read from the <tt>fdm</tt> property
149 <tt>propulsion/engine[x]/collective-ctrl-rad</tt>. See below for tail rotor</li>
150 <li> The lateral cyclic input. Read from
151 <tt>propulsion/engine[x]/lateral-ctrl-rad</tt>.</li>
152 <li> The longitudinal cyclic input. Read from
153 <tt>propulsion/engine[x]/longitudinal-ctrl-rad</tt>.</li>
154 <li> The tail rotor collective (aka antitorque, aka pedal) control input. Read from
155 <tt>propulsion/engine[x]/antitorque-ctrl-rad</tt> or
156 <tt>propulsion/engine[x]/tail-collective-ctrl-rad</tt>.</li>
157
158 </ul>
159
160 <h4>- Tail/tandem rotor -</h4>
161
162 Providing <tt>\<ExternalRPM\> 0 \</ExternalRPM\></tt> the tail rotor's RPM
163 is linked to to the main (=first, =0) rotor, and specifing
164 <tt>\<controlmap\> TAIL \</controlmap\></tt> tells this rotor to read the
165 collective input from <tt>propulsion/engine[1]/antitorque-ctrl-rad</tt>
166 (The TAIL-map ignores lateral and longitudinal input). The rotor needs to be
167 attached to a dummy engine, e.g. an 1HP electrical engine.
168 A tandem rotor is setup analogous.
169
170 <h4>- Sense -</h4>
171
172 The 'sense' parameter from the thruster is interpreted as follows, sense=1 means
173 counter clockwise rotation of the main rotor, as viewed from above. This is as a far
174 as I know more popular than clockwise rotation, which is defined by setting sense to
175 -1. Concerning coaxial designs - by setting 'sense' to zero, a Kamov-style rotor is
176 modeled (i.e. the rotor produces no torque).
177
178 <h4>- Engine issues -</h4>
179
180 In order to keep the rotor/engine speed constant, use of a RPM-Governor system is
181 encouraged (see examples).
182
183 In case the model requires the manual use of a clutch the <tt>\<gearloss\></tt>
184 property might need attention.<ul>
185
186 <li> Electrical: here the gear-loss should be rather large to keep the engine
187 controllable when the clutch is open (although full throttle might still make it
188 spin away).</li>
189 <li> Piston: this engine model already has some internal friction loss and also
190 looses power if it spins too high. Here the gear-loss could be set to 0.25%
191 of the engine power (which is also the approximated default).</li>
192 <li> Turboprop: Here the default value might be a bit too small. Also it's advisable
193 to adjust the power table for rpm values that are far beyond the nominal value.</li>
194
195 </ul>
196
197 <h4>- Scaling the ground effect -</h4>
198
199 The property <tt>propulsion/engine[x]/groundeffect-scale-norm</tt> allows fdm based
200 scaling of the ground effect influence. For instance the effect vanishes at speeds
201 above approx. 50kts, or one likes to land on a 'perforated' helipad.
202
203 <h4>- Development hints -</h4>
204
205 Setting <tt>\<ExternalRPM> -1 \</ExternalRPM></tt> the rotor's RPM is controlled by
206 the <tt>propulsion/engine[x]/x-rpm-dict</tt> property. This feature can be useful
207 when developing a FDM.
208
209
210 <h3>References:</h3>
211
212 <dl>
213 <dt>/SH79/</dt><dd>Shaugnessy, J. D., Deaux, Thomas N., and Yenni, Kenneth R.,
214 "Development and Validation of a Piloted Simulation of a
215 Helicopter and External Sling Load", NASA TP-1285, 1979.</dd>
216 <dt>/BA41/</dt><dd>Bailey,F.J.,Jr., "A Simplified Theoretical Method of Determining
217 the Characteristics of a Lifting Rotor in Forward Flight", NACA Rep.716, 1941.</dd>
218 <dt>/AM50/</dt><dd>Amer, Kenneth B.,"Theory of Helicopter Damping in Pitch or Roll and a
219 Comparison With Flight Measurements", NACA TN-2136, 1950.</dd>
220 <dt>/TA77/</dt><dd>Talbot, Peter D., Corliss, Lloyd D., "A Mathematical Force and Moment
221 Model of a UH-1H Helicopter for Flight Dynamics Simulations", NASA TM-73,254, 1977.</dd>
222 <dt>/GE49/</dt><dd>Gessow, Alfred, Amer, Kenneth B. "An Introduction to the Physical
223 Aspects of Helicopter Stability", NACA TN-1982, 1949.</dd>
224 </dl>
225
226 @author Thomas Kreitler
227 */
228
229
230
231 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
232 CLASS DECLARATION
233 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
234
235 class FGRotor : public FGThruster {
236
237 enum eCtrlMapping {eMainCtrl=0, eTailCtrl, eTandemCtrl};
238
239 public:
240
241 /** Constructor for FGRotor.
242 @param exec a pointer to the main executive object
243 @param rotor_element a pointer to the thruster config file XML element
244 @param num the number of this rotor */
245 FGRotor(FGFDMExec *exec, Element* rotor_element, int num);
246
247 /// Destructor for FGRotor
248 ~FGRotor();
249
250 /// Returns the power required by the rotor.
251 double GetPowerRequired(void)const { return PowerRequired; }
252
253 /// Returns the scalar thrust of the rotor, and adjusts the RPM value.
254 double Calculate(double EnginePower);
255
256
257 /// Retrieves the RPMs of the rotor.
258 double GetRPM(void) const { return RPM; }
259 void SetRPM(double rpm) { RPM = rpm; }
260
261 /// Retrieves the RPMs of the Engine, as seen from this rotor.
262 double GetEngineRPM(void) const {return EngineRPM;} //{ return GearRatio*RPM; }
263 void SetEngineRPM(double rpm) {EngineRPM = rpm;} //{ RPM = rpm/GearRatio; }
264 /// Tells the rotor's gear ratio, usually the engine asks for this.
265 double GetGearRatio(void) { return GearRatio; }
266 /// Retrieves the thrust of the rotor.
267 double GetThrust(void) const { return Thrust; }
268
269 /// Retrieves the rotor's coning angle
270 double GetA0(void) const { return a0; }
271 /// Retrieves the longitudinal flapping angle with respect to the rotor shaft
272 double GetA1(void) const { return a1s; }
273 /// Retrieves the lateral flapping angle with respect to the rotor shaft
274 double GetB1(void) const { return b1s; }
275
276 /// Retrieves the inflow ratio
277 double GetLambda(void) const { return lambda; }
278 /// Retrieves the tip-speed (aka advance) ratio
279 double GetMu(void) const { return mu; }
280 /// Retrieves the induced inflow ratio
281 double GetNu(void) const { return nu; }
282 /// Retrieves the induced velocity
283 double GetVi(void) const { return v_induced; }
284 /// Retrieves the thrust coefficient
285 double GetCT(void) const { return C_T; }
286 /// Retrieves the torque
287 double GetTorque(void) const { return Torque; }
288
289 /// Downwash angle - positive values point forward (given a horizontal spinning rotor)
290 double GetThetaDW(void) const { return theta_downwash; }
291 /// Downwash angle - positive values point leftward (given a horizontal spinning rotor)
292 double GetPhiDW(void) const { return phi_downwash; }
293
294 /// Retrieves the ground effect scaling factor.
295 double GetGroundEffectScaleNorm(void) const { return GroundEffectScaleNorm; }
296 /// Sets the ground effect scaling factor.
297 void SetGroundEffectScaleNorm(double g) { GroundEffectScaleNorm = g; }
298
299 /// Retrieves the collective control input in radians.
300 double GetCollectiveCtrl(void) const { return CollectiveCtrl; }
301 /// Retrieves the lateral control input in radians.
302 double GetLateralCtrl(void) const { return LateralCtrl; }
303 /// Retrieves the longitudinal control input in radians.
304 double GetLongitudinalCtrl(void) const { return LongitudinalCtrl; }
305
306 /// Sets the collective control input in radians.
307 void SetCollectiveCtrl(double c) { CollectiveCtrl = c; }
308 /// Sets the lateral control input in radians.
309 void SetLateralCtrl(double c) { LateralCtrl = c; }
310 /// Sets the longitudinal control input in radians.
311 void SetLongitudinalCtrl(double c) { LongitudinalCtrl = c; }
312
313 // Stubs. Only main rotor RPM is returned
314 std::string GetThrusterLabels(int id, const std::string& delimeter);
315 std::string GetThrusterValues(int id, const std::string& delimeter);
316
317 private:
318
319 // assist in parameter retrieval
320 double ConfigValueConv( Element* e, const std::string& ename, double default_val=0.0,
321 const std::string& unit = "", bool tell=false);
322
323 double ConfigValue( Element* e, const std::string& ename, double default_val=0.0,
324 bool tell=false);
325
326 double Configure(Element* rotor_element);
327
328 void CalcRotorState(void);
329
330 // rotor dynamics
331 void calc_flow_and_thrust(double theta_0, double Uw, double Ww, double flow_scale = 1.0);
332 void calc_coning_angle(double theta_0);
333 void calc_flapping_angles(double theta_0, const FGColumnVector3 &pqr_fus_w);
334 void calc_drag_and_side_forces(double theta_0);
335 void calc_torque(double theta_0);
336 void calc_downwash_angles();
337
338 // transformations
339 FGColumnVector3 hub_vel_body2ca( const FGColumnVector3 &uvw, const FGColumnVector3 &pqr,
340 double a_ic = 0.0 , double b_ic = 0.0 );
341 FGColumnVector3 fus_angvel_body2ca( const FGColumnVector3 &pqr);
342 FGColumnVector3 body_forces(double a_ic = 0.0 , double b_ic = 0.0 );
343 FGColumnVector3 body_moments(double a_ic = 0.0 , double b_ic = 0.0 );
344
345 // interface
346 bool bindmodel(FGPropertyManager* pm);
347 void Debug(int from);
348
349 // environment
350 double dt;
351 double rho;
352 Filter damp_hagl;
353
354 // configuration parameters
355 double Radius;
356 int BladeNum;
357
358 // rpm control
359 double Sense;
360 double NominalRPM;
361 double MinimalRPM;
362 double MaximalRPM;
363 int ExternalRPM;
364 int RPMdefinition;
365 FGPropertyNode_ptr ExtRPMsource;
366 double SourceGearRatio;
367
368 // 'real' rotor parameters
369 double BladeChord;
370 double LiftCurveSlope;
371 double BladeTwist;
372 double HingeOffset;
373 double BladeFlappingMoment;
374 double BladeMassMoment;
375 double PolarMoment;
376 double InflowLag;
377 double TipLossB;
378
379 // groundeffect
380 double GroundEffectExp;
381 double GroundEffectShift;
382 double GroundEffectScaleNorm;
383
384 // derived parameters
385 double LockNumberByRho;
386 double Solidity; // aka sigma
387 double R[5]; // Radius powers
388 double B[5]; // TipLossB powers
389
390 // Some of the calculations require shaft axes. So the
391 // thruster orientation (Tbo, with b for body) needs to be
392 // expressed/represented in helicopter shaft coordinates (Hsr).
393 FGMatrix33 InvTransform;
394 FGMatrix33 TboToHsr;
395 FGMatrix33 HsrToTbo;
396
397 // dynamic values
398 double RPM;
399 double Omega; // must be > 0
400 double beta_orient; // rotor orientation angle (rad)
401 double a0; // coning angle (rad)
402 double a_1, b_1, a_dw; // flapping angles
403 double a1s, b1s; // cyclic flapping relative to shaft axes, /SH79/ eqn(43)
404 double H_drag, J_side; // Forces
405
406 double Torque;
407 double C_T; // rotor thrust coefficient
408 double lambda; // inflow ratio
409 double mu; // tip-speed ratio
410 double nu; // induced inflow ratio
411 double v_induced; // induced velocity, usually positive [ft/s]
412
413 double theta_downwash;
414 double phi_downwash;
415
416 // control
417 eCtrlMapping ControlMap;
418 double CollectiveCtrl;
419 double LateralCtrl;
420 double LongitudinalCtrl;
421
422 // interaction with engine
423 FGTransmission *Transmission;
424 double EngineRPM;
425 double MaxBrakePower;
426 double GearLoss;
427 double GearMoment;
428
429 };
430
431 }
432 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
433 #endif