X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FSystems%2Fstatic.cxx;h=f8dc2add63d97a452610a1ab241029d0789018f6;hb=9c63b7713307eb4db9f6df7959fe83977f561c42;hp=f8510fe61a6619aafe4be934c4e9ff023bf52226;hpb=8770e61d1b1be465ee81d35f00ada11acf6773b3;p=flightgear.git diff --git a/src/Systems/static.cxx b/src/Systems/static.cxx index f8510fe61..f8dc2add6 100644 --- a/src/Systems/static.cxx +++ b/src/Systems/static.cxx @@ -15,6 +15,9 @@ #include
#include
#include +#include +#include +#include #include @@ -22,7 +25,7 @@ StaticSystem::StaticSystem ( SGPropertyNode *node ) : _name(node->getStringValue("name", "static")), _num(node->getIntValue("number", 0)), - _tau(node->getDoubleValue("tau", 1)), + _tau(SGMiscd::max(.0,node->getDoubleValue("tau", 1))), _error_factor(node->getDoubleValue("error-factor", 0)), _type(node->getIntValue("type", 0)) { @@ -76,7 +79,7 @@ StaticSystem::update (double dt) double beta; double alpha; double mach; - double trat = _tau ? dt/_tau : 100; + double trat = _tau ? dt/_tau : SGLimitsd::max(); double proj_factor = 0; double pt; @@ -93,14 +96,16 @@ StaticSystem::update (double dt) proj_factor = sqrt( 1.0 - cos(beta)*cos(beta) * cos(alpha)*cos(alpha) ); } - if ( (_type ==1) or (_type == 2) ) { + if ( (_type ==1) || (_type == 2) ) { mach = _mach_node->getDoubleValue(); pt = p_new * pow(1 + 0.2 * mach*mach*proj_factor*proj_factor, 3.5 ); //total pressure perpendicular to static port (=perpendicular to body x-axis) qc_part = (pt - p_new) * _error_factor ; //part of impact pressure to be added to static pressure (due to sideslip) p_new = p_new + qc_part; } - _pressure_out_node->setDoubleValue(fgGetLowPass(p, p_new, trat)); //setting new pressure in static system + _pressure_out_node->setDoubleValue( + _tau > .0 ? fgGetLowPass(p, p_new, trat) : p_new + ); //setting new pressure in static system } }