From: Erik H. <eh...@us...> - 2016-06-02 22:05:56
|
Update of /cvsroot/jsbsim/JSBSim/utils/aeromatic++/Systems In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv4385/Systems Modified Files: Controls.cpp Log Message: Fix a devide by zero and do not use push_back() but at(i) = when the vectors are already of the proper size Index: Controls.cpp =================================================================== RCS file: /cvsroot/jsbsim/JSBSim/utils/aeromatic++/Systems/Controls.cpp,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -r1.36 -r1.37 *** Controls.cpp 2 Jan 2016 14:58:27 -0000 1.36 --- Controls.cpp 2 Jun 2016 22:05:52 -0000 1.37 *************** *** 139,145 **** float Sh = _aircraft->_htail.area; ! _aircraft->_CLalpha.push_back(CLaw[0]+CLah[0]*Sh/Sw*(1.0f-deda)); ! _aircraft->_CLalpha.push_back(CLaw[1]); ! _aircraft->_CLalpha.push_back(CLaw[2]); // *** Pitch moment *** --- 139,145 ---- float Sh = _aircraft->_htail.area; ! _aircraft->_CLalpha.at(0) = CLaw[0]+CLah[0]*Sh/Sw*(1.0f-deda); ! _aircraft->_CLalpha.at(0) = CLaw[1]; ! _aircraft->_CLalpha.at(0) = CLaw[2]; // *** Pitch moment *** *************** *** 208,212 **** _aircraft->_CL0 = CL = CL0; ! _aircraft->_CDalpha.push_back(CLalpha*(2.0f*CL)/(PI*AR*Ew)); Vt = sqrtf(W/(0.5f*rho*CL*Sw)); --- 208,212 ---- _aircraft->_CL0 = CL = CL0; ! _aircraft->_CDalpha.at(i) = CLalpha*(2.0f*CL)/(PI*AR*Ew); Vt = sqrtf(W/(0.5f*rho*CL*Sw)); *************** *** 221,236 **** CL = W/Q/Sw; } ! _aircraft->_Re.push_back((0.0765f * Vt * cbarw)/ 1.983e-5f); alpha = (CL-CL0)/CLalpha; ! _aircraft->_alpha.push_back(alpha); float CLmin = CL - (alpha-MIN_ALPHA)*CLalpha; float CLmax = CL + (alpha+MAX_ALPHA)*CLalpha; ! _aircraft->_CYp.push_back(-CL*CYp_const); ! _aircraft->_Cnp.push_back(-CL/8.0f); ! // _aircraft->_Clbeta.push_back(-((1.0f+2.0f*TR)/(6.0f+6.0f*TR))*(dihedral*CLaw[0] + (CL*tanf(sweep)/(1.0f-M2*powf(cosf(sweep), 2.0f))))); ! // _aircraft->_Clr.push_back((CL/4.0f)-Clr_const); #if 1 --- 221,236 ---- CL = W/Q/Sw; } ! _aircraft->_Re.at(i) = (0.0765f * Vt * cbarw)/ 1.983e-5f; alpha = (CL-CL0)/CLalpha; ! _aircraft->_alpha.at(i) = alpha; float CLmin = CL - (alpha-MIN_ALPHA)*CLalpha; float CLmax = CL + (alpha+MAX_ALPHA)*CLalpha; ! _aircraft->_CYp.at(i) = -CL*CYp_const; ! _aircraft->_Cnp.at(i) = -CL/8.0f; ! // _aircraft->_Clbeta.at(i) = -((1.0f+2.0f*TR)/(6.0f+6.0f*TR))*(dihedral*CLaw[0] + (CL*tanf(sweep)/(1.0f-M2*powf(cosf(sweep), 2.0f))))); ! // _aircraft->_Clr.at(i) = (CL/4.0f)-Clr_const; #if 1 *************** *** 240,250 **** Cmin = (-((1.0f+2.0f*TR)/(6.0f+6.0f*TR))*(dihedral*CLaw[0] + (CLmin*tanf(sweep)/(1.0f-M2*powf(cosf(sweep), 2.0f))))); Cmax = (-((1.0f+2.0f*TR)/(6.0f+6.0f*TR))*(dihedral*CLaw[0] + (CLmax*tanf(sweep)/(1.0f-M2*powf(cosf(sweep), 2.0f))))); ! _aircraft->_Clbeta.push_back(-Cmin - Clbwf - Clbvt); ! _aircraft->_Clbeta.push_back(-Cmax - Clbwf - Clbvt); Cmin = (CLmin/4.0f)-Clr_const; Cmax = (CLmax/4.0f)-Clr_const; ! _aircraft->_Clr.push_back(Cmin); ! _aircraft->_Clr.push_back(Cmax); #endif } --- 240,250 ---- Cmin = (-((1.0f+2.0f*TR)/(6.0f+6.0f*TR))*(dihedral*CLaw[0] + (CLmin*tanf(sweep)/(1.0f-M2*powf(cosf(sweep), 2.0f))))); Cmax = (-((1.0f+2.0f*TR)/(6.0f+6.0f*TR))*(dihedral*CLaw[0] + (CLmax*tanf(sweep)/(1.0f-M2*powf(cosf(sweep), 2.0f))))); ! _aircraft->_Clbeta.at(i) = -Cmin - Clbwf - Clbvt; ! _aircraft->_Clbeta.at(i) = -Cmax - Clbwf - Clbvt; Cmin = (CLmin/4.0f)-Clr_const; Cmax = (CLmax/4.0f)-Clr_const; ! _aircraft->_Clr.at(i) = Cmin; ! _aircraft->_Clr.at(i) = Cmax; #endif } *************** *** 693,697 **** file << " </function>" << std::endl; file << std::endl; ! file << " <function name=\"aero/moment/Yaw_rol_rate\">" << std::endl; file << " <description>Yaw_moment_due_to_roll_rate</description>" << std::endl; file << " <product>" << std::endl; --- 693,697 ---- file << " </function>" << std::endl; file << std::endl; ! file << " <function name=\"aero/moment/Yaw_roll_rate\">" << std::endl; file << " <description>Yaw_moment_due_to_roll_rate</description>" << std::endl; file << " <product>" << std::endl; |