Method and energy generating device