1. A method for controlling a frequency converter connected to a power grid, the method comprising: determining an active current set point based on a comparison of measured active power output of the electrical generator with an active power set point; determining a reactive current set point based on a comparison of measured reactive power output of the electrical generator with a reactive power set point; identifying subsynchronous components in the electrical grid based on voltage measurements of the electrical grid; determining damping currents set points using the subsynchronous components of the electrical grid; adding the damping current set points to the current set points calculated by the comparison of measured active and reactive power outputs of the electrical generator with the active and reactive power set points to generate total current set points to dampen the sub synchronous resonance of the grid; and controlling the frequency converter based on the total current set points.