Board index FlightGear Development Weather

A unified weather system?

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

Re: A unified weather system?

Postby Soitanen » Sat Dec 07, 2013 12:59 pm

We (Tu-154B team) are trying to implement "altitude hold" autopilot mode. In reality it holds altitude, based on static pressure. But in FG pressure suddenly jumps, when flying from one weather tile to other, and autopilot become very jerky.
Is it possible to make smooth atmospheric pressure change?
Boeing 737-300. Reworked cockpit, FDM, autopilot and much more. WIP.
Boeing 737-800. WIP. Canvas PFD and ND.
Antonov An-24B. Made from scratch. Very good FDM. 3D model by Adrian. WIP.
Project Russia (some cities, based on OSM with custom objects).
Soitanen
 
Posts: 489
Joined: Sat Jun 16, 2012 6:50 am
Location: Saint-Petersburg, Russia
Version: git
OS: Linux Mint 17

Re: A unified weather system?

Postby Thorsten » Sat Dec 07, 2013 1:05 pm

It actually should be - I've had the same problem long ago when designing the system, and what is done is that each new interpolation point for a new tile is not just spawned but faded in with weight zero and then ramped up over time to avoid any discontinuity in pressure. I've been using a number of autopilots since and never had any issues.

I haven't run any checks recently, the interpolation code is in place since years and hasn't been modified, but I'll have a look whether I can find anything out of order.

Just to be sure - which property do you use to pick up the pressure?
Thorsten
 
Posts: 12015
Joined: Mon Nov 02, 2009 8:33 am

Re: A unified weather system?

Postby Soitanen » Sat Dec 07, 2013 1:39 pm

We are using /instrumentation/altimeter/pressure-alt-ft. Is it right?
Boeing 737-300. Reworked cockpit, FDM, autopilot and much more. WIP.
Boeing 737-800. WIP. Canvas PFD and ND.
Antonov An-24B. Made from scratch. Very good FDM. 3D model by Adrian. WIP.
Project Russia (some cities, based on OSM with custom objects).
Soitanen
 
Posts: 489
Joined: Sat Jun 16, 2012 6:50 am
Location: Saint-Petersburg, Russia
Version: git
OS: Linux Mint 17

Re: A unified weather system?

Postby Tomash Brechko » Sat Dec 07, 2013 1:50 pm

It's also possible that the interpolation is in place but the value changes too rapidly (for instance I recall that wind vector changes quite fast, but maybe it's sane for wind). What is the speed of interpolation, and does it depend on pressure difference, or completed in a fixed time? Sorry for not looking this up in the code myself :)
Tomash Brechko
 
Posts: 2
Joined: Sat Dec 07, 2013 1:44 pm

Re: A unified weather system?

Postby Tomash Brechko » Sat Dec 07, 2013 3:47 pm

After some thought, is it possible to estimate a typical pressure difference between the tiles (say, at sea level) and then calibrate interpolation time so that vertical speed required to hold the same altitude during the change is about 200 fpm (about 1mps). According to http://en.wikipedia.org/wiki/File:Atmos ... titude.png at sea level the lapse rate is about 10kPa/1000m ~= 0.0009 inHg/ft, so about 30 seconds for each 0.1 inHg of pressure difference with 200 fpm vertical speed.
Tomash Brechko
 
Posts: 2
Joined: Sat Dec 07, 2013 1:44 pm

Re: A unified weather system?

Postby Thorsten » Sun Dec 08, 2013 7:19 am

The routine you want to look at is in Nasal/local_weather/local_weather.nas

Line 490 has

Code: Select all
   if (s.weight < 1.0) {s.weight = s.weight + 0.02;}


which is the interpolation weight that gets added per loop iteration. Come to think of it, I changed the loop timer to a per-frame basis on Vivian's request a while ago (it used to run slower), so perhaps that causes the interpolation to fade in too fast, it's now 50 frames which isn't that much.

You can play with the number being added per iteration and try to find a suitable value, I'll be happy to commit that change then.

In addition, in Nasal/local_weather/weather_tiles.nas there's a function adjust_p which limits the per-tile pressure change (even if the tile type changes from high pressure to low pressure, that function ensures that the interpolation point isn't allowed to kick in with 20 mbar less) - you can also play with that function to make it more restrictive.

We are using /instrumentation/altimeter/pressure-alt-ft. Is it right?


I don't know - I sure hope. It's a derived one not set by the weather system, the weather system itself only writes /environment/pressure-sea-level-inhg and relies on everything being passed on somehow smoothly.
Thorsten
 
Posts: 12015
Joined: Mon Nov 02, 2009 8:33 am

Re: A unified weather system?

Postby Soitanen » Sun Dec 08, 2013 7:38 am

Sorry for may be dumb question, are the algorithm of smooth calculation of /environment/pressure-sea-level-inhg the same in Basic and Advanced weather?
Boeing 737-300. Reworked cockpit, FDM, autopilot and much more. WIP.
Boeing 737-800. WIP. Canvas PFD and ND.
Antonov An-24B. Made from scratch. Very good FDM. 3D model by Adrian. WIP.
Project Russia (some cities, based on OSM with custom objects).
Soitanen
 
Posts: 489
Joined: Sat Jun 16, 2012 6:50 am
Location: Saint-Petersburg, Russia
Version: git
OS: Linux Mint 17

Re: A unified weather system?

Postby Thorsten » Sun Dec 08, 2013 7:58 am

