[Gcblue-commits] gcb_wx/src/database tcAirDBObject.cpp,1.12,1.13 tcLauncherDBObject.cpp,1.14,1.15
Status: Alpha
Brought to you by:
ddcforge
|
From: Dewitt C. <ddc...@us...> - 2005-05-26 11:54:26
|
Update of /cvsroot/gcblue/gcb_wx/src/database In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29026/src/database Modified Files: tcAirDBObject.cpp tcLauncherDBObject.cpp Log Message: air model changes Index: tcAirDBObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/database/tcAirDBObject.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** tcAirDBObject.cpp 21 May 2005 02:01:04 -0000 1.12 --- tcAirDBObject.cpp 26 May 2005 11:54:11 -0000 1.13 *************** *** 34,39 **** namespace Database { ! ! /** * workaround for write serialization issue --- 34,126 ---- namespace Database { ! #define THRUST_DECAY_ALT 5000.0f ! /** ! * Calculate private parameters. Should be called after ! * object is loaded. ! */ ! void tcAirDBObject::CalculateParams() ! { ! // invMachRange ! wxASSERT(mfMsupm > mfMcm); ! ! if (mfMsupm > mfMcm) ! { ! invMachRange = 1.0f / (mfMsupm - mfMcm); ! } ! else ! { ! invMachRange = 0; ! } ! ! ! // thrustDecayFactor ! const float decay_alt = THRUST_DECAY_ALT; // altitude that decay begins at ! wxASSERT(zeroThrustAltitude_m > decay_alt); ! ! if (zeroThrustAltitude_m > decay_alt) ! { ! thrustDecayFactor = 1.0f / (zeroThrustAltitude_m - 5000.0f); ! } ! else ! { ! thrustDecayFactor = 0; ! } ! } ! ! /** ! * @param vmach Speed divided by speed of sound (mach number) ! * @return interpolated parasitic drag coeff ! */ ! float tcAirDBObject::GetParasiticDragCoefficient(float vmach) const ! { ! float K_dp; // parasitic drag coeff ! float mcrit = mfMcm; // critical mach number ! float msup = mfMsupm; // midpoint of transonic region ! float mtran = 0.5f*(mcrit + msup); // start of supersonic region ! ! if (vmach <= mcrit) ! { ! K_dp = mfCdpsub; // drag coeff includes 0.5*area factor ! } ! else if (vmach >= msup) ! { ! K_dp = mfCdpsup; ! } ! else if (vmach <= mtran) ! { ! K_dp = 2.0f * (vmach - mcrit) * (mfCdptran - mfCdpsub) * invMachRange ! + mfCdpsub; ! } ! else // (vmach > mtran)&&(vmach < msup) ! { ! K_dp = 2.0f * (msup - vmach) * (mfCdptran - mfCdpsup) * invMachRange ! + mfCdpsup; ! } ! return K_dp; ! } ! ! /** ! * Placed here to allow better thrust decay model to be incorporated into ! * database without affecting air model ! * @return thrust decay factor ! */ ! float tcAirDBObject::GetThrustFactor(float alt_m) const ! { ! const float decay_alt = THRUST_DECAY_ALT; // altitude that decay begins at ! ! float d_alt = alt_m - decay_alt; ! if (d_alt <= 0) return 1.0f; ! ! float thrustFactor = 1.0f - thrustDecayFactor * d_alt; ! if (thrustFactor > 0) ! { ! return thrustFactor * thrustFactor; ! } ! else ! { ! return 0; ! } ! } ! /** * workaround for write serialization issue *************** *** 54,58 **** if (mbLoad) { ! *csv >> mfAltThrustDecay_pm; *csv >> mfAfterburnFuelRate_kgps; *csv >> mfAfterburnThrust_N; --- 141,145 ---- if (mbLoad) { ! *csv >> zeroThrustAltitude_m; *csv >> mfAfterburnFuelRate_kgps; *csv >> mfAfterburnThrust_N; *************** *** 70,74 **** else { ! *csv << mfAltThrustDecay_pm; *csv << mfAfterburnFuelRate_kgps; *csv << mfAfterburnThrust_N; --- 157,161 ---- else { ! *csv << zeroThrustAltitude_m; *csv << mfAfterburnFuelRate_kgps; *csv << mfAfterburnThrust_N; *************** *** 86,89 **** --- 173,179 ---- csv->WriteLine(); } + + CalculateParams(); + return 1; } *************** *** 100,104 **** TiXmlElement* localNode = node->InsertEndChild(TiXmlElement("air"))->ToElement(); ! localNode->SetAttribute("altThrustDecay_pm", mfAltThrustDecay_pm); localNode->SetAttribute("afterburnFuelRate_kgps", mfAfterburnFuelRate_kgps); localNode->SetAttribute("afterburnThrust_N", mfAfterburnThrust_N); --- 190,194 ---- TiXmlElement* localNode = node->InsertEndChild(TiXmlElement("air"))->ToElement(); ! localNode->SetAttribute("ZeroThrustAltitude_m", zeroThrustAltitude_m); localNode->SetAttribute("afterburnFuelRate_kgps", mfAfterburnFuelRate_kgps); localNode->SetAttribute("afterburnThrust_N", mfAfterburnThrust_N); *************** *** 123,127 **** csv->SetWriteLineBlock(false); ! *csv << "Thrust altitude decay factor [1/m]"; *csv << "AfterburnFuelRate_kgps"; *csv << "AfterburnThrust_N"; --- 213,217 ---- csv->SetWriteLineBlock(false); ! *csv << "ZeroThrustAltitude_m"; *csv << "AfterburnFuelRate_kgps"; *csv << "AfterburnThrust_N"; *************** *** 150,154 **** columnString += ","; ! columnString += "ThrustDecay number(8),"; columnString += "ABFuelRate_kgps number(8),"; columnString += "ABThrust_N number(8),"; --- 240,244 ---- columnString += ","; ! columnString += "ZeroThrustAltitude_m number(5),"; columnString += "ABFuelRate_kgps number(8),"; columnString += "ABThrust_N number(8),"; *************** *** 170,174 **** tcGenericDBObject::ReadSql(entry); ! mfAltThrustDecay_pm = entry.GetDouble("ThrustDecay"); mfAfterburnFuelRate_kgps = entry.GetDouble("ABFuelRate_kgps"); mfAfterburnThrust_N = entry.GetDouble("ABThrust_N"); --- 260,264 ---- tcGenericDBObject::ReadSql(entry); ! zeroThrustAltitude_m = entry.GetDouble("ZeroThrustAltitude_m"); mfAfterburnFuelRate_kgps = entry.GetDouble("ABFuelRate_kgps"); mfAfterburnThrust_N = entry.GetDouble("ABThrust_N"); *************** *** 183,187 **** stallSpeed_mps = entry.GetDouble("StallSpeed_mps"); mfGmax = entry.GetDouble("Gmax"); ! } --- 273,278 ---- stallSpeed_mps = entry.GetDouble("StallSpeed_mps"); mfGmax = entry.GetDouble("Gmax"); ! ! CalculateParams(); } *************** *** 193,197 **** s << ","; ! s << mfAltThrustDecay_pm << ","; s << mfAfterburnFuelRate_kgps << ","; s << mfAfterburnThrust_N << ","; --- 284,288 ---- s << ","; ! s << zeroThrustAltitude_m << ","; s << mfAfterburnFuelRate_kgps << ","; s << mfAfterburnThrust_N << ","; *************** *** 213,216 **** --- 304,309 ---- tcAirDBObject::tcAirDBObject() + : thrustDecayFactor(0), + invMachRange(0) { mnClassID = DTYPE_AIR; *************** *** 220,227 **** tcAirDBObject::tcAirDBObject(tcAirDBObject& obj) ! : tcGenericDBObject(obj) { mnClassID = DTYPE_AIR; ! mfAltThrustDecay_pm = obj.mfAltThrustDecay_pm; mfAfterburnFuelRate_kgps = obj.mfAfterburnFuelRate_kgps; mfAfterburnThrust_N = obj.mfAfterburnThrust_N; --- 313,322 ---- tcAirDBObject::tcAirDBObject(tcAirDBObject& obj) ! : tcGenericDBObject(obj), ! thrustDecayFactor(obj.thrustDecayFactor), ! invMachRange(obj.invMachRange) { mnClassID = DTYPE_AIR; ! zeroThrustAltitude_m = obj.zeroThrustAltitude_m; mfAfterburnFuelRate_kgps = obj.mfAfterburnFuelRate_kgps; mfAfterburnThrust_N = obj.mfAfterburnThrust_N; Index: tcLauncherDBObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/database/tcLauncherDBObject.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** tcLauncherDBObject.cpp 4 Feb 2005 18:50:35 -0000 1.14 --- tcLauncherDBObject.cpp 26 May 2005 11:54:11 -0000 1.15 *************** *** 243,247 **** maChildClass[mnConfigurations] = entry.GetString(s.GetBuffer()).c_str(); ! if (strlen(maChildClass[mnConfigurations].mz) > 0) { mnConfigurations++; --- 243,247 ---- maChildClass[mnConfigurations] = entry.GetString(s.GetBuffer()).c_str(); ! if (strlen(maChildClass[mnConfigurations].mz) > 2) { mnConfigurations++; |