Jump to content
The simFlight Network Forums
borgfan

Payload services query

Recommended Posts

I've been experimenting with managing fuel and payload using vb and your excellent dll but have come across a couple of oddities.  Using your example code, I've observed that changing fuel level also changes the empty weight (by a small amount).  I've tested this on FSX/Acc using the default C172 but see the same behaviour on P3d. I'm using VS2017.

Also when I set a payload station value, write the change and then read the station again, the value does not seem to have been updated. 

payloadStations(0).WeightKgs = CDbl(txtPilot.Text)
FSUIPCConnection.PayloadServices.WriteChanges()
FSUIPCConnection.PayloadServices.RefreshData()
txtPayload.Text = FSUIPCConnection.PayloadServices.PayloadWeightKgs.ToString("F2")

However if I insert a short delay between writing the change and reading the new result, it seems ok.  Any ideas on what might be happening?

Thanks

Gerard

 

Share this post


Link to post
Share on other sites

Hi Gerard,

Quote

.  Using your example code, I've observed that changing fuel level also changes the empty weight (by a small amount)

Yes, I think I can see why. The empty weight is calculated by subtracting the total fuel and payload from the Gross Weight. All of the weight values are stored in lbs. To get kg they need converting. At the moment that conversion is done for every fuel tank and payload station. This means the small conversion errors for each tank/payload station will add up to something noticeable.

I'm not sure why I did that, but in the next few days I will improve this by just converting once at the end. This should improve things. 

I'll let you know when a new Beta version is ready for your to test.

Quote

Also when I set a payload station value, write the change and then read the station again, the value does not seem to have been updated. 

However if I insert a short delay between writing the change and reading the new result, it seems ok.  Any ideas on what might be happening?

I think this is just down to the time taken for the payload data to arrive at the sim.

The DLL sends the data to FSUIPC, which then has to prepare SimConnect calls and pass the data to the sim. Once the sim receives these it has to change the active payload values.

This is all going to take a bit of time, so reading the value back too soon won't be accurate. I would think it's unnecessary anyway.

If you're just trying to check that your values have been written properly, then it's reasonable to add the delay to give all the steps time to complete.

Paul

Share this post


Link to post
Share on other sites

Thanks Paul,

I can can see how the lbs to kgs conversion could lead to the small differences arising, I guess I was just expecting that the empty weight would be a constant irrespective of whatever other weight changes were going on. I suspected that the empty weight was derived from gross weight but kind of hoped it was static as defined in the aircraft.cfg.  No problem to work around.

I was toying with creating a payload manager app and thus spotted the delays in updating changed values. I can easily just insert a small delay after executing a write change and so keep everything consistent, no problems there.

Much appreciated.

Gerard

 

 

 

 

Share this post


Link to post
Share on other sites

Hi Gerard,

Version 3.1.11 is now available. This fixes the rounding problems in the payload services for Kgs.

In my testing it's much better. On the Cessna 172, changing between 100% fuel and 25% fuel, the empty weight would change by ~1kg. Now it's only 0.08kg.

I can't get it perfect as FSUIPC gives the fuel tank levels in volume not weight. So there is always going to be some small rounding error going from gallons to lbs.

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.