LCOV - code coverage report
Current view: top level - models - FGExternalReactions.h (source / functions) Hit Total Coverage
Test: JSBSim-Coverage-Statistics Lines: 2 2 100.0 %
Date: 2010-08-24 Functions: 0 0 -
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       2                 :            : 
       3                 :            :  Header:       FGExternalReactions.h
       4                 :            :  Author:       David P. Culp
       5                 :            :  Date started: 17/11/06
       6                 :            : 
       7                 :            :  ------------- Copyright (C) 2006  David P. Culp (davidculp2@comcast.net) -------------
       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                 :            : 17/11/06   DPC   Created
      29                 :            : 
      30                 :            : %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      31                 :            : SENTRY
      32                 :            : %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
      33                 :            : 
      34                 :            : #ifndef FGEXTERNALREACTIONS_H
      35                 :            : #define FGEXTERNALREACTIONS_H
      36                 :            : 
      37                 :            : /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      38                 :            : INCLUDES
      39                 :            : %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
      40                 :            : 
      41                 :            : #include "FGModel.h"
      42                 :            : #include "FGExternalForce.h"
      43                 :            : #include <vector>
      44                 :            : 
      45                 :            : /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      46                 :            : DEFINITIONS
      47                 :            : %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
      48                 :            : 
      49                 :            : #define ID_EXTERNALREACTIONS "$Id: FGExternalReactions.h,v 1.9 2009/10/24 22:59:30 jberndt Exp $"
      50                 :            : 
      51                 :            : /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      52                 :            : FORWARD DECLARATIONS
      53                 :            : %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
      54                 :            : 
      55                 :            : namespace JSBSim {
      56                 :            : 
      57                 :            : class Element;
      58                 :            : 
      59                 :            : /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      60                 :            : CLASS DOCUMENTATION
      61                 :            : %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
      62                 :            : 
      63                 :            : /** Manages the external and/or arbitrary forces.
      64                 :            :     The external reactions capability in JSBSim really should be named
      65                 :            :     "arbitrary forces", because this feature can be used to model a wide
      66                 :            :     variety of forces that act on a vehicle. Some examples include: parachutes,
      67                 :            :     catapult, arresting hook, and tow line.
      68                 :            :     
      69                 :            :     This class acts similarly to the other "manager classes" (FGPropulsion, 
      70                 :            :     FGFCS, FGGroundReactions, FGAerodynamics) because it manages collections
      71                 :            :     of constituent forces. The individual forces are implemented with the
      72                 :            :     FGExternalForce class.
      73                 :            :     
      74                 :            :     The format of the <em>optional</em> external reactions section in the config
      75                 :            :     file is as follows:
      76                 :            :     
      77                 :            :     @code
      78                 :            : <external_reactions>
      79                 :            : 
      80                 :            :   <!-- Interface properties, a.k.a. property declarations -->
      81                 :            :   <property> ... </property>
      82                 :            :     
      83                 :            :   <force name="name" frame="BODY | LOCAL | WIND" unit="unit">
      84                 :            :     ...
      85                 :            :   </force>
      86                 :            : 
      87                 :            :   <!-- Additional force definitions may follow -->
      88                 :            :   <force name="name" frame="BODY | LOCAL | WIND" unit="unit">
      89                 :            :     ...
      90                 :            :   </force>
      91                 :            : 
      92                 :            : </external_reactions>
      93                 :            :     @endcode
      94                 :            : 
      95                 :            :     See the FGExternalForce class for more information on the format of the
      96                 :            :     force specification itself.
      97                 :            :     
      98                 :            :     When force elements are encountered in the configuration file, a new instance
      99                 :            :     of the FGExternalForce class is created and a pointer to the class is pushed
     100                 :            :     onto the Forces vector.
     101                 :            :     
     102                 :            :     This class is one of a few of the manager classes that allows properties
     103                 :            :     to be "declared". In code, these are represented by the
     104                 :            :     <em>interface_properties</em> vector. Properties that have not yet been
     105                 :            :     created in an already parsed section of the configuration file and that are
     106                 :            :     used in the definition of an external force should be declared in the
     107                 :            :     external_reactions section because they will not be created automatically,
     108                 :            :     and so would cause an error, since the property cannot be found to exist.
     109                 :            :         
     110                 :            :     See the FGExternalForce documentation for details on how forces are
     111                 :            :     actually calculated.
     112                 :            :   */
     113                 :            : 
     114                 :            : /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     115                 :            : CLASS DECLARATION
     116                 :            : %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
     117                 :            : 
     118                 :            : class FGExternalReactions : public FGModel
     119                 :            : {
     120                 :            : public:
     121                 :            :   /** Constructor.
     122                 :            :       @param fdmex pointer to the main executive class.
     123                 :            :   */
     124                 :            :   FGExternalReactions(FGFDMExec* fdmex);
     125                 :            :   
     126                 :            :   /** Destructor.
     127                 :            :       Within the destructor the Forces and interface_properties vectors are
     128                 :            :       cleared out and the items pointed to are deleted.
     129                 :            :   */
     130                 :            :   ~FGExternalReactions(void);
     131                 :            : 
     132                 :            :   bool InitModel(void);
     133                 :            : 
     134                 :            :   /** Sum all the constituent forces for this cycle.
     135                 :            :       @return true always.
     136                 :            :   */
     137                 :            :   bool Run(void);
     138                 :            :   
     139                 :            :   /** Loads the external forces from the XML configuration file.
     140                 :            :       If the external_reactions section is encountered in the vehicle configuration
     141                 :            :       file, this Load() method is called. All external forces will be parsed, and 
     142                 :            :       a FGExternalForce object will be instantiated for each force definition.
     143                 :            :       @param el a pointer to the XML element holding the external reactions definition.
     144                 :            :   */
     145                 :            :   bool Load(Element* el);
     146                 :            : 
     147                 :            :   /** Retrieves the total forces defined in the external reactions.
     148                 :            :       @return the total force in pounds.
     149                 :            :   */
     150                 :     110563 :   FGColumnVector3 GetForces(void) {return vTotalForces;}
     151                 :            : 
     152                 :            :   /** Retrieves the total moment resulting from the forces defined in the external reactions.
     153                 :            :       @return the total moment in foot-pounds.
     154                 :            :   */
     155                 :      57460 :   FGColumnVector3 GetMoments(void) {return vTotalMoments;}
     156                 :            : 
     157                 :            : private:
     158                 :            : 
     159                 :            :   std::vector <FGExternalForce*> Forces;
     160                 :            :   unsigned int numForces;
     161                 :            :   FGColumnVector3 vTotalForces;
     162                 :            :   FGColumnVector3 vTotalMoments;
     163                 :            : 
     164                 :            :   bool NoneDefined;
     165                 :            : 
     166                 :            :   void Debug(int from);
     167                 :            : };
     168                 :            : }
     169                 :            : //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     170                 :            : #endif
     171                 :            : 

Generated by: LCOV version 1.9