Jump to content
The simFlight Network Forums

Frédéric-O DUCHEMIN

Members
  • Posts

    113
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by Frédéric-O DUCHEMIN

  1. Okay, sorry I did misunderstand.

    No sorry it's me

     

    So, my function using the wind direction does not give the same results as the function using AI?

     

    Is that what you mean?

    Nope I have read in your post to replace the function to read runway...Also I keep my function to read which runway aircraft here and ADD your function to replace AI

     Try
                    depart = getActiveRunway(lblDeparture.Text)
                    Me.lstDeparture.Items.Clear()
                    Me.lstDeparture.Items.Add(depart.ToString())
                    arrival = getActiveRunway(lblArrival.Text)
                    Me.lstArrival.Items.Clear()
                    Me.lstArrival.Items.Add(arrival.ToString())
                Catch ex As Exception
    
                End Try
    

    Well I need to put everywhere try because the FrmMain at load doesn't connect to FSUIPC  :mad: .

     

    Thanks Paul

  2. I've written the entire function for you. You just need to paste it in to your code, call it, and use the output however you want. Presumably adding it to the list box.

    I already thanks for all Paul

     

    I can help you use the DLL and give you example code, but I cannot do all your work for you or teach VB programming here.

    It's not my purpose just maybe misunderstood by myself. I have understood to replace this code by mine. So your function doesn't match if I have understood right with the original function given only where the aircraft taking-off or landing don't depend to the windir, because this function is call earlier.

    So If I have missed something just tell me.

    (it's not easy to understand I'm french I don't use google translate...sorry for that) ;)

    Regards Fred

  3. Thanks Paul,

     

    I have two functions one for read where the aircraft takiing off and landing readind runway.csv to find runway where the plane is and return the result to the log text

       Public Function getrunaway(ByVal icaocode As String) As String
            Dim lon As FsLongitude = New FsLongitude(playerLongitude.Value)
            Dim lat As FsLatitude = New FsLatitude(playerLatitude.Value)
            ' Get the point for the current plane position
            Dim currentPosition As FsLatLonPoint = New FsLatLonPoint(lat, lon)
            Dim pathto As String = My.Application.Info.DirectoryPath
            Using MyReader As New Microsoft.VisualBasic.FileIO.TextFieldParser(pathto & "\runways.csv")
                MyReader.TextFieldType = FileIO.FieldType.Delimited
                MyReader.SetDelimiters(",")
                Dim runawayst As String
                Dim runawaynum As String
                Dim runawaydes1 As String
                Dim runawaydes2 As String = ""
                Dim runawayreturn As String
                Dim currentRow As String()
                While Not MyReader.EndOfData
                    Try
                        currentRow = MyReader.ReadFields()
                        If currentRow(0) = icaocode Then
                            runawayst = currentRow(1)
                            runawaynum = runawayst.Substring(1, 2)
                            runawaydes1 = runawayst.Substring(3, 1)
                            If runawaydes1 = "0" Then runawaydes2 = ""
                            If runawaydes1 = "1" Then runawaydes2 = "L"
                            If runawaydes1 = "2" Then runawaydes2 = "R"
                            If runawaydes1 = "3" Then runawaydes2 = "C"
                            If runawaydes1 = "4" Then runawaydes2 = "W"
                            Dim aaa As String = currentRow(2)
                            Dim bbb As String = currentRow(3)
                            Dim aaaa As Double
                            Dim bbbb As Double
                            aaaa = System.Convert.ToDouble(aaa)
                            bbbb = System.Convert.ToDouble(bbb)
                            Dim rwyThresholdLat As FsLatitude = New FsLatitude(aaaa)
                            Dim rwyThresholdLon As FsLongitude = New FsLongitude(bbbb)
                            Dim rwyMagHeading As Double = CDbl(currentRow(5))
                            Dim rwyMagVariation As Double = 0
                            Dim rwyLength As Double = CDbl(currentRow(6)) / 2
                            Dim rwyWidth As Double = 254D
    
                            Dim thresholdCentre As FsLatLonPoint = New FsLatLonPoint(rwyThresholdLat, rwyThresholdLon)
                            Dim trueHeading As Double = rwyMagHeading + rwyMagVariation
                            runwayQuad = FsLatLonQuadrilateral.ForRunway(thresholdCentre, trueHeading, rwyWidth, rwyLength)
                            If runwayQuad.ContainsPoint(currentPosition) = True Then
                                runawayreturn = runawaynum & runawaydes2
                                Return runawayreturn
                                MyReader.Close()
                                MyReader.Dispose()
                                Exit Function
                            End If
                        End If
                    Catch ex As Microsoft.VisualBasic.FileIO.MalformedLineException
                        'MsgBox("Line " & ex.Message & "is not valid and will be skipped.")
                    End Try
                End While
                MyReader.Close()
                MyReader.Dispose()
            End Using
    
            Return ""
        End Function
    

    and this other to find the good runway for departure and arrival return the result in listbox. This is function where I would like to change by wind direction

       Public Sub Activerunways()
            
            ' Get a reference to the AITrafficServices class (saves typing)
            Try
               
                Dim AI As AITrafficServices = FSUIPCConnection.AITrafficServices
    
                ' Refresh the traffic information
    
                AI.ApplyFilter(False, True, 0, 360, Nothing, 10000D, 30D)
                AI.RefreshAITrafficInformation()
    
                ' Get the arrival runways in use
                Dim runways As List(Of FSRunway) = AI.GetArrivalRunwaysInUse(lblArrival.Text)
                ' Display in the listbox
                Me.lstArrival.Items.Clear()
                For Each rw As FSRunway In runways
                    Me.lstArrival.Items.Add(rw.ToString())
                Next rw
                ' same for departure runways
                runways = AI.GetDepartureRunwaysInUse(lblDeparture.Text)
                Me.lstDeparture.Items.Clear()
                For Each rw As FSRunway In runways
                    Me.lstDeparture.Items.Add(rw.ToString())
                Next rw
            Catch ex As Exception
            End Try
        End Sub
    
    Private Sub BtnGetFlight_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnGetFlight.Click
            RegisterKey(Options.Alt, Keys.F)
            UiFunctions.Connect()
            downloadmetar(lblDeparture.Text, lblWXDep.Text)
            downloadmetar(lblArrival.Text, lblWXArr.Text)
            Activerunways()
            'Try
            '    ui = FSUIPCConnection.UserInputServices
            '    AddMenuItems()
            'Catch ex As Exception
            'End Try
    
        End Sub
    

    Fred

  4. Thanks Paul,if for this reason I tell you this issue happen only with the bus by Aerosoft. PMDG works fine. I don't undestand why?! Check your PM BOX

     

     

    Seem  to work auto spoiler and beacon lights via LUA

    Aircraft Used in flight is Airbus A320 easyJet G-EZTB
    Aircraft model is A320CFM
    Flight Number= SDA7794
    Departure= LFPG
    Destination= LFBO
    [04:19] ZFW: 115030 lbs
    [04:19] TOW: 134005
    [04:19] METAR for departing airport: 2015/06/04 04:00
    LFPG 040400Z 02006KT 010V090 CAVOK 09/07 Q1026 NOSIG
    [04:19] Boarding 
    [04:19] Parking Brakes Engaged 
    [04:20] Transponder set to 2563
    [04:20] Paused 
    [04:21] Unpaused
    [04:23] NAV1 set to 110.35
    [04:25] NAV1 set to 109.10
    [04:28] Beacon lights ON
    [04:28] Engine 2 ON 
    [04:29] Engine 1 ON 
    [04:30] Auto spoilers armed
    [04:31] Flaps at Position 2
    [04:31] Taxi lights ON
    [04:31] Parking Brakes Released 
    [04:32] Taxiing to Runway 
    [04:32] Landing lights ON 
    [04:32] Strobe lights ON
    [04:33] Taking Off
    [04:33] Taking Off from Runway 26R
    [04:33] You Take off @ 161 Knots and Flaps at Position 2 
    [04:33] Pitch angle 9 degrees and 18666lbs FOB
    [04:33] Wind 14 @ 6 kt, Temperature 9 deg. C
    [04:33] Landing Gear Up @  168 Knots and 480 Feet
    [04:33] Taxi lights OFF
    [04:33] Auto spoilers disarmed
    [04:34] Climbing 
    [04:34] Flaps Retracted @ 195 Knots
    [04:37] Landing lights OFF @ 10830 ft 
    [04:47] TOC reached. Cruise 31000 ft
    

    Regards Fred

  5. Hi Paul,

     

    Public autospoiler As Offset(Of BitArray) = New FSUIPC.Offset(Of BitArray)(&HBCC, 4)
    
    Public Function getspoilersarmed()
            Return autospoiler.Value(0)
    End Function
    
     Private Sub cbSpoilersarmed_CheckStateChanged(sender As Object, e As EventArgs) Handles cbSpoilersarmed.CheckStateChanged
            'If cbSpoilersarmed.Checked = True Then
            If cbSpoilersarmed.Checked = True Then
                Dim vt As String = DateTime.UtcNow.ToString("[HH:mm]") & Chr(32) & "Auto spoilers armed" & vbCrLf
                My.Computer.FileSystem.WriteAllText(logname, vt, True)
                Dim xml As String = DateTime.UtcNow.ToString("[HH:mm]") & Chr(32) & "Auto spoilers armed " & "*"
                My.Computer.FileSystem.WriteAllText(reportname, xml, True)
                'ElseIf cbSpoilersarmed.Checked = False Then
            ElseIf cbSpoilersarmed.Checked = False Then
                Dim vt As String = DateTime.UtcNow.ToString("[HH:mm]") & Chr(32) & "Auto spoilers disarmed" & vbCrLf
                My.Computer.FileSystem.WriteAllText(logname, vt, True)
                Dim xml As String = DateTime.UtcNow.ToString("[HH:mm]") & Chr(32) & "Auto spoilers disarmed " & "*"
                My.Computer.FileSystem.WriteAllText(reportname, xml, True)
            End If
        End Sub
    
    Working nice with keyboard but the same problem like beacon lights (before) with checklist no work

    Regards Fred

  6. Sending Controls (e.g. Spoilers)

     

    You don't need Lua for this. You can send any control number through FSUIPC. Here is an example of writing the spoiler arm control via the dll. The second parameter (0 in the example) is where you send values with the control. Not all controls need values. Just pass 0 if they do not.

        Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
            ' write a control to FS:
            ' either send the number...
            FSUIPCConnection.SendControlToFS(66066, 0)
            ' or use the Enum to make the code easier to read...
            FSUIPCConnection.SendControlToFS(FsControl.SPOILERS_ARM_ON, 0)
            ' (Ils sont la meme chose)
        End Sub
    

    Ok I think there is a misunderstood I don't want to send an event  just check spoilers status like beacon lights it's again for Aerosoft Bus (PM)

     

    Regards Fred

  7. Paul

     

    Finding Active Runways  works fine now (just add filter and make a timer)

    FSUIPCConnection.AITrafficServices.ApplyFilter(False, True, 0, 360, Nothing, 10000D, 30D)
    

    So I woul like to add 4 submenu like getflight startlog stoplog pause I have seen the part of code but for C# (with the class UserInputServices)

    So can you help me please ? 

     

    And I can't give Spoilers Arm status I think LUA is needed 

    ipc.control(66066)
    ipc.control(66067)

    And to finish you now a way where I can give LUA script to pilots ?

     

    Fred

  8. Paul,

     

    your Lua script works fine

    -- set the pollrate to 250ms = 4 times per second
    pollrate = 250
    
    -- create a function to write the LVAR value to an offset
    function writeBeacon(varname, value)
       if value == 1 then
         ipc.setbitsUW(0x0D0C, 2) -- set bit 2
       else
         ipc.clearbitsUW(0x0D0C, 2) -- clear bit 2
       end
    end
    
    -- create an event listener to monitor the LVAR
    -- this will call the function above when the LVAR changes
    event.Lvar("L:LIGHT_BEACON", pollrate, "writeBeacon")
    

    But this no work for me

    Private Sub getActiveRunways()
     ' Get a reference to the AITrafficServices class (saves typing)
     Dim AI As AITrafficServices = FSUIPCConnection.AITrafficServices
     ' Refresh the traffic information 
     AI.RefreshAITrafficInformation() 
     ' Get the arrival runways in use 
     Dim runways As List(Of FSRunway) = AI.GetArrivalRunwaysInUse("EGLL")
     ' Display in the listbox 
     Me.lstArrival.Items.Clear()
     For Each rw As FSRunway In runways
     Me.lstArrival.Items.Add(rw.ToString()) 
     Next rw 
     ' same for departure runways 
     runways = AI.GetDepartureRunwaysInUse("EGLL") 
     Me.lstDeparture.Items.Clear()
     For Each rw As FSRunway In runways
     Me.lstDeparture.Items.Add(rw.ToString()) 
     Next rw 
     End Sub
    
  9. Paul I would like to say you thank you for your reply ;)

    -- set the pollrate to 250ms = 4 times per second
    pollrate = 250
    
    -- create a function to write the LVAR value to an offset
    function writeBeacon(varname, value)
       if value == 1 then
         ipc.setbitsUW(0x0D0C, 2) -- set bit 2
       else
         ipc.clearbitsUW(0x0D0C, 2) -- clear bit 2
       end
    end
    
    -- create an event listener to monitor the LVAR
    -- this will call the function above when the LVAR changes
    event.Lvar("L:LIGHT_BEACON", pollrate, "writeBeacon")

    This code it's written for VB.Net ? (I'm a nobe)

     

    Do you mean this facility on the AITrafficServices?

     

    Yes

    Dim AI As AITrafficServices = FSUIPCConnection.AITrafficServices
    ' Refresh the traffic information
    AI.RefreshAITrafficInformation()
    ' Get the arrival runways in use
    Dim runways As List(Of FSRunway) = AI.GetArrivalRunwaysInUse("EGLL")
    
    What do you want to know?

     

    I would like paste variable to your string "EGGL"  when I get a flight and check if the plane is in the good ICAO. So less my source code You can't view nothing sorry for that

     

    Pas de probleme. Je vous comprends. Je pense que vous parlez l'Anglais mieux que je parle la Francais. :smile:

     

    Paul

     

    Très bon Français Paul ;)

     

    So I'm a register FSUIPC and WideFS user so I'm using your DLL I would like to make donation where I can do that ?

     

    Fred

  10. Ok thanks Paul,

     

    I think those issues made by Aerosoft, so for L:VARS how I can use that ? For the SDK by Aerosoft I don't think exist maybe by Joshua?

     

    Once I have catch the L:VAR how I can make that in my VB.net code ?

     

    Source:http://forum.avsim.net/topic/451948-aerosoft-airbus-module-43-v2/

    function Lights_BEACON_on ()
        LVarSet = "L:LIGHT_BEACON"
        ipc.writeLvar(LVarSet, 1)
        LightSwitch ()
    	DspShow ("BCN", "on")
    end
    
    function Lights_BEACON_off ()
        LVarSet = "L:LIGHT_BEACON"
        ipc.writeLvar(LVarSet, 0)
        LightSwitch ()
    	DspShow ("BCN", "off")
    end
    

    An other question about you latest lines docs for know active runways can you help me please ? (sorry I don't have the source code with me here)

     

    Sorry for my poor English I try todo the best ;)

     

    Fred

  11. * Strange issues with this airplane for beacon lights offset is not working by light type method

     

    * For auto spoilers detection works but strange if armed by myself is good but when the checklist run the auto spoilers are not  checked in my Acars system

     

    example : view log here

     

    http://www.skydream-airlines.com/index.php/pireps/view/1594

     

    other with Airbus

     

    http://www.skydream-airlines.com/index.php/pireps/viewreport/1587

     

    For now I can't paste my code here (I'm not at home)

     

    Fred

     

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