Jump to content
The simFlight Network Forums

Eroor message: FSUIPC_ERR_SIZE


Delphi

Recommended Posts

Hello,

suddenly I get the following error message some seconds after opening the FSUIPC connection:

 

FSUIPC Error #15: FSUIPC_ERR_SIZE. The amount of data requested exceeded the maximum allowed in one Process()
 
Actually I request only a handfull offsets from FSUIPC and did not have any problems in the past. I did not add any new offset or data request.
 
Would be very helpful for further troublesshooting to know under which circumstances FSUIPC.dll generates the message.
 
Thanks for your help!
 
Best regards
 
Ruediger
Link to comment
Share on other sites

 

Hello,

suddenly I get the following error message some seconds after opening the FSUIPC connection:

 

FSUIPC Error #15: FSUIPC_ERR_SIZE. The amount of data requested exceeded the maximum allowed in one Process()
 
Actually I request only a handfull offsets from FSUIPC and did not have any problems in the past. I did not add any new offset or data request.
 
Would be very helpful for further troublesshooting to know under which circumstances FSUIPC.dll generates the message.
 
Thanks for your help!
 
Best regards
 
Ruediger

 

 

Sounds like a corrupted length field. Try using the logging in FSUIPC to see what is going on -- though I think that error is detected in the FSUIPC_Read or Write functions built into your code, before FSUIPC sees them.

 

Pete

Link to comment
Share on other sites

Hi Ruediger,

 

There is only one place the DLL throws this error. It's during the process() when it detects that the data exchange file is greater than approx. 32K.

 

If you're only requesting a few offsets and the amount of data is way under the 32K limit, the most likely cause is a that you program is creating the same offsets over and over. Have you changed where/how you are declaring your offsets?

 

Make sure each offset only gets declared once in the lifetime of your application. Usually this is done by declaring them as variables in the form/class level. If you create them in code then make sure that code only runs once, or if it needs to run more than once, make sure you clean up the offsets by either:

 

a. Calling .Disconnect() on the offset before it goes out of scope.

b. Adding them to a group and then calling FSUIPCConnection.DeleteGroup() before they go out of scope.

 

If you still can't see the problem in your code I'll be happy to take a look if you want to paste the offset declarations here, or PM them to me if you prefer. Otherwise I could add some diagnostics to the DLL so you can better see what's happening with the memory file.

 

Paul

Link to comment
Share on other sites

Hi Pete, Hi Paul,

I found the problem and learned :-)

 

The issue was that I called FSUIPCConnection.Process from 2 different forms. I could solve the problem and improved my code. Now I call FSUIPCConnection.Process only from the main form. All works well now. However, would it be possible to have a kind of 'isBusy' flag while FSUIPC.DLL is processing a request.

 

Ruediger

Link to comment
Share on other sites

Hi Ruediger,

 

It's good that you got it working.

 

I'm not convinced that the problem was running Process() from a different form. Unless you're explicitly running the other form on a separate thread, both forms will be running on the same thread. This means that the process() method cannot be executed at the same time by both forms because only one form can run code at a time.

 

The isBusy flag won't be of any use to single-threaded application.

 

Anyway if it's working now, that's the main thing.

 

Paul

Link to comment
Share on other sites

  • 6 years later...

Hi, I have the same problem in my program, but only after when start a second flight. When I start my program the code works fine. The aircraft is loaded and refueled. When doing a second flight and run the code again I get the Message FSUIPC Error #15: FSUIPC_ERR_SIZE. I have declared the variables only once and don't know how to fix. Here is my code with the error: Errorline is marked as 'Error in this line...' and is when I run the line FSUIPCConnection.Process()

