JSBSim Flight Dynamics Model  1.1.11 (13 Feb 2022)
An Open Source Flight Dynamics and Control Software Library in C++
FGExternalForce.h
1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 
3  Header: FGExternalForce.h
4  Author: Jon Berndt, Dave Culp
5  Date started: 9/21/07
6 
7  ------------- Copyright (C) 2007 Jon S. Berndt (jon@jsbsim.org) -------------
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
11  Software Foundation; either version 2 of the License, or (at your option) any
12  later 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
20  with this program; if not, write to the Free Software Foundation, Inc., 59
21  Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 
23  Further information about the GNU Lesser General Public License can also be
24  found on the world wide web at http://www.gnu.org.
25 
26 
27  HISTORY
28 --------------------------------------------------------------------------------
29 9/21/07 JB Created
30 
31 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
32 SENTRY
33 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
34 
35 #ifndef FGEXTERNALFORCE_H
36 #define FGEXTERNALFORCE_H
37 
38 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
39 INCLUDES
40 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
41 
42 #include "models/propulsion/FGForce.h"
43 #include "simgear/props/propertyObject.hxx"
44 
45 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
46 FORWARD DECLARATIONS
47 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
48 
49 namespace JSBSim {
50 
51 class FGParameter;
52 class Element;
53 class FGPropertyManager;
54 
55 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
56 CLASS DECLARATION
57 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
58 
60 {
61 public:
62  FGPropertyVector3(void) {}
63  FGPropertyVector3(FGPropertyManager* pm, const std::string& baseName,
64  const std::string& xcmp, const std::string& ycmp,
65  const std::string& zcmp);
66 
67  FGPropertyVector3& operator=(const FGColumnVector3& v) {
68  data[0] = v(1);
69  data[1] = v(2);
70  data[2] = v(3);
71 
72  return *this;
73  }
74 
75  operator FGColumnVector3() const {
76  return FGColumnVector3(data[0], data[1], data[2]);
77  }
78 
79  FGColumnVector3 operator*(double a) const {
80  return FGColumnVector3(a * data[0], a * data[1], a * data[2]);
81  }
82 
83 private:
84  SGPropObjDouble data[3];
85 };
86 
87 inline FGColumnVector3 operator*(double a, const FGPropertyVector3& v) {
88  return v*a;
89 }
90 
91 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
92 CLASS DOCUMENTATION
93 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
94 
208 class FGExternalForce : public FGForce
209 {
210 public:
215  explicit FGExternalForce(FGFDMExec *FDMExec)
216  : FGForce(FDMExec), forceMagnitude(NULL), momentMagnitude(NULL)
217  { Debug(0); }
218 
222  FGExternalForce(const FGExternalForce& extForce);
223 
225  ~FGExternalForce() override;
226 
227  void setForce(Element* el);
228  void setMoment(Element* el);
229  const FGColumnVector3& GetBodyForces(void) override;
230 
231 private:
232  FGParameter* bind(Element* el, const std::string& baseName,
233  FGPropertyVector3& v);
234 
235  std::string Name;
236  FGParameter *forceMagnitude, *momentMagnitude;
237  FGPropertyVector3 forceDirection, momentDirection;
238  void Debug(int from);
239 };
240 }
241 #endif
JSBSim::FGFDMExec
Encapsulates the JSBSim simulation executive.
Definition: FGFDMExec.h:185
JSBSim::FGColumnVector3
This class implements a 3 element column vector.
Definition: FGColumnVector3.h:63
JSBSim::FGPropertyVector3
Definition: FGExternalForce.h:59
JSBSim::FGExternalForce::FGExternalForce
FGExternalForce(FGFDMExec *FDMExec)
Constructor.
Definition: FGExternalForce.h:215
JSBSim::FGParameter
Represents various types of parameters.
Definition: FGParameter.h:58
JSBSim::FGForce
Utility class that aids in the conversion of forces between coordinate systems and calculation of mom...
Definition: FGForce.h:221
JSBSim::FGExternalForce::~FGExternalForce
~FGExternalForce() override
Destructor.
Definition: FGExternalForce.cpp:185
JSBSim::FGExternalForce
Encapsulates code that models an individual arbitrary force, moment or a combination thereof.
Definition: FGExternalForce.h:208
JSBSim::FGPropertyManager
Definition: FGPropertyManager.h:373
JSBSim::Element
Definition: FGXMLElement.h:143