Jump to content
Sign in to follow this  
Emerson67

Finally we have a visibility limiter plugin

Recommended Posts

If one of you guys could tweak the logic to make it more realistic...:)

 

Well I found this pdf with a nice graph at the end ("VISIBILITY VERSUS PRECIPITATION RATE AND RELATIVE HUMIDITY"):

 

https://www.google.it/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&ved=0CCoQFjAA&url=https%3A%2F%2Fams.confex.com%2Fams%2Fpdfpapers%2F113177.pdf&ei=v5vsUYOENunJ4ASQiYHIDg&usg=AFQjCNE6hJ4r8jk9yr_zQ0HM9kYXyPFpCw&sig2=IUgbylEoYzqjnEmiUDB2RQ&bvm=bv.49478099,d.bGE

 

Seems perfect to tune the plugin! I'll see tomorrow what can I do.


"The problem with quotes on the Internet is that it is hard to verify their authenticity." [Abraham Lincoln]

Share this post


Link to post
Share on other sites

Well I found this pdf with a nice graph at the end ("VISIBILITY VERSUS PRECIPITATION RATE AND RELATIVE HUMIDITY"):

 

https://www.google.it/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&ved=0CCoQFjAA&url=https%3A%2F%2Fams.confex.com%2Fams%2Fpdfpapers%2F113177.pdf&ei=v5vsUYOENunJ4ASQiYHIDg&usg=AFQjCNE6hJ4r8jk9yr_zQ0HM9kYXyPFpCw&sig2=IUgbylEoYzqjnEmiUDB2RQ&bvm=bv.49478099,d.bGE

 

Seems perfect to tune the plugin! I'll see tomorrow what can I do.

 

Good source. ELITE uses a similar algorithm since it doesn't even model precipitation graphically but rather in the form of visibility.

 

In real life, for instance, there's a difference between the conditions that favor the formation of mist vs haze, the later being associated with situation where the relative humidity exceeds 70% in the classical texts... sometimes higher values for other authors.

 

I'll try to find some time to think about it too, but the base in this source is already very good.


Main Simulation Rig:

Ryzen 5600x, 32GB RAM, Nvidia RTX 3060 Ti, 1 TB & 500 GB M.2 nvme drives, Win11.

Glider pilot since October 1980...

Avid simmer since 1992...

Share this post


Link to post
Share on other sites

I can't pretend to understand what you need to do, but thanks for your work anyway!


i910900k, RTX 3090, 32GB DDR4 RAM, AW3423DW, Ruddy girt big mug of Yorkshire Tea

Share this post


Link to post
Share on other sites

Another good source for choosing an appropriate conversion between T / Td and RH

 

http://journals.ametsoc.org/doi/pdf/10.1175/BAMS-86-2-225


Main Simulation Rig:

Ryzen 5600x, 32GB RAM, Nvidia RTX 3060 Ti, 1 TB & 500 GB M.2 nvme drives, Win11.

Glider pilot since October 1980...

Avid simmer since 1992...

Share this post


Link to post
Share on other sites

Here's the modified code:



 
HIGH_MAX_VIS = 60000.0          # meters at high altitude (float)

def FlightLoopCallback(self, elapsedMe, elapsedSim, counter, refcon):

        visibility = XPLMGetDataf(self.VisibilityDataRef)

        maxVis = HIGH_MAX_VIS

        diff = XPLMGetDatai(self.TemperatureSL) - XPLMGetDatai(self.DewPointSL)

        RH = 100 - 5 * diff

        if (RH > 50) :

            maxVis = ( - 0.0177 * RH ^ 2 + 1.462 * RH + 30.8 ) * 1000

        if (maxVis > HIGH_MAX_VIS) :
   
            maxVis = HIGH_MAX_VIS

        if (visibility > maxVis):

            XPLMSetDataf(self.VisibilityDataRef, maxVis)

        # Return 1.0 to indicate that we want to be called again in 1 second.

        return 1.0

