I'm programming a flight dynamics simulation and am running into issues with calculating the angle of attack during banked flight. I know what I'm doing wrong, but I'm not sure what I should be doing instead.
When an aircraft banks, angle of attack and lift are expected to increase in order to compensate for the reduced vertical component of lift: How does the angle of attack vary in turns?
However, in my simulation, angle of attack and lift decrease as the aircraft banks. This is because I am calculating angle of attack using the $u$ and $w$ values in the body frame. As the aircraft banks, the vertical component of gravity in the body frame is reduced, but the vertical component of lift in the body frame stays the same:
This means that it is generating more lift than gravity, causing the simulation to reduce angle of attack to compensate, and it stabilizes at a lower angle of attack. This causes issues like reducing drag, causing the aircraft to speed up as it banks, when I would expect it to slow down.
Assuming the $x$ axis in the body frame is parallel to relative wind, angle of attack should be calculated using the vertical velocity in the body frame. But banking reduces vertical acceleration in the body frame due to gravity, causing lift to reduce as well.
These are the (simplified) calculations I use to get the vertical acceleration components:
$\alpha = \arctan(w / u)$
$L_z = -2\pi \cdot \alpha \cdot q$
$g_z = 9.81 \cdot \cos(\text{bank}) \cdot \cos(\text{pitch})$
$w_z· = L_z + g_z$
So I rotate the gravity acceleration according to bank, but not the lift acceleration. This is what causes vertical acceleration in the body frame to decrease with bank. I've tried flipping it and rotating the vertical lift component instead, but this causes issues with other forces still being calculated in the body frame, and the simulation becomes unstable.
My question is: how do I calculate vertical acceleration in the body frame in a way that acceleration due to lift does not stabilize according to only the vertical component of gravity, but the entire gravity force? Or, how can I get angle of attack to increase in a bank, not decrease?