FlightGear next
FGForce.h
Go to the documentation of this file.
1/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2
3 Header: FGForce.h
4 Author: Tony Peden
5 Date started: 5/20/00
6
7 ------------- Copyright (C) 1999 Anthony K. Peden (apeden@earthlink.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
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--------------------------------------------------------------------------------
295/20/00 TP Created
30
31
32FUNCTIONAL DESCRIPTION
33--------------------------------------------------------------------------------
34
35The purpose of this class is to provide storage for computed forces and
36encapsulate all the functionality associated with transforming those
37forces from their native coord system to the body system. This includes
38computing the moments due to the difference between the point of application
39and the cg.
40
41CAVEAT: if the custom transform is used for wind-to-body transforms then the
42 user *must* always pass this class the negative of beta. This is true
43 because sideslip angle does not follow the right hand rule i.e. it is
44 positive for aircraft nose left sideslip. Note that use of the custom
45 transform for this purpose shouldn't be necessary as it is already
46 provided by SetTransform(tWindBody) and is not subject to the same
47 restriction.
48
49%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
50SENTRY
51%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
52
53#ifndef FGFORCE_H
54#define FGFORCE_H
55
56/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
57INCLUDES
58%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
59
60#include "FGJSBBase.h"
61#include "math/FGMatrix33.h"
62
63/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
64FORWARD DECLARATIONS
65%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
66
67namespace JSBSim {
68
69class FGFDMExec;
70class FGMassBalance;
71
72/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
73CLASS DOCUMENTATION
74%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
75
216
217/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
218CLASS DECLARATION
219%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
220
221class FGForce : public FGJSBBase
222{
223public:
225 explicit FGForce(FGFDMExec *FDMExec);
226 FGForce(const FGForce& force);
227
229 virtual ~FGForce();
230
232
233 virtual const FGColumnVector3& GetBodyForces(void);
234
235 inline double GetBodyXForce(void) const { return vFb(eX); }
236 inline double GetBodyYForce(void) const { return vFb(eY); }
237 inline double GetBodyZForce(void) const { return vFb(eZ); }
238 inline const FGColumnVector3& GetMoments(void) const { return vM; }
239
240 // Normal point of application, JSBsim structural coords
241 // (inches, x +back, y +right, z +up)
242 inline void SetLocation(double x, double y, double z) {
243 vXYZn(eX) = x;
244 vXYZn(eY) = y;
245 vXYZn(eZ) = z;
246 SetActingLocation(x, y, z);
247 }
248
257 inline void SetActingLocation(double x, double y, double z) {
258 vActingXYZn(eX) = x;
259 vActingXYZn(eY) = y;
260 vActingXYZn(eZ) = z;
261 }
262 inline void SetLocationX(double x) {vXYZn(eX) = x; vActingXYZn(eX) = x;}
263 inline void SetLocationY(double y) {vXYZn(eY) = y; vActingXYZn(eY) = y;}
264 inline void SetLocationZ(double z) {vXYZn(eZ) = z; vActingXYZn(eZ) = z;}
265 inline double SetActingLocationX(double x) {vActingXYZn(eX) = x; return x;}
266 inline double SetActingLocationY(double y) {vActingXYZn(eY) = y; return y;}
267 inline double SetActingLocationZ(double z) {vActingXYZn(eZ) = z; return z;}
268 inline void SetLocation(const FGColumnVector3& vv) { vXYZn = vv; SetActingLocation(vv);}
269 inline void SetActingLocation(const FGColumnVector3& vv) { vActingXYZn = vv; }
270
271 inline double GetLocationX( void ) const { return vXYZn(eX);}
272 inline double GetLocationY( void ) const { return vXYZn(eY);}
273 inline double GetLocationZ( void ) const { return vXYZn(eZ);}
274 inline double GetActingLocationX( void ) const { return vActingXYZn(eX);}
275 inline double GetActingLocationY( void ) const { return vActingXYZn(eY);}
276 inline double GetActingLocationZ( void ) const { return vActingXYZn(eZ);}
277 const FGColumnVector3& GetLocation(void) const { return vXYZn; }
278 const FGColumnVector3& GetActingLocation(void) const { return vActingXYZn; }
279
280 //these angles are relative to body axes, not earth!!!!!
281 //I'm using these because pitch, roll, and yaw are easy to visualize,
282 //there's no equivalent to roll in wind axes i.e. alpha, ? , beta
283 //making up new names or using these is a toss-up: either way people
284 //are going to get confused.
285 //They are in radians.
286
287 void SetAnglesToBody(double broll, double bpitch, double byaw);
288 inline void SetAnglesToBody(const FGColumnVector3& vv) {
289 SetAnglesToBody(vv(eRoll), vv(ePitch), vv(eYaw));
290 }
291
293 void SetPitch(double pitch) {vOrient(ePitch) = pitch; UpdateCustomTransformMatrix();}
294 void SetYaw(double yaw) {vOrient(eYaw) = yaw; UpdateCustomTransformMatrix();}
295
296 double GetPitch(void) const {return vOrient(ePitch);}
297 double GetYaw(void) const {return vOrient(eYaw);}
298
299 inline const FGColumnVector3& GetAnglesToBody(void) const {return vOrient;}
300 inline double GetAnglesToBody(int axis) const {return vOrient(axis);}
301
302 inline void SetTransformType(TransformType ii) { ttype=ii; }
303 inline TransformType GetTransformType(void) const { return ttype; }
304
305 const FGMatrix33& Transform(void) const;
306
307protected:
317
318private:
319 FGColumnVector3 vFb;
321
322 void Debug(int from);
323};
324}
325#endif
326
JSBSim::FGFDMExec * FDMExec
Definition JSBSim.cpp:88
This class implements a 3 element column vector.
double GetActingLocationY(void) const
Definition FGForce.h:275
FGColumnVector3 vOrient
Definition FGForce.h:312
void SetTransformType(TransformType ii)
Definition FGForce.h:302
virtual const FGColumnVector3 & GetBodyForces(void)
Definition FGForce.cpp:81
const FGMatrix33 & Transform(void) const
Definition FGForce.cpp:98
double GetLocationZ(void) const
Definition FGForce.h:273
void SetLocationY(double y)
Definition FGForce.h:263
FGMassBalance * MassBalance
Definition FGForce.h:309
double GetLocationY(void) const
Definition FGForce.h:272
void SetLocationX(double x)
Definition FGForce.h:262
FGForce(const FGForce &force)
void SetLocation(const FGColumnVector3 &vv)
Definition FGForce.h:268
virtual ~FGForce()
Destructor.
Definition FGForce.cpp:74
void SetLocationZ(double z)
Definition FGForce.h:264
double GetBodyZForce(void) const
Definition FGForce.h:237
void UpdateCustomTransformMatrix(void)
Definition FGForce.cpp:119
double GetActingLocationX(void) const
Definition FGForce.h:274
const FGColumnVector3 & GetActingLocation(void) const
Definition FGForce.h:278
void SetYaw(double yaw)
Definition FGForce.h:294
double GetPitch(void) const
Definition FGForce.h:296
double SetActingLocationY(double y)
Definition FGForce.h:266
FGFDMExec * fdmex
Definition FGForce.h:308
double GetAnglesToBody(int axis) const
Definition FGForce.h:300
FGColumnVector3 vMn
Definition FGForce.h:311
double SetActingLocationZ(double z)
Definition FGForce.h:267
double GetYaw(void) const
Definition FGForce.h:297
FGColumnVector3 vXYZn
Definition FGForce.h:314
const FGColumnVector3 & GetLocation(void) const
Definition FGForce.h:277
FGMatrix33 mT
Definition FGForce.h:316
FGForce(FGFDMExec *FDMExec)
Constructor.
Definition FGForce.cpp:53
const FGColumnVector3 & GetAnglesToBody(void) const
Definition FGForce.h:299
FGColumnVector3 vActingXYZn
Definition FGForce.h:315
void SetAnglesToBody(const FGColumnVector3 &vv)
Definition FGForce.h:288
void SetAnglesToBody(double broll, double bpitch, double byaw)
Definition FGForce.cpp:147
double SetActingLocationX(double x)
Definition FGForce.h:265
void SetActingLocation(double x, double y, double z)
Acting point of application.
Definition FGForce.h:257
double GetLocationX(void) const
Definition FGForce.h:271
double GetBodyYForce(void) const
Definition FGForce.h:236
void SetLocation(double x, double y, double z)
Definition FGForce.h:242
TransformType GetTransformType(void) const
Definition FGForce.h:303
const FGColumnVector3 & GetMoments(void) const
Definition FGForce.h:238
double GetBodyXForce(void) const
Definition FGForce.h:235
void SetPitch(double pitch)
Definition FGForce.h:293
double GetActingLocationZ(void) const
Definition FGForce.h:276
FGColumnVector3 vFn
Definition FGForce.h:310
TransformType ttype
Definition FGForce.h:313
void SetActingLocation(const FGColumnVector3 &vv)
Definition FGForce.h:269
FGJSBBase()
Constructor for FGJSBBase.
Definition FGJSBBase.h:81
Models weight, balance and moment of inertia information.
Handles matrix math operations.
Definition FGMatrix33.h:70