Bug: Body acceleration not applied correctly

EllipticCurve
Posts: 17
Joined: Mon Jun 12, 2017 6:14 pm

Bug: Body acceleration not applied correctly

Postby EllipticCurve » Sun Apr 28, 2019 10:14 pm

Hi,

I have the following:

Code: Select all

SimConnect_AddToDataDefinition(hSc,DEF_BODY_VEL_Z,"VELOCITY BODY Z","feet per second");
Bug:

The acceleration as set by:

Code: Select all

bvz.bvz = "7.31"; // ft sec^-2 SimConnect_SetDataOnSimObject(hSc,DEF_BODY_VEL_Z,SIMCONNECT_OBJECT_ID_USER,0,0,sizeof(_body_vel_z),&bvz);
is not applied to the simulation correctly.

It is dependent upon frame rate. At 120 FPS this input results in too much acceleration (by approx. 30%), and at 20 FPS (due to being frame-rate limited in settings, or otherwise) results in an under-acceleration by about 80%.

The rate application appears linear to frame rate according to:

SetBodyZAccel * (70.0 / actual_FPS);

...which results in completely incorrect behavior on systems where the FPS is anything other than 70 FPS.

On a system typically limited to 20 or 30 FPS, this means the acceleration rate is very low compared to the set value.

On a related note, there appears to be no reliable way of obtaining, or otherwise syncing to, the current frame rate or the flight model physics.
All comments and opinions are my own.

EllipticCurve
Posts: 17
Joined: Mon Jun 12, 2017 6:14 pm

Re: Bug: Body acceleration not applied correctly

Postby EllipticCurve » Mon Apr 29, 2019 4:44 pm

I made a typographical error in my above post yesterday.

It is BODY WORLD ACCELERATION Z that is malfunctioning (I did not test X or Y, but presume they are equally affected). The correct code snippet follows:

Code: Select all

SimConnect_AddToDataDefinition(hSc,DEF_BODY_ACCEL_Z,"ACCELERATION BODY Z","meter per second squared");
1) It applies this acceleration based on frame rate.

applied_accel = ((actual_FPS / 70.0) * set_accel_rate); // The lower the FPS, the lower the applied acceleration rate.

2) Regardless of units (m sec^-2 or ft sec^-2) the input must be in ft sec^-2.
All comments and opinions are my own.

JB3DG
Posts: 400
Joined: Mon Jan 09, 2012 6:44 pm

Re: Bug: Body acceleration not applied correctly

Postby JB3DG » Mon Apr 29, 2019 6:24 pm

I found this issue while doing my INS with a RK4 integrator. I had to resort to deriving acceleration from aircraft velocity between frames.
Jonathan Bleeker
Milviz systems dev

Formerly known as Naruto-kun

Mike Schroeter
Lockheed Martin
Posts: 296
Joined: Thu Jan 12, 2012 7:05 pm

Re: Bug: Body acceleration not applied correctly

Postby Mike Schroeter » Tue Apr 30, 2019 7:01 pm

Setting an acceleration value like this does not prevent the internal simulation from also writing to the acceleration data. So you are probably just fighting with the forces generated from the simulation. Depending on the rate at which you are sending, and the rate at which the aircraft is simulating, I would not expect any consistent behavior. Bear in mind that frame rate and aircraft simulation rate are two different things. Details on the simulation rate can be found in the SDK. SimConnect processing is also generally not synchronous, and can be influenced by application frame rate I believe.

Mike

EllipticCurve
Posts: 17
Joined: Mon Jun 12, 2017 6:14 pm

Re: Bug: Body acceleration not applied correctly

Postby EllipticCurve » Tue May 07, 2019 1:58 am

Setting an acceleration value like this does not prevent the internal simulation from also writing to the acceleration data. So you are probably just fighting with the forces generated from the simulation. Depending on the rate at which you are sending, and the rate at which the aircraft is simulating, I would not expect any consistent behavior. Bear in mind that frame rate and aircraft simulation rate are two different things. Details on the simulation rate can be found in the SDK. SimConnect processing is also generally not synchronous, and can be influenced by application frame rate I believe.

Mike
Hi Mike,

So basically using this is useless as there is no way to override or otherwise prevent the simulation from also writing this variable?
All comments and opinions are my own.

JB3DG
Posts: 400
Joined: Mon Jan 09, 2012 6:44 pm

Re: Bug: Body acceleration not applied correctly

Postby JB3DG » Tue May 07, 2019 8:49 am

Unless you use the PDK as provided in the SimpleAirplane example
Jonathan Bleeker
Milviz systems dev

Formerly known as Naruto-kun


Return to “SimConnect Interface Questions”

Who is online

Users browsing this forum: No registered users and 1 guest