Now, the plugin smoothly varies visibility with T-Td, according to empirical equations. A max visibility of 60 miles is reached for T-Td > 10.

 

If you think 60 miles is too much and causes too low FPS on your system, just lower the HIGH_MAX_VIS value. E.g. if you set

HIGH_MAX_VIS = 30000.0, the max visibility will be 30 miles, reached when T-Td > 3.4.

 

The modified version does not consider altitude, since X-Plane should automatically increase visibility with altitude.

 

It also does not lower visibility according to precipitation rate. I think that could be easily implemented, but I don't have time right now...

 

Marco

 

 


"The problem with quotes on the Internet is that it is hard to verify their authenticity." [Abraham Lincoln]

Share this post


Link to post
Share on other sites

Here's the modified code:

 

 
HIGH_MAX_VIS = 60000.0          # meters at high altitude (float)

def FlightLoopCallback(self, elapsedMe, elapsedSim, counter, refcon):

        visibility = XPLMGetDataf(self.VisibilityDataRef)

        maxVis = HIGH_MAX_VIS

        diff = XPLMGetDatai(self.TemperatureSL) - XPLMGetDatai(self.DewPointSL)

        RH = 100 - 5 * diff

        if (RH > 50) :

            maxVis = ( - 0.0177 * RH ^ 2 + 1.462 * RH + 30.8 ) * 1000

        if (maxVis > HIGH_MAX_VIS) :
   
            maxVis = HIGH_MAX_VIS

        if (visibility > maxVis):

            XPLMSetDataf(self.VisibilityDataRef, maxVis)

        # Return 1.0 to indicate that we want to be called again in 1 second.

        return 1.0

Now, the plugin smoothly varies visibility with T-Td, according to empirical equations. A max visibility of 60 miles is reached for T-Td > 10.

 

If you think 60 miles is too much and causes too low FPS on your system, just lower the HIGH_MAX_VIS value. E.g. if you set

HIGH_MAX_VIS = 30000.0, the max visibility will be 30 miles, reached when T-Td > 3.4.

 

The modified version does not consider altitude, since X-Plane should automatically increase visibility with altitude.

 

It also does not lower visibility according to precipitation rate. I think that could be easily implemented, but I don't have time right now...

 

Marco

 

 

Great work Marco!

 

Thx  a lot!  Tell Austin - he will certainly like to know, and since you and the original author did most of the work already, he has the material required to implement it into a future release of X-Plane10.

 

I am also talking to a colleague here at the aeronautical meteorology dept because she did precisely a study on visibility determination for aviation weather forecasts. We may end with even more material including various type of precipitation and it's impact on visibility.

 

Of course we will not be able to go as far as to take into account aerosols and pollution, but, X-Plane's World is not polluted!!!!! :-)


Main Simulation Rig:

Ryzen 5600x, 32GB RAM, Nvidia RTX 3060 Ti, 1 TB & 500 GB M.2 nvme drives, Win11.

Glider pilot since October 1980...

Avid simmer since 1992...

Share this post


Link to post
Share on other sites

Hmmm,

 

tried it but there's something wrong?

 

First I had to replace the "^" operator by a call to "pow"... because it was generating an error...

 

Then, there is always very low vis ?  I'll have a look at it again...

 

That nasty effect of clearing the downloaded weather is still the reason I had to disable it... It zeroed winds, turned everything to ISA...


Main Simulation Rig:

Ryzen 5600x, 32GB RAM, Nvidia RTX 3060 Ti, 1 TB & 500 GB M.2 nvme drives, Win11.

Glider pilot since October 1980...

Avid simmer since 1992...

Share this post


Link to post
Share on other sites

Yeah there are a couple of stupid errors I made in the code! D'oh!

 

Unfortunately I couldn't try it since I should install Python etc.

 

Here's the corrected code, this time it should work, except for the problem of clearing the downloaded weather that you mentioned. I don't know the reason for that.

 


 
HIGH_MAX_VIS = 60000.0          # meters at high altitude (float)

