Jump to content
The simFlight Network Forums

Recommended Posts

Posted

In a small program I read out the weather data including the cloud layers, as explained in your demo project.
This also works very well and reliably. 
But there's one thing I can't get to work: an entry in the cloud grid when there are no clouds. For example, it should say "No data" or something like that and the control should not simply be empty.
I have tried that. Once via the length of LayerTEXT and currently via the content, but the control remains empty if there are no clouds.
What  am I doing wrong? 

 

Me.lstClouds.Items.Clear()
 For Each layer As FsCloudLayer In weather.CloudLayers
     Dim cover As FsCloudCoverage = layer.CoverageOctas
     ' Gets the description of the coverage (e.g. Few, Broken etc)
     Dim coverDescription As String = cover.ToString().Substring(0, cover.ToString().Length - 2)
     ' add the number of Octars
     coverDescription += " (" & CInt(cover).ToString() & "/8)"
     ' Get the precipitation (rain/snow)
     Dim precipitation As String = ""
     If layer.PrecipitationType <> FsPrecipitationType.None Then
         precipitation = " - " & layer.PrecipitationRate.ToString() & " " & layer.PrecipitationType.ToString()
     End If
     Dim layerText As String = "-" & layer.LowerAltitudeFeet & "ft" & "  " & coverDescription & precipitation
    
If layerText = "" Then layerText = "No Clouds"

     Me.lstClouds.Items.Add(layerText)
 Next

 

Posted

I'm not sure that there can be cloud layer without clouds. The layers have a lower and upper altitude, so they only describe where the clouds are. They don't tell you where there are no clouds. 

Are you using MSFS? I don't have that sim so maybe it's changed and there are such things as cloud layers without clouds. Or maybe the weather isn't working yet in FSUIPC7.

I've looked at your code and ran it here. I can't see any way that layerText can ever be blank or "".

 Dim layerText As String = "-" & layer.LowerAltitudeFeet & "ft" & "  " & coverDescription & precipitation

This can't evaluate to "" because even if coverDescription and precipitation are "" and lowerAlt is 0 you'll get "-0ft  ".

I suggest putting a breakpoint on 

Me.lstClouds.Items.Add(layerText)

and print the value of layerText for each layer in the immediate window. It might give you a clue what's going on. 

Paul

 

Posted (edited)

Thanks for your quick reply The code runs perfectly. I use it with X-Plane 11/Xuipc and there it is possible to disable wind and clouds in the manual weather setting.

For purely visual reasons, I would like to have a short text there. For example, "No data" or "No cloud layer".
I had hoped that I could do this with the line

If layerText = "" Then layerText = "No Clouds"

as I assume that the LayerTXT is empty or has a lenght of zero, as it is nothing transferred to the listbox.

I wanted to take advantage of this by entering my own text in the listbox, but this line is not displayed and I don't understand why.

That is the whole point of my question.

Another question about the clouds The cloud types from 0 to 9 I believe, is there a documentaion what these type numbers mean? Like type_0 = cumulus or similar?

 

 

Screenshot 2024-06-29 182918.png

Screenshot 2024-06-29 183054.png

Edited by skino
Forget about it, I'm getting old.
Posted

Sorry, I misunderstood what your problem was.

You need to check how many layers are returned. If it's 0 then you can add your "No clouds" message. Something like this:

        Me.lstClouds.Items.Clear()
        If weather.CloudLayers.Count > 0 Then
            For Each layer As FsCloudLayer In weather.CloudLayers
                Dim cover As FsCloudCoverage = layer.CoverageOctas
                ' Gets the description of the coverage (e.g. Few, Broken etc)
                Dim coverDescription As String = cover.ToString().Substring(0, cover.ToString().Length - 2)
                ' add the number of Octars
                coverDescription += " (" & CInt(cover).ToString() & "/8)"
                ' Get the precipitation (rain/snow)
                Dim precipitation As String = ""
                If layer.PrecipitationType <> FsPrecipitationType.None Then
                    precipitation = " - " & layer.PrecipitationRate.ToString() & " " & layer.PrecipitationType.ToString()
                End If
                Dim layerText As String = "-" & layer.LowerAltitudeFeet & "ft" & "  " & coverDescription & precipitation
                Me.lstClouds.Items.Add(layerText)
            Next
        Else
            ' No cloud layers
            Me.lstClouds.Items.Add("No Clouds")
        End If

Paul

  • Thanks 1
Posted
Quote

Another question about the clouds The cloud types from 0 to 9 I believe, is there a documentaion what these type numbers mean? Like type_0 = cumulus or similar?

The only documentation I know of was the 'New weather Interface' document from Pete Dowson which I used to write the weather features. The Enum in the DLL is made from that documentation. Only a few numbers are known/used in Microsoft Flight Sims:

public enum FsCloudType : byte
{
    Type_0,
    Cirrus,
    Type_2,
    Type_3,
    Type_4,
    Type_5,
    Type_6,
    Type_7,
    Stratus,
    Cumulus,
    Cumulonimbus
}

So 1 would be Cirrus, Stratus is 8.

The best thing to do would be to make cloud layers in XPlane with the different type of clouds that XPlane allows and see what number they come though as.

Paul

  • Thanks 1
Posted

Thank you very much. That helps me a lot.
I am always enthusiastic about your DLL and your great support for us hobby programmers

  • Like 1

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
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.