Extracting the mains frequency clock without adding a phase shift artifact? - Page 1
Forum section: electronics / beginners

author: e100
author_rank: Frequent Contributor
timestamp: May 05, 2024, 01:05:46 am
content: I would guess that grid connected power generators somehow manage to extract the true frequency without adding a phase shift.My particular goal is to trigger the start of a series of ADC readings with the true zero crossing point of the mains frequency.As far as I can tell most frequency extractor schemes found on the web add a small lagging phase shift.How do the power companies do it?

author: IanB
author_rank: Super Contributor
timestamp: May 05, 2024, 01:45:42 am
content: Your question is not clear to me (it may be clear to others).As I understand it, frequency and phase angle are independent of each other. If you want to extract the frequency, then the phase angle does not come into the picture. The frequency is simply reported as a number, for example, 60.183 Hz. This is an absolute number, not relative to anything else. So it is not important if the measurement scheme includes a phase shift relative to the zero crossing point. It will not affect the result.On the other hand, if you want to measure a phase angle, or phase shift, then this is a relative measurement, comparing one signal to another. In this case, you would have to measure the zero crossing time accurately for signal A and for signal B, and then compute the time difference between them.As a matter of practicality, if a generator is connected to the grid, then it is locked to the grid frequency, and there can be no difference between the generator frequency and the grid frequency. However, there will be a phase shift between the generator and the grid. If the generator leads the grid it will be delivering power to the grid (normal and expected situation). If the generator lags the grid, it will be sucking power from the grid, and will be motoring (unexpected and undesirable). If the generator has no phase angle with the grid at all, then it will be idling, and this will generally be an unstable situation to be avoided (a trip is likely to follow).So in the real world, the generator has to be "pushing" at the grid, delivering power, and running with a phase angle ahead of the grid. By knowing the power delivered, the grid voltage, the excitation voltage on the generator, and other parameters, then there are equations that will indicate the phase angle that exists.I dare say, it may also be possible to measure the rotational angle of the generator shaft, and compare this with the zero crossing point on the grid, and this would also give the phase angle between the generator and the grid. Maybe an EE could comment on this? (I am not an EE, so do not consider me an expert on any of this.)

author: Xena E
author_rank: Frequent Contributor
timestamp: May 05, 2024, 07:18:19 am
content: In a situation as I understand your requirement, my approach would be generate a zero crossing pulse to lead the actual point of of ZC and then introduce an accurate variable delay.In a recent project, a pulse was created that detected the point where the line voltage had fallen below a convenient and accurately defined level, with as small a leading phase angle as practically possible to preseve the system accuracy. The leading edge was used to define the following synchronisation, which was done in code.(The peak level of the incoming supply was also monitored to prevent that translating into phase errors.)Regards,Xena.

author: Terry Bites
author_rank: Super Contributor
timestamp: May 05, 2024, 07:56:57 am
content: What matters to the plant operators is phase synchronisation. If you connect a generating station to the grid that is not in phase with the grid it will act as a motor and potentially cause enormous damage to alternator and distribution equipment. Frequency control is achieved by Carefully balancing supply with demand. High demand causes all the phase locked generators to slow and more supply is demanded to bring it back up to spec. The quoted frequency is a rolling average. The line voltage and phase of the incoming station must match the grid to enable a safe connection.The delay between stations will be a whole number of complete cycles. There is no requirement or practical method for phase lock across the system within a single cycle. Local lock is all that is needed. There is no practical differnce beteen a 0' phase shift and say, 14400'. Alternators, loads, transformers and interconnectors have reactive components that cause phase shifts that are impossible to eliminate. Large external reactors may used to limit short circuit currents (though more often its the internal reactance of the alternators that does this job). Load switching takes a finite time and whole numbers of cycles will be dropped during these periods.Note that there is considerable "phase noise" in the system", the currents are not purely sinusoidal. There are unlocked harmonics galore.Xena's device is easily created with a ZCD a, microcontroller and a tiny bit of code.You migh also use a triggered ramp (analog or counter DAC combo) and a comparator to achieve the same thing.seehttps://www.radiolocman.com/shem/schematics.html?di=648819

