diff --git a/Aircraft/c172p/c172p-set.xml b/Aircraft/c172p/c172p-set.xml
index d22b7fb9a..074307cd8 100644
--- a/Aircraft/c172p/c172p-set.xml
+++ b/Aircraft/c172p/c172p-set.xml
@@ -13,7 +13,14 @@ Started October 23 2001 by John Check, fgpanels@rockfish.net
Cessna 172P Skyhawk (1981 model)David Megginson
- production
+ early production
+
+ 3
+ 4
+ 5
+ 4
+
+
jsbc172p
diff --git a/Airports/metar.dat.gz b/Airports/metar.dat.gz
index d05b01795..e302aa922 100644
Binary files a/Airports/metar.dat.gz and b/Airports/metar.dat.gz differ
diff --git a/Docs/README.3DClouds b/Docs/README.3DClouds
index 97a1365e6..b8ebc2190 100644
--- a/Docs/README.3DClouds
+++ b/Docs/README.3DClouds
@@ -83,8 +83,8 @@ property arguments.
- Latitude t place the cloud, in degrees (default 0)
- Altitude to place the cloud, relative to the layer (!) in ft
(default 0)
-
-TODO: Add offset arguments for consistency with add-cloud.
+ - Offset in m from the lon-deg. +ve is south (default 0)
+ - Offset in m from the lat-deg. +ve is east (default 0)
Deleting Individual Clouds
===========================
diff --git a/Docs/README.local_weather.html b/Docs/README.local_weather.html
index 74f53a2e1..f5a945c5e 100644
--- a/Docs/README.local_weather.html
+++ b/Docs/README.local_weather.html
@@ -7,7 +7,7 @@
-
Local Weather Package - v1.0
+
Local Weather Package - v1.1
1. Introduction
@@ -15,19 +15,20 @@ The aim of a local weather system is to simulate weather phenomena tied to speci
This is in contrast to the current (v.2.0.0) global weather system of Flightgear where weather changes affect the weather everywhere in the simulated world and are (with few exceptions) not tied to specific locations. In such a system, it is impossible to observe e.g. the approach of a rainfront while flying in sunshine.
-The local weather package aims to provide the functionality to simulate such local phenomena. In version 1.0, the package supplies various cloud placement algorithms, as well as local control over most major weather parameters (wind, visibility, pressure, temperature, rain, snow, thermal lift, turbulence...) through interpolation routines and effect volumes. The dynamics of the different systems is tied together - for instance clouds and weather effects drift in the specified wind field. The package also contains a fairly detailed algorithm to generate convective clouds and thermals with a realistic distribution over the various terrain types. There is a simulation of the interaction of the convective cloud system with the terrain as a function of time. Clouds drifting in the wind flow over obstacles, i.e. they change their altitude dynamically. Convection is implemented with a life cycle model of Cumulus clouds - they are generated, evolve for a given lifetime dependent on the underlying terrain and decay at the end of their life cycle. Thermals associated with the clouds follow the same pattern. In particular, in the presence of wind favourable spots for convection generate 'alleys' of dense cloud cover downwind, or thermals and clouds generated over land decay rapidly once they reach open water.
+The local weather package aims to provide the functionality to simulate such local phenomena. In version 1.1, the package supplies various cloud placement algorithms, as well as local control over most major weather parameters (wind, visibility, pressure, temperature, rain, snow, thermal lift, turbulence...) through interpolation routines and effect volumes. The dynamics of the different systems is tied together - for instance clouds and weather effects drift in the specified wind field. The package also contains a fairly detailed algorithm to generate convective clouds and thermals with a realistic distribution over the various terrain types. There is a simulation of the interaction of the convective cloud system with the terrain as a function of time. Clouds drifting in the wind flow over obstacles, i.e. they change their altitude dynamically. Convection is implemented with a life cycle model of Cumulus clouds - they are generated, evolve for a given lifetime dependent on the underlying terrain and decay at the end of their life cycle. Thermals associated with the clouds follow the same pattern. In particular, in the presence of wind favourable spots for convection generate 'alleys' of dense cloud cover downwind, or thermals and clouds generated over land decay rapidly once they reach open water.
For long-range flights, the system provides an offline weather system with plausible transitions between different large-scale weather patterns like fronts and low and high pressure areas, as well as the optional use of live METAR data.
2. Installation
-The package needs to be unpacked in the Flightgear root directory. It writes content into the Nasal/, gui/, gui/dialogs/, Shaders, Effects/, Docs/, and Models/Weather/ subdirectories. The installation does not overwrite any of the default Flightgear files, but to be accessible from the menu for Flightgear 2.0.0, one must copy gui/menubar.xml.alt to the default menubar.xml or copy the three lines of the environemnt menu calling local_weather, local_weather_tiles and local_weather_config into the default file. More recent versions of Flightgear already provide the necessary menu items.
+The package needs to be unpacked in the Flightgear root directory. It writes content into the Nasal/, gui/, gui/dialogs/, Shaders, Effects/, Docs/, Environment/ and Models/Weather/ subdirectories. The installation does not overwrite any of the default Flightgear files, but to be accessible from the menu for Flightgear 2.0.0, one must copy gui/menubar.xml.alt to the default menubar.xml or copy the three lines of the environemnt menu calling local_weather, local_weather_tiles and local_weather_config into the default file. More recent versions of Flightgear already provide the necessary menu items. In order to read in the default menu entries, the line <local-weather include="Environment/local-weather-defaults.xml"/> needs to be added to the file preferences.xml.
-This adds the items Local Weather, Local Weather Tiles and Local Weather Config to the Environment menu when Flightgear is up. Most of the basic functionality is contained in local_weather.nas which is loaded at startup and identifies itself with a message.
+This adds the items Local Weather, Local Weather Tiles and Local Weather Config to the Environment menu when Flightgear is up. Most of the basic functionality is contained in local_weather.nas which is loaded at startup and identifies itself with a message. A compatibility layer (compat_layer.nas) tests for hard-coded support and ensures that, dependent on the version, hard-coded or Nasal-coded fallback functions are used.
Unless asked to do so from the menu, local weather does not run any process in the background. Upon loading, the package does not set any properties already existing, but only generates properties necessary for the menu entries in its own subdirectory /local-weather/ in the tree. The package also does a features check on startup if particular functions are available in hard-coded form. If the features are not present, the package will largely still function properly using slower Nasal fallback code.
+In order to use the hard-coded terrain presampling routines, it is currently necessary to add the line --prop:/environment/terrain/area[0]/enabled=1 to the Flightgear commandline. If this is not done, the system will use the slower fallback routines.
3. Functionality
@@ -163,7 +164,7 @@ The following pictures show possible results of tile setups 'High-pressure-borde
Performance settings
-The performance setting menu is available from the main menubar. It controls the allocation of system resources to the various tasks.
+The performance setting menu is available from the main menubar. It controls the allocation of system resources to the various tasks, as well as the behaviour of the offline weather system.
@@ -179,10 +180,16 @@ From this, it is apparent that the two ranges should not be drastically differen
There are additional options to do asymmetric buffering, i.e. to 'cut' out a wedge in the rear of the aircraft in which the tile creation radius or the cloud visibility radius are lower. For example, setting the buffering ratio to 0.2 and the angle to 180 degrees corresponds to a very agressive buffering in which clouds in the rear hemisphere of the aircraft are almost absent and shown only to 20% of the set distance. This may increase performance by 20-30%, but only in straight flight - in fast turns, lots of clouds have to be shuffled from the buffer into the scenery and back, which is actually slower than never trying to cut a wedge at all. Also, agressive asymmetric buffering is not nice in external views as the reference is always the aircraft course.
-The last option controls the amout of resources allocated to making clouds drift in the wind if dynamical weather is on. In order to avoid freezes, the weather dynamics system processes only a fixed number of clouds per frame inside the field of view. That means that faraway clouds do not necessarily move even with dynamical weather on. The slider indirectly controls the distance out to which clouds are being processed.
+The buffering control can also optionally be tied to a target framerate. In this case, the visible range set with the slider is ignored and a control loop tries to adjust the visible range instead such that a 5-second average of the framerate is within 10% of a specified target framerate. Currently, the subsystem only adjusts the visible range of buffering - asymmetric buffering and/or tile loading range still needs to be specified manually. Also, the system cannot respond to unsolvable problems - if the framerate in the absence of clouds falls below 30, then no setting for the cloud range will bring it to 35.
+
+The next option controls the amout of resources allocated to making clouds drift in the wind if dynamical weather is on. In order to avoid freezes, the weather dynamics system processes only a fixed number of clouds per frame inside the field of view. That means that faraway clouds do not necessarily move even with dynamical weather on. The slider indirectly controls the distance out to which clouds are being processed.
All performance setting menu-options work at runtime, but are processed over time rather than instantaneously, i.e. it takes 10-20 seconds till the new balance between buffered clouds and active clouds is reached after the slider is moved.
+The final options, weather pattern scales, deal with the long-range behaviour of the offline weather system. They are not parsed when the tile selection mode is set to METAR. The first slider controls the transition between different airmasses. In the default setting, the typical distance to encounter a different airmass when one flies in a 'High-pressure-core' tile is 200 km. The airmass slider allows to vary this distance between 200 and 800 km.
+
+Inside each tile, there are typically 4-8 different basic cloud patterns (distribution of layers) modelled, with a random pattern selected for each new tile of the given airmass classification. The cloud patterns slider adjusts the probability that the same cloud configuration is kept as long as a tile of the same airmass type is generated. Selecting a large scale in essence means that the theme of clouds will remain similar within each airmass, a small scale allows for more variation.
+
4. Cloud models
The package contains a number of different cloud models, both static ones for Cirrus and Cirrocumulus clouds as well as rotated ones for Altocumulus, Cirrostratus, Cumulus, Cumulonimbus, Stratus and Nimbostratus cloudlet models. Neither the cloud textures, nor the models nor the transformations are perfected, and any aspect can be improved, albeit at the cost of performance consumption.
@@ -246,7 +253,7 @@ Effect volumes are always specified between a minimum and a maximum altitude, an
where geometry is a flag (1: circular, 2: elliptical and 3: rectangular), lat and lon are the latitude and longitude, r1 and r2 are the two size parameters for the elliptic or rectangular shape (for the circular shape, only the first is used), phi is the rotation angle of the shape (not used for circular shape), alt_low and alt_high are the altitude boundaries, vis, rain, snow, turb and lift are weather parameters which are either set to the value they should assume, or to -1 if they are not to be used, or to -2 if a function instead of a parameter is to be used and -3 if a function for wave lift is used. Since thermal lift can be set to negative values in a sink, a separate flag is provided in this case. sat finally determines the light saturation, a parameter between 0 (dark) and 1 (normal light) - it can be used to dim the light beneath cloud layers (which is not done automatically as objects don't cast shades in Flightgear, and given that most cloud models are rotated, their shade would look rather odd on any case).
-In version 1.0, thermal lift and wave lift are implemented by function (wave lift is not yet automatically placed, but can be easily from Nasal). There is no easy way to implement any weather parameter by function in an effect volume, as this requires some amount of Nasal coding.
+In version 1.1, thermal lift and wave lift are implemented by function (wave lift is not yet automatically placed, but can be easily from Nasal). There is no easy way to implement any weather parameter by function in an effect volume, as this requires some amount of Nasal coding.
Both thermal lift and saturation require a more recent version of Flightgear than 2.0.0 in order to take effect.
@@ -362,7 +369,7 @@ With default settings, the local weather package generates a 40x40 km weather ti
Rain and snow may not start properly. For me, rain is only generated when I switch 'Shader effects' on and off in the menu on startup, otherwise neither moving the menu slider nor entering an effect volume generate rain. This seems to be a bug of some Flightgear versions, not of the local weather system.
-
Especially with multiple overcast layers and weather fronts, loading and unloading weather tiles may take a long time / cause severe drops in framerate. It seems that a dual core processor is very valuable with this particular issue - try switching multiprocessor support on if needed, otherwise please refer to performance tuning to solve such problems. In general, overcast layers and tropical weather tiles do require a system on the high end of the performance scale to render properly.
+
Especially with multiple overcast layers and weather fronts, loading and unloading weather tiles may take a long time / cause severe drops in framerate. It seems that a dual core processor is very valuable with this particular issue - try switching multiprocessor support on if needed, otherwise please refer to performance tuning to solve such problems. In more recent versions of Flightgear, an activated texture cache improves performance dramatically. In general, overcast layers and tropical weather tiles do require a system on the high end of the performance scale to render properly.
The local weather package is able to occasionally trigger errors like 'Warning:: Picked up error in TriangleIntersect'. These seem to be a problem in the core Flightgear code - the package does nothing but placing normal (rather simple) AC3D models into the scenery.
diff --git a/Docs/menu4.jpg b/Docs/menu4.jpg
index 4394ba1b3..79d29173f 100644
Binary files a/Docs/menu4.jpg and b/Docs/menu4.jpg differ
diff --git a/Environment/local-weather-defaults.xml b/Environment/local-weather-defaults.xml
new file mode 100644
index 000000000..6c26c3b60
--- /dev/null
+++ b/Environment/local-weather-defaults.xml
@@ -0,0 +1,106 @@
+
+
+ 0
+ 0.3
+ 90.0
+ 39000.0
+ 39500.0
+ 1
+ 0
+ 1.0
+ constant
+ 1
+ 0.7
+ 30000.0
+ 250
+ 0
+ 0
+ 0
+ 1
+ 1
+ 0
+ 25.0
+ 1.0
+ 0.0
+
+
+ realistic weather
+ High-pressure
+ 260.0
+ 8.0
+ 0.0
+ 0.0
+ 0.0
+ 0.0
+ 0
+ 260.0
+ 8.0
+ 262.0
+ 11.0
+ 264.0
+ 16.0
+ 265.0
+ 24.0
+ 269.0
+ 35.0
+ 273.0
+ 45.0
+ 274.0
+ 50.0
+ 273.0
+ 56.0
+ 272.0
+ 65.0
+ Altocumulus
+ 12000.0
+ 5
+ 800.0
+ 0.2
+ 15
+ 800.0
+ 0.2
+ 0.0
+ 1.0
+ 400.0
+ 400.0
+ 300.0
+ 1.0
+ 15.0
+ 2000.0
+ 3500.0
+ 150
+ 0.0
+ 5.0
+ 10.0
+ Altocumulus
+ small
+ 5000.0
+ 0.0
+ Nimbus
+ 10.0
+ 10.0
+ 0.0
+ 3000.0
+ 500.0
+ 1.0
+ 10.0
+ 1
+ 1.0
+ 600.0
+ 600.0
+ 300.0
+ 10
+ 0.4
+ 0.2
+ 1.4
+ 3
+ 0.9
+ 0.2
+ 12
+
+
+
+
+
+
+
diff --git a/Input/Joysticks/Microsoft/sidewinder-force-feed2.xml b/Input/Joysticks/Microsoft/sidewinder-force-feed2.xml
index e76347bfa..84aebc11c 100644
--- a/Input/Joysticks/Microsoft/sidewinder-force-feed2.xml
+++ b/Input/Joysticks/Microsoft/sidewinder-force-feed2.xml
@@ -161,7 +161,7 @@ ________________________________________________________________________________
Throttle3
- 2
+ 32
diff --git a/Input/Joysticks/Saitek/X52.xml b/Input/Joysticks/Saitek/X52.xml
index abc624e8a..dcaa633c5 100644
--- a/Input/Joysticks/Saitek/X52.xml
+++ b/Input/Joysticks/Saitek/X52.xml
@@ -1,56 +1,190 @@
+
Saitek X52
@@ -61,99 +195,37 @@ $Id$
Saitek X52 Flight Control SystemSaitek Saitek X52Saitek Saitek X52 Flight Stick (USB)
- Saitek Saitek X52 Flight Control Stick
+ Saitek Saitek X52 Flight Control StickSaitek Saitek X52 Flight Control System
-
+Aileron
+
+ 0
+ 0
+ 0
+ property-scale/controls/flight/aileron
- true
-
+
-
+Elevator
+
+ 1
+ 1
+ 1
+ property-scale/controls/flight/elevator-1.0
- true
-
+
-
-
-
-
-
-
- 7
- 6
- 6
-
- View Direction
-
- true
-
- nasal
-
-
-
-
- true
-
- nasal
-
-
-
-
-
-
- View Elevation
-
- 8
- 7
- 7
-
-
- true
-
- nasal
-
-
-
-
- true
-
- nasal
-
-
-
-
-
-
+Throttle2
@@ -164,9 +236,9 @@ $Id$
nasal
-
+
-
+Mixture3
@@ -175,14 +247,45 @@ $Id$
nasal
-
+
-
+
-
- Propeller Advance
+
+
+ unassigned (was: Propeller RPM)4
+ 8
+ 8
+
+
+ nasal
+
+
+
+
+
+
+ Rudder
+
+ 5
+ 3
+ 3
+
+
+ property-scale
+ /controls/flight/rudder
+
+
+
+
+
+ Propeller RPM
+
+ 644
@@ -190,18 +293,132 @@ $Id$
nasal
-
+
-
-
+
+ (Pinky) : Brakesnasal
@@ -212,183 +429,266 @@ $Id$
- -->
+
-
-
-
- Landing Gear Down
+
+
+ (D) : Shift Keynasal
-
+
nasal
-
+
-
+
-
-
- Landing Gear Up
-
- nasal
-
-
-
-
- nasal
-
-
-
-
+
+
+ (T1) : Landing Gear Handle Up
+
+ nasal
+
+
+
+
+ (T2) : Landing Gear Handle Down
+
+ nasal
+
+
+
-
-
- Mode 1
-
- nasal
-
-
-
-
-
- Mode 2
-
- nasal
-
-
-
-
-
- Mode 3
-
- nasal
-
-
-
-
-
-
-
+
+Elevator trim downtruenasal
-
+
-
+
+
+ Elevator trim up
+ true
+
+ nasal
+
+
+
-
+
+
+ (Throttle Rocker) : Rudder trim right
+ true
+
+ nasal
+
+
+
+
+ (Throttle Rocker) : Rudder trim left
+ true
+
+ nasal
+
+
+
+
+
+
+ (T3) : Decrease flaps (shift: Speed Brakes extend)
+
+ nasal
+
+
+
+
+ nasal
+
+
+
+
+
+ (T4) : Increase flaps (shift: Speed Brakes retract)
+
+ nasal
+
+
+
+
+ nasal
+
+
+
+
+
+
+
+ (T5) : Carb Heat On (shift: Cowl Flaps Close)
+
+ nasal
+
+
+
+
+ (T6) : Carb Heat Off (shift: Cowl Flaps Open)
+
+ nasal
+
+
+
+
+
+Aileron trim righttruenasal
-
-
-
- Elevator trim up
- true
-
- nasal
-
-
-
-
-
+
+Aileron trim lefttruenasal
-
+
-
-
- Decrease flaps
+
+
+
+
+ Mode 1nasal
-
+
-
-
+
+
+ Mode 2
+
+ nasal
+
+
+
+
+ Mode 3
+
+ nasal
+
+
+
+
+
+ (MFD Func) : Stopwatch timer becomes clock again
+
+ nasal
+
+
+
+
+
+ (MFD Reset) : Stopwatch timer reset
+
+ nasal
+
+
+
+
+
+
+
+ Mode 1
+ nasal
-
-
-
-
-
-
- Increase flaps
-
- nasal
-
+
-
-
+ nasal
-
-
-
-
+
+
+
-
-
- Rudder trim right
- true
-
- nasal
-
-
-
-
-
- Rudder trim left
- true
-
- nasal
-
-
-
-
-
-
+
+Toggle parking brake on or off
-
property-toggle/controls/gear/brake-parking
-
-
-
-
-
- Decrease speedbrake
-
- property-assign
- /controls/flight/speedbrake
- 0
-
-
-
-
- Increase speedbrake
-
- property-assign
- /controls/flight/speedbrake
- 1
-
-
+
diff --git a/Input/Joysticks/ThrustMaster/T-Flight-Stick-X.xml b/Input/Joysticks/ThrustMaster/T-Flight-Stick-X.xml
new file mode 100644
index 000000000..018d5f3f2
--- /dev/null
+++ b/Input/Joysticks/ThrustMaster/T-Flight-Stick-X.xml
@@ -0,0 +1,168 @@
+
+
+
+
+
+ T.Flight Stick X
+
+
+ Aileron
+
+ property-scale
+ /controls/flight/aileron
+ true
+
+
+
+
+ Elevator
+
+ property-scale
+ /controls/flight/elevator
+ -1.0
+ true
+
+
+
+
+ Increase/Reduce Throttle
+
+ nasal
+
+
+
+
+
+ Rudder Left/Right
+
+ property-scale
+ /controls/flight/rudder
+ 1.0
+
+
+
+
+ View Direction
+
+ true
+
+ property-adjust
+ /sim/current-view/goal-heading-offset-deg
+ 2.0
+
+
+
+ true
+
+ property-adjust
+ /sim/current-view/goal-heading-offset-deg
+ -2.0
+
+
+
+
+
+ View Elevation
+
+ true
+
+ property-adjust
+ /sim/current-view/goal-pitch-offset-deg
+ -2.0
+
+
+
+ true
+
+ property-adjust
+ /sim/current-view/goal-pitch-offset-deg
+ 2.0
+
+
+
+
+
+ Brakes
+
+ nasal
+
+
+
+
+ nasal
+
+
+
+
+
+
+ Change View
+
+ nasal
+
+
+
+
+
+ Trim Nose Up
+ true
+
+ nasal
+
+
+
+
+
+ Trim Nose Down
+ true
+
+ nasal
+
+
+
+
+
+ Extend Flaps Incrementally
+ false
+
+ nasal
+
+
+
+
+ nasal
+
+
+
+
+
+
+ Retract Flaps Incrementally
+ false
+
+ nasal
+
+
+
+
+ nasal
+
+
+
+
+
+
+ Landing gear Up/Down
+ false
+
+ nasal
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Nasal/IOrules b/Nasal/IOrules
index 138513059..07117c0f1 100644
--- a/Nasal/IOrules
+++ b/Nasal/IOrules
@@ -28,6 +28,7 @@
READ ALLOW $FG_ROOT/*
READ ALLOW $FG_HOME/*
READ ALLOW $FG_AIRCRAFT/*
+READ ALLOW $FG_SCENERY/*
WRITE ALLOW /tmp/*.xml
WRITE ALLOW $FG_HOME/*.sav
diff --git a/Nasal/balloons.nas b/Nasal/balloons.nas
index be13b1da9..2de550073 100644
--- a/Nasal/balloons.nas
+++ b/Nasal/balloons.nas
@@ -17,8 +17,8 @@ _setlistener("/sim/signals/fdm-initialized", func {
var callsign = tanker.getNode("callsign").getValue();
if( callsign == nil ) continue;
if( string.match(callsign,"ballon*") ) {
- tanker.getNode("position/latitude-deg",1).setDoubleValue( position.lat() );
- tanker.getNode("position/longitude-deg",1).setDoubleValue( position.lon() );
+ tanker.getNode("position/latitude-deg",1).setDoubleValue( position.lat() - 0.002 );
+ tanker.getNode("position/longitude-deg",1).setDoubleValue( position.lon() - 0.002 );
tanker.getNode("position/altitude-ft", 1 ).setDoubleValue( position.alt() );
}
}
diff --git a/Nasal/gui.nas b/Nasal/gui.nas
index cc18c00c3..524cc14cf 100644
--- a/Nasal/gui.nas
+++ b/Nasal/gui.nas
@@ -1254,3 +1254,15 @@ var common_aircraft_keys = {
{ name: "Shift-F8", desc: "scroll 2D panel right" },
],
};
+
+_setlistener("/sim/signals/screenshot", func {
+ var path = getprop("/sim/paths/screenshot-last");
+ var button = { button: { legend: "Ok", default: 1, binding: { command: "dialog-close" }}};
+ var success= getprop("/sim/signals/screenshot");
+ if (success) {
+ popupTip("Screenshot written to '" ~ path ~ "'", 3);
+ } else {
+ popupTip("Error writing screenshot '" ~ path ~ "'", 600, button);
+ }
+});
+
diff --git a/Nasal/io.nas b/Nasal/io.nas
index 41d5d7fc9..fbf1e358f 100644
--- a/Nasal/io.nas
+++ b/Nasal/io.nas
@@ -81,6 +81,33 @@ var read_properties = func(path, target = nil) {
return fgcommand("loadxml", args) ? ret : nil;
}
+# Load XML file in FlightGear's native format.
+# file will be located in the airport-scenery directories according to
+# ICAO and filename, i,e in Airports/I/C/A/ICAO.filename.xml
+# If the second, optional target parameter is set, then the properties
+# are loaded to this node in the global property tree. Otherwise they
+# are returned as a separate props.Node tree. Returns the data as a
+# props.Node on success or nil on error.
+#
+# Usage: io.read_airport_properties(, [, ]);
+#
+# Examples:
+#
+# var data = io.read_properties("KSFO", "rwyuse");
+#
+var read_airport_properties = func(icao, fname, target = nil) {
+ var args = props.Node.new({ filename: fname, icao:icao });
+ if (target == nil) {
+ var ret = args.getNode("data", 1);
+ } elsif (isa(target, props.Node)) {
+ args.getNode("targetnode", 1).setValue(target.getPath());
+ var ret = target;
+ } else {
+ args.getNode("targetnode", 1).setValue(target);
+ var ret = props.globals.getNode(target, 1);
+ }
+ return fgcommand("loadxml", args) ? ret : nil;
+}
# Write XML file in FlightGear's native format.
# Returns the filename on success or nil on error. If the source
@@ -245,6 +272,14 @@ _setlistener("/sim/signals/nasal-dir-initialized", func {
pattern = c.getValue() ~ "/" ~ p;
append(rules, [pattern, allow]);
printlog("info", "IORules: appending ", pattern);
+ }
+ } elsif (substr(pattern, 0, 12) == "$FG_SCENERY/") {
+ var p = substr(pattern, 12);
+ var sim = props.globals.getNode("/sim");
+ foreach (var c; sim.getChildren("fg-scenery")) {
+ pattern = c.getValue() ~ "/" ~ p;
+ append(rules, [pattern, allow]);
+ printlog("info", "IORules: appending ", pattern);
}
} else {
if (substr(pattern, 0, 9) == "$FG_ROOT/")
diff --git a/Nasal/local_weather.nas b/Nasal/local_weather.nas
index f2ba503ce..52c7a2ff4 100644
--- a/Nasal/local_weather.nas
+++ b/Nasal/local_weather.nas
@@ -415,8 +415,6 @@ return f_slow;
var interpolation_loop = func {
-var iNode = props.globals.getNode(lw~"interpolation", 1);
-var cNode = props.globals.getNode(lw~"current", 1);
var viewpos = geo.aircraft_position();
var sum_alt = 0.0;
@@ -428,6 +426,15 @@ var sum_norm = 0.0;
var vis_before = getprop(lwi~"visibility-m");
+# if applicable, do some work for fps sampling
+
+if (fps_control_flag == 1)
+ {
+ fps_samples = fps_samples +1;
+ fps_sum = fps_sum + getprop("/sim/frame-rate");
+ }
+
+
# determine at which distance we no longer keep an interpolation point, needs to be larger for METAR since points are more scarce
if (metar_flag == 1)
@@ -512,9 +519,9 @@ var alt1 = weather_dynamics.tile_convective_altitude[current_tile_index -1];
var alt2 = alt1 + 1500.0;
-var inc1 = 0.2;
+var inc1 = 0.1;
var inc2 = 5.0;
-var inc3 = 1.0;
+var inc3 = 0.5;
var alt_above_mean = altitude - current_mean_terrain_elevation;
@@ -547,41 +554,58 @@ setprop(lwi~"turbulence",0.0);
# now check if an effect volume writes the property and set only if not
-flag = props.globals.getNode("local-weather/effect-volumes/number-active-vis").getValue();
-if ((flag ==0) and (vis > 0.0))
+#flag = props.globals.getNode("local-weather/effect-volumes/number-active-vis").getValue();
+flag = getprop("local-weather/effect-volumes/number-active-vis");
+
+if ((flag ==0) and (vis > 0.0) and (getprop(lw~"lift-loop-flag") == 0))
{
- cNode.getNode("visibility-m").setValue(vis);
+ #cNode.getNode("visibility-m").setValue(vis);
+ setprop(lw~"current/visibility-m",vis);
compat_layer.setVisibility(vis);
}
-flag = props.globals.getNode("local-weather/effect-volumes/number-active-turb").getValue();
+#flag = props.globals.getNode("local-weather/effect-volumes/number-active-turb").getValue();
+flag = getprop("local-weather/effect-volumes/number-active-turb");
+
if ((flag ==0))
{
- cNode.getNode("turbulence").setValue(0.0);
+ #cNode.getNode("turbulence").setValue(0.0);
+ setprop(lw~"current/turbulence",0.0);
compat_layer.setTurbulence(0.0);
}
-flag = props.globals.getNode("local-weather/effect-volumes/number-active-lift").getValue();
+#flag = props.globals.getNode("local-weather/effect-volumes/number-active-lift").getValue();
+flag = getprop("local-weather/effect-volumes/number-active-lift");
+
if (flag ==0)
{
- cNode.getNode("thermal-lift").setValue(0.0);
+ #cNode.getNode("thermal-lift").setValue(0.0);
+ setprop(lw~"current/thermal-lift",0.0);
}
# no need to check for these, as they are not modelled in effect volumes
-cNode.getNode("temperature-degc",1).setValue(T);
+#cNode.getNode("temperature-degc",1).setValue(T);
+setprop(lw~"current/temperature-degc",T);
compat_layer.setTemperature(T);
-cNode.getNode("dewpoint-degc",1).setValue(D);
+#cNode.getNode("dewpoint-degc",1).setValue(D);
+setprop(lw~"current/dewpoint-degc", D);
compat_layer.setDewpoint(D);
-if (p>0.0) {cNode.getNode("pressure-sea-level-inhg",1).setValue(p); compat_layer.setPressure(p);}
+if (p>0.0)
+ {
+ #cNode.getNode("pressure-sea-level-inhg",1).setValue(p);
+ setprop(lw~"current/pressure-sea-level-inhg",p);
+ compat_layer.setPressure(p);
+ }
# now determine the local wind
-var tile_index = props.globals.getNode(lw~"tiles").getChild("tile",4).getNode("tile-index").getValue();
+#var tile_index = props.globals.getNode(lw~"tiles").getChild("tile",4).getNode("tile-index").getValue();
+var tile_index = getprop(lw~"tiles/tile[4]/tile-index");
if (wind_model_flag ==1) # constant
{
@@ -669,21 +693,33 @@ if (gust_frequency > 0.0)
var gust_relative_strength = getprop(lw~"tmp/gust-relative-strength");
var gust_angvar = getprop(lw~"tmp/gust-angular-variation-deg");
+ var winddir_last = getprop(lwi~"wind-from-heading-deg");
+
var alt_scaling_factor = 1.2 * windspeed / 10.0;
if (alt_scaling_factor < 1.0) {alt_scaling_factor = 1.0;}
# expected mean number of gusts in time interval (should be < 1)
var p_gust = gust_frequency * interpolation_loop_time;
+ winddir_change = 0.0;
+
if (rand() < p_gust) # we change the offsets for windspeed and direction
{
var alt_fact = 1.0 - altitude_agl/(boundary_alt * alt_scaling_factor);
if (alt_fact < 0.0) {alt_fact = 0.0};
windspeed_multiplier = (1.0 + ((rand()) * gust_relative_strength * alt_fact));
- winddir_change = alt_fact * (1.0 - 2.0 * rand() * gust_angvar);
+ winddir_change = alt_fact * (1.0 - 2.0 * rand()) * gust_angvar;
+ winddir_change = winddir_change * 0.2; # Markov chain parameter, max. change per frame is 1/5
+
+ # if the Markov chain reaches the boundary, reflect
+
+ #print("Winddir: ", winddir, " winddir_last: ", winddir_last, " winddir_change: ", winddir_change);
+ if (weather_tile_management.relangle(winddir_last + winddir_change, winddir) > gust_angvar)
+ {winddir_change = -winddir_change;}
+
}
windspeed_current = windspeed_current * windspeed_multiplier;
- winddir = winddir + winddir_change;
+ winddir = winddir_last + winddir_change;
}
@@ -692,13 +728,17 @@ if (gust_frequency > 0.0)
compat_layer.setWindSmoothly(winddir, windspeed_current);
-iNode.getNode("wind-from-heading-deg").setValue(winddir);
-iNode.getNode("wind-speed-kt").setValue(windspeed_current);
+setprop(lwi~"wind-from-heading-deg", winddir);
+setprop(lwi~"wind-speed-kt",windspeed_current);
-cNode.getNode("wind-from-heading-deg").setValue(winddir);
-cNode.getNode("wind-speed-kt").setValue(windspeed_current);
+setprop(lw~"current/wind-from-heading-deg",winddir);
+setprop(lw~"current/wind-speed-kt",windspeed_current);
+#iNode.getNode("wind-from-heading-deg").setValue(winddir);
+#iNode.getNode("wind-speed-kt").setValue(windspeed_current);
+#cNode.getNode("wind-from-heading-deg").setValue(winddir);
+#cNode.getNode("wind-speed-kt").setValue(windspeed_current);
if (getprop(lw~"interpolation-loop-flag") ==1) {settimer(interpolation_loop, interpolation_loop_time);}
@@ -777,6 +817,26 @@ if (getprop(lw~"wave-loop-flag") ==1)
lift = lift + getprop(lw~"current/wave-lift");
}
+# compute a reduction in visibility when entering the cloudbase
+
+var vis = getprop(lw~"interpolation/visibility-m");
+
+if (alt > 0.9 * thermal.height)
+ {
+ var visibility_reduction = math.pow((alt - 0.9 * thermal.height)/(0.2 * thermal.height),0.1);
+ visibility_reduction = visibility_reduction * (1.0 - math.pow(d/(0.8*thermal.radius),14));
+
+ if (visibility_reduction > 1.0) {visibility_reduction = 1.0;} # this shouldn't ever happen
+ if (visibility_reduction < 0.0) {visibility_reduction = 0.0;}
+ vis = vis * (1.0 - 0.98 * visibility_reduction);
+
+ }
+
+setprop(lw~"current/visibility-m",vis);
+compat_layer.setVisibility(vis);
+
+
+
setprop(lw~"current/thermal-lift",lift);
compat_layer.setLift(lift);
@@ -1732,8 +1792,13 @@ settimer ( func {
setprop(lw~"tmp/presampling-status", "idle");
+# reset the random store
+
+weather_tiles.rnd_store = rand();
+
# indicate that we are no longer running
+
local_weather_running_flag = 0;
}
@@ -1846,6 +1911,8 @@ var create_cumosys = func (blat, blon, balt, nc, size) {
if (detailed_clouds_flag == 1)
{nc = int(0.7 * nc);}
+nc = int(nc / cumulus_efficiency_factor);
+
if (thread_flag == 1)
{setprop(lw~"tmp/convective-status", "computing");
cumulus_loop(blat, blon, balt, nc, size);}
@@ -1861,7 +1928,7 @@ else
var cumulus_loop = func (blat, blon, balt, nc, size) {
-var n = 25;
+var n = int(25/cumulus_efficiency_factor);
if (nc < 0)
{
@@ -1951,7 +2018,7 @@ while (i < nc) {
# then decide if the thermal energy at the spot generates an updraft and a cloud
- if (rand() < p) # we decide to place a cloud at this spot
+ if (rand() < (p * cumulus_efficiency_factor)) # we decide to place a cloud at this spot
{
strength = (1.5 * rand() + (2.0 * p)) * t_factor2; # the strength of thermal activity at the spot
if (strength > 1.0)
@@ -2105,7 +2172,7 @@ while (i < nc) {
# check if to place a cloud with weight sqrt(p), the lifetime gets another sqrt(p) factor
- if (rand() > math.sqrt(p))
+ if (rand() > math.sqrt(p * cumulus_efficiency_factor))
{i=i+1; continue;}
@@ -3168,8 +3235,8 @@ var set_wind_ipoint_metar = func (lat, lon, d0, v0) {
if (lat >0.0) {var dsign = -1.0;} else {var dsign = 1.0;}
-var v1 = v0 * (1.0 + rand() * 0.2);
-var d1 = d0 + dsign * 3.0 * rand();
+var v1 = v0 * (1.0 + rand() * 0.1);
+var d1 = d0 + dsign * 2.0 * rand();
var v2 = v0 * (1.2 + rand() * 0.2);
var d2 = d0 + dsign * (3.0 * rand() + 2.0);
@@ -3225,11 +3292,11 @@ if (getprop(lw~"config/generate-thermal-lift-flag") ==1) {generate_thermal_lift_
thread_flag = getprop(lw~"config/thread-flag");
dynamics_flag = getprop(lw~"config/dynamics-flag");
-presampling_flag = getprop(lw~"tmp/presampling-flag");
+presampling_flag = getprop(lw~"config/presampling-flag");
detailed_clouds_flag = getprop(lw~"config/detailed-clouds-flag");
dynamical_convection_flag = getprop(lw~"config/dynamical-convection-flag");
debug_output_flag = getprop(lw~"config/debug-output-flag");
-
+fps_control_flag = getprop(lw~"config/fps-control-flag");
}
@@ -3825,8 +3892,12 @@ setprop(lw~"METAR/layer[3]/cover-oct",0);
setprop(lw~"METAR/layer[3]/alt-agl-ft", 20000.0);
setprop(lw~"METAR/available-flag",1);
+# set initial value for stored random number for small-scale cloud patterns
-# set listener for worker threads
+weather_tiles.rnd_store = rand();
+
+
+# set listeners
setlistener(lw~"tmp/thread-status", func {var s = size(clouds_path); compat_layer.create_cloud_array(s, clouds_path, clouds_lat, clouds_lon, clouds_alt, clouds_orientation); });
setlistener(lw~"tmp/convective-status", func {var s = size(clouds_path); compat_layer.create_cloud_array(s, clouds_path, clouds_lat, clouds_lon, clouds_alt, clouds_orientation); });
@@ -3840,6 +3911,12 @@ setlistener(lw~"config/clouds-in-dynamics-loop", func {weather_dynamics.max_clou
setlistener(lw~"config/clouds-visible-range-m", func {weather_tile_management.cloud_view_distance = getprop(lw~"config/clouds-visible-range-m");});
setlistener(lw~"config/distance-to-load-tile-m", func {setprop(lw~"config/distance-to-remove-tile-m",getprop(lw~"config/distance-to-load-tile-m") + 500.0);});
+
+setlistener(lw~"config/fps-control-flag", func {fps_control_flag = getprop(lw~"config/fps-control-flag");});
+setlistener(lw~"config/target-framerate", func {target_framerate = getprop(lw~"config/target-framerate");});
+
+setlistener(lw~"config/small-scale-persistence", func {weather_tiles.small_scale_persistence = getprop(lw~"config/small-scale-persistence");});
+
}
@@ -4152,12 +4229,10 @@ var windIpointArray = [];
var wind_model_flag = 1;
-# a global determining the relative amount of different textures in detailed convective clouds
+# globals governing properties of the Cumulus system
var convective_texture_mix = 0.0;
-
-# a global keeping track of the mean cloud altitude when building a Cumulus from individual cloudlets
-
+var cumulus_efficiency_factor = 1.0;
var cloud_mean_altitude = 0.0;
# globals keeping track of the lifetime when building a Cumulus from individual cloudlets
@@ -4181,69 +4256,76 @@ var dynamical_convection_flag = 1;
var debug_output_flag = 1;
var metar_flag = 0;
var local_weather_running_flag = 0;
+var fps_control_flag = 1;
+
+# globals for framerate controlled cloud management
+
+var fps_average = 0.0;
+var fps_samples = 0;
+var fps_sum = 0.0;
+var target_framerate = 25.0;
# set all sorts of default properties for the menu
-setprop(lw~"tmp/cloud-type", "Altocumulus");
-setprop(lw~"tmp/alt", 12000.0);
-setprop(lw~"tmp/nx",5);
-setprop(lw~"tmp/xoffset",800.0);
-setprop(lw~"tmp/xedge", 0.2);
-setprop(lw~"tmp/ny",15);
-setprop(lw~"tmp/yoffset",800.0);
-setprop(lw~"tmp/yedge", 0.2);
-setprop(lw~"tmp/dir",0.0);
-setprop(lw~"tmp/tri", 1.0);
-setprop(lw~"tmp/rnd-pos-x",400.0);
-setprop(lw~"tmp/rnd-pos-y",400.0);
-setprop(lw~"tmp/rnd-alt", 300.0);
-setprop(lw~"tmp/conv-strength", 1);
-setprop(lw~"tmp/conv-size", 15.0);
-setprop(lw~"tmp/conv-alt", 2000.0);
-setprop(lw~"tmp/bar-alt", 3500.0);
-setprop(lw~"tmp/bar-n", 150.0);
-setprop(lw~"tmp/bar-dir", 0.0);
-setprop(lw~"tmp/bar-dist", 5.0);
-setprop(lw~"tmp/bar-size", 10.0);
-setprop(lw~"tmp/scloud-type", "Altocumulus");
-setprop(lw~"tmp/scloud-subtype", "small");
+# setprop(lw~"tmp/cloud-type", "Altocumulus");
+# setprop(lw~"tmp/alt", 12000.0);
+# setprop(lw~"tmp/nx",5);
+# setprop(lw~"tmp/xoffset",800.0);
+# setprop(lw~"tmp/xedge", 0.2);
+# setprop(lw~"tmp/ny",15);
+# setprop(lw~"tmp/yoffset",800.0);
+# setprop(lw~"tmp/yedge", 0.2);
+# setprop(lw~"tmp/dir",0.0);
+# setprop(lw~"tmp/tri", 1.0);
+# setprop(lw~"tmp/rnd-pos-x",400.0);
+# setprop(lw~"tmp/rnd-pos-y",400.0);
+# setprop(lw~"tmp/rnd-alt", 300.0);
+# setprop(lw~"tmp/conv-strength", 1);
+# setprop(lw~"tmp/conv-size", 15.0);
+# setprop(lw~"tmp/conv-alt", 2000.0);
+# setprop(lw~"tmp/bar-alt", 3500.0);
+# setprop(lw~"tmp/bar-n", 150.0);
+# setprop(lw~"tmp/bar-dir", 0.0);
+# setprop(lw~"tmp/bar-dist", 5.0);
+# setprop(lw~"tmp/bar-size", 10.0);
+# setprop(lw~"tmp/scloud-type", "Altocumulus");
+# setprop(lw~"tmp/scloud-subtype", "small");
setprop(lw~"tmp/scloud-lat",getprop("position/latitude-deg"));
setprop(lw~"tmp/scloud-lon",getprop("position/longitude-deg"));
-setprop(lw~"tmp/scloud-alt", 5000.0);
-setprop(lw~"tmp/scloud-dir", 0.0);
-setprop(lw~"tmp/layer-type","Nimbus");
-setprop(lw~"tmp/layer-rx",10.0);
-setprop(lw~"tmp/layer-ry",10.0);
-setprop(lw~"tmp/layer-phi",0.0);
-setprop(lw~"tmp/layer-alt",3000.0);
-setprop(lw~"tmp/layer-thickness",500.0);
-setprop(lw~"tmp/layer-density",1.0);
-setprop(lw~"tmp/layer-edge",0.2);
-setprop(lw~"tmp/layer-rain-flag",1);
-setprop(lw~"tmp/layer-rain-density",1.0);
-setprop(lw~"tmp/box-x-m",600.0);
-setprop(lw~"tmp/box-y-m",600.0);
-setprop(lw~"tmp/box-alt-ft",300.0);
-setprop(lw~"tmp/box-n",10);
-setprop(lw~"tmp/box-core-fraction",0.4);
-setprop(lw~"tmp/box-core-offset",0.2);
-setprop(lw~"tmp/box-core-height",1.4);
-setprop(lw~"tmp/box-core-n",3);
-setprop(lw~"tmp/box-bottom-fraction",0.9);
-setprop(lw~"tmp/box-bottom-thickness",0.5);
-setprop(lw~"tmp/box-bottom-n",12);
-setprop(lw~"tmp/tile-type", "High-pressure");
-setprop(lw~"tmp/tile-orientation-deg", 260.0);
-setprop(lw~"tmp/windspeed-kt", 8.0);
-setprop(lw~"tmp/gust-frequency-hz", 0.0);
-setprop(lw~"tmp/gust-relative-strength",0.0);
-setprop(lw~"tmp/gust-angular-variation-deg",0.0);
-setprop(lw~"tmp/tile-alt-offset-ft", 0.0);
+# setprop(lw~"tmp/scloud-alt", 5000.0);
+# setprop(lw~"tmp/scloud-dir", 0.0);
+# setprop(lw~"tmp/layer-type","Nimbus");
+# setprop(lw~"tmp/layer-rx",10.0);
+# setprop(lw~"tmp/layer-ry",10.0);
+# setprop(lw~"tmp/layer-phi",0.0);
+# setprop(lw~"tmp/layer-alt",3000.0);
+# setprop(lw~"tmp/layer-thickness",500.0);
+# setprop(lw~"tmp/layer-density",1.0);
+# setprop(lw~"tmp/layer-edge",0.2);
+# setprop(lw~"tmp/layer-rain-flag",1);
+# setprop(lw~"tmp/layer-rain-density",1.0);
+# setprop(lw~"tmp/box-x-m",600.0);
+# setprop(lw~"tmp/box-y-m",600.0);
+# setprop(lw~"tmp/box-alt-ft",300.0);
+# setprop(lw~"tmp/box-n",10);
+# setprop(lw~"tmp/box-core-fraction",0.4);
+# setprop(lw~"tmp/box-core-offset",0.2);
+# setprop(lw~"tmp/box-core-height",1.4);
+# setprop(lw~"tmp/box-core-n",3);
+# setprop(lw~"tmp/box-bottom-fraction",0.9);
+# setprop(lw~"tmp/box-bottom-thickness",0.5);
+# setprop(lw~"tmp/box-bottom-n",12);
+# setprop(lw~"tmp/tile-type", "High-pressure");
+# setprop(lw~"tmp/tile-orientation-deg", 260.0);
+# setprop(lw~"tmp/windspeed-kt", 8.0);
+# setprop(lw~"tmp/gust-frequency-hz", 0.0);
+# setprop(lw~"tmp/gust-relative-strength",0.0);
+# setprop(lw~"tmp/gust-angular-variation-deg",0.0);
+# setprop(lw~"tmp/tile-alt-offset-ft", 0.0);
setprop(lw~"tmp/tile-alt-median-ft",0.0);
setprop(lw~"tmp/tile-alt-min-ft",0.0);
-setprop(lw~"tmp/tile-management", "realistic weather");
-setprop(lw~"tmp/presampling-flag", 1);
-setprop(lw~"tmp/asymmetric-tile-loading-flag", 0);
+# setprop(lw~"tmp/tile-management", "realistic weather");
+# setprop(lw~"tmp/asymmetric-tile-loading-flag", 0);
setprop(lw~"tmp/last-reading-pos-del",0);
setprop(lw~"tmp/last-reading-pos-mod",0);
setprop(lw~"tmp/thread-status", "idle");
@@ -4251,47 +4333,48 @@ setprop(lw~"tmp/convective-status", "idle");
setprop(lw~"tmp/presampling-status", "idle");
setprop(lw~"tmp/buffer-status", "idle");
setprop(lw~"tmp/buffer-tile-index", 0);
-setprop(lw~"tmp/FL0-wind-from-heading-deg",260.0);
-setprop(lw~"tmp/FL0-windspeed-kt",8.0);
-setprop(lw~"tmp/FL50-wind-from-heading-deg",262.0);
-setprop(lw~"tmp/FL50-windspeed-kt",11.0);
-setprop(lw~"tmp/FL100-wind-from-heading-deg",264.0);
-setprop(lw~"tmp/FL100-windspeed-kt",16.0);
-setprop(lw~"tmp/FL180-wind-from-heading-deg",265.0);
-setprop(lw~"tmp/FL180-windspeed-kt",24.0);
-setprop(lw~"tmp/FL240-wind-from-heading-deg",269.0);
-setprop(lw~"tmp/FL240-windspeed-kt",35.0);
-setprop(lw~"tmp/FL300-wind-from-heading-deg",273.0);
-setprop(lw~"tmp/FL300-windspeed-kt",45.0);
-setprop(lw~"tmp/FL340-wind-from-heading-deg",274.0);
-setprop(lw~"tmp/FL340-windspeed-kt",50.0);
-setprop(lw~"tmp/FL390-wind-from-heading-deg",273.0);
-setprop(lw~"tmp/FL390-windspeed-kt",56.0);
-setprop(lw~"tmp/FL450-wind-from-heading-deg",272.0);
-setprop(lw~"tmp/FL450-windspeed-kt",65.0);
+#setprop(lw~"tmp/FL0-wind-from-heading-deg",260.0);
+#setprop(lw~"tmp/FL0-windspeed-kt",8.0);
+#setprop(lw~"tmp/FL50-wind-from-heading-deg",262.0);
+#setprop(lw~"tmp/FL50-windspeed-kt",11.0);
+#setprop(lw~"tmp/FL100-wind-from-heading-deg",264.0);
+#setprop(lw~"tmp/FL100-windspeed-kt",16.0);
+#setprop(lw~"tmp/FL180-wind-from-heading-deg",265.0);
+#setprop(lw~"tmp/FL180-windspeed-kt",24.0);
+#setprop(lw~"tmp/FL240-wind-from-heading-deg",269.0);
+#setprop(lw~"tmp/FL240-windspeed-kt",35.0);
+#setprop(lw~"tmp/FL300-wind-from-heading-deg",273.0);
+#setprop(lw~"tmp/FL300-windspeed-kt",45.0);
+#setprop(lw~"tmp/FL340-wind-from-heading-deg",274.0);
+#setprop(lw~"tmp/FL340-windspeed-kt",50.0);
+#setprop(lw~"tmp/FL390-wind-from-heading-deg",273.0);
+#setprop(lw~"tmp/FL390-windspeed-kt",56.0);
+#setprop(lw~"tmp/FL450-wind-from-heading-deg",272.0);
+#setprop(lw~"tmp/FL450-windspeed-kt",65.0);
setprop(lw~"tmp/ipoint-latitude-deg",getprop("position/latitude-deg"));
setprop(lw~"tmp/ipoint-longitude-deg",getprop("position/longitude-deg"));
# set config values
-setprop(lw~"config/distance-to-load-tile-m",39000.0);
-setprop(lw~"config/distance-to-remove-tile-m",39500.0);
-setprop(lw~"config/detailed-clouds-flag",1);
-setprop(lw~"config/dynamics-flag",0);
-setprop(lw~"config/thermal-properties",1.0);
-setprop(lw~"config/wind-model","constant");
-setprop(lw~"config/buffer-flag",1);
-setprop(lw~"config/asymmetric-reduction",0.7);
-setprop(lw~"config/clouds-visible-range-m",30000.0);
-setprop(lw~"config/asymmetric-buffering-flag",0);
-setprop(lw~"config/asymmetric-buffering-reduction",0.3);
-setprop(lw~"config/asymmetric-buffering-angle-deg",90.0);
-setprop(lw~"config/clouds-in-dynamics-loop",250);
-setprop(lw~"config/debug-output-flag",0);
-setprop(lw~"config/generate-thermal-lift-flag", 0);
-setprop(lw~"config/dynamical-convection-flag", 0);
-setprop(lw~"config/thread-flag", 1);
+# setprop(lw~"config/distance-to-load-tile-m",39000.0);
+# setprop(lw~"config/distance-to-remove-tile-m",39500.0);
+# setprop(lw~"config/detailed-clouds-flag",1);
+# setprop(lw~"config/dynamics-flag",0);
+# setprop(lw~"config/thermal-properties",1.0);
+# setprop(lw~"config/wind-model","constant");
+# setprop(lw~"config/buffer-flag",1);
+# setprop(lw~"config/asymmetric-reduction",0.7);
+# setprop(lw~"config/clouds-visible-range-m",30000.0);
+# setprop(lw~"config/asymmetric-buffering-flag",0);
+# setprop(lw~"config/asymmetric-buffering-reduction",0.3);
+# setprop(lw~"config/asymmetric-buffering-angle-deg",90.0);
+# setprop(lw~"config/clouds-in-dynamics-loop",250);
+# setprop(lw~"config/debug-output-flag",0);
+# setprop(lw~"config/generate-thermal-lift-flag", 0);
+# setprop(lw~"config/dynamical-convection-flag", 0);
+# setprop(lw~"config/thread-flag", 1);
+# setprop(lw~"config/presampling-flag", 1);
# set the default loop flags to loops inactive
diff --git a/Nasal/weather_tile_management.nas b/Nasal/weather_tile_management.nas
index 2c3ab7d19..9488c5634 100644
--- a/Nasal/weather_tile_management.nas
+++ b/Nasal/weather_tile_management.nas
@@ -62,6 +62,35 @@ if ((local_weather.metar_flag == 1) and (getprop(lw~"METAR/station-id") != getpr
weather_tiles.set_METAR_weather_station();
}
+# compute the averaged framerate and see if cloud visibility needs to be adjusted
+
+if (local_weather.fps_control_flag == 1)
+ {
+ local_weather.fps_average = local_weather.fps_sum/local_weather.fps_samples;
+
+ # print("Average framerate: ", local_weather.fps_average);
+
+ local_weather.fps_sum = 0.0;
+ local_weather.fps_samples = 0;
+
+ if (local_weather.fps_average > 1.1 * local_weather.target_framerate)
+ {
+ var target_cloud_view_distance = cloud_view_distance * 1.1;
+ if (target_cloud_view_distance > 45000.0)
+ {target_cloud_view_distance = 45000.0;}
+ setprop(lw~"config/clouds-visible-range-m", target_cloud_view_distance);
+ }
+ if (local_weather.fps_average < 0.9 * local_weather.target_framerate)
+ {
+ var target_cloud_view_distance = cloud_view_distance * 0.9;
+ if (target_cloud_view_distance < 15000.0)
+ {target_cloud_view_distance = 15000.0;}
+ setprop(lw~"config/clouds-visible-range-m", target_cloud_view_distance);
+ }
+
+ }
+
+
foreach (var t; tNode) {
@@ -441,7 +470,7 @@ if (getprop(lw~"tmp/tile-management") == "repeat tile")
else if (code == "cold_sector") {weather_tiles.set_cold_sector_tile();}
else if (code == "warm_sector") {weather_tiles.set_warm_sector_tile();}
else if (code == "tropical_weather") {weather_tiles.set_tropical_weather_tile();}
- #else if (code == "test") {weather_tiles.set_4_8_stratus_tile;}
+ else if (code == "test") {weather_tiles.set_4_8_stratus_tile();}
else
{
print("Repeat tile not implemented with this tile type!");
@@ -450,50 +479,50 @@ if (getprop(lw~"tmp/tile-management") == "repeat tile")
}
else if (getprop(lw~"tmp/tile-management") == "realistic weather")
{
- var rn = rand();
+ var rn = rand() * getprop(lw~"config/large-scale-persistence");
if (code == "low_pressure_core")
{
- if (rn > 0.2) {weather_tiles.set_low_pressure_core_tile();}
+ if (rn > 0.1) {weather_tiles.set_low_pressure_core_tile();}
else {weather_tiles.set_low_pressure_tile();}
}
else if (code == "low_pressure")
{
- if (rn > 0.2) {weather_tiles.set_low_pressure_tile();}
- else if (rn > 0.1) {weather_tiles.set_low_pressure_core_tile();}
+ if (rn > 0.1) {weather_tiles.set_low_pressure_tile();}
+ else if (rn > 0.05) {weather_tiles.set_low_pressure_core_tile();}
else {weather_tiles.set_low_pressure_border_tile();}
}
else if (code == "low_pressure_border")
{
- if (rn > 0.4) {weather_tiles.set_low_pressure_border_tile();}
- else if (rn > 0.3) {weather_tiles.set_cold_sector_tile();}
- else if (rn > 0.2) {weather_tiles.set_warm_sector_tile();}
- else if (rn > 0.1) {weather_tiles.set_low_pressure_tile();}
+ if (rn > 0.2) {weather_tiles.set_low_pressure_border_tile();}
+ else if (rn > 0.15) {weather_tiles.set_cold_sector_tile();}
+ else if (rn > 0.1) {weather_tiles.set_warm_sector_tile();}
+ else if (rn > 0.05) {weather_tiles.set_low_pressure_tile();}
else {weather_tiles.set_high_pressure_border_tile();}
}
else if (code == "high_pressure_border")
{
- if (rn > 0.4) {weather_tiles.set_high_pressure_border_tile();}
- else if (rn > 0.3) {weather_tiles.set_cold_sector_tile();}
- else if (rn > 0.2) {weather_tiles.set_warm_sector_tile();}
- else if (rn > 0.1) {weather_tiles.set_high_pressure_tile();}
+ if (rn > 0.2) {weather_tiles.set_high_pressure_border_tile();}
+ else if (rn > 0.15) {weather_tiles.set_cold_sector_tile();}
+ else if (rn > 0.1) {weather_tiles.set_warm_sector_tile();}
+ else if (rn > 0.05) {weather_tiles.set_high_pressure_tile();}
else {weather_tiles.set_low_pressure_border_tile();}
}
else if (code == "high_pressure")
{
- if (rn > 0.2) {weather_tiles.set_high_pressure_tile();}
- else if (rn > 0.1) {weather_tiles.set_high_pressure_border_tile();}
+ if (rn > 0.1) {weather_tiles.set_high_pressure_tile();}
+ else if (rn > 0.05) {weather_tiles.set_high_pressure_border_tile();}
else {weather_tiles.set_high_pressure_core_tile();}
}
else if (code == "high_pressure_core")
{
- if (rn > 0.2) {weather_tiles.set_high_pressure_core_tile();}
+ if (rn > 0.1) {weather_tiles.set_high_pressure_core_tile();}
else {weather_tiles.set_high_pressure_tile();}
}
else if (code == "cold_sector")
{
- if (rn > 0.3) {weather_tiles.set_cold_sector_tile();}
- else if (rn > 0.2)
+ if (rn > 0.15) {weather_tiles.set_cold_sector_tile();}
+ else if (rn > 0.1)
{
if ((dir_index ==0) or (dir_index ==1) or (dir_index==2))
{weather_tiles.set_warmfront1_tile();}
@@ -502,13 +531,13 @@ else if (getprop(lw~"tmp/tile-management") == "realistic weather")
else if ((dir_index ==6) or (dir_index ==7) or (dir_index==8))
{weather_tiles.set_coldfront_tile();}
}
- else if (rn > 0.1) {weather_tiles.set_low_pressure_border_tile();}
+ else if (rn > 0.05) {weather_tiles.set_low_pressure_border_tile();}
else {weather_tiles.set_high_pressure_border_tile();}
}
else if (code == "warm_sector")
{
- if (rn > 0.3) {weather_tiles.set_warm_sector_tile();}
- else if (rn > 0.2)
+ if (rn > 0.15) {weather_tiles.set_warm_sector_tile();}
+ else if (rn > 0.1)
{
if ((dir_index ==0) or (dir_index ==1) or (dir_index==2))
{weather_tiles.set_coldfront_tile();}
@@ -517,7 +546,7 @@ else if (getprop(lw~"tmp/tile-management") == "realistic weather")
else if ((dir_index ==6) or (dir_index ==7) or (dir_index==8))
{weather_tiles.set_warmfront4_tile();}
}
- else if (rn > 0.1) {weather_tiles.set_low_pressure_border_tile();}
+ else if (rn > 0.05) {weather_tiles.set_low_pressure_border_tile();}
else {weather_tiles.set_high_pressure_border_tile();}
}
else if (code == "warmfront1")
@@ -525,7 +554,12 @@ else if (getprop(lw~"tmp/tile-management") == "realistic weather")
if ((dir_index ==0) or (dir_index ==1) or (dir_index==2))
{weather_tiles.set_warmfront2_tile();}
else if ((dir_index ==3) or (dir_index ==5))
- {weather_tiles.set_warmfront1_tile();}
+ {
+ if (rand() > 0.15)
+ {weather_tiles.set_warmfront1_tile();}
+ else
+ {weather_tiles.set_high_pressure_border_tile();}
+ }
else if ((dir_index ==6) or (dir_index ==7) or (dir_index==8))
{weather_tiles.set_cold_sector_tile();}
}
@@ -534,7 +568,12 @@ else if (getprop(lw~"tmp/tile-management") == "realistic weather")
if ((dir_index ==0) or (dir_index ==1) or (dir_index==2))
{weather_tiles.set_warmfront3_tile();}
if ((dir_index ==3) or (dir_index ==5))
- {weather_tiles.set_warmfront2_tile();}
+ {
+ if (rand() > 0.15)
+ {weather_tiles.set_warmfront2_tile();}
+ else
+ {weather_tiles.set_high_pressure_border_tile();}
+ }
if ((dir_index ==6) or (dir_index ==7) or (dir_index==8))
{weather_tiles.set_warmfront1_tile();}
}
@@ -543,7 +582,12 @@ else if (getprop(lw~"tmp/tile-management") == "realistic weather")
if ((dir_index ==0) or (dir_index ==1) or (dir_index==2))
{weather_tiles.set_warmfront4_tile();}
if ((dir_index ==3) or (dir_index ==5))
- {weather_tiles.set_warmfront3_tile();}
+ {
+ if (rand() > 0.15)
+ {weather_tiles.set_warmfront3_tile();}
+ else
+ {weather_tiles.set_low_pressure_border_tile();}
+ }
if ((dir_index ==6) or (dir_index ==7) or (dir_index==8))
{weather_tiles.set_warmfront2_tile();}
}
@@ -552,7 +596,12 @@ else if (getprop(lw~"tmp/tile-management") == "realistic weather")
if ((dir_index ==0) or (dir_index ==1) or (dir_index==2))
{weather_tiles.set_warm_sector_tile();}
if ((dir_index ==3) or (dir_index ==5))
- {weather_tiles.set_warmfront4_tile();}
+ {
+ if (rand() > 0.15)
+ {weather_tiles.set_warmfront4_tile();}
+ else
+ {weather_tiles.set_low_pressure_tile();}
+ }
if ((dir_index ==6) or (dir_index ==7) or (dir_index==8))
{weather_tiles.set_warmfront3_tile();}
}
@@ -561,7 +610,12 @@ else if (getprop(lw~"tmp/tile-management") == "realistic weather")
if ((dir_index ==0) or (dir_index ==1) or (dir_index==2))
{weather_tiles.set_cold_sector_tile();}
else if ((dir_index ==3) or (dir_index ==5))
- {weather_tiles.set_coldfront_tile();}
+ {
+ if (rand() > 0.15)
+ {weather_tiles.set_coldfront_tile();}
+ else
+ {weather_tiles.set_high_pressure_border_tile();}
+ }
else if ((dir_index ==6) or (dir_index ==7) or (dir_index==8))
{weather_tiles.set_warm_sector_tile();}
}
@@ -1379,8 +1433,7 @@ var lon_to_m = 0.0; #local_weather.lon_to_m;
var m_to_lon = 0.0; # local_weather.m_to_lon;
var lw = "/local-weather/";
-var cloud_view_distance = 20000.0;
-
+var cloud_view_distance = getprop(lw~"config/clouds-visible-range-m");
var modelArrays = [];
var active_tile_list = [];
diff --git a/Nasal/weather_tiles.nas b/Nasal/weather_tiles.nas
index 6922da128..e48a952d5 100644
--- a/Nasal/weather_tiles.nas
+++ b/Nasal/weather_tiles.nas
@@ -29,7 +29,10 @@ var current_code = getprop(lw~"tiles/code");
var dir_index = getprop(lw~"tiles/tmp/dir-index");
props.globals.getNode(lw~"tiles").getChild("tile",dir_index).getNode("code").setValue(current_code);
+#print(current_code, getprop(lw~"tiles/tmp/code"));
+if (current_code != getprop(lw~"tiles/tmp/code"))
+ {weather_tiles.rnd_store = rand();}
# generate a handling array for models
@@ -95,7 +98,7 @@ calc_geo(blat);
local_weather.set_weather_station(blat, blon, alt_offset, 20000.0, 14.0, 12.0, 29.78);
-create_8_8_nimbus_var3(blat, blon, 2000.0 + alt_offset+local_weather.cloud_vertical_size_map["Nimbus"] * 0.5 * m_to_ft, 0.0);
+# create_8_8_nimbus_var3(blat, blon, 2000.0 + alt_offset+local_weather.cloud_vertical_size_map["Nimbus"] * 0.5 * m_to_ft, 0.0);
#create_2_8_sstratus_streak(blat, blon,5000.0,0.0);
@@ -105,7 +108,7 @@ create_8_8_nimbus_var3(blat, blon, 2000.0 + alt_offset+local_weather.cloud_verti
# create_2_8_cirrocumulus(blat, blon, 6000.0, 0.0);
-#create_detailed_stratocumulus_bank(blat, blon,5000.0+alt_offset,0.0);
+create_detailed_small_stratocumulus_bank(blat, blon,3000.0+alt_offset,0.0);
#create_4_8_altocumulus_perlucidus(blat, blon, 10000.0, 0.0);
@@ -151,7 +154,7 @@ calc_geo(blat);
# get probabilistic values for the weather parameters
-var vis = 35000.0 + rand() * 20000.0;
+var vis = 30000.0 + rand() * 15000.0;
var T = 20.0 + rand() * 10.0;
var spread = 5.0 + 3.0 * rand();
var D = T - spread;
@@ -164,11 +167,16 @@ local_weather.set_weather_station(blat, blon, alt_offset, vis, T, D, p * hp_to_i
var alt = spread * 1000;
var strength = 0.0;
+
var rn = rand();
+if (rand() < small_scale_persistence)
+ {rn = rnd_store;}
+else
+ {rnd_store = rn;}
-if (rn > 0.66)
+if (rn > 0.8)
{
# cloud scenario 1: weak cumulus development and blue thermals
@@ -186,7 +194,7 @@ if (rn > 0.66)
}
}
-else if (rn > 0.33)
+else if (rn > 0.6)
{
# cloud scenario 2: some Cirrocumulus patches
@@ -194,8 +202,10 @@ else if (rn > 0.33)
local_weather.create_cumosys(blat,blon, alt + alt_offset, get_n(strength), 20000.0);
create_2_8_cirrocumulus(blat, blon, alt + alt_offset + 5000.0, alpha);
+
+ create_2_8_cirrus(blat, blon, alt + alt_offset + 35000.0, alpha);
}
-else if (rn > 0.0)
+else if (rn > 0.4)
{
# cloud scenario 3: Cirrostratus undulatus over weak cumulus
@@ -204,6 +214,27 @@ else if (rn > 0.0)
create_4_8_cirrostratus_undulatus(blat, blon, alt + alt_offset + 32000.0, alpha);
}
+else if (rn > 0.2)
+ {
+ # cloud scenario 4: Cirrostratus undulatus streak
+
+ strength = rand() * 0.03;
+ local_weather.create_cumosys(blat,blon, alt + alt_offset, get_n(strength), 20000.0);
+
+ create_1_8_cirrostratus_undulatus(blat, blon, alt + alt_offset + 32000.0, alpha);
+ }
+else if (rn > 0.0)
+ {
+ # cloud scenario 5: Cirrus
+
+ create_2_8_cirrus(blat, blon, alt + alt_offset + 35000.0, alpha);
+
+
+ create_1_8_cirrostratus_undulatus(blat, blon, alt + alt_offset + 28000.0, alpha);
+
+
+ create_1_8_cirrostratus_undulatus(blat, blon, alt + alt_offset + 28000.0, alpha);
+ }
# store convective altitude and strength
@@ -261,9 +292,14 @@ var strength = 0.0;
var rn = rand();
+if (rand() < small_scale_persistence)
+ {rn = rnd_store;}
+else
+ {rnd_store = rn;}
+# rn = 0.1;
-if (rn > 0.75)
+if (rn > 0.8)
{
# cloud scenario 1: possible Cirrus over Cumulus
strength = 0.2 + rand() * 0.4;
@@ -285,7 +321,7 @@ if (rn > 0.75)
}
}
-else if (rn > 0.5)
+else if (rn > 0.6)
{
# cloud scenario 2: Cirrostratus over weak Cumulus
@@ -295,7 +331,7 @@ else if (rn > 0.5)
create_2_8_cirrostratus(blat, blon, alt+alt_offset+25000.0, alpha);
}
-else if (rn > 0.25)
+else if (rn > 0.4)
{
# cloud scenario 3: Cirrocumulus sheet over Cumulus
@@ -310,7 +346,7 @@ else if (rn > 0.25)
compat_layer.create_cloud(path, blat + get_lat(x,y,phi), blon+get_lon(x,y,phi), alt + alt_offset +24000,alpha);
}
-else if (rn > 0.0)
+else if (rn > 0.2)
{
# cloud scenario 4: Cirrostratus undulatus over weak Cumulus
@@ -319,6 +355,17 @@ else if (rn > 0.0)
create_4_8_cirrostratus_undulatus(blat, blon, alt + alt_offset + 25000.0, alpha);
}
+else if (rn > 0.0)
+ {
+ # cloud scenario 5: some scattered Altocumuli over Cumulus
+
+ strength = 0.25 + rand() * 0.1;
+ local_weather.create_cumosys(blat,blon, alt + alt_offset, get_n(strength), 20000.0);
+
+ create_1_8_altocumulus_scattered(blat, blon, alt+alt_offset+10000.0, alpha);
+
+ create_1_8_cirrostratus_undulatus(blat, blon, alt + alt_offset + 25000.0, alpha);
+ }
# store convective altitude and strength
@@ -375,6 +422,10 @@ var strength = 0.0;
var rn = rand();
+if (rand() < small_scale_persistence)
+ {rn = rnd_store;}
+else
+ {rnd_store = rn;}
if (rn > 0.875)
{
@@ -476,6 +527,7 @@ else if (rn > 0.0)
create_4_8_altocumulus_perlucidus(blat, blon, alt + 10000.0 + alt_offset, alpha);
+ create_2_8_cirrus(blat, blon, alt + 30000.0 + alt_offset, alpha);
}
@@ -507,10 +559,8 @@ var lon = 0.0;
var alpha = getprop(lw~"tmp/tile-orientation-deg");
var phi = alpha * math.pi/180.0;
-if (getprop(lw~"tmp/presampling-flag") == 0)
- {var alt_offset = getprop(lw~"tmp/tile-alt-offset-ft");}
-else
- {var alt_offset = getprop(lw~"tmp/tile-alt-layered-ft");}
+
+var alt_offset = getprop(lw~"tmp/tile-alt-offset-ft");
# get tile center coordinates
@@ -538,76 +588,87 @@ var strength = 0.0;
var rn = rand();
-if (rn > 0.875)
- {
- # cloud scenario 1: a low 4/8 stratus patches, thin patches above
+if (rand() < small_scale_persistence)
+ {rn = rnd_store;}
+else
+ {rnd_store = rn;}
- alt = alt + local_weather.cloud_vertical_size_map["Stratus"] * 0.5 * m_to_ft;
- create_4_8_stratus_patches(blat, blon, alt+alt_offset,alpha);
- create_4_8_tstratus_patches(blat, blon, alt+alt_offset+6000,alpha);
- }
-else if (rn > 0.75)
- {
- # cloud scenario 2: a low 4/8 undulatus, thin patches above
+# rn = 0.1;
- alt = alt + local_weather.cloud_vertical_size_map["Stratus"] * 0.5 * m_to_ft;
- create_4_8_sstratus_undulatus(blat, blon, alt+alt_offset,alpha);
- create_2_8_tstratus(blat, blon, alt+alt_offset+7000,alpha);
- }
-else if (rn > 0.625)
+if (rn > 0.857)
{
- # cloud scenario 3: low Stratocumulus
+ # cloud scenario 1: low Stratocumulus, thin streaks above
+
+ strength = 0.05 + rand() * 0.1;
+ local_weather.create_cumosys(blat,blon, alt + alt_offset, get_n(strength), 20000.0);
- # alt = alt + local_weather.cloud_vertical_size_map["Cumulus"] * 0.5 * m_to_ft;
create_detailed_stratocumulus_bank(blat, blon, alt+alt_offset,alpha);
- create_2_8_sstratus(blat, blon, alt+alt_offset+6000,alpha);
- create_2_8_tstratus(blat, blon, alt+alt_offset+9000,alpha);
- }
-else if (rn > 0.5)
- {
- # cloud scenario 4: dense low Stratocumulus
- # alt = alt + local_weather.cloud_vertical_size_map["Cumulus"] * 0.5 * m_to_ft;
- create_detailed_stratocumulus_bank(blat, blon, alt+alt_offset,alpha);
- create_detailed_stratocumulus_bank(blat, blon, alt+alt_offset,alpha);
- create_2_8_sstratus(blat, blon, alt+alt_offset+8000,alpha);
+ create_4_8_alttstratus_streaks(blat, blon, alt+alt_offset+4000.0,alpha);
}
-else if (rn > 375)
+else if (rn > 0.714)
{
- # cloud scenario 5: Cirrocumulus over 4/8 Stratus
+ # cloud scenario 2: weak Cumulus, Stratus undulatus above
+ strength = 0.15 + rand() * 0.15;
+ local_weather.create_cumosys(blat,blon, alt + alt_offset, get_n(strength), 20000.0);
+
+ create_6_8_tstratus_undulatus(blat, blon, alt+alt_offset+4000.0,alpha);
+
+ create_2_8_alttstratus(blat, blon, alt+alt_offset+7000.0,alpha);
+ }
+else if (rn > 0.571)
+ {
+ # cloud scenario 3: Stratocumulus banks with patches above
+
+ create_detailed_stratocumulus_bank(blat, blon, alt+alt_offset,alpha);
+ create_detailed_small_stratocumulus_bank(blat, blon, alt+alt_offset,alpha);
+
+ create_4_8_alttstratus_patches(blat, blon, alt+alt_offset+4000.0,alpha);
+ }
+else if (rn > 0.428)
+ {
+ # cloud scenario 4: structured Stratus
+
alt = alt + local_weather.cloud_vertical_size_map["Stratus"] * 0.5 * m_to_ft;
create_4_8_sstratus_patches(blat, blon, alt+alt_offset,alpha);
- create_4_8_cirrocumulus_bank(blat, blon, alt+alt_offset + 12000.0, alpha);
+ create_2_8_alttstratus(blat, blon, alt+alt_offset+7000.0,alpha);
}
-else if (rn > 0.250)
+else if (rn > 0.285)
{
- # cloud scenario 6: Cirrostratus over 4/8 Stratus undulatus
+ # cloud scenario 5: Stratus blending with Cumulus with Cirrocumulus above
+
+ strength = 0.1 + rand() * 0.1;
+ local_weather.create_cumosys(blat,blon, alt + alt_offset, get_n(strength), 20000.0);
- alt = alt + local_weather.cloud_vertical_size_map["Stratus"] * 0.5 * m_to_ft;
-
- create_6_8_stratus_undulatus(blat, blon, alt+alt_offset,alpha);
-
- create_4_8_cirrostratus_undulatus(blat, blon, alt+alt_offset+24000,alpha);
+ create_4_8_tstratus_patches(blat, blon, alt+alt_offset,alpha);
+
+ create_4_8_cirrocumulus_undulatus(blat, blon, alt+alt_offset + 12000.0,alpha);
}
-else if (rn > 0.125)
+else if (rn > 0.142)
{
- # cloud scenario 7: thin stratus
+ # cloud scenario 6: small Stratocumulus banks
- create_4_8_alttstratus_streaks(blat, blon, alt+alt_offset,alpha);
+ create_detailed_small_stratocumulus_bank(blat, blon, alt+alt_offset,alpha);
+ create_detailed_small_stratocumulus_bank(blat, blon, alt+alt_offset,alpha);
- create_2_8_sstratus(blat, blon, alt+alt_offset+6000,alpha);
+ create_4_8_tstratus_patches(blat, blon, alt+alt_offset,alpha);
+
+ create_2_8_cirrostratus(blat, blon, alt+alt_offset + 25000.0,alpha);
}
-else if (rn > 0.0)
+else
{
- # cloud scenario 8: thin stratus
-
- create_4_8_alttstratus_patches(blat, blon, alt+alt_offset,alpha);
+ # cloud scenario 7: blended structured and unstructured Stratiform clouds
- create_4_8_cirrostratus_undulatus(blat, blon, alt+alt_offset+25000,alpha);
+ create_4_8_tstratus_patches(blat, blon, alt+alt_offset,alpha);
+ create_4_8_sstratus_patches(blat, blon, alt+alt_offset,alpha);
+
+ create_2_8_cirrostratus(blat, blon, alt+alt_offset + 25000.0,alpha);
}
+
+
# store convective altitude and strength
append(weather_dynamics.tile_convective_altitude,alt);
@@ -666,7 +727,10 @@ var strength = 0.0;
var rn = rand();
-
+if (rand() < small_scale_persistence)
+ {rn = rnd_store;}
+else
+ {rnd_store = rn;}
if (rn > 0.75)
{
@@ -784,18 +848,23 @@ var alt = spread * 1000.0 + local_weather.cloud_vertical_size_map["Nimbus"] * 0.
var strength = 0.0;
-create_8_8_nimbus(blat, blon, alt+alt_offset, alpha);
+create_8_8_nimbus_rain(blat, blon, alt+alt_offset, alpha,0.4 + rand()*0.2);
# and a precipitation layer below, more rain in the center of the tile
-local_weather.create_effect_volume(3, blat, blon, 20000.0, 20000.0, alpha, 0.0, alt + alt_offset, 3000.0, 0.3, -1, -1, -1,0 ,0.95);
-local_weather.create_effect_volume(3, blat , blon, 16000.0, 16000.0, alpha, 0.0, alt + alt_offset - 300.0, 1500.0, 0.5, -1, -1, -1,0 ,0.8);
+#local_weather.create_effect_volume(3, blat, blon, 20000.0, 20000.0, alpha, 0.0, alt + alt_offset, 3000.0, 0.3, -1, -1, -1,0 ,0.95);
+#local_weather.create_effect_volume(3, blat , blon, 16000.0, 16000.0, alpha, 0.0, alt + alt_offset - 300.0, 1500.0, 0.5, -1, -1, -1,0 ,0.8);
# and some broken Stratus cover above
var rn = rand();
+if (rand() < small_scale_persistence)
+ {rn = rnd_store;}
+else
+ {rnd_store = rn;}
+
if (rn > 0.5){create_4_8_stratus_patches(blat, blon, alt+alt_offset+3000.0, alpha);}
else {create_4_8_stratus(blat, blon, alt+alt_offset+3000.0, alpha);}
@@ -851,6 +920,11 @@ var strength = 0.0;
var rn = rand();
+if (rand() < small_scale_persistence)
+ {rn = rnd_store;}
+else
+ {rnd_store = rn;}
+
#rn = 0.1;
if (rn > 0.5)
@@ -935,6 +1009,10 @@ var strength = 0.0;
var rn = rand();
+if (rand() < small_scale_persistence)
+ {rn = rnd_store;}
+else
+ {rnd_store = rn;}
if (rn > 0.8)
{
@@ -1054,6 +1132,7 @@ var t_factor = 0.5 * (1.0-math.cos((t * sec_to_rad)-0.9));
var rn = rand();
+
if (rn > (t_factor * t_factor * t_factor * t_factor)) # call a normal convective cloud system
{
strength = 1.0 + rand() * 0.2;
@@ -1067,6 +1146,11 @@ else
rn = rand();
+if (rand() < small_scale_persistence)
+ {rn = rnd_store;}
+else
+ {rnd_store = rn;}
+
if (rn > 0.2)
{
# cloud scenario 1: 1-2 medium sized storms
@@ -2142,10 +2226,10 @@ var set_METAR_weather_station = func {
var gust_angvar = 0.5 * weather_tile_management.relangle(wind_range_from, wind_range_to);
- if (gust_strength > 0.0)
+ if ((gust_strength > 0.0) or (gust_angvar > 0.0))
{
var gust_relative_strength = (gust_strength - windspeed)/windspeed;
- setprop(lw~"tmp/gust-frequency-hz", 1.0);
+ setprop(lw~"tmp/gust-frequency-hz", 0.2 + rand()*0.8);
}
else
{
@@ -2436,12 +2520,16 @@ var create_4_8_tstratus_patches = func (lat, lon, alt, alpha) {
var phi = alpha * math.pi/180.0;
-for (var i=0; i<16; i=i+1)
+for (var i=0; i<22; i=i+1)
{
var x = 2.0 * (rand()-0.5) * 18000;
var y = 2.0 * (rand()-0.5) * 18000;
var beta = (rand() -0.5) * 180.0;
- local_weather.create_streak("Stratus (thin)",lat+get_lat(x,y,phi), lon+get_lon(x,y,phi), alt,300.0,4,950.0,0.2,500.0,6,950.0,0.2,500.0,alpha+beta,1.0);
+
+ var m = int(3 + rand() * 3);
+ var n = int(3 + rand() * 5);
+
+ local_weather.create_streak("Stratus (thin)",lat+get_lat(x,y,phi), lon+get_lon(x,y,phi), alt,300.0,m,1000.0,0.2,500.0,n,1000.0,0.2,500.0,alpha+beta,1.0);
}
@@ -2452,12 +2540,14 @@ var create_4_8_sstratus_patches = func (lat, lon, alt, alpha) {
var phi = alpha * math.pi/180.0;
-for (var i=0; i<16; i=i+1)
+for (var i=0; i<22; i=i+1)
{
var x = 2.0 * (rand()-0.5) * 18000;
var y = 2.0 * (rand()-0.5) * 18000;
var beta = (rand() -0.5) * 180.0;
- local_weather.create_streak("Stratus (structured)",lat+get_lat(x,y,phi), lon+get_lon(x,y,phi), alt,300.0,4,950.0,0.2,500.0,6,950.0,0.2,500.0,alpha+beta,1.0);
+ var m = int(3 + rand() * 5);
+ var n = int(3 + rand() * 5);
+ local_weather.create_streak("Stratus (structured)",lat+get_lat(x,y,phi), lon+get_lon(x,y,phi), alt,300.0,m,1000.0,0.2,500.0,n,1000.0,0.2,500.0,alpha+beta,1.0);
}
@@ -2726,6 +2816,17 @@ for (var i=0; i<25; i=i+1)
}
+var create_2_8_cirrus = func (lat, lon, alt, alpha) {
+
+var phi = alpha * math.pi/180.0;
+
+var x = 2.0 * (rand()-0.5) * 3000;
+var y = 2.0 * (rand()-0.5) * 3000;
+
+
+local_weather.create_streak("Cirrus",lat+get_lat(x,y,phi), lon+get_lon(x,y,phi), alt,1500.0,3,12000.0,0.0, 4000.0, 3,12000.0,0.0,4000.0,alpha,1.0);
+
+}
var create_2_8_alttstratus = func (lat, lon, alt, alpha) {
@@ -2757,6 +2858,25 @@ for (var i=0; i<2; i=i+1)
}
+var create_1_8_altocumulus_scattered = func (lat, lon, alt, alpha) {
+
+var phi = alpha * math.pi/180.0;
+
+
+local_weather.create_streak("Altocumulus",lat, lon, alt,1500.0,15,0.0,0.2,19000.0,15,0.0,0.2,19000.0,alpha ,0.0);
+
+for (var i=0; i<6; i=i+1)
+{
+ var x = 2.0 * (rand()-0.5) * 14000;
+ var y = 2.0 * (rand()-0.5) * 14000;
+ var tri = 1.0 + rand();
+
+ local_weather.create_streak("Altocumulus",lat+get_lat(x,y,phi), lon+get_lon(x,y,phi), alt,1500.0,10,750.0,0.1,800.0,4,550.0,0.1,500.0,alpha ,tri);
+ }
+
+}
+
+
var create_1_8_cirrocumulus = func (lat, lon, alt, alpha) {
var phi = alpha * math.pi/180.0;
@@ -2777,6 +2897,12 @@ for (var i = 0; i < 2; i = i + 1)
}
+var create_1_8_cirrostratus_undulatus = func (lat, lon, alt, alpha) {
+
+local_weather.create_undulatus("Cirrostratus",lat, lon, alt,300.0,1,8000.0,0.0,400.0,40,1000.0,0.1,100.0, 1500.0, alpha,1.0);
+}
+
+
var create_1_8_contrails = func (lat, lon, alt, alpha) {
@@ -2854,16 +2980,44 @@ var y = 2.0 * (rand()-0.5) * 6000;
var tri = 1.5 + 1.5*rand();
var beta = (rand() -0.5) * 60.0;
+var m = int(7 + rand() * 7);
+var n = int(9 + rand() * 7);
+
var alt_offset = 0.5 * local_weather.cloud_vertical_size_map["Cumulus"] * ft_to_m;
-local_weather.create_streak("Stratocumulus",lat+get_lat(x,y+7500,phi), lon+get_lon(x,y+7500,phi), alt + alt_offset,500.0,12,1000.0,0.1,400.0,15,1000.0,0.1,400.0,alpha+90.0+beta,tri);
+local_weather.create_streak("Stratocumulus",lat+get_lat(x,y+7500,phi), lon+get_lon(x,y+7500,phi), alt + alt_offset,500.0,m,1100.0,0.1,400.0,n,1100.0,0.1,400.0,alpha+90.0+beta,tri);
-local_weather.create_streak("Stratocumulus",lat+get_lat(x,y-7500,phi), lon+get_lon(x,y-7500,phi), alt + alt_offset,500.0,12,1000.0,0.1,400.0,15,1000.0,0.1,400.0,alpha+270.0+beta,tri);
+local_weather.create_streak("Stratocumulus",lat+get_lat(x,y-7500,phi), lon+get_lon(x,y-7500,phi), alt + alt_offset,500.0,m,1100.0,0.1,400.0,n,1100.0,0.1,400.0,alpha+270.0+beta,tri);
-local_weather.create_streak("Stratocumulus bottom",lat+get_lat(x,y+5250,phi), lon+get_lon(x,y+5250,phi), alt,0.0,10,700.0,0.2,400.0,15,700.0,0.0,400.0,alpha+90.0+beta,tri);
+local_weather.create_streak("Stratocumulus bottom",lat+get_lat(x,y+5250,phi), lon+get_lon(x,y+5250,phi), alt,0.0,m+1,700.0,0.2,400.0,n+1,700.0,0.0,400.0,alpha+90.0+beta,tri);
-local_weather.create_streak("Stratocumulus bottom",lat+get_lat(x,y-5250,phi), lon+get_lon(x,y-5250,phi), alt,0.0,10,700.0,0.2,400.0,15,700.0,0.0,400.0,alpha+270.0+beta,tri);
+local_weather.create_streak("Stratocumulus bottom",lat+get_lat(x,y-5250,phi), lon+get_lon(x,y-5250,phi), alt,0.0,m+1,700.0,0.2,400.0,n+1,700.0,0.0,400.0,alpha+270.0+beta,tri);
+
+}
+
+
+var create_detailed_small_stratocumulus_bank = func (lat, lon, alt, alpha) {
+
+var phi = alpha * math.pi/180.0;
+var x = 2.0 * (rand()-0.5) * 12000;
+var y = 2.0 * (rand()-0.5) * 12000;
+var tri = 1.5 + 1.5*rand();
+var beta = (rand() -0.5) * 60.0;
+
+var m = int(5 + rand() * 5);
+var n = int(6 + rand() * 5);
+
+var alt_offset = 0.5 * local_weather.cloud_vertical_size_map["Cumulus"] * ft_to_m;
+
+local_weather.create_streak("Stratocumulus",lat+get_lat(x,y+7500,phi), lon+get_lon(x,y+7500,phi), alt + alt_offset,500.0,m,1100.0,0.12,400.0,n,1100.0,0.12,400.0,alpha+90.0+beta,tri);
+
+local_weather.create_streak("Stratocumulus",lat+get_lat(x,y-7500,phi), lon+get_lon(x,y-7500,phi), alt + alt_offset,500.0,m,1100.0,0.12,400.0,n,1100.0,0.12,400.0,alpha+270.0+beta,tri);
+
+
+local_weather.create_streak("Stratocumulus bottom",lat+get_lat(x,y+7050,phi), lon+get_lon(x,y+7050,phi), alt,0.0,m,700.0,0.2,400.0,n,700.0,0.0,400.0,alpha+90.0+beta,tri);
+
+local_weather.create_streak("Stratocumulus bottom",lat+get_lat(x,y-7050,phi), lon+get_lon(x,y-7050,phi), alt,0.0,m,700.0,0.2,400.0,n,700.0,0.0,400.0,alpha+270.0+beta,tri);
}
@@ -3012,6 +3166,9 @@ var lon_to_m = 0.0; # needs to be calculated dynamically
var m_to_lon = 0.0; # we do this on startup
var lw = "/local-weather/";
+var small_scale_persistence = getprop(lw~"config/small-scale-persistence");
+var rnd_store = 0.0;
+
var elat = [];
var elon = [];
var erad = [];
diff --git a/gui/dialogs/local_weather.xml b/gui/dialogs/local_weather.xml
index 6561adba8..e0130e620 100644
--- a/gui/dialogs/local_weather.xml
+++ b/gui/dialogs/local_weather.xml
@@ -10,6 +10,8 @@
false
+
+
10570
@@ -62,7 +64,7 @@
0525
-
+
100
@@ -101,7 +103,7 @@
dialog-apply
-
+
203
@@ -231,7 +233,7 @@
0440
-
+
100
@@ -426,7 +428,7 @@
1650
-
+
245
@@ -440,7 +442,7 @@
3200
-
+
410
@@ -649,7 +651,7 @@
0195
-
+
100
diff --git a/gui/dialogs/local_weather_config.xml b/gui/dialogs/local_weather_config.xml
index 1be6c2729..5826cff85 100644
--- a/gui/dialogs/local_weather_config.xml
+++ b/gui/dialogs/local_weather_config.xml
@@ -2,7 +2,7 @@
-
+
local_weather_config400
@@ -18,19 +18,19 @@
60
- 340
+ 34510
- 320
+ 32560
- 320
+ 3251002029000.0
@@ -43,14 +43,14 @@
170
- 320
+ 325250
- 350
+ 3551515
@@ -62,13 +62,13 @@
220
- 320
+ 325250
- 320
+ 325100200.5
@@ -81,32 +81,32 @@
360
- 320
+ 3255
- 280
+ 28560
- 260
+ 26510
- 240
+ 24560
- 240
+ 2451002015000.0
@@ -119,14 +119,14 @@
170
- 240
+ 245250
- 270
+ 2751515
@@ -138,13 +138,13 @@
220
- 240
+ 245250
- 240
+ 245100200.2
@@ -157,26 +157,26 @@
360
- 240
+ 245170
- 210
+ 215220
- 210
+ 215250
- 210
+ 215100200.0
@@ -189,35 +189,71 @@
360
- 210
+ 215
+
+ 30
+ 185
+ 15
+ 15
+
+ /local-weather/config/fps-control-flag
+
+ dialog-apply
+
+
+
+
+ 200
+ 180
+
+
+
+
+ 250
+ 180
+ 100
+ 20
+ 10.0
+ 40.0
+ /local-weather/config/target-framerate
+
+ dialog-apply
+
+
+
+
+ 355
+ 180
+
+5
- 160
+ 150
- 60
- 140
+ 55
+ 13010
- 120
+ 11060
- 120
+ 11010020100
@@ -230,12 +266,80 @@
170
- 120
+ 110
+
+ 5
+ 80
+
+
+
+ 15
+ 45
+
+
+
+
+ 78
+ 60
+
+
+
+
+ 60
+ 45
+ 100
+ 20
+ 0.5
+ 2.0
+ /local-weather/config/large-scale-persistence
+
+ dialog-apply
+
+
+
+
+ 165
+ 45
+
+
+
+
+
+ 205
+ 45
+
+
+
+
+ 257
+ 60
+
+
+
+
+ 250
+ 45
+ 100
+ 20
+ 0.0
+ 1.0
+ /local-weather/config/small-scale-persistence
+
+ dialog-apply
+
+
+
+
+ 355
+ 45
+
+
+
10
diff --git a/gui/dialogs/local_weather_tiles.xml b/gui/dialogs/local_weather_tiles.xml
index 0f08aebb7..da833826e 100644
--- a/gui/dialogs/local_weather_tiles.xml
+++ b/gui/dialogs/local_weather_tiles.xml
@@ -35,10 +35,18 @@
ColdfrontWarmfrontTropical
-
+ Test tiledialog-apply
+
@@ -100,7 +108,7 @@
50200.0
- 1.0
+ 2.0/local-weather/tmp/gust-frequency-hzdialog-apply
@@ -205,7 +213,7 @@
1515
- /local-weather/tmp/presampling-flag
+ /local-weather/config/presampling-flagdialog-apply
@@ -330,7 +338,7 @@
0
- true
+
nasal
@@ -341,7 +349,7 @@
1350
- true
+
Escdialog-close
@@ -352,7 +360,7 @@
2000
- true
+
dialog-showlocal_weather_winds
diff --git a/gui/dialogs/map.xml b/gui/dialogs/map.xml
index 490f834a7..d5aa0f975 100644
--- a/gui/dialogs/map.xml
+++ b/gui/dialogs/map.xml
@@ -57,8 +57,12 @@ command interface /autopilot/route-manager/input:
vbox
-
-
+
+
+
+
+
+
100/gui/map/draw-fixestrue
@@ -68,10 +72,10 @@ command interface /autopilot/route-manager/input:
property-toggle
-
+
-
-
+
+
100/gui/map/draw-navaidstrue
@@ -81,7 +85,7 @@ command interface /autopilot/route-manager/input:
property-toggle
-
+
-
-
+
+
100/gui/map/draw-traffictrue
@@ -100,7 +104,7 @@ command interface /autopilot/route-manager/input:
property-toggle
-
+
-
-
+
+
100/gui/map/draw-datatrue
@@ -120,12 +124,12 @@ command interface /autopilot/route-manager/input:
property-toggle
-
+
true
-
-
+
+
100/gui/map/centre-on-aircrafttrue
@@ -135,10 +139,10 @@ command interface /autopilot/route-manager/input:
property-toggle
-
+
-
-
+
+
100/gui/map/aircraft-heading-uptrue
@@ -148,10 +152,10 @@ command interface /autopilot/route-manager/input:
property-toggle
-
+
-
-
+
+
100/gui/map/magnetic-headingstrue
@@ -161,7 +165,7 @@ command interface /autopilot/route-manager/input:
property-toggle
-
+
true
diff --git a/gui/dialogs/replay.xml b/gui/dialogs/replay.xml
index 16e5ae53d..493173d82 100644
--- a/gui/dialogs/replay.xml
+++ b/gui/dialogs/replay.xml
@@ -87,6 +87,15 @@
+
+ 2
1
+ left
+ /sim/replay/looped
+
+
+ dialog-apply
+
+
diff --git a/keyboard.xml b/keyboard.xml
index 3aea16bd2..06f7f9423 100644
--- a/keyboard.xml
+++ b/keyboard.xml
@@ -951,20 +951,7 @@ top down before the key bindings are parsed.
pToggle the pause state of the sim
- property-toggle
- /sim/freeze/master
-
-
- property-toggle
- /sim/freeze/clock
-
-
-
- /sim/freeze/replay-state
-
- property-assign
- /sim/replay/disable
- true
+ pause
@@ -1119,20 +1106,7 @@ top down before the key bindings are parsed.
F3Capture screen
- nasal
-
+ screen-captureLoad panel
diff --git a/preferences.xml b/preferences.xml
index 430e08ba5..a4938454b 100644
--- a/preferences.xml
+++ b/preferences.xml
@@ -10,6 +10,8 @@ Started September 2000 by David Megginson, david@megginson.com
+
+
@@ -674,6 +676,7 @@ Started September 2000 by David Megginson, david@megginson.com
901
+ true