Thanks in advance for your help.

    Protected Sub refuel()

        If Not FSUIPCConnection.IsOpen Then
            Try
                FSUIPCConnection.Open()
            Catch ex As Exception
                Response.Write("<script>alert('no connection to FSUIPC. Check and reload Aircraft manual');</script>")
                Exit Sub
            End Try
        End If

        Dim fuelTanks As FsFuelTanksCollection = Nothing
        Dim PayloadStations As List(Of FsPayloadStation) = Nothing
        Dim Parkingbrk As Offset(Of Short) = New FSUIPC.Offset(Of Short)(&HBC8)

        FSUIPCConnection.PayloadServices.RefreshData()
        fuelTanks = FSUIPCConnection.PayloadServices.FuelTanks
        PayloadStations = FSUIPCConnection.PayloadServices.PayloadStations
        If Aircraft = "Prosim A320 2020" Or Aircraft = "Prosim A320" Then
                For Each tank In fuelTanks
                    If fuelTanks IsNot Nothing AndAlso tank.IsPresent Then
                        If tank.Tank = 0 Then
                            CT = tank.WeightKgs.ToString("F0")
                            CTMax = tank.CapacityKgs.ToString("F0")
                        ElseIf tank.Tank = 1 Then
                            TankL = tank.WeightKgs.ToString("F0")
                            TankLMax = tank.CapacityKgs.ToString("F0")
                        ElseIf tank.Tank = 2 Then
                            TankR = tank.WeightKgs.ToString("F0")
                            TankRMax = tank.CapacityKgs.ToString("F0")
                        End If
                    End If
                Next

            ElseIf Aircraft = "JeeHell Airbus" Then
                For Each tank In fuelTanks
                    If fuelTanks IsNot Nothing AndAlso tank.IsPresent Then
                        If tank.Tank = 0 Then
                            CT = tank.WeightKgs.ToString("F0")
                            CTMax = tank.CapacityKgs.ToString("F0")
                        ElseIf tank.Tank = 1 Then
                            TankL = tank.WeightKgs.ToString("F0")
                            TankLMax = tank.CapacityKgs.ToString("F0")
                        ElseIf tank.Tank = 2 Then
                            TankR = tank.WeightKgs.ToString("F0")
                            TankRMax = tank.CapacityKgs.ToString("F0")
                        ElseIf tank.Tank = 3 Then
                            AuxL = tank.WeightKgs.ToString("F0")
                            AuxLMax = tank.CapacityKgs.ToString("F0")
                        ElseIf tank.Tank = 4 Then
                            AuxR = tank.WeightKgs.ToString("F0")
                            AuxRMax = tank.CapacityKgs.ToString("F0")
                        End If
                    End If
                Next
            End If

        FSUIPCConnection.Process()    'Error in this line...'

        If Parkingbrk.Value > 0 Then
            If Aircraft = "Prosim A320 2020" Or Aircraft = "Prosim A320" Then
                Dim MaxFuel As Double = CDbl(CTMax) + CDbl(TankLMax) + CDbl(TankRMax)
                Dim Refuel As Double = CDbl(FOB)

                If Refuel > MaxFuel Then
                    Refuel = MaxFuel
                    Response.Write("<script>alert('Fuel limited by Max Fuel capacity');</script>")
                End If

                If Refuel > CDbl(TankLMax) + CDbl(TankRMax) Then
                    Dim Wing As Double
                    Dim CT As Double
                    CT = Refuel - (CDbl(TankLMax) + CDbl(TankRMax))
                    Wing = Refuel - CT

                    For Each tank In fuelTanks
                        If tank.Tank = 0 Then
                            tank.WeightKgs = CT
                        ElseIf tank.Tank = 1 Then
                            tank.WeightKgs = Wing / 2
                        ElseIf tank.Tank = 2 Then
                            tank.WeightKgs = Wing / 2
                        End If
                    Next
                Else
                    For Each tank In fuelTanks
                        If tank.Tank = 1 Then
                            tank.WeightKgs = Refuel / 2
                        ElseIf tank.Tank = 2 Then
                            tank.WeightKgs = Refuel / 2
                        ElseIf tank.Tank = 0 Then
                            tank.WeightKgs = 0
                        End If
                    Next
                End If

                FSUIPCConnection.PayloadServices.WriteChanges()

                Dim PLPassengers, FClass, Coach1, Coach2, Coach3, Baggage, PLCargo, FWDBaggage, AftBaggage As Double

                PLPassengers = CDbl(Passengers)
                PLCargo = CDbl(Cargo)
                FClass = Math.Round((PLPassengers / 100) * 18.19, 0)
                Coach1 = Math.Round((PLPassengers / 100) * 22.73, 0)
                Coach2 = Math.Round((PLPassengers / 100) * 27.28, 0)
                Coach3 = Math.Truncate(Passengers - FClass - Coach1 - Coach2)
                Baggage = (Passengers * 11) + PLCargo
                FWDBaggage = Math.Round(((PLPassengers * 11) / 2) + (Cargo / 2), 0)
                AftBaggage = Baggage - FWDBaggage

                For Each station As FsPayloadStation In PayloadStations

                    If station.Index = 0 Then
                        station.WeightKgs = 77
                    ElseIf station.Index = 1 Then
                        station.WeightKgs = 77
                    ElseIf station.Index = 2 Then
                        station.WeightKgs = 352
                    ElseIf station.Index = 3 Then
                        station.WeightKgs = FClass * 88
                    ElseIf station.Index = 4 Then
                        station.WeightKgs = Coach1 * 88
                    ElseIf station.Index = 5 Then
                        station.WeightKgs = Coach2 * 88
                    ElseIf station.Index = 6 Then
                        station.WeightKgs = Coach3 * 88
                    ElseIf station.Index = 7 Then
                        station.WeightKgs = FWDBaggage
                    ElseIf station.Index = 8 Then
                        station.WeightKgs = AftBaggage
                    End If

                Next

                FSUIPCConnection.PayloadServices.WriteChanges()

            ElseIf Aircraft = "JeeHell Airbus" Then
                Dim MaxFuel As Double = CDbl(CTMax) + CDbl(TankLMax) + CDbl(TankRMax) + CDbl(AuxLMax) + CDbl(AuxRMax)
                Dim Refuel As Double = CDbl(FOB)

                If Refuel > MaxFuel Then
                    Refuel = MaxFuel
                    Response.Write("<script>alert('Fuel limited by Max Fuel capacity');</script>")
                End If

                If Refuel > CDbl(TankLMax) + CDbl(TankRMax) Then
                    For Each tank In fuelTanks
                        If tank.Tank = 1 Then
                            tank.WeightKgs = TankLMax
                        ElseIf tank.Tank = 2 Then
                            tank.WeightKgs = TankRMax
                        End If
                    Next
                    Refuel = Refuel - CDbl(TankLMax) - CDbl(TankRMax)
                    If Refuel > CDbl(AuxLMax) + CDbl(AuxRMax) Then
                        Dim Wing As Double
                        Dim CT As Double
                        CT = Refuel - (CDbl(AuxLMax) + CDbl(AuxRMax))
                        Wing = Refuel - CT
                        For Each tank In fuelTanks
                            If tank.Tank = 0 Then
                                tank.WeightKgs = CT
                            ElseIf tank.Tank = 3 Then
                                tank.WeightKgs = Wing / 2
                            ElseIf tank.Tank = 4 Then
                                tank.WeightKgs = Wing / 2
                            End If
                        Next
                    Else
                        For Each tank In fuelTanks
                            If tank.Tank = 3 Then
                                tank.WeightKgs = Refuel / 2
                            ElseIf tank.Tank = 4 Then
                                tank.WeightKgs = Refuel / 2
                            ElseIf tank.Tank = 0 Then
                                tank.WeightKgs = 0
                            End If
                        Next
                    End If
                Else
                    For Each tank In fuelTanks
                        If tank.Tank = 1 Then
                            tank.WeightKgs = Refuel / 2
                        ElseIf tank.Tank = 2 Then
                            tank.WeightKgs = Refuel / 2
                        ElseIf tank.Tank = 0 Then
                            tank.WeightKgs = 0
                        ElseIf tank.Tank = 3 Then
                            tank.WeightKgs = 0
                        ElseIf tank.Tank = 4 Then
                            tank.WeightKgs = 0
                        End If
                    Next
                End If

                FSUIPCConnection.PayloadServices.WriteChanges()

                Dim PLPassengers, PLCargo, Baggage, CABOA, CABOB, CABOC, CPT1, CPT3, CPT4, CPT5 As Double

                PLPassengers = CDbl(Passengers) * 84
                PLCargo = Cargo
                CABOA = Math.Round((PLPassengers / 100) * 33.33, 0)
                CABOB = Math.Round((PLPassengers / 100) * 33.33, 0)
                CABOC = Math.Truncate(PLPassengers - CABOA - CABOB)
                Baggage = (Passengers * 11) + PLCargo
                CPT1 = (Baggage / 100) * 36.11
                CPT3 = (Baggage / 100) * 25.55
                CPT4 = (Baggage / 100) * 22.22
                CPT5 = Baggage - (CPT1 + CPT3 + CPT4)

                For Each station As FsPayloadStation In PayloadStations

                    If station.Index = 0 Then
                        station.WeightKgs = CABOA
                    ElseIf station.Index = 1 Then
                        station.WeightKgs = CABOB
                    ElseIf station.Index = 2 Then
                        station.WeightKgs = CABOC
                    ElseIf station.Index = 3 Then
                        station.WeightKgs = CPT1
                    ElseIf station.Index = 4 Then
                        station.WeightKgs = CPT3
                    ElseIf station.Index = 5 Then
                        station.WeightKgs = CPT4
                    ElseIf station.Index = 6 Then
                        MsgBox(Aircraft)
                        station.WeightKgs = CPT5
                    End If

                Next
                FSUIPCConnection.PayloadServices.WriteChanges()
            End If
            FSUIPCConnection.WriteLVar("FSDT_GSX_NUMPASSENGERS", Passengers)
            FSUIPCConnection.WriteLVar("FSDT_GSX_PILOTS_NOT_DEBOARDING", 1)
            FSUIPCConnection.WriteLVar("FSDT_GSX_CREW_NOT_DEBOARDING", 1)
            FSUIPCConnection.WriteLVar("FSDT_GSX_PILOTS_NOT_BOARDING", 1)
            FSUIPCConnection.WriteLVar("FSDT_GSX_CREW_NOT_BOARDING", 1)
        Else
            Response.Write("<script>alert('Reload only with Parking Brakes set. Set Parking Brakes and reload Aircraft again');</script>")
        End If
        FSUIPCConnection.Close()
        fuelTanks = Nothing
        PayloadStations = Nothing
        Parkingbrk = Nothing

    End Sub

 

Link to comment
Share on other sites

Hi, 

There doesn't seem to be much wrong with this sub you have posted. Most of it uses the payload services which manages the offsets for you.

There is one small issue:

Dim Parkingbrk As Offset(Of Short) = New FSUIPC.Offset(Of Short)(&HBC8)

This offset is being re-created every time you call refuel(). If you call it 3 times you will have three copies of this offset. That's obviously not enough to cause the  FSUIPC_ERR_SIZE, but you might be making the same mistake elsewhere in your code.

Are you creating offsets anywhere else? You should declare offsets at the form or module level. If you declare them in subs they get created again and again. Even if the variables go out of scope, the offsets are still there.

If you must declare them in a sub, place them in a group and then delete the group when you are finished. E.g:

Dim Parkingbrk As Offset(Of Short) = New FSUIPC.Offset(Of Short)("refuelOffsets", &HBC8)

....

FSUIPCConnection.Process("refuelOffsets")

....

FSUIPCConnection.DeleteGroup("refuelOffsets")

Exit Sub

Paul

Link to comment
Share on other sites

Hello Paul,

thank you very much for your fast reply. I will check and rewrite the code to Groups and report in a few days. I don't think I have declared the variables multiple times. But I check it also.

Matthias

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.