A multiport approach to modeling electromechanical systems