A method for controlling operation of a generator (5) for a wind
turbine is disclosed. A measure for a rotational speed of the generator (5), and a measure for vibrations originating from
gear tooth meshing of a gearbox (3) of the wind
turbine, at the rotational speed of the generator (5), and at least one amplitude of a
harmonic in the gearbox vibrations is determined. An
initial phase angle and an initial amplitude are selected, based on the rotational speed of the generator (5), on initial characteristics of the wind
turbine, and on the at least one amplitude of the
harmonic in the gearbox vibrations. An optimization process is performed, including adjusting the
initial phase angle and the initial amplitude in order to obtain a minimum in amplitude of a
resultant vibration of vibrations originating from the gearbox (3) and vibrations originating from the generator (5), corresponding to the
harmonic in the gearbox vibrations, thereby obtaining an adjusted
phase angle and an adjusted amplitude. A torque modulating
signal for the generator (5), specifying the adjusted
phase angle and the adjusted amplitude, is generated and injected into the generator (5). Information regarding residual vibrations at the minimised
resultant vibration is derived.