Tentative improvements to AW gust modeling
This commit is contained in:
parent
9020bda565
commit
04524c0cca
5 changed files with 109 additions and 26 deletions
|
@ -19,6 +19,7 @@
|
||||||
<detailed-terrain-interaction-flag type="bool" userarchive="y">0</detailed-terrain-interaction-flag>
|
<detailed-terrain-interaction-flag type="bool" userarchive="y">0</detailed-terrain-interaction-flag>
|
||||||
<realistic-visibility-flag type="bool" userarchive="y">0</realistic-visibility-flag>
|
<realistic-visibility-flag type="bool" userarchive="y">0</realistic-visibility-flag>
|
||||||
<thread-flag type="bool" userarchive="n">1</thread-flag>
|
<thread-flag type="bool" userarchive="n">1</thread-flag>
|
||||||
|
<turbulence-scale type="double" userarchive="y">1.0</turbulence-scale>
|
||||||
<presampling-flag type="bool" userarchive="y">1</presampling-flag>
|
<presampling-flag type="bool" userarchive="y">1</presampling-flag>
|
||||||
<fps-control-flag type="bool" userarchive="y">0</fps-control-flag>
|
<fps-control-flag type="bool" userarchive="y">0</fps-control-flag>
|
||||||
<target-framerate type="double" userarchive="y">25.0</target-framerate>
|
<target-framerate type="double" userarchive="y">25.0</target-framerate>
|
||||||
|
@ -37,6 +38,7 @@
|
||||||
<gust-frequency-hz type="double" userarchive="n">0.0</gust-frequency-hz>
|
<gust-frequency-hz type="double" userarchive="n">0.0</gust-frequency-hz>
|
||||||
<gust-relative-strength type="double" userarchive="n">0.0</gust-relative-strength>
|
<gust-relative-strength type="double" userarchive="n">0.0</gust-relative-strength>
|
||||||
<gust-angular-variation-deg type="double" userarchive="n">0.0</gust-angular-variation-deg>
|
<gust-angular-variation-deg type="double" userarchive="n">0.0</gust-angular-variation-deg>
|
||||||
|
<squall-scaling-norm type="double" userarchive="n">1.0</squall-scaling-norm>
|
||||||
<tile-alt-offset-ft type="double" userarchive="n">0.0</tile-alt-offset-ft>
|
<tile-alt-offset-ft type="double" userarchive="n">0.0</tile-alt-offset-ft>
|
||||||
<asymmetric-tile-loading-flag type="bool" userarchive="y">0</asymmetric-tile-loading-flag>
|
<asymmetric-tile-loading-flag type="bool" userarchive="y">0</asymmetric-tile-loading-flag>
|
||||||
<FL0-wind-from-heading-deg type="double" userarchive="y">260.0</FL0-wind-from-heading-deg>
|
<FL0-wind-from-heading-deg type="double" userarchive="y">260.0</FL0-wind-from-heading-deg>
|
||||||
|
|
|
@ -286,7 +286,9 @@ setprop("/environment/precipitation-control/snow-flake-size", size);
|
||||||
|
|
||||||
var setTurbulence = func (turbulence) {
|
var setTurbulence = func (turbulence) {
|
||||||
|
|
||||||
setprop("/environment/turbulence/magnitude-norm",turbulence);
|
var turbulence_scale = getprop("/local-weather/config/turbulence-scale");
|
||||||
|
|
||||||
|
setprop("/environment/turbulence/magnitude-norm",turbulence * turbulence_scale);
|
||||||
setprop("/environment/turbulence/rate-hz",3.0);
|
setprop("/environment/turbulence/rate-hz",3.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -415,10 +417,28 @@ setprop("/environment/clouds/layer[0]/elevation-ft",0.0);
|
||||||
# interpolating across several frames
|
# interpolating across several frames
|
||||||
###########################################################
|
###########################################################
|
||||||
|
|
||||||
|
var smoothDirection = func (dir0, dir1, factor) {
|
||||||
|
|
||||||
|
var diff = ( math.mod( dir0 - dir1 + 180 + 360, 360 ) - 180 );
|
||||||
|
diff *= factor;
|
||||||
|
|
||||||
|
return math.mod( 360 + dir1 + ( diff / 2), 360);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
var setWindSmoothly = func (dir, speed) {
|
var setWindSmoothly = func (dir, speed) {
|
||||||
|
|
||||||
setWind(dir, speed);
|
var curDir = getprop("/environment/wind-from-heading-deg");
|
||||||
|
var curSpeed = getprop("/environment/wind-speed-kt");
|
||||||
|
|
||||||
|
dir = math.mod(dir, 360);
|
||||||
|
|
||||||
|
var newSpeed = (curSpeed * 9 + speed) / 10;
|
||||||
|
var newDir = smoothDirection(dir, curDir, 0.2);
|
||||||
|
|
||||||
|
setWind(newDir, newSpeed);
|
||||||
|
|
||||||
|
#setWind(dir, speed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -926,13 +926,30 @@ if (gust_frequency > 0.0)
|
||||||
# expected mean number of gusts in time interval (should be < 1)
|
# expected mean number of gusts in time interval (should be < 1)
|
||||||
var p_gust = gust_frequency * interpolation_loop_time;
|
var p_gust = gust_frequency * interpolation_loop_time;
|
||||||
|
|
||||||
|
# real time series show a ~10-30 second modulation as well
|
||||||
|
var p_squall = gust_frequency * 0.1 * interpolation_loop_time;
|
||||||
|
var squall_scale = getprop("/local-weather/tmp/squall-scaling-norm");
|
||||||
|
|
||||||
|
if (rand() < p_squall)
|
||||||
|
{
|
||||||
|
squall_scale = rand();
|
||||||
|
# prefer large changes
|
||||||
|
if ((squall_scale > 0.3) and (squall_scale < 0.7))
|
||||||
|
{squall_scale = rand();}
|
||||||
|
|
||||||
|
setprop("/local-weather/tmp/squall-scaling-norm", squall_scale);
|
||||||
|
}
|
||||||
|
|
||||||
winddir_change = 0.0;
|
winddir_change = 0.0;
|
||||||
|
|
||||||
if (rand() < p_gust) # we change the offsets for windspeed and direction
|
if (rand() < p_gust) # we change the offsets for windspeed and direction
|
||||||
{
|
{
|
||||||
var alt_fact = 1.0 - altitude_agl/(boundary_alt * alt_scaling_factor);
|
var alt_fact = 1.0 - altitude_agl/(boundary_alt * alt_scaling_factor);
|
||||||
if (alt_fact < 0.0) {alt_fact = 0.0};
|
if (alt_fact < 0.0) {alt_fact = 0.0};
|
||||||
windspeed_multiplier = (1.0 + ((rand()) * gust_relative_strength * alt_fact));
|
|
||||||
|
var random_factor = 0.3 * rand() + 0.7 * squall_scale;
|
||||||
|
|
||||||
|
windspeed_multiplier = (1.0 + (random_factor * 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
|
winddir_change = winddir_change * 0.2; # Markov chain parameter, max. change per frame is 1/5
|
||||||
|
|
||||||
|
@ -4052,7 +4069,7 @@ if (local_weather.cloud_shadow_flag == 1)
|
||||||
weather_tile_management.shadow_management_loop(0);
|
weather_tile_management.shadow_management_loop(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
# weather_tile_management.watchdog_loop();
|
#weather_tile_management.watchdog_loop();
|
||||||
|
|
||||||
# start thunderstorm management
|
# start thunderstorm management
|
||||||
|
|
||||||
|
|
|
@ -1493,7 +1493,14 @@ settimer( func {shadow_management_loop(i)}, 0);
|
||||||
|
|
||||||
var watchdog_loop = func {
|
var watchdog_loop = func {
|
||||||
|
|
||||||
var tNode = props.globals.getNode(lw~"tiles", 1).getChildren("tile");
|
var winddir = getprop("/environment/wind-from-heading-deg");
|
||||||
|
var windspeed = getprop("/environment/wind-speed-kt");
|
||||||
|
|
||||||
|
print (windspeed, " ", winddir);
|
||||||
|
|
||||||
|
|
||||||
|
if (0==1)
|
||||||
|
{var tNode = props.globals.getNode(lw~"tiles", 1).getChildren("tile");
|
||||||
|
|
||||||
var i = 0;
|
var i = 0;
|
||||||
|
|
||||||
|
@ -1536,6 +1543,8 @@ for (var i = 0; i < wsize; i=i+1) {
|
||||||
}
|
}
|
||||||
|
|
||||||
print("dir_int: ", sum_wind[0], " speed_int: ", sum_wind[1]/sum_norm);
|
print("dir_int: ", sum_wind[0], " speed_int: ", sum_wind[1]/sum_norm);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (0==1)
|
if (0==1)
|
||||||
{
|
{
|
||||||
|
@ -1589,9 +1598,9 @@ print("Mismatch: ", relangle(res[0], getprop(lw~"tiles/tile[4]/orientation-deg")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
print("====================");
|
#print("====================");
|
||||||
|
|
||||||
settimer(watchdog_loop, 10.0);
|
settimer(watchdog_loop, 4.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -214,7 +214,7 @@
|
||||||
<col>1</col>
|
<col>1</col>
|
||||||
<halign>fill</halign>
|
<halign>fill</halign>
|
||||||
<min>0.0</min>
|
<min>0.0</min>
|
||||||
<max>2.0</max>
|
<max>1.0</max>
|
||||||
<property>/local-weather/tmp/gust-frequency-hz</property>
|
<property>/local-weather/tmp/gust-frequency-hz</property>
|
||||||
<binding>
|
<binding>
|
||||||
<command>dialog-apply</command>
|
<command>dialog-apply</command>
|
||||||
|
@ -441,23 +441,58 @@
|
||||||
<label>low convection</label>
|
<label>low convection</label>
|
||||||
</text>
|
</text>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<text>
|
<text>
|
||||||
<row>3</row>
|
<row>3</row>
|
||||||
<col>0</col>
|
<col>0</col>
|
||||||
<halign>right</halign>
|
<halign>right</halign>
|
||||||
<label>Ground Haze:</label>
|
<label> Turbulence:</label>
|
||||||
</text>
|
</text>
|
||||||
|
|
||||||
<text>
|
<text>
|
||||||
<row>3</row>
|
<row>3</row>
|
||||||
<col>1</col>
|
<col>1</col>
|
||||||
<halign>right</halign>
|
<halign>right</halign>
|
||||||
<label>thick</label>
|
<label>weak</label>
|
||||||
</text>
|
</text>
|
||||||
|
|
||||||
<slider>
|
<slider>
|
||||||
<row>3</row>
|
<row>3</row>
|
||||||
<col>2</col>
|
<col>2</col>
|
||||||
|
<min>0.0</min>
|
||||||
|
<max>1.5</max>
|
||||||
|
<property>/local-weather/config/turbulence-scale</property>
|
||||||
|
<binding>
|
||||||
|
<command>dialog-apply</command>
|
||||||
|
</binding>
|
||||||
|
</slider>
|
||||||
|
|
||||||
|
<text>
|
||||||
|
<row>3</row>
|
||||||
|
<col>3</col>
|
||||||
|
<halign>left</halign>
|
||||||
|
<label>strong</label>
|
||||||
|
</text>
|
||||||
|
|
||||||
|
|
||||||
|
<text>
|
||||||
|
<row>4</row>
|
||||||
|
<col>0</col>
|
||||||
|
<halign>right</halign>
|
||||||
|
<label>Ground Haze:</label>
|
||||||
|
</text>
|
||||||
|
|
||||||
|
<text>
|
||||||
|
<row>4</row>
|
||||||
|
<col>1</col>
|
||||||
|
<halign>right</halign>
|
||||||
|
<label>thick</label>
|
||||||
|
</text>
|
||||||
|
|
||||||
|
<slider>
|
||||||
|
<row>4</row>
|
||||||
|
<col>2</col>
|
||||||
<min>0.1</min>
|
<min>0.1</min>
|
||||||
<max>1.0</max>
|
<max>1.0</max>
|
||||||
<property>/local-weather/config/ground-haze-factor</property>
|
<property>/local-weather/config/ground-haze-factor</property>
|
||||||
|
@ -467,28 +502,28 @@
|
||||||
</slider>
|
</slider>
|
||||||
|
|
||||||
<text>
|
<text>
|
||||||
<row>3</row>
|
<row>4</row>
|
||||||
<col>3</col>
|
<col>3</col>
|
||||||
<halign>left</halign>
|
<halign>left</halign>
|
||||||
<label>thin</label>
|
<label>thin</label>
|
||||||
</text>
|
</text>
|
||||||
|
|
||||||
<text>
|
<text>
|
||||||
<row>4</row>
|
<row>5</row>
|
||||||
<col>0</col>
|
<col>0</col>
|
||||||
<halign>right</halign>
|
<halign>right</halign>
|
||||||
<label>Air Pollution:</label>
|
<label>Air Pollution:</label>
|
||||||
</text>
|
</text>
|
||||||
|
|
||||||
<text>
|
<text>
|
||||||
<row>4</row>
|
<row>5</row>
|
||||||
<col>1</col>
|
<col>1</col>
|
||||||
<halign>right</halign>
|
<halign>right</halign>
|
||||||
<label>clean</label>
|
<label>clean</label>
|
||||||
</text>
|
</text>
|
||||||
|
|
||||||
<slider>
|
<slider>
|
||||||
<row>4</row>
|
<row>5</row>
|
||||||
<col>2</col>
|
<col>2</col>
|
||||||
<min>0.0</min>
|
<min>0.0</min>
|
||||||
<max>1.0</max>
|
<max>1.0</max>
|
||||||
|
@ -499,28 +534,28 @@
|
||||||
</slider>
|
</slider>
|
||||||
|
|
||||||
<text>
|
<text>
|
||||||
<row>4</row>
|
<row>5</row>
|
||||||
<col>3</col>
|
<col>3</col>
|
||||||
<halign>left</halign>
|
<halign>left</halign>
|
||||||
<label>smog</label>
|
<label>smog</label>
|
||||||
</text>
|
</text>
|
||||||
|
|
||||||
<text>
|
<text>
|
||||||
<row>5</row>
|
<row>6</row>
|
||||||
<col>0</col>
|
<col>0</col>
|
||||||
<halign>right</halign>
|
<halign>right</halign>
|
||||||
<label>Fog Properties:</label>
|
<label>Fog Properties:</label>
|
||||||
</text>
|
</text>
|
||||||
|
|
||||||
<text>
|
<text>
|
||||||
<row>5</row>
|
<row>6</row>
|
||||||
<col>1</col>
|
<col>1</col>
|
||||||
<halign>right</halign>
|
<halign>right</halign>
|
||||||
<label>smooth</label>
|
<label>smooth</label>
|
||||||
</text>
|
</text>
|
||||||
|
|
||||||
<slider>
|
<slider>
|
||||||
<row>5</row>
|
<row>6</row>
|
||||||
<col>2</col>
|
<col>2</col>
|
||||||
<min>0.0</min>
|
<min>0.0</min>
|
||||||
<max>12.0</max>
|
<max>12.0</max>
|
||||||
|
@ -531,14 +566,14 @@
|
||||||
</slider>
|
</slider>
|
||||||
|
|
||||||
<text>
|
<text>
|
||||||
<row>5</row>
|
<row>6</row>
|
||||||
<col>3</col>
|
<col>3</col>
|
||||||
<halign>left</halign>
|
<halign>left</halign>
|
||||||
<label>structured</label>
|
<label>structured</label>
|
||||||
</text>
|
</text>
|
||||||
|
|
||||||
<text>
|
<text>
|
||||||
<row>6</row>
|
<row>7</row>
|
||||||
<col>0</col>
|
<col>0</col>
|
||||||
<halign>right</halign>
|
<halign>right</halign>
|
||||||
<!--<enable>
|
<!--<enable>
|
||||||
|
@ -551,14 +586,14 @@
|
||||||
</text>
|
</text>
|
||||||
|
|
||||||
<text>
|
<text>
|
||||||
<row>6</row>
|
<row>7</row>
|
||||||
<col>1</col>
|
<col>1</col>
|
||||||
<halign>right</halign>
|
<halign>right</halign>
|
||||||
<label>20 km</label>
|
<label>20 km</label>
|
||||||
</text>
|
</text>
|
||||||
|
|
||||||
<slider>
|
<slider>
|
||||||
<row>6</row>
|
<row>7</row>
|
||||||
<col>2</col>
|
<col>2</col>
|
||||||
<!--<enable>
|
<!--<enable>
|
||||||
<equals>
|
<equals>
|
||||||
|
@ -575,7 +610,7 @@
|
||||||
</slider>
|
</slider>
|
||||||
|
|
||||||
<text>
|
<text>
|
||||||
<row>6</row>
|
<row>7</row>
|
||||||
<col>3</col>
|
<col>3</col>
|
||||||
<halign>left</halign>
|
<halign>left</halign>
|
||||||
<!--<enable>
|
<!--<enable>
|
||||||
|
|
Loading…
Reference in a new issue