JSBSim Flight Dynamics Model  1.1.11 (13 Feb 2022)
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 FORWARD DECLARATIONS
49 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
50 
51 namespace JSBSim {
52 
53 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
54 CLASS DOCUMENTATION
55 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
56 
231 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
232 CLASS DECLARATION
233 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
234 
235 class FGRotor : public FGThruster {
236 
237  enum eCtrlMapping {eMainCtrl=0, eTailCtrl, eTandemCtrl};
238 
239 public:
240 
245  FGRotor(FGFDMExec *exec, Element* rotor_element, int num);
246 
248  ~FGRotor();
249 
251  double GetPowerRequired(void)const { return PowerRequired; }
252 
254  double Calculate(double EnginePower);
255 
256 
258  double GetRPM(void) const { return RPM; }
259  void SetRPM(double rpm) { RPM = rpm; }
260 
262  double GetEngineRPM(void) const {return EngineRPM;} //{ return GearRatio*RPM; }
263  void SetEngineRPM(double rpm) {EngineRPM = rpm;} //{ RPM = rpm/GearRatio; }
265  double GetGearRatio(void) { return GearRatio; }
267  double GetThrust(void) const { return Thrust; }
268 
270  double GetA0(void) const { return a0; }
272  double GetA1(void) const { return a1s; }
274  double GetB1(void) const { return b1s; }
275 
277  double GetLambda(void) const { return lambda; }
279  double GetMu(void) const { return mu; }
281  double GetNu(void) const { return nu; }
283  double GetVi(void) const { return v_induced; }
285  double GetCT(void) const { return C_T; }
287  double GetTorque(void) const { return Torque; }
288 
290  double GetThetaDW(void) const { return theta_downwash; }
292  double GetPhiDW(void) const { return phi_downwash; }
293 
295  double GetGroundEffectScaleNorm(void) const { return GroundEffectScaleNorm; }
297  void SetGroundEffectScaleNorm(double g) { GroundEffectScaleNorm = g; }
298 
300  double GetCollectiveCtrl(void) const { return CollectiveCtrl; }
302  double GetLateralCtrl(void) const { return LateralCtrl; }
304  double GetLongitudinalCtrl(void) const { return LongitudinalCtrl; }
305 
307  void SetCollectiveCtrl(double c) { CollectiveCtrl = c; }
309  void SetLateralCtrl(double c) { LateralCtrl = c; }
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
JSBSim::FGRotor::~FGRotor
~FGRotor()
Destructor for FGRotor.
Definition: FGRotor.cpp:220
JSBSim::FGRotor::GetVi
double GetVi(void) const
Retrieves the induced velocity.
Definition: FGRotor.h:283
JSBSim::FGFDMExec
Encapsulates the JSBSim simulation executive.
Definition: FGFDMExec.h:185
JSBSim::FGRotor::SetLateralCtrl
void SetLateralCtrl(double c)
Sets the lateral control input in radians.
Definition: FGRotor.h:309
JSBSim::FGRotor::GetThetaDW
double GetThetaDW(void) const
Downwash angle - positive values point forward (given a horizontal spinning rotor)
Definition: FGRotor.h:290
JSBSim::FGColumnVector3
This class implements a 3 element column vector.
Definition: FGColumnVector3.h:63
JSBSim::FGRotor::GetThrust
double GetThrust(void) const
Retrieves the thrust of the rotor.
Definition: FGRotor.h:267
JSBSim::FGRotor::GetRPM
double GetRPM(void) const
Retrieves the RPMs of the rotor.
Definition: FGRotor.h:258
JSBSim::FGRotor::SetLongitudinalCtrl
void SetLongitudinalCtrl(double c)
Sets the longitudinal control input in radians.
Definition: FGRotor.h:311
JSBSim::FGRotor::GetA1
double GetA1(void) const
Retrieves the longitudinal flapping angle with respect to the rotor shaft.
Definition: FGRotor.h:272
JSBSim::FGRotor::GetCT
double GetCT(void) const
Retrieves the thrust coefficient.
Definition: FGRotor.h:285
JSBSim::FGRotor::GetEngineRPM
double GetEngineRPM(void) const
Retrieves the RPMs of the Engine, as seen from this rotor.
Definition: FGRotor.h:262
JSBSim::FGRotor::SetCollectiveCtrl
void SetCollectiveCtrl(double c)
Sets the collective control input in radians.
Definition: FGRotor.h:307
JSBSim::FGMatrix33
Handles matrix math operations.
Definition: FGMatrix33.h:69
JSBSim::FGRotor::GetLongitudinalCtrl
double GetLongitudinalCtrl(void) const
Retrieves the longitudinal control input in radians.
Definition: FGRotor.h:304
JSBSim::FGTransmission
Utility class that handles power transmission in conjunction with FGRotor.
Definition: FGTransmission.h:108
JSBSim::FGRotor::GetPhiDW
double GetPhiDW(void) const
Downwash angle - positive values point leftward (given a horizontal spinning rotor)
Definition: FGRotor.h:292
JSBSim::FGRotor::SetGroundEffectScaleNorm
void SetGroundEffectScaleNorm(double g)
Sets the ground effect scaling factor.
Definition: FGRotor.h:297
JSBSim::FGRotor::GetCollectiveCtrl
double GetCollectiveCtrl(void) const
Retrieves the collective control input in radians.
Definition: FGRotor.h:300
JSBSim::FGRotor
Models a helicopter rotor.
Definition: FGRotor.h:235
JSBSim::FGRotor::GetNu
double GetNu(void) const
Retrieves the induced inflow ratio.
Definition: FGRotor.h:281
JSBSim::FGRotor::GetA0
double GetA0(void) const
Retrieves the rotor's coning angle.
Definition: FGRotor.h:270
JSBSim::FGRotor::GetGearRatio
double GetGearRatio(void)
Tells the rotor's gear ratio, usually the engine asks for this.
Definition: FGRotor.h:265
JSBSim::FGRotor::FGRotor
FGRotor(FGFDMExec *exec, Element *rotor_element, int num)
Constructor for FGRotor.
Definition: FGRotor.cpp:74
JSBSim::FGRotor::GetLambda
double GetLambda(void) const
Retrieves the inflow ratio.
Definition: FGRotor.h:277
JSBSim::FGRotor::GetLateralCtrl
double GetLateralCtrl(void) const
Retrieves the lateral control input in radians.
Definition: FGRotor.h:302
JSBSim::FGRotor::GetB1
double GetB1(void) const
Retrieves the lateral flapping angle with respect to the rotor shaft.
Definition: FGRotor.h:274
JSBSim::FGThruster
Base class for specific thrusting devices such as propellers, nozzles, etc.
Definition: FGThruster.h:77
JSBSim::FGRotor::GetPowerRequired
double GetPowerRequired(void) const
Returns the power required by the rotor.
Definition: FGRotor.h:251
JSBSim::FGRotor::GetTorque
double GetTorque(void) const
Retrieves the torque.
Definition: FGRotor.h:287
JSBSim::FGPropertyManager
Definition: FGPropertyManager.h:373
JSBSim::Element
Definition: FGXMLElement.h:143
JSBSim::FGRotor::Calculate
double Calculate(double EnginePower)
Returns the scalar thrust of the rotor, and adjusts the RPM value.
Definition: FGRotor.cpp:670
JSBSim::FGRotor::GetMu
double GetMu(void) const
Retrieves the tip-speed (aka advance) ratio.
Definition: FGRotor.h:279
JSBSim::FGRotor::GetGroundEffectScaleNorm
double GetGroundEffectScaleNorm(void) const
Retrieves the ground effect scaling factor.
Definition: FGRotor.h:295