Jump to content
The simFlight Network Forums

How to get the right values?


Recommended Posts

Hi,

As my question is related to Project Magenta, I know, primarily should have written to their support, which I actually did, but no answer from their side.

That's why I dare to ask it here as my problem is at least partially related to FSUIPC.

So to sum it up:

I need to read the annunciated FMA Trust related values to rightly drive my motorized throttle quadrant.

The offset in the PM docs for this says:

0504 2 AP Mode 3 (Annunciator Values) (Read Only)

Autopilots Active (Bits 0 = none or any combination of 1, 2, 3 (bit 3), i.e. value 5 would be A/P 1 and 3 active)

Thrust Channel (Speed modes)

Vertical Channel (ALT etc.)

Horizontal Channel (HDG etc.)

0xAuto * 0x1000 + 0xThr * 0X100 + 0xVer * 0x10 + 0xHor

And I understand that the different hex values for each 'channel' sum up the value.

But how can I specifically read those few values I'm interested in?

What does actually the line 0xAuto * 0x1000 + 0xThr * 0X100 + 0xVer * 0x10 + 0xHor - means?

For instance, I need to know when toga is annunciated and when the THR part of the FMA say Retard.

Used FSUIPC's logging function to find these values, but the given hex values are always dependent on other channels, those I'm actually not interested in this time.

How would it be possible to only read the needed values in the THR channel?

thanks in advance

Potroh

Link to comment
Share on other sites

I need to read the annunciated FMA Trust related values to rightly drive my motorized throttle quadrant.

"Thrust" you mean? No idea what FMA is.

The offset in the PM docs for this says:

0504 2 AP Mode 3 (Annunciator Values) (Read Only)

Autopilots Active (Bits 0 = none or any combination of 1, 2, 3 (bit 3), i.e. value 5 would be A/P 1 and 3 active)

Thrust Channel (Speed modes)

Vertical Channel (ALT etc.)

Horizontal Channel (HDG etc.)

0xAuto * 0x1000 + 0xThr * 0X100 + 0xVer * 0x10 + 0xHor

Okay.

And I understand that the different hex values for each 'channel' sum up the value.

But how can I specifically read those few values I'm interested in?

What does actually the line 0xAuto * 0x1000 + 0xThr * 0X100 + 0xVer * 0x10 + 0xHor - means?

It just means that, seen in hexadecimal as:

0xABCD

for instance, that A = Autopilots, B = thrust channel, C=vertical channel and D=horizontal channel. In other words, in the 16 bits, 4 bits are allocated to each.

How would it be possible to only read the needed values in the THR channel?

Read the offset, AND it with 0x0F00 to isolate the 4 bits for thrust, and shift the result 8 bits right (or divide by 256 which is the same).

Or, more simply, read the 1 byte offset 0505 (the high byte) and AND it with 0x0F.

Pete

Link to comment
Share on other sites

"Thrust" you mean? No idea what FMA is.

Read the offset, AND it with 0x0F00 to isolate the 4 bits for thrust, and shift the result 8 bits right (or divide by 256 which is the same).

Or, more simply, read the 1 byte offset 0505 (the high byte) and AND it with 0x0F.

Hi Pete,

I'm truly grateful for your help!

The FMA stands for the "Flight Mode Annunciator", those 3 bars on the PFD which show the current mode the AP/AT is commanded.

Green letters show the current active mode and white letters the 'armed' ones.

Those seem to be vital in the scenario I'm struggling with, because when I need to connect or disconnect the throttle levers, only those indications can provide the proper guidance.

In theory PM's MCP/GC is supposed to be writing to the offset 310A to connect or disconnect the throttle, which it does occasionally, but regarding autothrottle phases like 'RETARD' or 'IDLE' it does not do it and more importantly in case of the the Trust-Hold phase right in the middle of takeoff.

When you manually move the levers to 40% or so N1 and then press the Toga button, the lever should move forward until it N1 reaches the CDU commanded value and then (above 80kts) THR-HLD is annunciated in the trust channel, when the pilot is able to manually correct the throttle levers.

When someone is doing a complete automatic landing, whenever 'IDLE' is annunciated, the levers should automatically move back to idle and then AT should also disconnect automatically.

These are the things not modeled there and that's why I need to read the FMA annunciated modes (values in this case) because it is the only way I can instruct the throttle to do whatever it is supposed to.

There are many motorized throttles out there nowadays, but none of them are able to do what the real thing does.

I just bought a THQ from Revolution-Simproducts, far the best available out there, but the software they provide is very basic in this regard. They use the Opencockpits motor boards to drive the throttle (and trim, etc.) and unfortunately those boards use that famous SIOC script language which is a very simple language, allowing only to write one single operation in a line.

So it is a very complicated but I'm on the right track if I'm able to read those Thrust-Channel values and instruct the throttle accordingly.

Just one question if you don't mind:

