Jump to content
The simFlight Network Forums

Plane with Fsuipc Client DLL refuel


skino

Recommended Posts

I want to fill the standard aircraft in the FSX and P3D with a small VB tool. A value is to be written into a text field and transferred as gallons into the simulator.

The necessary functions and declarations, I have not found in the client Dll.
How exactly do I get the tanks filled?
I am grateful for every note. Of course also for VB code examples.

Link to comment
Share on other sites

The fuel tanks are accessed through the PayloadServices module.

Here is an example of setting the level of the centre-main tank with a level typed into a text box:

    Private Sub LoadFuel()
        ' Connection must already be open
        Dim ps As PayloadServices = FSUIPCConnection.PayloadServices
        Dim requestedFuel As Double
        ' Turn the text into a number
        If Double.TryParse(Me.txtFuelGallons.Text, requestedFuel) Then
            ' set the level on the centre main tank
            ps.FuelTanks(FSFuelTanks.Centre_Main).LevelUSGallons = requestedFuel
            ' sent new levels to the sim
            ps.RefreshData()
        Else
            ' Not a number in the text box
        End If
    End Sub

To work with a different tank, just change the value of the FSFuelTanks enum. For example:

ps.FuelTanks(FSFuelTanks.Left_Main)

All possible fuel tanks are included in the FsFuelTanks enumeration. The popup menu will show you all tanks when you type . after FSFuelTanks.

Each fuel tank must be processed separately. You can't specify a level for all tanks globally. If you want your user to be able to enter a level of fuel for all tanks then your program will need to split the fuel across all the available tanks, keeping the aircraft as balanced as possible.

To find out which tanks are available on the aircraft you can test the capacity. If the capacity is 0 then this fuel tank does not exist on the loaded aircraft.

e.g.

        If ps.FuelTanks(FSFuelTanks.Centre_Main).CapacityUSGallons = 0 Then
            ' This aircraft has no centre fuel tank.
        End If

Paul

 

Link to comment
Share on other sites

  • 4 weeks later...

Hello Paul,
If I use this code I always get an error message

 

Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick

        Dim ps As PayloadServices = FSUIPCConnection.PayloadServices


        If ps.FuelTanks(FSFuelTanks.Centre_Main).CapacityUSGallons = 0 Then
            CheckBox6.Checked = True
        End If

        Label3.Text = ps.FuelTanks(FSFuelTanks.Centre_Main).LevelUSGallons & " Gal"

        If ps.FuelTanks(FSFuelTanks.Centre_2).CapacityUSGallons = 0 Then
            CheckBox7.Checked = True
        End If

        If ps.FuelTanks(FSFuelTanks.Centre_3).CapacityUSGallons = 0 Then
            CheckBox8.Checked = True
        End If

        If ps.FuelTanks(FSFuelTanks.Left_Aux).CapacityUSGallons = 0 Then
            CheckBox11.Checked = True
        End If

        If ps.FuelTanks(FSFuelTanks.Left_Main).CapacityUSGallons = 0 Then
            CheckBox10.Checked = True
        End If

        If ps.FuelTanks(FSFuelTanks.Left_Tip).CapacityUSGallons = 0 Then
            CheckBox9.Checked = True
        End If

        If ps.FuelTanks(FSFuelTanks.Right_Aux).CapacityUSGallons = 0 Then
            CheckBox13.Checked = True
        End If
        If ps.FuelTanks(FSFuelTanks.Right_Main).CapacityUSGallons = 0 Then
            CheckBox12.Checked = True
        End If
        If ps.FuelTanks(FSFuelTanks.Right_Tip).CapacityUSGallons = 0 Then
            CheckBox3.Checked = True
        End If
        ps.RefreshData()

        If My.Settings.NoPanel = 1 Then
            Form1.Hide()
            Tank34.Hide()
        Else
            Form1.Show()
            Tank34.Show()
        End If

        FSUIPCConnection.Process("AircraftInfo")
        Label2.Text = aircraftType.Value
      

    End Sub

29039238es.jpg

Screenshot 2017-04-28 14.40.47.png

Link to comment
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
×
×
  • 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.