How to understand function euler_accel_limit(...)?

Hi,

the function euler_accel_limit(…) is to translate the angle accel from body frame to NED frame, but I cann’t undersdand this function.

Whereas I think the right way is like the euler kinematical equation, just use angle accel instead of angle rate.

the euler kinematical equation is as following: