JSBSim Flight Dynamics Model 1.3.3 (16 Oct 2026)
An Open Source Flight Dynamics and Control Software Library in C++
Loading...
Searching...
No Matches
FGRotor.h
1/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2
3 Header: FGRotor.h
4 Author: T. Kreitler
5 Date started: 08/24/00
6
7 ------------- Copyright (C) 2010 T. Kreitler (t.kreitler@web.de) -------------
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
26HISTORY
27--------------------------------------------------------------------------------
2801/01/10 T.Kreitler test implementation
2901/10/11 T.Kreitler changed to single rotor model
3003/06/11 T.Kreitler added brake, clutch, and experimental free-wheeling-unit
3102/05/12 T.Kreitler brake, clutch, and FWU now in FGTransmission class
32
33%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
34SENTRY
35%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
36
37#ifndef FGROTOR_H
38#define FGROTOR_H
39
40/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
41INCLUDES
42%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
43
44#include "FGThruster.h"
45#include "FGTransmission.h"
46
47/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
48FORWARD DECLARATIONS
49%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
50
51namespace JSBSim {
52
53/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
54CLASS DOCUMENTATION
55%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
56
231/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
232CLASS DECLARATION
233%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
234
235class FGRotor : public FGThruster {
236
237 enum eCtrlMapping {eMainCtrl=0, eTailCtrl, eTandemCtrl};
238
239public:
240
245 FGRotor(FGFDMExec *exec, Element* rotor_element, int num);
246
248 ~FGRotor();
249
251 void ResetToIC(void);
252
254 double GetPowerRequired(void) { return PowerRequired; }
255
257 double Calculate(double EnginePower);
258
259
261 double GetRPM(void) const { return RPM; }
262 void SetRPM(double rpm) { RPM = rpm; }
263
265 double GetEngineRPM(void) const {return EngineRPM;} //{ return GearRatio*RPM; }
266 void SetEngineRPM(double rpm) {EngineRPM = rpm;} //{ RPM = rpm/GearRatio; }
268 double GetGearRatio(void) { return GearRatio; }
270 double GetThrust(void) const { return Thrust; }
271
273 double GetA0(void) const { return a0; }
275 double GetA1(void) const { return a1s; }
277 double GetB1(void) const { return b1s; }
278
280 double GetLambda(void) const { return lambda; }
282 double GetMu(void) const { return mu; }
284 double GetNu(void) const { return nu; }
286 double GetVi(void) const { return v_induced; }
288 double GetCT(void) const { return C_T; }
290 double GetTorque(void) const { return Torque; }
291
293 double GetThetaDW(void) const { return theta_downwash; }
295 double GetPhiDW(void) const { return phi_downwash; }
296
298 double GetGroundEffectScaleNorm(void) const { return GroundEffectScaleNorm; }
300 void SetGroundEffectScaleNorm(double g) { GroundEffectScaleNorm = g; }
301
303 double GetCollectiveCtrl(void) const { return CollectiveCtrl; }
305 double GetLateralCtrl(void) const { return LateralCtrl; }
307 double GetLongitudinalCtrl(void) const { return LongitudinalCtrl; }
308
310 void SetCollectiveCtrl(double c) { CollectiveCtrl = c; }
312 void SetLateralCtrl(double c) { LateralCtrl = c; }
314 void SetLongitudinalCtrl(double c) { LongitudinalCtrl = c; }
315
316 // Stubs. Only main rotor RPM is returned
317 std::string GetThrusterLabels(int id, const std::string& delimeter);
318 std::string GetThrusterValues(int id, const std::string& delimeter);
319
320private:
321
322 // assist in parameter retrieval
323 double ConfigValueConv( Element* e, const std::string& ename, double default_val=0.0,
324 const std::string& unit = "", bool tell=false);
325
326 double ConfigValue( Element* e, const std::string& ename, double default_val=0.0,
327 bool tell=false);
328
329 double Configure(Element* rotor_element);
330
332 void InitDynamics(void);
333
334 void CalcRotorState(void);
335
336 // rotor dynamics
337 void calc_flow_and_thrust(double theta_0, double Uw, double Ww, double flow_scale = 1.0);
338 void calc_coning_angle(double theta_0);
339 void calc_flapping_angles(double theta_0, const FGColumnVector3 &pqr_fus_w);
340 void calc_drag_and_side_forces(double theta_0);
341 void calc_torque(double theta_0);
342 void calc_downwash_angles();
343
344 // transformations
345 FGColumnVector3 hub_vel_body2ca( const FGColumnVector3 &uvw, const FGColumnVector3 &pqr,
346 double a_ic = 0.0 , double b_ic = 0.0 );
347 FGColumnVector3 fus_angvel_body2ca( const FGColumnVector3 &pqr);
348 FGColumnVector3 body_forces(double a_ic = 0.0 , double b_ic = 0.0 );
349 FGColumnVector3 body_moments(double a_ic = 0.0 , double b_ic = 0.0 );
350
351 // interface
352 bool bindmodel(FGPropertyManager* pm);
353 void Debug(int from);
354
355 // environment
356 double dt;
357 double rho;
358 Filter damp_hagl;
359
360 // configuration parameters
361 double Radius;
362 int BladeNum;
363
364 // rpm control
365 double Sense;
366 double NominalRPM;
367 double MinimalRPM;
368 double MaximalRPM;
369 int ExternalRPM;
370 int RPMdefinition;
371 SGPropertyNode_ptr ExtRPMsource;
372 double SourceGearRatio;
373
374 // 'real' rotor parameters
375 double BladeChord;
376 double LiftCurveSlope;
377 double BladeTwist;
378 double HingeOffset;
379 double BladeFlappingMoment;
380 double BladeMassMoment;
381 double PolarMoment;
382 double InflowLag;
383 double TipLossB;
384
385 // groundeffect
386 double GroundEffectExp;
387 double GroundEffectShift;
388 double GroundEffectScaleNorm;
389
390 // derived parameters
391 double LockNumberByRho;
392 double Solidity; // aka sigma
393 double R[5]; // Radius powers
394 double B[5]; // TipLossB powers
395
396 // Some of the calculations require shaft axes. So the
397 // thruster orientation (Tbo, with b for body) needs to be
398 // expressed/represented in helicopter shaft coordinates (Hsr).
399 FGMatrix33 InvTransform;
400 FGMatrix33 TboToHsr;
401 FGMatrix33 HsrToTbo;
402
403 // dynamic values
404 double RPM;
405 double Omega; // must be > 0
406 double beta_orient; // rotor orientation angle (rad)
407 double a0; // coning angle (rad)
408 double a_1, b_1, a_dw; // flapping angles
409 double a1s, b1s; // cyclic flapping relative to shaft axes, /SH79/ eqn(43)
410 double H_drag, J_side; // Forces
411
412 double Torque;
413 double C_T; // rotor thrust coefficient
414 double lambda; // inflow ratio
415 double mu; // tip-speed ratio
416 double nu; // induced inflow ratio
417 double v_induced; // induced velocity, usually positive [ft/s]
418
419 double theta_downwash;
420 double phi_downwash;
421
422 // control
423 eCtrlMapping ControlMap;
424 double CollectiveCtrl;
425 double LateralCtrl;
426 double LongitudinalCtrl;
427
428 // interaction with engine
429 FGTransmission *Transmission;
430 double EngineRPM;
431 double MaxBrakePower;
432 double GearLoss;
433 double GearMoment;
434
435};
436
437}
438//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
439#endif
This class implements a 3 element column vector.
Encapsulates the JSBSim simulation executive.
Definition FGFDMExec.h:185
Handles matrix math operations.
Definition FGMatrix33.h:70
Models a helicopter rotor.
Definition FGRotor.h:235
double GetLambda(void) const
Retrieves the inflow ratio.
Definition FGRotor.h:280
double Calculate(double EnginePower)
Returns the scalar thrust of the rotor, and adjusts the RPM value.
Definition FGRotor.cpp:695
double GetB1(void) const
Retrieves the lateral flapping angle with respect to the rotor shaft.
Definition FGRotor.h:277
double GetGroundEffectScaleNorm(void) const
Retrieves the ground effect scaling factor.
Definition FGRotor.h:298
double GetPowerRequired(void)
Returns the power required by the rotor.
Definition FGRotor.h:254
double GetRPM(void) const
Retrieves the RPMs of the rotor.
Definition FGRotor.h:261
void ResetToIC(void)
Reset the initial conditions.
Definition FGRotor.cpp:227
~FGRotor()
Destructor for FGRotor.
Definition FGRotor.cpp:218
double GetThrust(void) const
Retrieves the thrust of the rotor.
Definition FGRotor.h:270
void SetCollectiveCtrl(double c)
Sets the collective control input in radians.
Definition FGRotor.h:310
double GetCollectiveCtrl(void) const
Retrieves the collective control input in radians.
Definition FGRotor.h:303
void SetGroundEffectScaleNorm(double g)
Sets the ground effect scaling factor.
Definition FGRotor.h:300
double GetLongitudinalCtrl(void) const
Retrieves the longitudinal control input in radians.
Definition FGRotor.h:307
void SetLongitudinalCtrl(double c)
Sets the longitudinal control input in radians.
Definition FGRotor.h:314
double GetTorque(void) const
Retrieves the torque.
Definition FGRotor.h:290
void SetLateralCtrl(double c)
Sets the lateral control input in radians.
Definition FGRotor.h:312
double GetMu(void) const
Retrieves the tip-speed (aka advance) ratio.
Definition FGRotor.h:282
double GetPhiDW(void) const
Downwash angle - positive values point leftward (given a horizontal spinning rotor)
Definition FGRotor.h:295
double GetCT(void) const
Retrieves the thrust coefficient.
Definition FGRotor.h:288
double GetEngineRPM(void) const
Retrieves the RPMs of the Engine, as seen from this rotor.
Definition FGRotor.h:265
double GetA1(void) const
Retrieves the longitudinal flapping angle with respect to the rotor shaft.
Definition FGRotor.h:275
double GetNu(void) const
Retrieves the induced inflow ratio.
Definition FGRotor.h:284
double GetThetaDW(void) const
Downwash angle - positive values point forward (given a horizontal spinning rotor)
Definition FGRotor.h:293
double GetA0(void) const
Retrieves the rotor's coning angle.
Definition FGRotor.h:273
double GetGearRatio(void)
Tells the rotor's gear ratio, usually the engine asks for this.
Definition FGRotor.h:268
double GetVi(void) const
Retrieves the induced velocity.
Definition FGRotor.h:286
double GetLateralCtrl(void) const
Retrieves the lateral control input in radians.
Definition FGRotor.h:305
Base class for specific thrusting devices such as propellers, nozzles, etc.
Definition FGThruster.h:77
Utility class that handles power transmission in conjunction with FGRotor.
Main namespace for the JSBSim Flight Dynamics Model.
Definition FGFDMExec.cpp:73