Menu

#2423 Local weather: setprop() passed a NaN in local_weather/weather_tiles.nas, line 2795

2020.3
Started
None
Low
2024-01-19
2020-11-17
No

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.

Discussion

  • Anonymous

    Anonymous - 2020-11-17
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,4 +1,4 @@
    -When testing FG stability with the UFO I found (probably a non-fatal error) in local weather.
    +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
    
     
  • James Turner

    James Turner - 2020-11-17

    Good catch. Will ping Thorsten for comment.

     
  • James Turner

    James Turner - 2020-11-17
    • assigned_to: Thorsten Renk
     
  • James Turner

    James Turner - 2020-11-17

    Over to ThorstenR for his opinion.

     
  • xDraconian

    xDraconian - 2020-11-21
    • status: New --> Fixed
    • assigned_to: Thorsten Renk --> xDraconian
    • Milestone: None --> 2020.3
     
  • xDraconian

    xDraconian - 2020-11-21

    Related to ticket 2425.
    Resolved on branch next

     
  • Anonymous

    Anonymous - 2021-02-08
    • status: Fixed --> Started
     
  • Anonymous

    Anonymous - 2021-02-08

    The bug still appears on next, same line numbers:

      835.74 [ALRT]:nasal      Nasal runtime error: setprop() passed a NaN
      835.74 [ALRT]:nasal        at /home/mike/src/git/flightgear/fgdata/Nasal/local_weather/weather_tiles.nas, line 2795
      835.74 [ALRT]:nasal        called from: /home/mike/src/git/flightgear/fgdata/Nasal/local_weather/weather_tile_management.nas, line 77
    
     

    Last edit: Anonymous 2021-02-08
  • Anonymous

    Anonymous - 2021-02-08

    Why does it rely on windspeed being non-zero in var gust_relative_strength = (gust_strength - windspeed)/windspeed;? Why not be more defensive and have if(abs(windspeed) < smallnumber) gust_relative_strength=0.0?

     

    Last edit: Anonymous 2021-02-08
  • Gijs

    Gijs - 2024-01-19

    @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:

    windspeed_multiplier =  (1.0 + (random_factor * gust_relative_strength * alt_fact));
    windspeed_current = windspeed_current *  windspeed_multiplier
    

    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.

     

Log in to post a comment.

MongoDB Logo MongoDB