Dynamic modeling and optimal control for hybrid electric vehicle drivetrain