LCOV - code coverage report
Current view: top level - models/propulsion - FGPropeller.cpp (source / functions) Hit Total Coverage
Test: JSBSim-Coverage-Statistics Lines: 1 203 0.5 %
Date: 2010-08-24 Functions: 3 14 21.4 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 3 176 1.7 %

           Branch data     Line data    Source code
       1                 :            : /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       2                 :            : 
       3                 :            :  Module:       FGPropeller.cpp
       4                 :            :  Author:       Jon S. Berndt
       5                 :            :  Date started: 08/24/00
       6                 :            :  Purpose:      Encapsulates the propeller object
       7                 :            : 
       8                 :            :  ------------- Copyright (C) 2000  Jon S. Berndt (jon@jsbsim.org) -------------
       9                 :            : 
      10                 :            :  This program is free software; you can redistribute it and/or modify it under
      11                 :            :  the terms of the GNU Lesser General Public License as published by the Free Software
      12                 :            :  Foundation; either version 2 of the License, or (at your option) any later
      13                 :            :  version.
      14                 :            : 
      15                 :            :  This program is distributed in the hope that it will be useful, but WITHOUT
      16                 :            :  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
      17                 :            :  FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
      18                 :            :  details.
      19                 :            : 
      20                 :            :  You should have received a copy of the GNU Lesser General Public License along with
      21                 :            :  this program; if not, write to the Free Software Foundation, Inc., 59 Temple
      22                 :            :  Place - Suite 330, Boston, MA  02111-1307, USA.
      23                 :            : 
      24                 :            :  Further information about the GNU Lesser General Public License can also be found on
      25                 :            :  the world wide web at http://www.gnu.org.
      26                 :            : 
      27                 :            : FUNCTIONAL DESCRIPTION
      28                 :            : --------------------------------------------------------------------------------
      29                 :            : 
      30                 :            : HISTORY
      31                 :            : --------------------------------------------------------------------------------
      32                 :            : 08/24/00  JSB  Created
      33                 :            : 
      34                 :            : %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      35                 :            : INCLUDES
      36                 :            : %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
      37                 :            : 
      38                 :            : #include <iostream>
      39                 :            : #include <sstream>
      40                 :            : 
      41                 :            : #include "FGPropeller.h"
      42                 :            : #include "models/FGPropagate.h"
      43                 :            : #include "models/FGAtmosphere.h"
      44                 :            : #include "models/FGAuxiliary.h"
      45                 :            : #include "input_output/FGXMLElement.h"
      46                 :            : 
      47                 :            : using namespace std;
      48                 :            : 
      49                 :            : namespace JSBSim {
      50                 :            : 
      51                 :            : static const char *IdSrc = "$Id: FGPropeller.cpp,v 1.30 2010/05/02 15:10:07 jberndt Exp $";
      52                 :            : static const char *IdHdr = ID_PROPELLER;
      53                 :            : 
      54                 :            : /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      55                 :            : CLASS IMPLEMENTATION
      56                 :            : %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
      57                 :            : 
      58                 :            : // This class currently makes certain assumptions when calculating torque and
      59                 :            : // p-factor. That is, that the axis of rotation is the X axis of the aircraft -
      60                 :            : // not just the X-axis of the engine/propeller. This may or may not work for a
      61                 :            : // helicopter.
      62                 :            : 
      63                 :          0 : FGPropeller::FGPropeller(FGFDMExec* exec, Element* prop_element, int num)
      64                 :          0 :                        : FGThruster(exec, prop_element, num)
      65                 :            : {
      66                 :          0 :   string token;
      67                 :            :   Element *table_element, *local_element;
      68                 :          0 :   string name="";
      69                 :          0 :   FGPropertyManager* PropertyManager = exec->GetPropertyManager();
      70                 :            : 
      71                 :          0 :   MaxPitch = MinPitch = P_Factor = Pitch = Advance = MinRPM = MaxRPM = 0.0;
      72                 :          0 :   Sense = 1; // default clockwise rotation
      73                 :          0 :   ReversePitch = 0.0;
      74                 :          0 :   Reversed = false;
      75                 :          0 :   Feathered = false;
      76                 :          0 :   Reverse_coef = 0.0;
      77                 :          0 :   GearRatio = 1.0;
      78                 :          0 :   CtFactor = CpFactor = 1.0;
      79                 :          0 :   ConstantSpeed = 0;
      80                 :          0 :   cThrust = cPower = CtMach = CpMach = 0;
      81                 :          0 :   Vinduced = 0.0;
      82                 :            : 
      83 [ #  # ][ #  # ]:          0 :   if (prop_element->FindElement("ixx"))
      84                 :          0 :     Ixx = prop_element->FindElementValueAsNumberConvertTo("ixx", "SLUG*FT2");
      85 [ #  # ][ #  # ]:          0 :   if (prop_element->FindElement("diameter"))
      86                 :          0 :     Diameter = prop_element->FindElementValueAsNumberConvertTo("diameter", "FT");
      87 [ #  # ][ #  # ]:          0 :   if (prop_element->FindElement("numblades"))
      88                 :          0 :     numBlades = (int)prop_element->FindElementValueAsNumber("numblades");
      89 [ #  # ][ #  # ]:          0 :   if (prop_element->FindElement("gearratio"))
      90                 :          0 :     GearRatio = prop_element->FindElementValueAsNumber("gearratio");
      91 [ #  # ][ #  # ]:          0 :   if (prop_element->FindElement("minpitch"))
      92                 :          0 :     MinPitch = prop_element->FindElementValueAsNumber("minpitch");
      93 [ #  # ][ #  # ]:          0 :   if (prop_element->FindElement("maxpitch"))
      94                 :          0 :     MaxPitch = prop_element->FindElementValueAsNumber("maxpitch");
      95 [ #  # ][ #  # ]:          0 :   if (prop_element->FindElement("minrpm"))
      96                 :          0 :     MinRPM = prop_element->FindElementValueAsNumber("minrpm");
      97 [ #  # ][ #  # ]:          0 :   if (prop_element->FindElement("maxrpm")) {
      98                 :            :     MaxRPM = prop_element->FindElementValueAsNumber("maxrpm");
      99                 :          0 :     ConstantSpeed = 1;
     100                 :            :     }
     101 [ #  # ][ #  # ]:          0 :   if (prop_element->FindElement("constspeed"))
     102                 :          0 :     ConstantSpeed = (int)prop_element->FindElementValueAsNumber("constspeed");
     103 [ #  # ][ #  # ]:          0 :   if (prop_element->FindElement("reversepitch"))
     104                 :          0 :     ReversePitch = prop_element->FindElementValueAsNumber("reversepitch");
     105 [ #  # ][ #  # ]:          0 :   for (int i=0; i<2; i++) {
     106                 :          0 :     table_element = prop_element->FindNextElement("table");
     107                 :          0 :     name = table_element->GetAttributeValue("name");
     108   [ #  #  #  # ]:          0 :     if (name == "C_THRUST") {
     109                 :          0 :       cThrust = new FGTable(PropertyManager, table_element);
     110   [ #  #  #  # ]:          0 :     } else if (name == "C_POWER") {
     111                 :          0 :       cPower = new FGTable(PropertyManager, table_element);
     112   [ #  #  #  # ]:          0 :     } else if (name == "CT_MACH") {
     113                 :          0 :       CtMach = new FGTable(PropertyManager, table_element);
     114   [ #  #  #  # ]:          0 :     } else if (name == "CP_MACH") {
     115                 :          0 :       CpMach = new FGTable(PropertyManager, table_element);
     116                 :            :     } else {
     117                 :          0 :       cerr << "Unknown table type: " << name << " in propeller definition." << endl;
     118                 :            :     }
     119                 :            :   }
     120                 :            : 
     121                 :          0 :   local_element = prop_element->GetParent()->FindElement("sense");
     122   [ #  #  #  # ]:          0 :   if (local_element) {
     123                 :          0 :     double Sense = local_element->GetDataAsNumber();
     124                 :          0 :     SetSense(fabs(Sense)/Sense);
     125                 :            :   }
     126                 :          0 :   local_element = prop_element->GetParent()->FindElement("p_factor");
     127   [ #  #  #  # ]:          0 :   if (local_element) {
     128                 :          0 :     P_Factor = local_element->GetDataAsNumber();
     129                 :            :   }
     130 [ #  # ][ #  # ]:          0 :   if (P_Factor < 0) {
     131                 :          0 :     cerr << "P-Factor value in config file must be greater than zero" << endl;
     132                 :            :   }
     133 [ #  # ][ #  # ]:          0 :   if (prop_element->FindElement("ct_factor"))
     134                 :          0 :     SetCtFactor( prop_element->FindElementValueAsNumber("ct_factor") );
     135 [ #  # ][ #  # ]:          0 :   if (prop_element->FindElement("cp_factor"))
     136                 :          0 :     SetCpFactor( prop_element->FindElementValueAsNumber("cp_factor") );
     137                 :            : 
     138                 :          0 :   Type = ttPropeller;
     139                 :          0 :   RPM = 0;
     140                 :          0 :   vTorque.InitMatrix();
     141                 :          0 :   D4 = Diameter*Diameter*Diameter*Diameter;
     142                 :          0 :   D5 = D4*Diameter;
     143                 :          0 :   Pitch = MinPitch;
     144                 :            : 
     145                 :          0 :   string property_name, base_property_name;
     146                 :          0 :   base_property_name = CreateIndexedPropertyName("propulsion/engine", EngineNum);
     147                 :          0 :   property_name = base_property_name + "/advance-ratio";
     148                 :          0 :   PropertyManager->Tie( property_name.c_str(), &J );
     149                 :          0 :   property_name = base_property_name + "/blade-angle";
     150                 :          0 :   PropertyManager->Tie( property_name.c_str(), &Pitch );
     151                 :          0 :   property_name = base_property_name + "/thrust-coefficient";
     152                 :          0 :   PropertyManager->Tie( property_name.c_str(), this, &FGPropeller::GetThrustCoefficient );
     153                 :          0 :   property_name = base_property_name + "/propeller-rpm";
     154                 :          0 :   PropertyManager->Tie( property_name.c_str(), this, &FGPropeller::GetRPM );
     155                 :          0 :   property_name = base_property_name + "/helical-tip-Mach";
     156                 :          0 :   PropertyManager->Tie( property_name.c_str(), this, &FGPropeller::GetHelicalTipMach );
     157                 :          0 :   property_name = base_property_name + "/constant-speed-mode";
     158                 :            :   PropertyManager->Tie( property_name.c_str(), this, &FGPropeller::GetConstantSpeed,
     159                 :          0 :                       &FGPropeller::SetConstantSpeed );
     160                 :          0 :   property_name = base_property_name + "/prop-induced-velocity_fps";
     161                 :            :   PropertyManager->Tie( property_name.c_str(), this, &FGPropeller::GetInducedVelocity,
     162                 :          0 :                       &FGPropeller::SetInducedVelocity );
     163                 :            : 
     164                 :          0 :   Debug(0);
     165                 :          0 : }
     166                 :            : 
     167                 :            : //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     168                 :            : 
     169                 :          0 : FGPropeller::~FGPropeller()
     170                 :            : {
     171 [ #  # ][ #  # ]:          0 :   delete cThrust;
                 [ #  # ]
     172 [ #  # ][ #  # ]:          0 :   delete cPower;
                 [ #  # ]
     173 [ #  # ][ #  # ]:          0 :   delete CtMach;
                 [ #  # ]
     174 [ #  # ][ #  # ]:          0 :   delete CpMach;
                 [ #  # ]
     175                 :            : 
     176                 :          0 :   Debug(1);
     177 [ #  # ][ #  # ]:          0 : }
                 [ #  # ]
     178                 :            : 
     179                 :            : //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     180                 :            : //
     181                 :            : // We must be getting the aerodynamic velocity here, NOT the inertial velocity.
     182                 :            : // We need the velocity with respect to the wind.
     183                 :            : //
     184                 :            : // Note that PowerAvailable is the excess power available after the drag of the
     185                 :            : // propeller has been subtracted. At equilibrium, PowerAvailable will be zero -
     186                 :            : // indicating that the propeller will not accelerate or decelerate.
     187                 :            : // Remembering that Torque * omega = Power, we can derive the torque on the
     188                 :            : // propeller and its acceleration to give a new RPM. The current RPM will be
     189                 :            : // used to calculate thrust.
     190                 :            : //
     191                 :            : // Because RPM could be zero, we need to be creative about what RPM is stated as.
     192                 :            : 
     193                 :          0 : double FGPropeller::Calculate(double PowerAvailable)
     194                 :            : {
     195                 :            :   double omega, alpha, beta;
     196                 :            : 
     197                 :          0 :   double Vel = fdmex->GetAuxiliary()->GetAeroUVW(eU);
     198                 :          0 :   double rho = fdmex->GetAtmosphere()->GetDensity();
     199                 :          0 :   double RPS = RPM/60.0;
     200                 :            : 
     201                 :            :   // Calculate helical tip Mach
     202                 :          0 :   double Area = 0.25*Diameter*Diameter*M_PI;
     203                 :          0 :   double Vtip = RPS * Diameter * M_PI;
     204                 :            :   HelicalTipMach = sqrt(Vtip*Vtip + Vel*Vel) / 
     205                 :          0 :                    fdmex->GetAtmosphere()->GetSoundSpeed(); 
     206                 :            : 
     207         [ #  # ]:          0 :   if (RPS > 0.0) J = Vel / (Diameter * RPS); // Calculate J normally
     208                 :          0 :   else           J = Vel / Diameter;      
     209                 :            : 
     210         [ #  # ]:          0 :   if (MaxPitch == MinPitch) {    // Fixed pitch prop
     211                 :          0 :          ThrustCoeff = cThrust->GetValue(J);
     212                 :            :   } else {                       // Variable pitch prop
     213                 :          0 :          ThrustCoeff = cThrust->GetValue(J, Pitch);
     214                 :            :   }
     215                 :            :  
     216                 :            :   // Apply optional scaling factor to Ct (default value = 1)
     217                 :          0 :   ThrustCoeff *= CtFactor;
     218                 :            : 
     219                 :            :   // Apply optional Mach effects from CT_MACH table
     220         [ #  # ]:          0 :   if (CtMach) ThrustCoeff *= CtMach->GetValue(HelicalTipMach);
     221                 :            : 
     222         [ #  # ]:          0 :   if (P_Factor > 0.0001) {
     223                 :          0 :     alpha = fdmex->GetAuxiliary()->Getalpha();
     224                 :          0 :     beta  = fdmex->GetAuxiliary()->Getbeta();
     225                 :          0 :     SetActingLocationY( GetLocationY() + P_Factor*alpha*Sense);
     226                 :          0 :     SetActingLocationZ( GetLocationZ() + P_Factor*beta*Sense);
     227                 :            :   }
     228                 :            : 
     229                 :          0 :   Thrust = ThrustCoeff*RPS*RPS*D4*rho;
     230                 :            : 
     231                 :            :   // From B. W. McCormick, "Aerodynamics, Aeronautics, and Flight Mechanics"
     232                 :            :   // first edition, eqn. 6.15 (propeller analysis chapter).
     233                 :          0 :   Vinduced = 0.5 * (-Vel + sqrt(Vel*Vel + 2.0*Thrust/(rho*Area)));
     234                 :            : 
     235                 :          0 :   omega = RPS*2.0*M_PI;
     236                 :            : 
     237                 :          0 :   vFn(1) = Thrust;
     238                 :            : 
     239                 :            :   // The Ixx value and rotation speed given below are for rotation about the
     240                 :            :   // natural axis of the engine. The transform takes place in the base class
     241                 :            :   // FGForce::GetBodyForces() function.
     242                 :            : 
     243                 :          0 :   vH(eX) = Ixx*omega*Sense;
     244                 :          0 :   vH(eY) = 0.0;
     245                 :          0 :   vH(eZ) = 0.0;
     246                 :            : 
     247         [ #  # ]:          0 :   if (omega > 0.0) ExcessTorque = PowerAvailable / omega;
     248                 :          0 :   else             ExcessTorque = PowerAvailable / 1.0;
     249                 :            : 
     250                 :          0 :   RPM = (RPS + ((ExcessTorque / Ixx) / (2.0 * M_PI)) * deltaT) * 60.0;
     251                 :            : 
     252         [ #  # ]:          0 :   if (RPM < 0.0) RPM = 0.0; // Engine won't turn backwards
     253                 :            : 
     254                 :            :   // Transform Torque and momentum first, as PQR is used in this
     255                 :            :   // equation and cannot be transformed itself.
     256                 :          0 :   vMn = fdmex->GetPropagate()->GetPQR()*(Transform()*vH) + Transform()*vTorque;
     257                 :            : 
     258                 :          0 :   return Thrust; // return thrust in pounds
     259                 :            : }
     260                 :            : 
     261                 :            : //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     262                 :            : 
     263                 :          0 : double FGPropeller::GetPowerRequired(void)
     264                 :            : {
     265                 :            :   double cPReq, J;
     266                 :          0 :   double rho = fdmex->GetAtmosphere()->GetDensity();
     267                 :          0 :   double Vel = fdmex->GetAuxiliary()->GetAeroUVW(eU);
     268                 :          0 :   double RPS = RPM / 60.0;
     269                 :            : 
     270         [ #  # ]:          0 :   if (RPS != 0.0) J = Vel / (Diameter * RPS);
     271                 :          0 :   else            J = Vel / Diameter; 
     272                 :            : 
     273         [ #  # ]:          0 :   if (MaxPitch == MinPitch) {   // Fixed pitch prop
     274                 :          0 :     cPReq = cPower->GetValue(J);
     275                 :            : 
     276                 :            :   } else {                      // Variable pitch prop
     277                 :            : 
     278         [ #  # ]:          0 :     if (ConstantSpeed != 0) {   // Constant Speed Mode
     279                 :            : 
     280                 :            :       // do normal calculation when propeller is neither feathered nor reversed
     281                 :            :       // Note:  This method of feathering and reversing was added to support the
     282                 :            :       //        turboprop model.  It's left here for backward compatablity, but
     283                 :            :       //        now feathering and reversing should be done in Manual Pitch Mode.
     284         [ #  # ]:          0 :       if (!Feathered) {
     285         [ #  # ]:          0 :         if (!Reversed) {
     286                 :            : 
     287                 :          0 :           double rpmReq = MinRPM + (MaxRPM - MinRPM) * Advance;
     288                 :          0 :           double dRPM = rpmReq - RPM;
     289                 :            :           // The pitch of a variable propeller cannot be changed when the RPMs are
     290                 :            :           // too low - the oil pump does not work.
     291         [ #  # ]:          0 :           if (RPM > 200) Pitch -= dRPM * deltaT;
     292         [ #  # ]:          0 :           if (Pitch < MinPitch)       Pitch = MinPitch;
     293         [ #  # ]:          0 :           else if (Pitch > MaxPitch)  Pitch = MaxPitch;
     294                 :            : 
     295                 :            :         } else { // Reversed propeller
     296                 :            : 
     297                 :            :           // when reversed calculate propeller pitch depending on throttle lever position
     298                 :            :           // (beta range for taxing full reverse for braking)
     299                 :          0 :           double PitchReq = MinPitch - ( MinPitch - ReversePitch ) * Reverse_coef;
     300                 :            :           // The pitch of a variable propeller cannot be changed when the RPMs are
     301                 :            :           // too low - the oil pump does not work.
     302         [ #  # ]:          0 :           if (RPM > 200) Pitch += (PitchReq - Pitch) / 200;
     303         [ #  # ]:          0 :           if (RPM > MaxRPM) {
     304                 :          0 :             Pitch += (MaxRPM - RPM) / 50;
     305         [ #  # ]:          0 :             if (Pitch < ReversePitch) Pitch = ReversePitch;
     306         [ #  # ]:          0 :             else if (Pitch > MaxPitch)  Pitch = MaxPitch;
     307                 :            :           }
     308                 :            :         }
     309                 :            : 
     310                 :            :       } else { // Feathered propeller
     311                 :            :                // ToDo: Make feathered and reverse settings done via FGKinemat
     312                 :          0 :         Pitch += (MaxPitch - Pitch) / 300; // just a guess (about 5 sec to fully feathered)
     313                 :            :       }
     314                 :            : 
     315                 :            :     } else { // Manual Pitch Mode, pitch is controlled externally
     316                 :            : 
     317                 :            :     }
     318                 :            :   
     319                 :          0 :     cPReq = cPower->GetValue(J, Pitch);
     320                 :            :   }
     321                 :            : 
     322                 :            :   // Apply optional scaling factor to Cp (default value = 1)
     323                 :          0 :   cPReq *= CpFactor;
     324                 :            : 
     325                 :            :   // Apply optional Mach effects from CP_MACH table
     326         [ #  # ]:          0 :   if (CpMach) cPReq *= CpMach->GetValue(HelicalTipMach);
     327                 :            : 
     328         [ #  # ]:          0 :   if (RPS > 0.1) {
     329                 :          0 :     PowerRequired = cPReq*RPS*RPS*RPS*D5*rho;
     330                 :          0 :     vTorque(eX) = -Sense*PowerRequired / (RPS*2.0*M_PI);
     331                 :            :   } else {
     332                 :            :      // For a stationary prop we have to estimate torque first.
     333                 :          0 :      double CL = (90.0 - Pitch) / 20.0;
     334         [ #  # ]:          0 :      if (CL > 1.5) CL = 1.5;
     335                 :          0 :      double BladeArea = Diameter * Diameter / 32.0 * numBlades;
     336                 :          0 :      vTorque(eX) = -Sense*BladeArea*Diameter*Vel*Vel*rho*0.19*CL;
     337                 :          0 :      PowerRequired = vTorque(eX)*0.2*M_PI;
     338                 :            :   }
     339                 :            : 
     340                 :          0 :   return PowerRequired;
     341                 :            : }
     342                 :            : 
     343                 :            : //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     344                 :            : 
     345                 :          0 : FGColumnVector3 FGPropeller::GetPFactor()
     346                 :            : {
     347                 :          0 :   double px=0.0, py, pz;
     348                 :            : 
     349                 :          0 :   py = Thrust * Sense * (GetActingLocationY() - GetLocationY()) / 12.0;
     350                 :          0 :   pz = Thrust * Sense * (GetActingLocationZ() - GetLocationZ()) / 12.0;
     351                 :            : 
     352                 :          0 :   return FGColumnVector3(px, py, pz);
     353                 :            : }
     354                 :            : 
     355                 :            : //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     356                 :            : 
     357                 :          0 : string FGPropeller::GetThrusterLabels(int id, string delimeter)
     358                 :            : {
     359                 :          0 :   std::ostringstream buf;
     360                 :            : 
     361                 :            :   buf << Name << " Torque (engine " << id << ")" << delimeter
     362                 :            :       << Name << " PFactor Pitch (engine " << id << ")" << delimeter
     363                 :            :       << Name << " PFactor Yaw (engine " << id << ")" << delimeter
     364                 :          0 :       << Name << " Thrust (engine " << id << " in lbs)" << delimeter;
     365         [ #  # ]:          0 :   if (IsVPitch())
     366                 :          0 :     buf << Name << " Pitch (engine " << id << ")" << delimeter;
     367                 :          0 :   buf << Name << " RPM (engine " << id << ")";
     368                 :            : 
     369                 :          0 :   return buf.str();
     370                 :            : }
     371                 :            : 
     372                 :            : //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     373                 :            : 
     374                 :          0 : string FGPropeller::GetThrusterValues(int id, string delimeter)
     375                 :            : {
     376                 :          0 :   std::ostringstream buf;
     377                 :            : 
     378                 :          0 :   FGColumnVector3 vPFactor = GetPFactor();
     379                 :            :   buf << vTorque(eX) << delimeter
     380                 :            :       << vPFactor(ePitch) << delimeter
     381                 :            :       << vPFactor(eYaw) << delimeter
     382                 :          0 :       << Thrust << delimeter;
     383         [ #  # ]:          0 :   if (IsVPitch())
     384                 :          0 :     buf << Pitch << delimeter;
     385                 :          0 :   buf << RPM;
     386                 :            : 
     387                 :          0 :   return buf.str();
     388                 :            : }
     389                 :            : 
     390                 :            : //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     391                 :            : //    The bitmasked value choices are as follows:
     392                 :            : //    unset: In this case (the default) JSBSim would only print
     393                 :            : //       out the normally expected messages, essentially echoing
     394                 :            : //       the config files as they are read. If the environment
     395                 :            : //       variable is not set, debug_lvl is set to 1 internally
     396                 :            : //    0: This requests JSBSim not to output any messages
     397                 :            : //       whatsoever.
     398                 :            : //    1: This value explicity requests the normal JSBSim
     399                 :            : //       startup messages
     400                 :            : //    2: This value asks for a message to be printed out when
     401                 :            : //       a class is instantiated
     402                 :            : //    4: When this value is set, a message is displayed when a
     403                 :            : //       FGModel object executes its Run() method
     404                 :            : //    8: When this value is set, various runtime state variables
     405                 :            : //       are printed out periodically
     406                 :            : //    16: When set various parameters are sanity checked and
     407                 :            : //       a message is printed out when they go out of bounds
     408                 :            : 
     409                 :          0 : void FGPropeller::Debug(int from)
     410                 :            : {
     411         [ #  # ]:          0 :   if (debug_lvl <= 0) return;
     412                 :            : 
     413         [ #  # ]:          0 :   if (debug_lvl & 1) { // Standard console startup message output
     414         [ #  # ]:          0 :     if (from == 0) { // Constructor
     415                 :          0 :       cout << "\n    Propeller Name: " << Name << endl;
     416                 :          0 :       cout << "      IXX = " << Ixx << endl;
     417                 :          0 :       cout << "      Diameter = " << Diameter << " ft." << endl;
     418                 :          0 :       cout << "      Number of Blades  = " << numBlades << endl;
     419                 :          0 :       cout << "      Gear Ratio  = " << GearRatio << endl;
     420                 :          0 :       cout << "      Minimum Pitch  = " << MinPitch << endl;
     421                 :          0 :       cout << "      Maximum Pitch  = " << MaxPitch << endl;
     422                 :          0 :       cout << "      Minimum RPM  = " << MinRPM << endl;
     423                 :          0 :       cout << "      Maximum RPM  = " << MaxRPM << endl;
     424                 :            : //      cout << "      Thrust Coefficient: " <<  endl;
     425                 :            : //      cThrust->Print();
     426                 :            : //      cout << "      Power Coefficient: " <<  endl;
     427                 :            : //      cPower->Print();
     428                 :            :     }
     429                 :            :   }
     430         [ #  # ]:          0 :   if (debug_lvl & 2 ) { // Instantiation/Destruction notification
     431         [ #  # ]:          0 :     if (from == 0) cout << "Instantiated: FGPropeller" << endl;
     432         [ #  # ]:          0 :     if (from == 1) cout << "Destroyed:    FGPropeller" << endl;
     433                 :            :   }
     434                 :          0 :   if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
     435                 :            :   }
     436                 :          0 :   if (debug_lvl & 8 ) { // Runtime state variables
     437                 :            :   }
     438                 :          0 :   if (debug_lvl & 16) { // Sanity checking
     439                 :            :   }
     440         [ #  # ]:          0 :   if (debug_lvl & 64) {
     441         [ #  # ]:          0 :     if (from == 0) { // Constructor
     442                 :          0 :       cout << IdSrc << endl;
     443                 :          0 :       cout << IdHdr << endl;
     444                 :            :     }
     445                 :            :   }
     446                 :            : }
     447 [ +  + ][ +  - ]:         12 : }

Generated by: LCOV version 1.9