A frequency converter for electrically connecting an electric power generating machine, in particular a generator of a wind turbine, with a power grid, the frequency converter comprising an AC-to-DC stage for converting a first AC power signal being generated by the electric power generating machine into a DC power signal, a DC-to-AC stage for converting the DC power signal into a second AC power signal being received from the power grid, an apparatus for determining a phase (θ) and a frequency (ω) of an electric quantity being associated with an operation of an electrical device, the apparatus comprising an extracting unit configured for extracting a fundamental component of the electric quantity; a calculating unit configured for calculating a positive sequence component of the electric quantity based on the extracted fundamental component; and a determining unit configured for determining the phase and the frequency of the electric quantity based on the calculated positive sequence component, wherein the apparatus is assigned alternatively to the AC-to-DC stage or to the DC-to-AC stage by a switch, and a further determining unit configured for, when the apparatus is assigned to the AC-to-DC-stage, determining a counter electromotive force being associated with the electrical device, wherein, - when the apparatus is assigned to the DC-to-AC-stage, the electrical device is the power grid, and - when the apparatus is assigned to the AC-to-DC-stage, the electrical device is the electric power generating machine. an AC-to-DC stage for converting a first AC power signal being generated by the electric power generating machine into a DC power signal, a DC-to-AC stage for converting the DC power signal into a second AC power signal being received from the power grid, an apparatus for determining a phase (θ) and a frequency (ω) of an electric quantity being associated with an operation of an electrical device, the apparatus comprising an extracting unit configured for extracting a fundamental component of the electric quantity; a calculating unit configured for calculating a positive sequence component of the electric quantity based on the extracted fundamental component; and a determining unit configured for determining the phase and the frequency of the electric quantity based on the calculated positive sequence component, wherein the apparatus is assigned alternatively to the AC-to-DC stage or to the DC-to-AC stage by a switch, and an extracting unit configured for extracting a fundamental component of the electric quantity; a calculating unit configured for calculating a positive sequence component of the electric quantity based on the extracted fundamental component; and a determining unit configured for determining the phase and the frequency of the electric quantity based on the calculated positive sequence component, wherein the apparatus is assigned alternatively to the AC-to-DC stage or to the DC-to-AC stage by a switch, and a further determining unit configured for, when the apparatus is assigned to the AC-to-DC-stage, determining a counter electromotive force being associated with the electrical device, wherein, - when the apparatus is assigned to the DC-to-AC-stage, the electrical device is the power grid, and - when the apparatus is assigned to the AC-to-DC-stage, the electrical device is the electric power generating machine. - when the apparatus is assigned to the DC-to-AC-stage, the electrical device is the power grid, and - when the apparatus is assigned to the AC-to-DC-stage, the electrical device is the electric power generating machine.