A method for operating an internal combustion engine configured to be coupled to both an electric generator for generating electric power and a heat recovery system for generating thermal power, the internal combustion engine being operable in an electric power generation mode and a thermal power generation mode, the method comprising: providing a first set of characteristic engine maps comprising operating parameters for operating the internal combustion engine in the thermal power generation mode; providing a second set of characteristic engine maps comprising operating parameters for operating said internal combustion engine in the electric power generation mode; and switching between the first and second sets of characteristic engine maps upon an input, wherein the switching further comprises: determining an electric power output (P el); determining an electric power demand (P el, dem); determining whether the electric power output (P el) is below the electric power demand (P el, dem); and switching from the thermal power generation mode to the electric power generation mode, if the electric power output (P el) is below the electric power demand (P el, dem); and/or determining a thermal power output (P th); determining a thermal power demand (P th, dem); determining whether the thermal power output (P th) is below the thermal power demand (P th, dem); and switching from the electric power generation mode to the thermal power generation mode, if the thermal power output (P th) is below the thermal power demand (P th, dem), the method further comprising: determining that the thermal power demand (P th, dem) exceeds a maximum thermal power output (P th, max); and/or determining that the electric power demand (P el, dem) exceeds a maximum electric power output (P el, max); and operating the internal combustion engine in safe mode using operating parameters that result in a safe operation of the internal combustion engine when it is determined that the thermal or electric power demand exceeds the respective maximum thermal or electric power output. providing a first set of characteristic engine maps comprising operating parameters for operating the internal combustion engine in the thermal power generation mode; providing a second set of characteristic engine maps comprising operating parameters for operating said internal combustion engine in the electric power generation mode; and switching between the first and second sets of characteristic engine maps upon an input, wherein the switching further comprises: determining an electric power output (P el); determining an electric power demand (P el, dem); determining whether the electric power output (P el) is below the electric power demand (P el, dem); and switching from the thermal power generation mode to the electric power generation mode, if the electric power output (P el) is below the electric power demand (P el, dem); and/or determining a thermal power output (P th); determining a thermal power demand (P th, dem); determining whether the thermal power output (P th) is below the thermal power demand (P th, dem); and switching from the electric power generation mode to the thermal power generation mode, if the thermal power output (P th) is below the thermal power demand (P th, dem), determining an electric power output (P el); determining an electric power demand (P el, dem); determining whether the electric power output (P el) is below the electric power demand (P el, dem); and switching from the thermal power generation mode to the electric power generation mode, if the electric power output (P el) is below the electric power demand (P el, dem); and/or determining a thermal power output (P th); determining a thermal power demand (P th, dem); determining whether the thermal power output (P th) is below the thermal power demand (P th, dem); and switching from the electric power generation mode to the thermal power generation mode, if the thermal power output (P th) is below the thermal power demand (P th, dem), the method further comprising: determining that the thermal power demand (P th, dem) exceeds a maximum thermal power output (P th, max); and/or determining that the electric power demand (P el, dem) exceeds a maximum electric power output (P el, max); and operating the internal combustion engine in safe mode using operating parameters that result in a safe operation of the internal combustion engine when it is determined that the thermal or electric power demand exceeds the respective maximum thermal or electric power output. determining that the thermal power demand (P th, dem) exceeds a maximum thermal power output (P th, max); and/or determining that the electric power demand (P el, dem) exceeds a maximum electric power output (P el, max); and operating the internal combustion engine in safe mode using operating parameters that result in a safe operation of the internal combustion engine when it is determined that the thermal or electric power demand exceeds the respective maximum thermal or electric power output.