Hi fellow wiki editors!

To help newly registered users get more familiar with the wiki (and maybe older users too) there is now a {{Welcome to the wiki}} template. Have a look at it and feel free to add it to new users discussion pages (and perhaps your own).

I have tried to keep the template short, but meaningful. /Johan G

Changes

Jump to: navigation, search

Advanced weather

1,969 bytes added, 21:44, 21 May 2014
m
Creating custom Weather Tiles: http://forum.flightgear.org/viewtopic.php?f=69&t=23120&p=210238#p210214
Advanced Weather allows to specify a weather effect volume by function (like the distribution of lift inside thermals is implemented) and such a dedicated windshear function could be simulated close to the ground. The required tool is Nasal, FGs scripting language.
There Nasal files are other possibilitiesusually *.nas files, they are program code, not just "configuration files". So you might for instance try will want to alter the generic boundary layer code of Advanced Weather to add automatic windshear detectioncheck out $FG_ROOT/Nasal/local_weather and in particular, or you might alter see the C++ code of Basic Weather - it really depends on what information you have and what you'd like to dovarious "tiles" in weather_tiles.nas 
You probably want to have a look at the effect volume management routines. Basically you want to write something analogous to thermal_lift_start(), thermal_lift_stop() and thermal_lift_loop() in /Nasal/local_weather/local_weather.nas and use the management routines of effect_volume_loop()
 
You'd have the best control over weather just defining your own specific tile (see the various tiles in weather_tiles.nas - a minimal structure might be
<syntaxhighlight lang="nasal">
####################################
# my own tile
####################################
var set_my_own_tile = func {
 
setprop(lw~"tiles/code","myown");
 
tile_start();
 
var x = 0.0;
var y = 0.0;
var lat = 0.0;
var lon = 0.0;
 
var alpha = getprop(lw~"tmp/tile-orientation-deg");
var phi = alpha * math.pi/180.0;
var alt_offset = getprop(lw~"tmp/tile-alt-offset-ft");
 
# get tile center coordinates
 
var blat = getprop(lw~"tiles/tmp/latitude-deg");
var blon = getprop(lw~"tiles/tmp/longitude-deg");
calc_geo(blat);
 
# first weather info for tile center (lat, lon, visibility, temperature, dew point, pressure)
 
local_weather.set_weather_station(blat, blon, alt_offset, 45000.0, 14.0, 12.0, 29.78);
 
var alt_offset = getprop(lw~"tmp/tile-alt-offset-ft");
 
# draw some clouds
 
create_2_8_altocumulus_streaks(blat, blon, 12000+alt_offset, alpha) ;
create_6_8_stratus(blat, blon, 3000+alt_offset, alpha) ;
 
# set visibility and light attenuation as a function of altitude
 
local_weather.set_atmosphere_ipoint(blat, blon, 45000.0, 3000.0, 45000.0, 0.0, 15000.0, 17000.0, 0.8, 12000.0, 17000.0);
 
append(weather_dynamics.tile_convective_altitude,3000.0);
append(weather_dynamics.tile_convective_strength,0.0);
 
tile_finished();
 
}
</syntaxhighlight>
which controls all clouds/visibility. Turbulence can be coded into that as an effect volume spanning the whole tile (as e.g. for the coldfront). Wind is read from the menu, so the properties need to be set accordingly.
 
METAR strings give you a lower level of control (you can't control the precise clouds being drawn and the vertical structure of the atmosphere that way).
If you have a Nasal subroutine creating the wind field, Thorsten (get in touch via the forum) volunteers to provide integration help you with implementing it in the correct places.
 
There are other possibilities, you might for instance try to alter the generic boundary layer code of Advanced Weather to add automatic windshear detection, or you might alter the C++ code of Basic Weather - it really depends on what information you have and what you'd like to do.
== Related Discussions ==
18,232
edits

Navigation menu