Modeling, analysis and simulation of multibody systems with contact and friction