An optimal control approach for estimating aircraft command margins