orthogonal singal generator
Use a master oscillator running at four times the grid frequency, and divide it down to 4 quadrature signals. Lock one of them in phase to your reference. Another will then be at exactly 90 degrees to it.







simulate this circuit &ndash; Schematic created using CircuitLab

A lot of this can be integrated into a 4046 IC, the phase detector and clk oscillator and parts of the loop filter. All you need to add is the /4 shown as the two D registers. An HC74 would be the ideal component for this.