Design of data-driven Hamiltonian models for complex mechatronic systems and their application in energy-based control