JSBSim-Team/jsbsim

Problem with stall warning

eeeewwqq opened this issue · 2 comments

I'm submitting a ...

  • bug report
  • feature request
  • support request => Please do not submit support request here, see note at the top of this template.

Describe the issue
systems/stall-warn-norm and aero/stall-hyst-norm doesn't seem to be working for some aircrafts. I put plane at some altitude above ground with zero speed and velocities and I was able to get stall warn only for c172x. It doesn't work for global5000 and f104 models. + I tried some 3d-party models and it doesn't work as well.

Could someone help?

What is the current behavior?
global5000 and f104 systems/stall-warn-norm=0 aero/stall-hyst-norm=0

What is the expected behavior?
global5000 and f104 systems/stall-warn-norm>0 aero/stall-hyst-norm=1

Please tell us about your environment:

  • OS: Windows
  • JSBSim version: 1.2.0
  • Language: Unity + JSBSim compiled as dll

Output examples
f104.csv
c172x.csv
global5000.csv

That's because the author of the aircraft's FDM needs to provide data for alphalimits and hysteresis_limits and these aren't compulsory/required data. So you will only get meaningful output for the properties if the required input data is supplied.

if ((temp_element = document->FindElement("alphalimits"))) {
scratch_unit = temp_element->GetAttributeValue("unit");
if (scratch_unit.empty()) scratch_unit = "RAD";
alphaclmin0 = temp_element->FindElementValueAsNumberConvertFromTo("min", scratch_unit, "RAD");
alphaclmax0 = temp_element->FindElementValueAsNumberConvertFromTo("max", scratch_unit, "RAD");
alphaclmin = alphaclmin0;
alphaclmax = alphaclmax0;
}
if ((temp_element = document->FindElement("hysteresis_limits"))) {
scratch_unit = temp_element->GetAttributeValue("unit");
if (scratch_unit.empty()) scratch_unit = "RAD";
alphahystmin = temp_element->FindElementValueAsNumberConvertFromTo("min", scratch_unit, "RAD");
alphahystmax = temp_element->FindElementValueAsNumberConvertFromTo("max", scratch_unit, "RAD");
}

if (alphaclmax != 0) {
if (in.Alpha > 0.85*alphaclmax) {
impending_stall = 10*(in.Alpha/alphaclmax - 0.85);
} else {
impending_stall = 0;
}
}
if (alphahystmax != 0.0 && alphahystmin != 0.0) {
if (in.Alpha > alphahystmax) {
stall_hyst = 1;
} else if (in.Alpha < alphahystmin) {
stall_hyst = 0;
}
}

Thanks