Multibody simulation and control of open kinematic chains with flexible bodies