CONFIG LIB 1.5
Configuration Files Library (by TGG 2020)
Loading...
Searching...
No Matches
MASS_OBJECT_DATA Class Reference

MASS_OBJECT_DATA class and functions. More...

#include <mass_data.h>

Public Member Functions

void Clean (void)
 cleans local variables

 
int CheckData (bool CheckMassFlag)
 checks integrity of data of the mass object
 
int CoordinateSystems ()
 computes coordinate systems versors of the mass object
 
void Read (std::ifstream &in)
 reads single mass object
 
void Write (std::ofstream &out, int Id)
 writes single mass object
 

Public Attributes

bool Active
 object activity flag
 
std::string Name
 name of the object
 
GeomObjType Type
 type of the object (see enum GeomObjType)
 
unsigned int Color
 
VECTOR_3D Base
 Base point.
 
VECTOR_3D Tip
 Direction component

 
VECTOR_3D Side
 Direction component

 
VECTOR_3D CG_s
 CG position in SELF CS.
 
VECTOR_3D CG_l
 CG position in LOCAL CS.
 
VECTOR_3D CG_g
 CG position in GLOBAL CS.
 
MATRIX_3x3 I_s
 Inertia matrix in SELF CS.
 
MATRIX_3x3 I_l
 Inertia matrix in LOCAL CS.
 
double m
 mass [kg]
 
double ro
 density [kg/m^3]
 
double Vol
 volume [m^3]
 
double R
 external radius [m]
 
double r
 internal (tube) radius [m]
 
double H
 height [m]
 
double a
 edge (x) length [m]
 
double b
 edge (y) length [m]
 
double c
 edge (z) length [m]
 
double th
 hollow objects wallss thicknes [m]
 
VECTOR_3D is
 
VECTOR_3D js
 
VECTOR_3D ks
 SELF coordinate system (versors)
 
VECTOR_3D il
 
VECTOR_3D jl
 
VECTOR_3D kl
 LOCAL coordinate system (versors)
 
VECTOR_3D ig
 
VECTOR_3D jg
 
VECTOR_3D kg
 GLOBAL coordinate system (versors)
 

Detailed Description

MASS_OBJECT_DATA class and functions.

Basic coordinate systems:
SELF - local object coordinate system used to define object geometry
LOCAL - local coordinate system of the object, origin in the object CG, axes parallel to the global system axis
GLOBAL - global coordinate system to define the geometry of the entire aircraft

Definition at line 53 of file mass_data.h.

Constructor & Destructor Documentation

◆ MASS_OBJECT_DATA()

MASS_OBJECT_DATA::MASS_OBJECT_DATA ( void )

Definition at line 24 of file mass_data.cpp.

24{ Clean (); }
void Clean(void)
cleans local variables
Definition mass_data.cpp:28

◆ ~MASS_OBJECT_DATA()

MASS_OBJECT_DATA::~MASS_OBJECT_DATA ( void )

Definition at line 26 of file mass_data.cpp.

26{}

Member Function Documentation

◆ CheckData()

int MASS_OBJECT_DATA::CheckData ( bool CheckMassFlag)

checks integrity of data of the mass object

Definition at line 54 of file mass_data.cpp.

55{
56 if(m == 0 && CheckMassFlag == 1) return 1;
57
58 //if(Base == Tip) return 2;
59 //if(Base == Side) return 3;
60 if(Tip == Side) return 4;
61
62 if(Type != M_POINT)
63 {
64 if(Type == SPHERE || Type == CYLINDER || Type == TUBE || Type == CONE || Type == DISC)
65 if(R == 0) return 5;
66
67 if(Type == TUBE)
68 {
69 if(r == 0) return 6;
70 if(r >= R) return 9;
71 }
72
73 if(Type == CYLINDER || Type == TUBE || Type == CONE)
74 if(H == 0) return 7;
75
76 if(Type == CUBOID)
77 if(a == 0 || b == 0 || c == 0) return 8;
78 }
79
80 VECTOR_3D v1 = Tip;// - Base;
81 v1.Normalize();
82 VECTOR_3D v2 = Side;// - Base;
83 v2.Normalize();
84 if(v1 == v2) return 10;
85
86 return 0;
87}
VECTOR_3D Side
Direction component
Definition mass_data.h:65
double R
external radius [m]
Definition mass_data.h:78
GeomObjType Type
type of the object (see enum GeomObjType)
Definition mass_data.h:60
VECTOR_3D Tip
Direction component
Definition mass_data.h:64
double m
mass [kg]
Definition mass_data.h:74
double c
edge (z) length [m]
Definition mass_data.h:83
double r
internal (tube) radius [m]
Definition mass_data.h:79
double H
height [m]
Definition mass_data.h:80
double b
edge (y) length [m]
Definition mass_data.h:82
double a
edge (x) length [m]
Definition mass_data.h:81
Vector 3D class - vector manipulation.
Definition vector3d.h:34
double Normalize(void)
normalizes the vector to unit - coordiantes are divided by the vector value, returnes the vector valu...
Definition vector3d.cpp:38
@ TUBE
tube (height H, internal radius r, external radius R)
Definition mass_data.h:39
@ M_POINT
mass piont (particle)
Definition mass_data.h:35
@ CYLINDER
cylinder (height H, radius R)
Definition mass_data.h:38
@ DISC
thin disc (radius R)
Definition mass_data.h:41
@ CONE
cone (height H, base radius R)
Definition mass_data.h:40
@ SPHERE
sphere (radius R)
Definition mass_data.h:36
@ CUBOID
cuboid (the edges: a,b,c)
Definition mass_data.h:37

