Suppose we have an aircraft with accelerometer measuring accelerations along each axis. It is mounted in a way so it is perpendicular to the plane in all axes (that should be obvious). We also have gyrometer sensor mounted on the plane - it can tell us how is the plane currently aligned (rotated) in air.
1st case: Suppose we have an aircraft on the ground. Then we can get our desired acceleration component just by reading the accelerometer's Z axis reading (Z axis is pointing from sky to the center of the earth).
2nd case: The plane is in the air, doing some loops for example - now to get the desired reading as previously (acceleration towards earth) we would need to compensate the Z axis acceleration with current rotation and/or accelerations.
So, I have all the data but I don't know what physical/mathematical formulas I should use to extract the acceleration component pointing towards the earth. I would also be glad to see some tips about what literature I should read to be able to do this.