"read the 1 byte offset 0505 (the high byte) and AND it with 0x0F" means I have to add the hex value 0x0F to the value I read?

'AND it' means that?

best regards

Potroh

Link to comment
Share on other sites

In theory PM's MCP/GC is supposed to be writing to the offset 310A to connect or disconnect the throttle, which it does occasionally, but regarding autothrottle phases like 'RETARD' or 'IDLE' it does not do it and more importantly in case of the the Trust-Hold phase right in the middle of takeoff.

Hmm. I thought some of those phases were intended to allow manual control.

When you manually move the levers to 40% or so N1 and then press the Toga button, the lever should move forward until it N1 reaches the CDU commanded value and then (above 80kts) THR-HLD is annunciated in the trust channel, when the pilot is able to manually correct the throttle levers.

When someone is doing a complete automatic landing, whenever 'IDLE' is annunciated, the levers should automatically move back to idle and then AT should also disconnect automatically.

Okay. Those things are unknown to me, so I've never thought anything was wrong. I don't have a motorized throttle so I suppose it wouldn't have as much impact for me.

I just bought a THQ from Revolution-Simproducts, far the best available out there

Yes, I saw those demonstrated in Lelystad. Very nice. I really wish there was some way of fitting one in my PFC ready-built 737 cockpit, but alas it would be a major metal cutting and reworking job which would be beyond me.

Just one question if you don't mind:

"read the 1 byte offset 0505 (the high byte) and AND it with 0x0F" means I have to add the hex value 0x0F to the value I read?

'AND it' means that?

No no.

AND is a logical operation between bit patterns. There are four main logic operations. Consider two binary values, 1100 and 1010 (hex C and A, or 12 and 10 in decimal):

1100 AND 1010 = 1000 in other words a 1 only where there is a 1 in both (this AND that in English)

1100 OR 1010 = 1110 in other words a 1 where there is a 1 in either (this OR that in English)

1100 XOR 1010 = 0110 in other words a 1 where there two are different. (XOR is "exclusive or")

The 4th main one is NOT, so NOT 1100 is 0011 and NOT 1010 is 0101, i.e. just change all bits to their inverse.

Using AND to select bits, as I am doing with the byte at 0505, is called "masking" and the 0x0F value I am using to select the bits is called the mask. Maybe the software you are using understands those terms instead of the logic operations.

An alternative to masking, if the software only supports arithmetic operations and not logical, would be to divide by 16 and take the remainder.

Regards

Pete

Link to comment
Share on other sites

I really wish there was some way of fitting one in my PFC ready-built 737 cockpit, but alas it would be a major metal cutting and reworking job which would be beyond me.

I'm truly sorry for that. When it works as it should, it really makes a difference.

Using AND to select bits, as I am doing with the byte at 0505, is called "masking" and the 0x0F value I am using to select the bits is called the mask. Maybe the software you are using understands those terms instead of the logic operations.

Many thanks indeed, now I sort of understand it and it works!

The software at least knows logical AND so I was successful to get the right values.

My last last question, just if you don't mind:

I AND it with 0x0F to get those THR values, but what should I use to get if I wanted to get, say the Hor or Ver channel only?

thanks very much

Potroh

Link to comment
Share on other sites

I AND it with 0x0F to get those THR values, but what should I use to get if I wanted to get, say the Hor or Ver channel only?

To recap, the value in offset 0504 is

0xABCD where A = Autopilots, B = thrust channel, C=vertical channel and D=horizontal channel. In other words, in the 16 bits, 4 bits are allocated to each.

So if you are reading the 2-byte (16-bit) word, the masks for isolating each of the 4 bits are easy to see:

0xABCD AND 0xF000 = 0xA000

0xABCD AND 0x0F00 = 0x0B00

0xABCD AND 0x00F0 = 0x00C0

0xABCD AND 0x000F = 0x000D

because hexadecimal "F" is 1111 in binary, making the logical AND select only those 4 bits, in each of the 4 positions. See?

Having isolated the correct bits you probably need to move them so they make a normal integer number. To do that logically involves SHIFTS -- i.e. shifting bits left or right -- in this case right.

However, doing it ARITHMETICALLY might be easier for your software. I don't know. But for this note that hex 0x10 = decimal 16, 0x100 = 16x16 = 256 and 0x1000 = 16x16x16 = 4096, so to shift right by 4 bits divide by 16, by 8 bits divide by 256 and by 12 bits by 4096.

This is all simple logic or arithmetic. Much more basic and easy than understanding aircraft systems! ;-)

Pete

Link to comment
Share on other sites

However, doing it ARITHMETICALLY might be easier for your software. I don't know. But for this note that hex 0x10 = decimal 16, 0x100 = 16x16 = 256 and 0x1000 = 16x16x16 = 4096, so to shift right by 4 bits divide by 16, by 8 bits divide by 256 and by 12 bits by 4096.

Hi Pete,

Many thanks for you invaluable help.

Everything is clear now.

best regards

Potroh

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

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