◆ Clean()

void MASS_OBJECT_DATA::Clean ( void )

cleans local variables

Definition at line 28 of file mass_data.cpp.

29{
30 Active = 1;
31
32 Name = "-";
33 Type = M_POINT;
34 Color = 3; // FL_YELLOW
35
36 Base.GetFrom(0., 0., 0.);
37 Tip.GetFrom (0., 0., 1.);
38 Side.GetFrom(1., 0., 0.);
39
40 R = 0.;
41 H = 0.;
42 a = 0.;
43 b = 0.;
44 c = 0.;
45 th = 0.;
46
47 m = 0.;
48 ro = 0.;
49 Vol = 0.;
50
52}
double th
hollow objects wallss thicknes [m]
Definition mass_data.h:84
VECTOR_3D Base
Base point.
Definition mass_data.h:63
int CoordinateSystems()
computes coordinate systems versors of the mass object
Definition mass_data.cpp:89
double ro
density [kg/m^3]
Definition mass_data.h:75
std::string Name
name of the object
Definition mass_data.h:59
bool Active
object activity flag
Definition mass_data.h:57
double Vol
volume [m^3]
Definition mass_data.h:76
void GetFrom(double xp, double yp, double zp)
sets coordinates from three variables
Definition vector3d.h:65

◆ CoordinateSystems()

int MASS_OBJECT_DATA::CoordinateSystems ( )

computes coordinate systems versors of the mass object

Definition at line 89 of file mass_data.cpp.

90{
91 //SELF
92 ks = Tip; // z - direction
93 ks.Normalize();
94
95 is = Side; // x - direction
96 is.Normalize();
97
98 if(is == ks)
99 {
100 clog << "is == ks !!!" << endl << endl;
101 return 1;
102 }
103
104 js = ks % is; //cross product of versors k & i, y - direction
105 js.Normalize();
106
107 //LOCAL
108 il.GetFrom(1, 0, 0);
109 jl.GetFrom(0, 1, 0);
110 kl.GetFrom(0, 0, 1);
111
112 //GLOBAL
113 ig = il;
114 jg = jl;
115 kg = kl;
116
117 return 0;
118}
VECTOR_3D kl
LOCAL coordinate system (versors)
Definition mass_data.h:87
VECTOR_3D kg
GLOBAL coordinate system (versors)
Definition mass_data.h:88
VECTOR_3D ks
SELF coordinate system (versors)
Definition mass_data.h:86

Referenced by Clean().

◆ Read()

void MASS_OBJECT_DATA::Read ( std::ifstream & in)

reads single mass object

Definition at line 120 of file mass_data.cpp.

