JSBSim Flight Dynamics Model  1.0 (02 March 2017)
An Open Source Flight Dynamics and Control Software Library in C++
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 
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 DEFINITIONS
49 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
50 
51 #define ID_ROTOR "$Id: FGRotor.h,v 1.17 2015/09/27 10:03:53 bcoconni Exp $"
52 
53 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
54 FORWARD DECLARATIONS
55 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
56 
57 namespace JSBSim {
58 
59 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
60 CLASS DOCUMENTATION
61 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
62 
238 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
239 CLASS DECLARATION
240 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
241 
242 class FGRotor : public FGThruster {
243 
244  enum eCtrlMapping {eMainCtrl=0, eTailCtrl, eTandemCtrl};
245 
246 public:
247 
252  FGRotor(FGFDMExec *exec, Element* rotor_element, int num);
253 
255  ~FGRotor();
256 
258  double GetPowerRequired(void)const { return PowerRequired; }
259 
261  double Calculate(double EnginePower);
262 
263 
265  double GetRPM(void) const { return RPM; }
266  void SetRPM(double rpm) { RPM = rpm; }
267 
269  double GetEngineRPM(void) const {return EngineRPM;} //{ return GearRatio*RPM; }
270  void SetEngineRPM(double rpm) {EngineRPM = rpm;} //{ RPM = rpm/GearRatio; }
272  double GetGearRatio(void) { return GearRatio; }
274  double GetThrust(void) const { return Thrust; }
275 
277  double GetA0(void) const { return a0; }
279  double GetA1(void) const { return a1s; }
281  double GetB1(void) const { return b1s; }
282 
284  double GetLambda(void) const { return lambda; }
286  double GetMu(void) const { return mu; }
288  double GetNu(void) const { return nu; }
290  double GetVi(void) const { return v_induced; }
292  double GetCT(void) const { return C_T; }
294  double GetTorque(void) const { return Torque; }
295 
297  double GetThetaDW(void) const { return theta_downwash; }
299  double GetPhiDW(void) const { return phi_downwash; }
300 
302  double GetGroundEffectScaleNorm(void) const { return GroundEffectScaleNorm; }
304  void SetGroundEffectScaleNorm(double g) { GroundEffectScaleNorm = g; }
305 
307  double GetCollectiveCtrl(void) const { return CollectiveCtrl; }
309  double GetLateralCtrl(void) const { return LateralCtrl; }
311  double GetLongitudinalCtrl(void) const { return LongitudinalCtrl; }
312 
314  void SetCollectiveCtrl(double c) { CollectiveCtrl = c; }
316  void SetLateralCtrl(double c) { LateralCtrl = c; }
318  void SetLongitudinalCtrl(double c) { LongitudinalCtrl = c; }
319 
320  // Stubs. Only main rotor RPM is returned
321  std::string GetThrusterLabels(int id, const std::string& delimeter);
322  std::string GetThrusterValues(int id, const std::string& delimeter);
323 
324 private:
325 
326  // assist in parameter retrieval
327  double ConfigValueConv( Element* e, const std::string& ename, double default_val=0.0,
328  const std::string& unit = "", bool tell=false);
329 
330  double ConfigValue( Element* e, const std::string& ename, double default_val=0.0,
331  bool tell=false);
332 
333  double Configure(Element* rotor_element);
334 
335  void CalcRotorState(void);
336 
337  // rotor dynamics
338  void calc_flow_and_thrust(double theta_0, double Uw, double Ww, double flow_scale = 1.0);
339  void calc_coning_angle(double theta_0);
340  void calc_flapping_angles(double theta_0, const FGColumnVector3 &pqr_fus_w);
341  void calc_drag_and_side_forces(double theta_0);
342  void calc_torque(double theta_0);
343  void calc_downwash_angles();
344 
345  // transformations
346  FGColumnVector3 hub_vel_body2ca( const FGColumnVector3 &uvw, const FGColumnVector3 &pqr,
347  double a_ic = 0.0 , double b_ic = 0.0 );
348  FGColumnVector3 fus_angvel_body2ca( const FGColumnVector3 &pqr);
349  FGColumnVector3 body_forces(double a_ic = 0.0 , double b_ic = 0.0 );
350  FGColumnVector3 body_moments(double a_ic = 0.0 , double b_ic = 0.0 );
351 
352  // interface
353  bool bindmodel(FGPropertyManager* pm);
354  void Debug(int from);
355 
356  // environment
357  double dt;
358  double rho;
359  Filter damp_hagl;
360 
361  // configuration parameters
362  double Radius;
363  int BladeNum;
364 
365  // rpm control
366  double Sense;
367  double NominalRPM;
368  double MinimalRPM;
369  double MaximalRPM;
370  int ExternalRPM;
371  int RPMdefinition;
372  FGPropertyNode_ptr ExtRPMsource;
373  double SourceGearRatio;
374 
375  // 'real' rotor parameters
376  double BladeChord;
377  double LiftCurveSlope;
378  double BladeTwist;
379  double HingeOffset;
380  double BladeFlappingMoment;
381  double BladeMassMoment;
382  double PolarMoment;
383  double InflowLag;
384  double TipLossB;
385 
386  // groundeffect
387  double GroundEffectExp;
388  double GroundEffectShift;
389  double GroundEffectScaleNorm;
390 
391  // derived parameters
392  double LockNumberByRho;
393  double Solidity; // aka sigma
394  double R[5]; // Radius powers
395  double B[5]; // TipLossB powers
396 
397  // Some of the calculations require shaft axes. So the
398  // thruster orientation (Tbo, with b for body) needs to be
399  // expressed/represented in helicopter shaft coordinates (Hsr).
400  FGMatrix33 InvTransform;
401  FGMatrix33 TboToHsr;
402  FGMatrix33 HsrToTbo;
403 
404  // dynamic values
405  double RPM;
406  double Omega; // must be > 0
407  double beta_orient; // rotor orientation angle (rad)
408  double a0; // coning angle (rad)
409  double a_1, b_1, a_dw; // flapping angles
410  double a1s, b1s; // cyclic flapping relative to shaft axes, /SH79/ eqn(43)
411  double H_drag, J_side; // Forces
412 
413  double Torque;
414  double C_T; // rotor thrust coefficient
415  double lambda; // inflow ratio
416  double mu; // tip-speed ratio
417  double nu; // induced inflow ratio
418  double v_induced; // induced velocity, usually positive [ft/s]
419 
420  double theta_downwash;
421  double phi_downwash;
422 
423  // control
424  eCtrlMapping ControlMap;
425  double CollectiveCtrl;
426  double LateralCtrl;
427  double LongitudinalCtrl;
428 
429  // interaction with engine
430  FGTransmission *Transmission;
431  double EngineRPM;
432  double MaxBrakePower;
433  double GearLoss;
434  double GearMoment;
435 
436 };
437 
438 }
439 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
440 #endif
double GetGroundEffectScaleNorm(void) const
Retrieves the ground effect scaling factor.
Definition: FGRotor.h:302
double Calculate(double EnginePower)
Returns the scalar thrust of the rotor, and adjusts the RPM value.
Definition: FGRotor.cpp:673
double GetThetaDW(void) const
Downwash angle - positive values point forward (given a horizontal spinning rotor) ...
Definition: FGRotor.h:297
~FGRotor()
Destructor for FGRotor.
Definition: FGRotor.cpp:223
double GetVi(void) const
Retrieves the induced velocity.
Definition: FGRotor.h:290
void SetLateralCtrl(double c)
Sets the lateral control input in radians.
Definition: FGRotor.h:316
double GetThrust(void) const
Retrieves the thrust of the rotor.
Definition: FGRotor.h:274
void SetLongitudinalCtrl(double c)
Sets the longitudinal control input in radians.
Definition: FGRotor.h:318
double GetCT(void) const
Retrieves the thrust coefficient.
Definition: FGRotor.h:292
Utility class that handles power transmission in conjunction with FGRotor.
Base class for specific thrusting devices such as propellers, nozzles, etc.
Definition: FGThruster.h:84
Models a helicopter rotor.
Definition: FGRotor.h:242
double GetRPM(void) const
Retrieves the RPMs of the rotor.
Definition: FGRotor.h:265
double GetA1(void) const
Retrieves the longitudinal flapping angle with respect to the rotor shaft.
Definition: FGRotor.h:279
double GetEngineRPM(void) const
Retrieves the RPMs of the Engine, as seen from this rotor.
Definition: FGRotor.h:269
void SetCollectiveCtrl(double c)
Sets the collective control input in radians.
Definition: FGRotor.h:314
First order, (low pass / lag) filter.
Definition: FGJSBBase.h:102
double GetLongitudinalCtrl(void) const
Retrieves the longitudinal control input in radians.
Definition: FGRotor.h:311
double GetPhiDW(void) const
Downwash angle - positive values point leftward (given a horizontal spinning rotor) ...
Definition: FGRotor.h:299
void SetGroundEffectScaleNorm(double g)
Sets the ground effect scaling factor.
Definition: FGRotor.h:304
double GetCollectiveCtrl(void) const
Retrieves the collective control input in radians.
Definition: FGRotor.h:307
double GetNu(void) const
Retrieves the induced inflow ratio.
Definition: FGRotor.h:288
This class implements a 3 element column vector.
double GetA0(void) const
Retrieves the rotor's coning angle.
Definition: FGRotor.h:277
double GetGearRatio(void)
Tells the rotor's gear ratio, usually the engine asks for this.
Definition: FGRotor.h:272
double GetLambda(void) const
Retrieves the inflow ratio.
Definition: FGRotor.h:284
double GetLateralCtrl(void) const
Retrieves the lateral control input in radians.
Definition: FGRotor.h:309
FGRotor(FGFDMExec *exec, Element *rotor_element, int num)
Constructor for FGRotor.
Definition: FGRotor.cpp:77
double GetB1(void) const
Retrieves the lateral flapping angle with respect to the rotor shaft.
Definition: FGRotor.h:281
double GetTorque(void) const
Retrieves the torque.
Definition: FGRotor.h:294
double GetPowerRequired(void) const
Returns the power required by the rotor.
Definition: FGRotor.h:258
Handles matrix math operations.
Definition: FGMatrix33.h:92
Encapsulates the JSBSim simulation executive.
Definition: FGFDMExec.h:189
double GetMu(void) const
Retrieves the tip-speed (aka advance) ratio.
Definition: FGRotor.h:286