When testing FG stability with the UFO I found a (probably non-fatal) error in local weather.
846.47 [ALRT]:nasal Nasal runtime error: setprop() passed a NaN
846.47 [ALRT]:nasal at /home/mike/src/git/flightgear/fgdata/Nasal/local_weather/weather_tiles.nas, line 2795
846.47 [ALRT]:nasal called from: /home/mike/src/git/flightgear/fgdata/Nasal/local_weather/weather_tile_management.nas, line 77
It is likely caused by this line:
var gust_relative_strength = (gust_strength - windspeed)/windspeed;
if windspeed is very small.
Diff:
Good catch. Will ping Thorsten for comment.
Over to ThorstenR for his opinion.
Related to ticket 2425.
Resolved on branch next
The bug still appears on next, same line numbers:
Last edit: Anonymous 2021-02-08
Why does it rely on
windspeedbeing non-zero invar gust_relative_strength = (gust_strength - windspeed)/windspeed;? Why not be more defensive and haveif(abs(windspeed) < smallnumber) gust_relative_strength=0.0?Last edit: Anonymous 2021-02-08
@trenk, I think setting the gust_relative_strength to zero when the windspeed is zero should be safe? As far I as I understand it, further down the route the actual wind is calculated as follows, which would output to zero anyway for a 0kt base wind:
This does of course leave the question whether a METAR reporting zero wind with non-zero gusts is valid. But FlightGear should not crash on that.