Jump to content
The simFlight Network Forums

Recommended Posts

Posted

Hi there,

I've been working on my own version of acars and the development is going well. I've managed to learn from the code samples from many places and this forum was my reference couple of times.

I know FS reads flaps as specific intervals, i.e. 0, 2047, ... 16383 when reading the offset 0x3BFA or 0xBDC. Depending how many flaps the aircraft has, the interval will be read accordingly.

Does anyone have any logic in translating these values into Flap 1 (0), Flap 2 (8191), Flap 3 (16383), which already expects any aircraft, even the Wilco one, which has a different flap interval from other aircrafts? It can be in any language.

I don’t want to reinvent the wheel here.

Thanks.

Posted

I know FS reads flaps as specific intervals, i.e. 0, 2047, ... 16383 when reading the offset 0x3BFA or 0xBDC. Depending how many flaps the aircraft has, the interval will be read accordingly.

Does anyone have any logic in translating these values into Flap 1 (0), Flap 2 (8191), Flap 3 (16383), which already expects any aircraft, even the Wilco one, which has a different flap interval from other aircrafts?

What version of FS are you aiming this at? If for FSX you can get the index number from offset 0BFC. (0 = full up).

Pete

Posted

As aircraft have differing flap angles for each interval you will have to determine which flap angles to use for the current flap interval

Here are snippets of code, not complete here just for example, in vb.net from my aircraft class for reading the flap angles (formatting doesnt look like it does in VStudio)

I have a config file for each aircraft that I fly with flap data stored like this (taken from my 737-700 file)

First number is raw value, 2nd is flap angle and 3rd is max airspeed for that flap extended


//Flaps
<NumberOfFlapAngles> 8
<FlapsData>
2048 1 250
4096 2 250
6144 5 250
8192 10 210
10239 15 200
12287 25 190
14335 30 175
16383 40 162
<EndFlapsData>
<DefaultFlaps> 5 30
[/CODE]

hence the following code copies the values read from the above section of the config file into the required arrays

[CODE]
'read first line of flap data'
line = parser.ReadFields()
'loop until end of flaps data section'
While line(0) <> "<EndFlapsData>"
objAircraft.FlapDetails(arrayindex) = line(0)
objAircraft.FlapDetails(arrayindex + 1) = line(1)
objAircraft.FlapDetails(arrayindex + 2) = line(2)
'read first line of flap data'
line = parser.ReadFields()
arrayindex += 3
End While

[/CODE]

The following code shows how to get the currently selected flap angle, max speed based on the raw value read from FS. This sub is called whenever I want to check for the flap values which I then do by reading the values stored within FlapAngleSet, FlapAngleMaximumSpeed

[CODE]
Public Sub getFlaps()
Me.readFlapsOffset()
Dim b As Short = 0
Dim c As Short = 1 'used as loop counter and also for flap array position so not zero based'
Me.RawFlapsNumber = Me.fsRawFlapsNumber.Value
While c <= Me.NumberOfFlapAngles 'only loop for the number of flaps ie 3'
If Me.RawFlapsNumber = 0 Then
'if no flaps set then set angle to 0 for up and set max airspeed to max speed of aircraft'
Me.FlapAngleSet = 0
Me.FlapAngleMaximumSpeed = Me.MaxStructuralAirspeed
Me.FlapArrayPosition = 0
Exit While
ElseIf Me.RawFlapsNumber = Me.FlapDetails(B) Then
'if raw value matches that for selected flap then get'
'the flap angle ie 20 and the max flap down speed for that angle'
Me.FlapAngleSet = Me.FlapDetails(b + 1)
Me.FlapAngleMaximumSpeed = Me.FlapDetails(b + 2)
Me.FlapArrayPosition = c
Exit While
End If
'if not found then loop until read all the flap settings for that aircraft'
'ie 5 flaps settings, loop 5 times'
b = b + 3 'move to next flap settings in array'
c += 1
End While
End Sub

Public Sub readFlapsOffset()
FSUIPCConnection.Process("flaps")
End Sub
[/CODE]

These are only snippets from my aircraft class but should give you an idea of how to customise your ACARS app for flaps. This works fine for me.

Posted

What version of FS are you aiming this at? If for FSX you can get the index number from offset 0BFC. (0 = full up).

Pete

Hi Pete,

First thanks for replying, I noticed you have been helping FS developers for a long time!

Well, the VA I've been developing has pilots that fly with FS2004 (most of them) and few FSX.

It will have to expect any aircraft (FS default, freeware and payware) based on the fleet of the VA (B350, EMB120, ATR72, E-170, E-195, 737-800, A319, A320, 757, 767-300, 747-400, MD-11, 777-300 and 727-200).

Thanks for the offset suggestion. I can also get the info when flaps are full, reading offset 0BDC = 16383.

I think I will have to build some logic like gjpollitt wrote above. Having all flap details stored in a config file, retrieving them in a loop and them parse it according to the FS offset read.

There is a multiline textbox on my acars where it displays all the events during the flight. All I want is display to the user (pilot), the flap change and its speed, like:

[10h45 - Flap 2 at 210 kts]

Thanks

Posted

As aircraft have differing flap angles for each interval you will have to determine which flap angles to use for the current flap interval

Here are snippets of code, not complete here just for example, in vb.net from my aircraft class for reading the flap angles (formatting doesnt look like it does in VStudio)

I have a config file for each aircraft that I fly with flap data stored like this (taken from my 737-700 file)

First number is raw value, 2nd is flap angle and 3rd is max airspeed for that flap extended

Thanks gjpollitt. Let me grasp your suggestion and then I'll post it here how I am getting on. It looks like the way to go. Your code will help me for sure.

Posted

I think I will have to build some logic like gjpollitt wrote above. Having all flap details stored in a config file, retrieving them in a loop and them parse it according to the FS offset read.

Why? There are offsets that list flap positions in degrees (multiplied by 512) that I use which work for the vast majority of aircraft. The config file doesn't seem very extendible.

Cheers!

Luke

Posted

Why? There are offsets that list flap positions in degrees (multiplied by 512) that I use which work for the vast majority of aircraft. The config file doesn't seem very extendible.

Cheers!

Luke

I use config files for the aircraft as I need to read the maximum speed for that flap setting. That info isn't available within FS

  • 2 weeks later...
Posted

Thanks guys.

Why Am I not getting notification by e-mail when someone replies on this post?

I am following this topic and also checked my notification settings and they are all ok.

Emerson

  • 5 weeks later...
Posted

Just to let you know, the development was successful and my own acars is now being tested by few members of the VA.

It was very interesting development and my first FS application.

I used .NET framework windows forms.

Thanks for all help.

Emerson

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.