34 #ifndef FGMASSBALANCE_H
35 #define FGMASSBALANCE_H
42 #include "math/FGMatrix33.h"
51 class FGGroundReactions;
129 bool Load(
Element* el)
override;
130 bool InitModel(
void)
override;
139 bool Run(
bool Holding)
override;
141 double GetMass(
void)
const {
return Mass;}
142 double GetWeight(
void)
const {
return Weight;}
143 double GetEmptyWeight(
void)
const {
return EmptyWeight;}
147 double GetXYZcg(
int axis)
const {
return vXYZcg(axis);}
148 const FGColumnVector3& GetDeltaXYZcg(
void)
const {
return vDeltaXYZcg;}
149 double GetDeltaXYZcg(
int axis)
const {
return vDeltaXYZcg(axis);}
163 double xx = sv(1)*v(1);
164 double yy = sv(2)*v(2);
165 double zz = sv(3)*v(3);
166 double xy = -sv(1)*v(2);
167 double xz = -sv(1)*v(3);
168 double yz = -sv(2)*v(3);
185 void SetEmptyWeight(
double EW) { EmptyWeight = EW;}
186 void SetBaseCG(
const FGColumnVector3& CG) {vbaseXYZcg = vXYZcg = CG;}
188 void AddPointMass(Element* el);
189 double GetTotalPointMassWeight(
void)
const;
191 const FGColumnVector3& GetPointMassMoment(
void);
196 void SetAircraftBaseInertias(
const FGMatrix33& BaseJ) {baseJ = BaseJ;}
197 void GetMassPropertiesReport(
int i);
227 double GetIxx(
void)
const {
return mJ(1,1); }
228 double GetIyy(
void)
const {
return mJ(2,2); }
229 double GetIzz(
void)
const {
return mJ(3,3); }
230 double GetIxy(
void)
const {
return -mJ(1,2); }
231 double GetIxz(
void)
const {
return mJ(1,3); }
232 double GetIyz(
void)
const {
return -mJ(2,3); }
237 PointMass(
double w, FGColumnVector3& vXYZ) :
238 eShapeType(esUnspecified), Location(vXYZ), Weight(w), Radius(0.0),
241 void CalculateShapeInertia(
void) {
244 mPMInertia(1,1) = (Weight/(
slugtolb))*Radius*Radius;
245 mPMInertia(2,2) = (Weight/(
slugtolb*12))*(6*Radius*Radius + Length*Length);
246 mPMInertia(3,3) = mPMInertia(2,2);
249 mPMInertia(1,1) = (Weight/(
slugtolb*2))*Radius*Radius;
250 mPMInertia(2,2) = (Weight/(
slugtolb*12))*(3*Radius*Radius + Length*Length);
251 mPMInertia(3,3) = mPMInertia(2,2);
254 mPMInertia(1,1) = (Weight/(
slugtolb*3))*Radius*Radius*2;
255 mPMInertia(2,2) = mPMInertia(1,1);
256 mPMInertia(3,3) = mPMInertia(1,1);
259 mPMInertia(1,1) = (Weight/(
slugtolb*5))*Radius*Radius*2;
260 mPMInertia(2,2) = mPMInertia(1,1);
261 mPMInertia(3,3) = mPMInertia(1,1);
268 enum esShape {esUnspecified, esTube, esCylinder, esSphere, esBall} eShapeType;
269 FGColumnVector3 Location;
274 FGMatrix33 mPMInertia;
276 double GetPointMassLocation(
int axis)
const {
return Location(axis);}
277 double GetPointMassWeight(
void)
const {
return Weight;}
278 esShape GetShapeType(
void) {
return eShapeType;}
279 const FGColumnVector3& GetLocation(
void) {
return Location;}
280 const FGMatrix33& GetPointMassInertia(
void) {
return mPMInertia;}
281 const std::string& GetName(
void) {
return Name;}
283 void SetPointMassLocation(
int axis,
double value) {Location(axis) = value;}
284 void SetPointMassWeight(
double wt) {
286 CalculateShapeInertia();
288 void SetPointMassShapeType(esShape st) {eShapeType = st;}
289 void SetRadius(
double r) {Radius = r;}
290 void SetLength(
double l) {Length = l;}
291 void SetName(
const std::string& name) {Name = name;}
292 void SetPointMassMoI(
const FGMatrix33& MoI) { mPMInertia = MoI; }
293 double GetPointMassMoI(
int r,
int c) {
return mPMInertia(r,c);}
295 void bind(FGPropertyManager* PropertyManager,
unsigned int num);
298 std::vector <struct PointMass*> PointMasses;
301 void Debug(
int from)
override;