121{
122 int Id;
123 string sVal;
124
125 in >> Id >> Active >> Name >> sVal;
126
127 Type = M_POINT;
128 if(sVal.compare("M_POINT") == 0) Type = M_POINT;
129 else if(sVal.compare("SPHERE") == 0) Type = SPHERE;
130 else if(sVal.compare("CUBOID") == 0) Type = CUBOID;
131 else if(sVal.compare("CYLINDER") == 0) Type = CYLINDER;
132 else if(sVal.compare("TUBE") == 0) Type = TUBE;
133 else if(sVal.compare("CONE") == 0) Type = CONE;
134 else if(sVal.compare("DISC") == 0) Type = DISC;
135
136 in >> m >> ro >> Vol;
137
138 in >> CG_g.x >> CG_g.y >> CG_g.z;
139
140 in >> I_l.xx >> I_l.yy >> I_l.zz;
141 in >> I_l.xy >> I_l.yz >> I_l.zx;
142
143 I_l.yx = I_l.xy;
144 I_l.zy = I_l.yz;
145 I_l.xz = I_l.zx;
146
147 if(Type == M_POINT) //For arbitrary assigned moments of inertia (no rotation allowed!)
148 {
149 I_s.xx = I_l.xx;
150 I_s.yy = I_l.yy;
151 I_s.zz = I_l.zz;
152
153 I_s.yx = I_s.xy = I_l.xy;
154 I_s.zy = I_s.yz = I_l.yz;
155 I_s.xz = I_s.zx = I_l.zx;
156 }
157
158 in >> Base.x >> Base.y >> Base.z;
159 in >> Tip.x >> Tip.y >> Tip.z;
160 in >> Side.x >> Side.y >> Side.z;
161
162 in >> R >> r >> H >> a >> b >> c >> th;
163
164 in >> Color;
165}
MATRIX_3x3 I_s
Inertia matrix in SELF CS.
Definition mass_data.h:71
VECTOR_3D CG_g
CG position in GLOBAL CS.
Definition mass_data.h:69
MATRIX_3x3 I_l
Inertia matrix in LOCAL CS.
Definition mass_data.h:72
double yy
(1,1) element
Definition matr3d.h:48
double xx
(0,0) element
Definition matr3d.h:44
double zz
(2,2) element
Definition matr3d.h:52
double yz
(1,2) element
Definition matr3d.h:49
double zx
(2,0) element
Definition matr3d.h:50
double yx
(1,0) element
Definition matr3d.h:47
double xz
(0,2) element
Definition matr3d.h:46
double xy
(0,1) element
Definition matr3d.h:45
double zy
(2,1) element
Definition matr3d.h:51
double x
x coordinate
Definition vector3d.h:38
double z
z coordinate
Definition vector3d.h:38
double y
y coordinate
Definition vector3d.h:38

Referenced by MASS_FILE::Read().

◆ Write()

void MASS_OBJECT_DATA::Write ( std::ofstream & out,
int Id )

writes single mass object

Definition at line 167 of file mass_data.cpp.

168{
169 out << setw(4) << std::left << Id;
170 out << setw(8) << std::left << Active;
171 out << setw(80) << std::left << Name;
172
173 if(Name.length() >= 80)
174 out << " ";
175
176 switch(Type)
177 {
178 case M_POINT : out << setw(12) << std::left << "POINT"; break;
179 case SPHERE : out << setw(12) << std::left << "SPHERE"; break;
180 case CUBOID : out << setw(12) << std::left << "CUBOID"; break;
181 case CYLINDER : out << setw(12) << std::left << "CYLINDER"; break;
182 case TUBE : out << setw(12) << std::left << "TUBE"; break;
183 case CONE : out << setw(12) << std::left << "CONE"; break;
184 case DISC : out << setw(12) << std::left << "DISC"; break;
185 }
186
187 out << setw(12) << std::left << m;
188 out << setw(12) << std::left << ro;
189 out << setw(12) << std::left << Vol;
190
191 out << setw(12) << std::left << CG_g.x;
192 out << setw(12) << std::left << CG_g.y;
193 out << setw(12) << std::left << CG_g.z;
194
195 out << setw(12) << std::left << I_l.xx;
196 out << setw(12) << std::left << I_l.yy;
197 out << setw(12) << std::left << I_l.zz;
198 out << setw(12) << std::left << I_l.xy;
199 out << setw(12) << std::left << I_l.yz;
200 out << setw(12) << std::left << I_l.zx;
201
202 out << setw(12) << std::left << Base.x;
203 out << setw(12) << std::left << Base.y;
204 out << setw(12) << std::left << Base.z;
205 out << setw(12) << std::left << Tip.x;
206 out << setw(12) << std::left << Tip.y;
207 out << setw(12) << std::left << Tip.z;
208 out << setw(12) << std::left << Side.x;
209 out << setw(12) << std::left << Side.y;
210 out << setw(12) << std::left << Side.z;
211
212 out << setw(12) << std::left << R;
213 out << setw(12) << std::left << r;
214 out << setw(12) << std::left << H;
215 out << setw(12) << std::left << a;
216 out << setw(12) << std::left << b;
217 out << setw(12) << std::left << c;
218 out << setw(12) << std::left << th;
219
220 out << setw(4) << std::left << Color << endl;
221}

Member Data Documentation

◆ a

double MASS_OBJECT_DATA::a

edge (x) length [m]

Definition at line 81 of file mass_data.h.

Referenced by CheckData(), Clean(), Read(), and Write().

◆ Active

bool MASS_OBJECT_DATA::Active

object activity flag

Definition at line 57 of file mass_data.h.

Referenced by Clean(), Read(), and Write().

◆ b

double MASS_OBJECT_DATA::b

edge (y) length [m]

Definition at line 82 of file mass_data.h.

Referenced by CheckData(), Clean(), Read(), and Write().

◆ Base

VECTOR_3D MASS_OBJECT_DATA::Base

Base point.

Definition at line 63 of file mass_data.h.

