Model based control with applications to automotive engines