author: gf
author_rank: Super Contributor
timestamp: May 05, 2024, 11:15:06 am
content: Quote from: e100 on May 05, 2024, 01:05:46 amWhat is the purpose of this goal? What are you going to do with the samples?

author: e100
author_rank: Frequent Contributor
timestamp: May 05, 2024, 11:55:03 am
content: Quote from: gf on May 05, 2024, 11:15:06 amLooking at SCR triggering behavior.

author: CaptDon
author_rank: Super Contributor
timestamp: May 05, 2024, 12:49:19 pm
content: Two approaches, 1, run a phase locked loop with a variable digital delay that will correspond to the zero crossing point, or 2, use a comparator that is set to change states as the positive input goes more positive that the negative input and set the negative input very near to zero volts, maybe even very slightly negative. Use a voltage divider on the positive input and a zener clamp. The clamp could allow perhaps a positive input voltage of 4.7 volts (the zener knee) to the comparator and would naturally also clamp at .7 volts on the negative swing. The phase locked loop is most likely the better choice as the loop filter will be somewhat noise resistant, much more so than a comparator. Also, the PLL with a variable digital delay will allow you to shift the exact time of your start of trigger.

author: David Hess
author_rank: Super Contributor
timestamp: May 05, 2024, 12:54:39 pm
content: The solution is to phase lock a local oscillator to the line signal, so now the phase difference can be whatever you want, including zero. Doing this also has the virtue of producing a noise free output since switching noise at the zero crossing, or anywhere else on the line waveform, is not present on the phase locked waveform.

author: gf
author_rank: Super Contributor
timestamp: May 05, 2024, 01:06:13 pm
content: Even if the sampling clock is a phase-locked integral multiple of the mains frequency, you still don't know which sampling clock period corresponds to the "begin" of the mains waveform. I tend to disregard phase locking and sample both, the reference sine wave (mains), and the signal of interest simultaneously, and implement a digital trigger in software, like today's DSOs do.

author: Terry Bites
author_rank: Super Contributor
timestamp: May 09, 2024, 04:33:39 pm
content: I get it now.How much "artifact" is too much?A window comparator will create a pulse that straddles the zero crossing.With a narrow enough window you can get down to uS widths.

author: mag_therm
author_rank: Frequent Contributor
timestamp: May 09, 2024, 05:52:00 pm
content: Working in automotive body assembly plant as example, I found that there can be nastiness masking the actual zero cross and causing errors to analog comparator methods.Hundreds of resistance spot welders, robots and other stuff drawing transient loads. The phase to phase zero crosses can have ringing, and/or flat spots.The phases in themselves can have phase noise due to transient load changes against upstream impedance.Phase to neutral zero cross ambiguity may be worse, with transient negative and zero sequence currents.

author: S. Petrukhin
author_rank: Super Contributor
timestamp: May 14, 2024, 01:26:21 pm
content: Typically, zero cross detection circuits use an optocoupler or semiconductor to detect a low voltage. Of course, they need some threshold.In addition, they can respond to network interference and sine wave distortion.If you need to very accurately determine zero cross, the best way is to programmatically or hardware form a sine wave and set it up so that they keep up.At the same time, filtering and averaging of the power signal can be used to synchronize with the model signal and receive accurate data from the already formed follower.That is, you can form a pure custom sample with an obviously known zero cross point, you need to bend it to the measured signal only.Similarly, for example, contactless phase alternation determinants operate.

author: S. Petrukhin
author_rank: Super Contributor
timestamp: May 14, 2024, 01:27:59 pm
content: But the easiest way is to make an adjustment to the result, knowing how wrong the traditional simple zero crossing sensor is.