Page 1 of 1

Bug: Body acceleration not applied correctly

Posted: Sun Apr 28, 2019 10:14 pm
by EllipticCurve
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.

Re: Bug: Body acceleration not applied correctly

Posted: Mon Apr 29, 2019 4:44 pm
by EllipticCurve
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.

Re: Bug: Body acceleration not applied correctly

Posted: Mon Apr 29, 2019 6:24 pm
by JB3DG
I found this issue while doing my INS with a RK4 integrator. I had to resort to deriving acceleration from aircraft velocity between frames.

Re: Bug: Body acceleration not applied correctly

Posted: Tue Apr 30, 2019 7:01 pm
by Mike Schroeter
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

Re: Bug: Body acceleration not applied correctly

Posted: Tue May 07, 2019 1:58 am
by EllipticCurve
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?

Re: Bug: Body acceleration not applied correctly

Posted: Tue May 07, 2019 8:49 am
by JB3DG
Unless you use the PDK as provided in the SimpleAirplane example