Board index FlightGear Development Weather

Two classic runtime errors when inserting advanced weather

Everything related to weather simulation, visuals should be discussed in the shader subforum.

Two classic runtime errors when inserting advanced weather

Postby abassign » Sat Aug 19, 2017 8:50 pm

Two classic runtime errors when actrivate advanced weather is this:

Code: Select all
Starting hard-coded terrain presampling
Nasal runtime error: setprop() passed a NaN
  at /home/abassign/fgfs/install/flightgear/fgdata/Nasal/local_weather/local_weather.nas, line 597
Nasal runtime error: vector index 1 out of bounds (size: 1)
  at /home/abassign/fgfs/install/flightgear/fgdata/Nasal/local_weather/local_weather.nas, line 2109
  called from: /home/abassign/fgfs/install/flightgear/fgdata/Nasal/local_weather/local_weather.nas, line 2084
  called from: /home/abassign/fgfs/install/flightgear/fgdata/Nasal/local_weather/local_weather.nas, line 2053
  called from: /home/abassign/fgfs/install/flightgear/fgdata/Nasal/local_weather/weather_tiles.nas, line 367
  called from: /home/abassign/fgfs/install/flightgear/fgdata/Nasal/local_weather/weather_tile_management.nas, line 535
  called from: /home/abassign/fgfs/install/flightgear/fgdata/Nasal/local_weather/weather_tile_management.nas, line 158


This first error:
Nasal runtime error: setprop() passed a NaN
at /home/abassign/fgfs/install/flightgear/fgdata/Nasal/local_weather/local_weather.nas, line 597

is it resolved inserting one line code first:

File: flightgear/fgdata/Nasal/local_weather/local_weather.nas
Code: Select all
597: setprop("/environment/ground-visibility-m",vis);
598: setprop("/environment/ground-haze-thickness-m",alt2 * ft_to_m);


Code: Select all
596: if (vis == nil) vis = 1000000.0;
597: setprop("/environment/ground-visibility-m",vis);
598: setprop("/environment/ground-haze-thickness-m",alt2 * ft_to_m);


Note:
I put 100,000, but it would be more elegant to enter the maximum number allowed by this parameter, but I do not know what.

The second error:
Nasal runtime error: vector index 1 out of bounds (size: 1)
at /home/abassign/fgfs/install/flightgear/fgdata/Nasal/local_weather/local_weather.nas, line 2109
called from: /home/abassign/fgfs/install/flightgear/fgdata/Nasal/local_weather/local_weather.nas, line 2084
called from: /home/abassign/fgfs/install/flightgear/fgdata/Nasal/local_weather/local_weather.nas, line 2053
called from: /home/abassign/fgfs/install/flightgear/fgdata/Nasal/local_weather/weather_tiles.nas, line 367
called from: /home/abassign/fgfs/install/flightgear/fgdata/Nasal/local_weather/weather_tile_management.nas, line 535
called from: /home/abassign/fgfs/install/flightgear/fgdata/Nasal/local_weather/weather_tile_management.nas, line 158


Code: Select all
2109: if (presampling_flag==1) {alt_base = alt_20_array[tile_index -1];}


It resolves by inserting a check:
Code: Select all
[code]2109:   if (tile_index -1 >= 0) {  if (presampling_flag==1) {alt_base = alt_20_array[tile_index -1];}}

The variable alt_base is already initialized so it should not give side effects.

I advise include these simple changes to avoid possible side effects.
Developer of the program https://wiki.flightgear.org/Julia_photoscenery_generator
FDM developer of the G91R1B aircraft https://wiki.flightgear.org/FIAT_G91R1B
JSBSim collaborator
abassign
 
Posts: 947
Joined: Mon Feb 27, 2012 6:09 pm
Location: Italy (living 5 Km from airport LIME)
Callsign: I-BASSY
Version: 2020.4
OS: Ubuntu 20.10

Re: Two classic runtime errors when inserting advanced weath

Postby Thorsten » Sat Aug 19, 2017 8:55 pm

It would actually be useful to learn how you get them because I never saw them.

The supposed 'fixes' just seem to hide an underlying issue elsewhere - so please just make a proper bug report.
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Two classic runtime errors when inserting advanced weath

Postby Hooray » Sat Aug 19, 2017 9:07 pm

It would also seem helpful to detail exactly how you configured the GUI prior to seeing these bugs, because these fixes seem to suggest that you were using the system in a way that Thorsten neither designed, nor tested, it - which may imply that you are doing something counter-intuitive, i.e. you may end up merely masking the real issue, because even with your changes included, the system may still not be doing what you expect it to do.
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU


Return to Weather

Who is online

Users browsing this forum: No registered users and 2 guests