1
0
Fork 0

Vivian Meazza:

Attached are the modified files to add buoyancy as a parameter for a
ballistic object. It may be set by adding

<buoyancy>x</buoyancy> to the submodel .xml file, where x is the appropriate
value (ft per sec2):

	32   neutral buoyancy - contrails
	>32  positive buoyancy - exhaust plumes
	(0   non-op - default value)

If <buoyancy>x</buoyancy> is not used, then there is no effect on the
current ballistic model
This commit is contained in:
ehofman 2004-09-01 08:32:54 +00:00
parent d2d27f2d76
commit 1853012d90
6 changed files with 30 additions and 14 deletions

View file

@ -33,7 +33,8 @@ FGAIBallistic::FGAIBallistic(FGAIManager* mgr) {
_otype = otBallistic;
drag_area = 0.007;
life_timer = 0.0;
}
gravity = 32;
}
FGAIBallistic::~FGAIBallistic() {
}
@ -41,7 +42,7 @@ FGAIBallistic::~FGAIBallistic() {
bool FGAIBallistic::init() {
FGAIBase::init();
aero_stabilized = true;
aero_stabilized = true;
hdg = azimuth;
pitch = elevation;
return true;
@ -86,6 +87,11 @@ void FGAIBallistic::setLife(double seconds) {
life = seconds;
}
void FGAIBallistic::setBuoyancy(double fpss) {
buoyancy = fpss;
}
void FGAIBallistic::Run(double dt) {
life_timer += dt;
@ -110,13 +116,13 @@ void FGAIBallistic::Run(double dt) {
pos.setlat( pos.lat() + speed_north_deg_sec * dt);
pos.setlon( pos.lon() + speed_east_deg_sec * dt);
// adjust vertical speed for acceleration of gravity
vs -= (gravity - buoyancy) * dt;
// adjust altitude (feet)
altitude += vs * dt;
pos.setelev(altitude * SG_FEET_TO_METER);
// adjust vertical speed for acceleration of gravity
vs -= 32.17 * dt;
// recalculate pitch (velocity vector) if aerostabilized
if (aero_stabilized) pitch = atan2( vs, hs ) * SG_RADIANS_TO_DEGREES;
@ -127,4 +133,3 @@ void FGAIBallistic::Run(double dt) {
if (altitude < -1000.0) setDie(true);
}

View file

@ -41,7 +41,8 @@ public:
void setStabilization( bool val );
void setDragArea( double a );
void setLife( double seconds );
void setBuoyancy( double fps2 );
private:
double azimuth; // degrees true
@ -50,6 +51,9 @@ private:
bool aero_stabilized; // if true, object will point where it's going
double drag_area; // equivalent drag area in ft2
double life_timer; // seconds
double gravity; // fps2
double buoyancy; // fps2
void Run(double dt);
};

View file

@ -253,7 +253,7 @@ int FGAIManager::createShip( string path, FGAIFlightPlan* flightplan ) {
int FGAIManager::createBallistic( string path, double latitude, double longitude,
double altitude, double azimuth, double elevation,
double speed, double eda, double life ) {
double speed, double eda, double life, double buoyancy ) {
FGAIBallistic* ai_ballistic = new FGAIBallistic(this);
ai_list.push_back(ai_ballistic);
@ -268,6 +268,7 @@ int FGAIManager::createBallistic( string path, double latitude, double longitude
ai_ballistic->setLatitude(latitude);
ai_ballistic->setDragArea(eda);
ai_ballistic->setLife(life);
ai_ballistic->setBuoyancy(buoyancy);
ai_ballistic->init();
ai_ballistic->bind();
return ai_ballistic->getID();
@ -307,6 +308,7 @@ int FGAIManager::createThermal( double latitude, double longitude,
return ai_thermal->getID();
}
void FGAIManager::destroyObject( int ID ) {
ai_list_itr = ai_list.begin();
while(ai_list_itr != ai_list.end()) {
@ -385,7 +387,7 @@ void FGAIManager::processScenario( string filename ) {
} else if (en->aitype == "ballistic"){
createBallistic( en->model_path, en->latitude, en->longitude,
en->altitude, en->azimuth, en->elevation, en->speed,
en->eda, en->life );
en->eda, en->life, en->buoyancy );
}
}
}

View file

@ -99,8 +99,10 @@ public:
double elevation, // in degrees (same as pitch)
double speed, // in feet per second
double eda, // equivalent drag area, ft2
double life ); // life span in seconds
double life, // life span in seconds
double buoyancy // acceleration in ft per second2
);
int createStorm( string path, // path to exterior model
double latitude, // in degrees -90 to 90
double longitude, // in degrees -180 to 180
@ -112,7 +114,8 @@ public:
double longitude, // in degrees -180 to 180
double strength, // in feet per second
double diameter ); // in feet
void destroyObject( int ID );
inline double get_user_latitude() { return user_latitude; }

View file

@ -70,7 +70,8 @@ FGAIScenario::FGAIScenario(string filename)
en->strength = entry_node->getDoubleValue("strength-fps", 0.0);
en->diameter = entry_node->getDoubleValue("diameter-ft", 0.0);
en->eda = entry_node->getDoubleValue("eda", 0.007);
en->life = entry_node->getDoubleValue("life", 900.0);
en->life = entry_node->getDoubleValue("life", 900.0);
en->buoyancy = entry_node->getDoubleValue("buoyancy", 0);
}
entry_iterator = entries.begin();

View file

@ -32,7 +32,7 @@ public:
typedef struct {
string callsign;
string aitype; // can be aircraft, ship, storm, thermal
string aitype; // can be aircraft, ship, storm, thermal, ballistic, smoke
string aircraft_class;
string model_path;
string flightplan;
@ -50,6 +50,7 @@ public:
double diameter; // used by thermal objects
double eda; // used by ballistic objects
double life; // life span in seconds
double buoyancy; // acceleration in ft per sec2
} entry;
FGAIScenario(string filename);