1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7 ------------- Copyright (C) 1999 Anthony K. Peden (apeden@earthlink.net) -------------
9 This program is free software; you can redistribute it and/or modify it under
10 the terms of the GNU General Public License as published by the Free Software
11 Foundation; either version 2 of the License, or (at your option) any later
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 General Public License for more
19 You should have received a copy of the GNU 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.
23 Further information about the GNU General Public License can also be found on
24 the world wide web at http://www.gnu.org.
28 --------------------------------------------------------------------------------
32 FUNCTIONAL DESCRIPTION
33 --------------------------------------------------------------------------------
35 The purpose of this class is to provide storage for computed forces and
36 encapsulate all the functionality associated with transforming those
37 forces from their native coord system to the body system. This includes
38 computing the moments due to the difference between the point of application
41 CAVEAT: 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
49 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
51 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
56 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
58 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
60 #define ID_FORCE "$Id$"
62 #include "FGFDMExec.h"
65 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
67 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
74 FGForce(FGFDMExec *FDMExec);
77 enum TransformType { tNone, tWindBody, tLocalBody, tCustom } ttype;
79 inline void SetNativeForces(float Fnx, float Fny, float Fnz) {
84 inline void SetNativeForces(FGColumnVector vv) { vFn = vv; };
86 inline void SetNativeMoments(float Ln,float Mn, float Nn) {
91 inline void SetNativeMoments(FGColumnVector vv) { vMn = vv; }
93 inline FGColumnVector GetNativeForces(void) { return vFn; }
94 inline FGColumnVector GetNativeMoments(void) { return vMn; }
97 FGColumnVector GetBodyForces(void);
99 inline FGColumnVector GetMoments(void) { return vM; }
101 //point of application, JSBsim structural coords
102 //(inches, x +back, y +right, z +up)
103 inline void SetLocation(float x, float y, float z) {
108 inline void SetLocation(FGColumnVector vv) { vXYZn = vv; }
109 FGColumnVector GetLocation(void) { return vXYZn; }
111 //these angles are relative to body axes, not earth!!!!!
112 //I'm using these because pitch, roll, and yaw are easy to visualize,
113 //there's no equivalent to roll in wind axes i.e. alpha, ? , beta
114 //making up new names or using these is a toss-up: either way people
115 //are going to get confused.
116 //They are in radians.
118 void SetAnglesToBody(float broll, float bpitch, float byaw);
119 inline void SetAnglesToBody(FGColumnVector vv) { SetAnglesToBody(vv(1), vv(2), vv(3));}
121 inline void SetSense(float x, float y, float z) { vSense(1)=x, vSense(2)=y, vSense(3)=z; }
122 inline void SetSense(FGColumnVector vv) { vSense=vv; }
124 inline FGColumnVector GetSense(void) { return vSense; }
126 inline void SetTransformType(TransformType ii) { ttype=ii; }
127 inline TransformType GetTransformType(void) { return ttype; }
129 FGMatrix Transform(void);
140 FGColumnVector vXYZn;
141 FGColumnVector vDXYZ;
142 FGColumnVector vSense;