Multibody systems modeling based on a generalized d'Alembert's principle