To strengthen the competitiveness of machine products, it is indispensable in the initial stages of development to create and run on computer virtual prototypes with which mechanical performance, functioning and reliability can be confirmed. This paper introduces the basic theory of automating modeling process of complex mechanical systems on computer. The main modeling strategy is that the energic primitive systems defined by Lagrangian should be interconnected through interconnection multiport systems which can be obtained by employing principle of interconnections. The virtual prototypes are visualized and differential algebraic equations are hierarchically derived via bond graph. Simple virtual prototypes are introduced using modeling of mechanical system and analysis examples.