Added a custom function for energy generation.