No, certainly not. Basic weather makes a temporal interpolation every time a new METAR is reported, Advanced Weather makes a space-time interpolation assigning every new METAR to a certain location.

The idea is just that the weather system sets /environment/pressure-sea-level-inhg and then some generic atmosphere code takes over and computes the altitude dependence of pressure and any derived quantity like dynamic pressure readings. In principle something in these auxiliary routines could also go fishy, but I don't think that's actually the case.
Thorsten
 
Posts: 12015
Joined: Mon Nov 02, 2009 8:33 am

Re: A unified weather system?

Postby Soitanen » Wed Dec 18, 2013 8:03 am

Thorsten - thank you for your answers, pressure is not jumping, some bug in Tu-154.

I got some mentions, that switch between Basic and Detailed weather slightly confuses people. Why do this happen: they select Detailed weather, restart sim and think, that Detailed weather is active (if they open Weather window radiobutton show Deatiled), but in reality Basic weather works.
I see 2 ways of solution:
1. Load weather engine, that was used in previous simulator session.
2. Show by radiobutton in weather dialog which weather engine is used now.
Boeing 737-300. Reworked cockpit, FDM, autopilot and much more. WIP.
Boeing 737-800. WIP. Canvas PFD and ND.
Antonov An-24B. Made from scratch. Very good FDM. 3D model by Adrian. WIP.
Project Russia (some cities, based on OSM with custom objects).
Soitanen
 
Posts: 489
Joined: Sat Jun 16, 2012 6:50 am
Location: Saint-Petersburg, Russia
Version: git
OS: Linux Mint 17

Re: A unified weather system?

Postby Thorsten » Wed Dec 18, 2013 11:23 am

The present state is driven by the opinion of some core developers about having large chunks of Nasal code run 'automatically'. It'd be technically easy to simply set a a timer to start a function a few seconds after startup, checks whether Advanced Weather is selected in the menu and then starts it up automatically. But any change to the way Advanced Weather is managed tends to be highly controversial on the devel list. So please forgive me if I won't get into this again - the current GUI is a compromise which was reached after long discussions, it's not optimal from my perspective, but I can live with it.
Thorsten
 
Posts: 12015
Joined: Mon Nov 02, 2009 8:33 am

Re: A unified weather system?

Postby Soitanen » Wed Dec 18, 2013 12:26 pm

Ok, understand you. I hope, that someone of some core developers will read this and understand, that showing Detailed weather in dialog, but running Basic weather at the same time is bad for simple user understanding.
Boeing 737-300. Reworked cockpit, FDM, autopilot and much more. WIP.
Boeing 737-800. WIP. Canvas PFD and ND.
Antonov An-24B. Made from scratch. Very good FDM. 3D model by Adrian. WIP.
Project Russia (some cities, based on OSM with custom objects).
Soitanen
 
Posts: 489
Joined: Sat Jun 16, 2012 6:50 am
Location: Saint-Petersburg, Russia
Version: git
OS: Linux Mint 17

Re: A unified weather system?

Postby Soitanen » Fri Dec 20, 2013 4:37 pm

I have found very interesting resource, which shows winds in every point of planet, depending on different isobaric surfaces. Data updated every 3 hour. Does Flightgear's Advanced weather generate something similar? Or if no, can we use this data?
Link
Boeing 737-300. Reworked cockpit, FDM, autopilot and much more. WIP.
Boeing 737-800. WIP. Canvas PFD and ND.
Antonov An-24B. Made from scratch. Very good FDM. 3D model by Adrian. WIP.
Project Russia (some cities, based on OSM with custom objects).
Soitanen
 
Posts: 489
Joined: Sat Jun 16, 2012 6:50 am
Location: Saint-Petersburg, Russia
Version: git
OS: Linux Mint 17

Re: A unified weather system?

Postby Thorsten » Fri Dec 20, 2013 6:00 pm

If anyone puts the info into the property tree, Advanced Weather can use it, the code to do so is all in place. Just somebody needs to write the routine to fetch the info and place it into the tree, I don't think that's a good idea to do from Nasal...
Thorsten
 
Posts: 12015
Joined: Mon Nov 02, 2009 8:33 am

Re: A unified weather system?

Postby ludomotico » Fri Dec 20, 2013 6:10 pm

Imagine someone writes an external application that every 5 seconds (configurable, of course) gets the position of the aircraft (latitude/longitude/altitude), queries the wind model (http://www.emc.ncep.noaa.gov/) and writes the wind conditions in the property tree.

Will it work?
User avatar
ludomotico
 
Posts: 1200
Joined: Tue Apr 24, 2012 1:01 pm
Version: nightly
OS: Windows 10

Re: A unified weather system?

Postby Hooray » Fri Dec 20, 2013 6:43 pm

Thorsten wrote in Fri Dec 20, 2013 6:00 pm:If anyone puts the info into the property tree, Advanced Weather can use it, the code to do so is all in place. Just somebody needs to write the routine to fetch the info and place it into the tree, I don't think that's a good idea to do from Nasal...


There's now HTTP client support available in Nasal space: https://gitorious.org/fg/flightgear/sou ... TP.cxx#L82
This can be used to fetch/download web sites and further process those files.

So as long as something can be accessed via HTTP, it can also be done via Nasal now. The original HTTP implementation was asynchronous, i.e. would not block the main loop - it would simply fire a listener once the request is complete.
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 12186
Joined: Tue Mar 25, 2008 8:40 am

PreviousNext

Return to Weather

Who is online

Users browsing this forum: No registered users and 2 guests