Referenced by Clean(), Read(), and Write().

◆ c

double MASS_OBJECT_DATA::c

edge (z) length [m]

Definition at line 83 of file mass_data.h.

Referenced by CheckData(), Clean(), Read(), and Write().

◆ CG_g

VECTOR_3D MASS_OBJECT_DATA::CG_g

CG position in GLOBAL CS.

Definition at line 69 of file mass_data.h.

Referenced by Read(), and Write().

◆ CG_l

VECTOR_3D MASS_OBJECT_DATA::CG_l

CG position in LOCAL CS.

Definition at line 68 of file mass_data.h.

◆ CG_s

VECTOR_3D MASS_OBJECT_DATA::CG_s

CG position in SELF CS.

Definition at line 67 of file mass_data.h.

◆ Color

unsigned int MASS_OBJECT_DATA::Color

Definition at line 61 of file mass_data.h.

◆ H

double MASS_OBJECT_DATA::H

height [m]

Definition at line 80 of file mass_data.h.

Referenced by CheckData(), Clean(), Read(), and Write().

◆ I_l

MATRIX_3x3 MASS_OBJECT_DATA::I_l

Inertia matrix in LOCAL CS.

Definition at line 72 of file mass_data.h.

Referenced by Read(), and Write().

◆ I_s

MATRIX_3x3 MASS_OBJECT_DATA::I_s

Inertia matrix in SELF CS.

Definition at line 71 of file mass_data.h.

Referenced by Read().

◆ ig

VECTOR_3D MASS_OBJECT_DATA::ig

Definition at line 88 of file mass_data.h.

◆ il

VECTOR_3D MASS_OBJECT_DATA::il

Definition at line 87 of file mass_data.h.

◆ is

VECTOR_3D MASS_OBJECT_DATA::is

Definition at line 86 of file mass_data.h.

◆ jg

VECTOR_3D MASS_OBJECT_DATA::jg

Definition at line 88 of file mass_data.h.

◆ jl

VECTOR_3D MASS_OBJECT_DATA::jl

Definition at line 87 of file mass_data.h.

◆ js

VECTOR_3D MASS_OBJECT_DATA::js

Definition at line 86 of file mass_data.h.

◆ kg

VECTOR_3D MASS_OBJECT_DATA::kg

GLOBAL coordinate system (versors)

Definition at line 88 of file mass_data.h.

Referenced by CoordinateSystems().

◆ kl

VECTOR_3D MASS_OBJECT_DATA::kl

LOCAL coordinate system (versors)

Definition at line 87 of file mass_data.h.

Referenced by CoordinateSystems().

◆ ks

VECTOR_3D MASS_OBJECT_DATA::ks

SELF coordinate system (versors)

Definition at line 86 of file mass_data.h.

Referenced by CoordinateSystems().

◆ m

double MASS_OBJECT_DATA::m

mass [kg]

Definition at line 74 of file mass_data.h.

Referenced by CheckData(), Clean(), Read(), and Write().

◆ Name

std::string MASS_OBJECT_DATA::Name

name of the object

Definition at line 59 of file mass_data.h.

Referenced by Clean(), Read(), and Write().

◆ R

double MASS_OBJECT_DATA::R

external radius [m]

Definition at line 78 of file mass_data.h.

Referenced by CheckData(), Clean(), Read(), and Write().

◆ r

double MASS_OBJECT_DATA::r

internal (tube) radius [m]

Definition at line 79 of file mass_data.h.

Referenced by CheckData(), Read(), and Write().

◆ ro

double MASS_OBJECT_DATA::ro

density [kg/m^3]

Definition at line 75 of file mass_data.h.

Referenced by Clean(), Read(), and Write().

◆ Side

VECTOR_3D MASS_OBJECT_DATA::Side

Direction component

Definition at line 65 of file mass_data.h.

Referenced by CheckData(), Clean(), CoordinateSystems(), Read(), and Write().

◆ th

double MASS_OBJECT_DATA::th

hollow objects wallss thicknes [m]

Definition at line 84 of file mass_data.h.

Referenced by Clean(), Read(), and Write().

◆ Tip

VECTOR_3D MASS_OBJECT_DATA::Tip

Direction component

Definition at line 64 of file mass_data.h.

Referenced by CheckData(), Clean(), CoordinateSystems(), Read(), and Write().

◆ Type

GeomObjType MASS_OBJECT_DATA::Type

type of the object (see enum GeomObjType)

Definition at line 60 of file mass_data.h.

Referenced by CheckData(), Clean(), Read(), and Write().

◆ Vol

double MASS_OBJECT_DATA::Vol

volume [m^3]

Definition at line 76 of file mass_data.h.

Referenced by Clean(), Read(), and Write().


The documentation for this class was generated from the following files: