Jump to content
The simFlight Network Forums

Recommended Posts

Hey, guys! I'm a beginner in applications with FSUIPC, and I'm pretty sure this is a stupid question but, how do I set the payload of an aircraft?

The plane in question is an Embraer 195, with 3 sectores: crew, passengers and cargo.

I can read and set the fuel levels, but got nowhere close with the payload. Here's what I'm doing so far, fuelwise:

double targetFuel = 2134;

double maxFuel = 6495.225;

int formula = (int)((targetFuel * 100 / maxFuel) * (128 * 65536) / 100);

result = fsuipc.FSUIPC_Write(0x0B94, formula, ref token, ref dwResult);

result = fsuipc.FSUIPC_Write(0x0B7C, formula, ref token, ref dwResult);

result = fsuipc.FSUIPC_Process(ref dwResult);

This works as a charm, but I have no idea how to work on offset 1400.

Any help at all would be greatly appreciated. Thank you!

Share this post


Link to post
Share on other sites

I can read and set the fuel levels, but got nowhere close with the payload.

...

I have no idea how to work on offset 1400.

What are you finding wrong? Have you read the details of the 1400 offsets, where it says that it doesn't seem to affect real weights and balances on FS9, and no one has yet provided any feedback for FSX? What version of FS are you using in the first place?

Regards

Pete

Share this post


Link to post
Share on other sites

I'm using FSX. I have read the detais of the offset, but didn't find it very explainative. Like, how can I even read from a payload sector? Because normally, I would do this:

result = fsuipc.FSUIPC_Read(0x1400, 48, ref token, ref dwResult);
result = fsuipc.FSUIPC_Process(ref dwResult);
result = fsuipc.FSUIPC_Get(ref token, ref dwResult);
crewWeight = dwResult;[/CODE]

And when I try to run that with the 1400 offset, it simply will always read 0 or True, even though the actual weight should always be 385 KG for this sector.

I've seen somthing about BitConverter, but no idea how that would work, and I couldn't find any portion of usable code about that.

Edited by Henrique Sirot

Share this post


Link to post
Share on other sites

I'm using FSX. I have read the detais of the offset, but didn't find it very explainative. Like, how can I even read from a payload sector?

Ah, you want advice about programming, not the FSUIPC interface facilities. Sorry, I can't help with anything other than C/C++ or ASM. Are you using Paul Henty's interface? I think that makes things easier.

The payload section of offsets is a simple array of structures, so you'd need to know how to handle those in your language. Alternatively of course, if you know the payload sectors you need to change, you can simply address the weight variables directly -- the double at 1400 for the first station, 1430 for the second, and so on. They are spaced at 48 byte intervals, of course, because each entry takes that much space.

Regards

Pete

Share this post


Link to post
Share on other sites

Hello Henrique,

You might want to have a look at my .NET DLL for FSUIPC. It much easier than using the old C# SDK that you are using.

See this thread for a description and download for version 2.0.

http://forum.simflight.com/topic/40989-fsuipc-client-dll-for-net-version-20/

If you like it and want to use it please send me a PM - I have a Beta version 2.2 that allows easy access to the payload and fuel data. I can send you a copy to try. But please get familiar with using the 2.0 version first.

Paul

Share this post


Link to post
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

×

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.