def FlightLoopCallback(self, elapsedMe, elapsedSim, counter, refcon):

        visibility = XPLMGetDataf(self.VisibilityDataRef)

        maxVis = HIGH_MAX_VIS

        diff = XPLMGetDatai(self.TemperatureSL) - XPLMGetDatai(self.DewPointSL)

        RH = (100 - (5 * diff) ) / 100

        if (RH > 50) :

            maxVis = ( (- 0.0177 * RH * RH) + (1.462 * RH) + 30.8 ) * 1000

        if (maxVis > HIGH_MAX_VIS) :
   
            maxVis = HIGH_MAX_VIS

        if (visibility > maxVis):

            XPLMSetDataf(self.VisibilityDataRef, maxVis)

        # Return 1.0 to indicate that we want to be called again in 1 second.

        return 1.0

Marco

 


"The problem with quotes on the Internet is that it is hard to verify their authenticity." [Abraham Lincoln]

Share this post


Link to post
Share on other sites

Another little error.. ehm... Instead of:

RH = (100 - (5 * diff) ) / 100

It was correct as in the first version, so delete "/ 100":


RH = (100 - (5 * diff) )
 

 

Now if it doesn't work, the error must be in the original code, not my modifications.


"The problem with quotes on the Internet is that it is hard to verify their authenticity." [Abraham Lincoln]

Share this post


Link to post
Share on other sites

So is this creating a better effect and if so can you tell us how to insert the code into the plugin?

 

edit - actually I think I'm going to stop using the plugin as it is. I really like the haze effect but getting a bit tired with it continually reverting back to set weather uniformly and deleting the real weather.

 

It seems like it might be a problem with Python rather than the script itself, as the problem only goes away when I stopped Python, not when I simply disabled the script. Is the author aware of this?


i910900k, RTX 3090, 32GB DDR4 RAM, AW3423DW, Ruddy girt big mug of Yorkshire Tea

Share this post


Link to post
Share on other sites

Oh, looks like the author is aware of the issue and is using it with this real world weather plugin:

 

http://forums.x-plane.org/index.php?app=downloads&showfile=15453

 

Jcomm, I know you're a weather geek, any thoughts on this plugin?

 

Hmmm, I didn't know about it, but will investigate ;-)  Thx for the link!


Main Simulation Rig:

Ryzen 5600x, 32GB RAM, Nvidia RTX 3060 Ti, 1 TB & 500 GB M.2 nvme drives, Win11.

Glider pilot since October 1980...

Avid simmer since 1992...

Share this post


Link to post
Share on other sites

Well, first tests of the NOAA GFS plugin are VERY POSITIVE!!!!

 

I installed Python 2.7, and then the NOAA GFS plugin only. Set the METAR altitude to FL060 (sector for LPPT) and went flying.

 

All I can tell you is that this is a true MUST HAVE for X-Plane 10!!!!!

 

Get it!!!!

 

Very plausible winds and cloud cover above, also temperature!

 

I could I have been missing this on :-/


Main Simulation Rig:

Ryzen 5600x, 32GB RAM, Nvidia RTX 3060 Ti, 1 TB & 500 GB M.2 nvme drives, Win11.

Glider pilot since October 1980...

Avid simmer since 1992...

Share this post


Link to post
Share on other sites

Whoa... Never even heard of this gem. Will have to test it tomorrow but sounds like a must-have if it works!

Share this post


Link to post
Share on other sites

Great!

 

The good thing is that the NOAA plugin automatically sets X-Plane to METAR auto-download mode bellow a parametrized altitude (FL), so that it solves the problem on the visibility plugin (which can't restore the METAR auto-download mode by itself).

 

 

Well, first tests of the NOAA GFS plugin are VERY POSITIVE!!!!

 

I installed Python 2.7, and then the NOAA GFS plugin only. Set the METAR altitude to FL060 (sector for LPPT) and went flying.

 

All I can tell you is that this is a true MUST HAVE for X-Plane 10!!!!!

 

Get it!!!!

 

Very plausible winds and cloud cover above, also temperature!

 

I could I have been missing this on :-/

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...