There is described an
electric power generating apparatus having: a free-
piston linear expander having a moving shaft creating mechanical power; an electrical generator converting the mechanical power into electrical power; a
variable frequency drive configured for applying an
electromagnetic load force modifying the shaft's movement; and a controller communicatively coupled to the
variable frequency drive, the controller configured to perform the steps of: receiving sensor data including a first shaft position value, a first shaft velocity value, and a first
electromagnetic load force value; using a drive control module, determining, based on the sensor, a second
electromagnetic load force value which when applied would cause a shaft velocity to gradually change to a second shaft velocity value, the second electromagnetic
load force value and the second shaft velocity value causing an output power value to correspond to a desired output power value; and applying the second electromagnetic
load force value.