Author Topic: SynchroPhasor PMU OSHW Project - open for negative feedback  (Read 8898 times)

0 Members and 1 Guest are viewing this topic.

AJ

• Contributor
• Posts: 9
• Country:
SynchroPhasor PMU OSHW Project - open for negative feedback
« on: November 04, 2014, 05:10:13 pm »
I would appreciate feedback [negative, like the T-shirt says] and any bullshit detection from anyone for my open source synchrophasor PMU (phasor measurement unit) project.  The project goal is to develop an open source hardware sensor device (or kit) for measuring frequency and phase in AC power grids.  It is designed to be compatible and used with the openPDC open source software project.

I am Open to suggestions, critique, and negative feedback for all aspects of the project.  From your reply(s), I hope to figure out how to take the project to the next level.

The current project site is:  http://gridtrak.codeplex.com

//AJ
----
Update Nov 6, 2014:

Here is an example of how to observe AC power grid phasor:
1)  use an AC/AC transformer to step down your mains voltage to a safe level for your oscilloscope to measure.
2)  observe the AC sine wave on the scope on channel 1
3)  input a function generator signal to channel 2 which will be used as a trigger
4)  set the function generator's frequency to an even division of your mains frequency.  For 50Hz, set the trigger signal to 10Hz
5)  observe the position of the sine wave with respect to the trigger point.  If the mains frequency is not exactly 50Hz, then you will observe the sine wave drift on the screen.

Now, get one of your friends in a location a 100km away and perform the same setup.
1)  If your friend is on the same power grid, her/his mains frequency will be the same.
2)  the phase angle offset from the trigger will be different because you two are not "synchronized"

Why?
The SynchroPhasor is the measurement of the phasor when you synchronize the measurements to a common time source - like a GPS PPS (pulse per second) or another signal.

When your PMU (phasor measurement units) are precise enough (synchronized to GPS or not), when the measurements are plotted on the same chart for Phase Angle VS Time, the 2 signals will be parallel while the power grid is working normally.  In abnormal conditions (high loads in a section of the grid), the signals will drift apart or together.  As the grid tries to balance itself, the signal separation will oscillate.  If the corrective oscillation is observed to be increasing - you don't want that to happen.

How this particular Open Source PMU works:
* Converts the sine wave to complimentary half waves then to square waves triggered at a fixed voltage reference point on the sine curve.  It does this using an OpAmp to avoid hysteresis (e.g. TTL transition or Schmitt trigger).
* Measures the frequency based on the square wave timing
* Measures the phase angle from the last PPS and timer increments in between
* Computes the magnitude of the "ideal" signal - in case anyone is interested in that

Feedback I would like:
I designed this as a EET student and later refined the design.  However, there are probably a bunch of artifacts in the circuit that either reduce its accuracy or efficiency.  I figure you EEVBlog engineers can spot these artifacts or problems right away!

The reason the project uses thru-hole components is that it is mostly intended to be a kit and the entire concept can be reproduced on a prototype board without soldering and allowing the experimenter more flexibility to change the circuit - i.e. to troubleshoot any of my mistakes!

« Last Edit: November 07, 2014, 03:27:18 am by AJ »
//AJ

Yansi

• Super Contributor
• Posts: 3015
• Country:
• STM32, STM8, AVR, 8051
Re: SynchroPhasor PMU OSHW Project - open for negative feedback
« Reply #1 on: November 08, 2014, 05:25:16 pm »
I am not an grid expert, but can anybody explain me, what does he mean with the phasor oscillation? Is that some special property of USA power grid? Do you have any literature, for me/us to study?

For me, european technician, what you are telling us seem like a nonsense. Yes, the phase angle  changes with load a little, the grid frequency drops with rising load a little,... But phase angle oscillation? whatta?

I understand, that you measure the difference of phase angle between two points in the same grid. The angle might change a little with load change but, who or what will tell it to start oscillating?
There might be some transient or maybe damped angle oscillation, when the load changes rapidly (usual for synchronous generators), but I dont see the point, when it can grow to continuous oscillation. What are the conditions for the oscillation to begin?

And now something to the PCB: Well.. I do not want to be much negative as a newbie here... The PCB does not respect any common rules for supply voltage decoupling - look at the 5V regulator, thats just crazy, the whole board. I did not check that any further, I am much more interested to understand the phasor oscillation.
//One little more recommendation - place all the connectors on the board. Soldering tens of wires isn't just practical - if you plan to make more units than maybe five, any extra wire to solder is just pain in the butt.

Have a nice weekend

//EDIT: And I think I've just spotted a weak spot in the detector - you canot compare the sinewawe from the grid with a voltage reference. Grid voltage amplitude changes, so does the measured angle then. Did you considered this, even tested with a variable AC supply? Comparing maybe just 9Vac with 2.5 volts makes a horrible measurement error. It is much better to detect zero crossings. That is amplitude independent and easily doable.
The AC measuring input is unprotected, any ESD discharge or spike from the mains will instantly kill this device. And there is also no need for costly 10MHz rail2rail OPamp in this design, I think. That is work for something like LM311.
« Last Edit: November 08, 2014, 05:42:33 pm by Yansi »

djacobow

• Super Contributor
• Posts: 1062
• Country:
• takin' it apart since the 70's
Re: SynchroPhasor PMU OSHW Project - open for negative feedback
« Reply #2 on: November 08, 2014, 05:42:58 pm »
A PMU is a real thing. In the utility industry they are used to assess flows and stability on the grid. The entire grid is syncrhonized but the phase can vary between elements, depending on power flows. If you have a good understanding of the impedance of all the elements in the network, by looking at the phase variation, you can make good assessments of what those flows are, and if they are becoming problematic. If you have a bunch of PMUs around the network they make a nice diagnostic tool. Keep in mind that prior to GPS timing this was difficult/impossible to do, so power system engineers had to make do with only magnitude measurements or real and imaginary power.

If an oscillation is building up in the power system, it will show as oscillation in the phase measurement. Such an oscillation could have a period of seconds, minutes, and even hours, and measuring phase gives you an early indication that something bad is happening.. Remember that the electric power system is a giant distributed LCR circuit, so weird stuff can happen. If you are not careful, you can get a lot of power sloshing around the network and start destroying things.

Real, utility PMUs are expensive, but the concept is simple enough, and it can be reproduced at home. One complication of using a PMU that is plugged into a wall socket in your house, though, is that it will also show the phase impact of the distribution system. I would think that would "confound" any understanding of what is going on in the network at large. For example, let's say you share a pole transformer with a neighbor that has a large inductive load that turns on and off. That will affect your phasor measurements and not tell you much about the power system generally.

I've worked in electric power a bit, and I think this project is cool, at least for a hobbyist who is interested in such things.

Here's a professional instrument for this purpose: http://www.gedigitalenergy.com/multilin/catalog/n60.htm

I am not an grid expert, but can anybody explain me, what does he mean with the phasor oscillation? Is that some special property of USA power grid? Do you have any literature, for me/us to study?

For me, european technician, what you are telling us seem like a nonsense. Yes, the phase angle  changes with load a little, the grid frequency drops with rising load a little,... But phase angle oscillation? whatta?

I understand, that you measure the difference of phase angle between two points in the same grid. The angle might change a little with load change but, who or what will tell it to start oscillating?
There might be some transient or maybe damped angle oscillation, when the load changes rapidly (usual for synchronous generators), but I dont see the point, when it can grow to continuous oscillation. What are the conditions for the oscillation to begin?

And now something to the PCB: Well.. I do not want to be much negative as a newbie here... The PCB does not respect any common rules for supply voltage decoupling - look at the 5V regulator, thats just crazy, the whole board. I did not check that any further, I am much more interested to understand the phasor oscillation.
//One little more recommendation - place all the connectors on the board. Soldering tens of wires isn't just practical - if you plan to make more units than maybe five, any extra wire to solder is just pain in the butt.

Have a nice weekend

djacobow

• Super Contributor
• Posts: 1062
• Country:
• takin' it apart since the 70's
Re: SynchroPhasor PMU OSHW Project - open for negative feedback
« Reply #3 on: November 08, 2014, 06:19:35 pm »
I think this is a cool project. I have not built a PMU before, but I have made a line frequency analyzer, and this design looks to me to be slightly more complex than it necessary -- but I could be missing something.

In my frequency analyzer, I used an optoisolator, like a 4N25 to create a zero cross detector. Basically, by setting up the transistor as a pulldown and putting a pullup resistor, I got a pule every time the AC voltage went negative. I fed that right into an pin on the uC attached to a timer. Didn't even need an interrupt, as the pin change could capture the count.

In the case of PMU measurements, I would think that you could use the GPS to set the time, and maybe use the 1PPS output from the GPS feeding into an interrupt or timer to get it really spot on.

I think to get 0.1 degree accuracy you'd need about 4.6 uS timing (@60Hz), which should be no problem for a uC with a timer with a capture pin running at 16 MHz.

Probably a trick to keeping this simple on the uC side is to user timer/capture pins rather than interrupts. That way interrupt latency does not have to factor into your accuracy. The processor essentially has a whole second per crossing to get around to reading those registers, making adjustments, and packing the data into a buffer to send.

Using a transformer for safety seems reasonable, but I'm wondering if it introduces some phase of its own. If so, it's probably static so doesn't matter, but if your friend 100km away has a different xformer, he might also get a different static or quasi-static phase difference. For example, would it change when the transformer warms up? I have no idea.

From all this, you could get a very accurately time-stamped stream of positive zero crossings. The uC could buffer them up and send them out in bunches to some web server, which would collect them from other PMUs and calculate phase variation. Data rate would not be killer. Say it's 8B/crossing, that's < 500 B/s. But your server will have to be smart enough to line up packets of data that can come with significant variation in latency. I think that's just a matter of having a big circular time buffer and not calculating/displaying time data for a block of time until all participating PMUs have contributed. Could be tricky in real time, but not insurmountable.

Yansi

• Super Contributor
• Posts: 3015
• Country:
• STM32, STM8, AVR, 8051
Re: SynchroPhasor PMU OSHW Project - open for negative feedback
« Reply #4 on: November 08, 2014, 06:57:54 pm »
Strange you no sure enough about different xformer having different phase angle. Offcourse! I dunno, how (and if) you do that in USA (with ur strange power grid), but here in eu, we can have 3phase grid transformers connected various ways to alter the phase angle of a known amount. We call that here "vector group of transformer". So phase angle being measured in different places, gives different phase angle. You could only measure here (in eu) the deviation between two places on the grid. But i don't see the point of doing so, at least now.

Phase error which makes the 115/12V transformer he uses, is negligible, compared to his bad method of taking measurment of the waveform by comparing it to some voltage. The measured phase by his method is I think wrong, beacuse the measured value is directly affected by the input voltage amplitude. Even if he is comparing both polarities with the same voltage. Lower the amplitude, bigger phase delay being captured. Maybe I disregard something, so I will wait for his reply.

djacobow

• Super Contributor
• Posts: 1062
• Country:
• takin' it apart since the 70's
Re: SynchroPhasor PMU OSHW Project - open for negative feedback
« Reply #5 on: November 08, 2014, 09:37:20 pm »
Oh, I know that the xformers will introduce phase difference. I'm only unsure about how variable it is, and what makes it vary. A fixed phase error is not that big a deal. You can zero it out with a constant (if you know the constant) and anyway, it doesn't matter too much to a hobby project that wants to pick up the variation in phase in the transmission system as a result of different power flows. But if the phase error introduced by the transformer varies a lot, it will ruin the fun.

In any case, I think a ZCD approach using direct connection to an optoisolator is superior. You still can't get rid of the transformer that feeds your house.

Another problem, which I perhaps talked around but didn't state in my earlier post is that the absolute phase error relative to a GPS-accurate clock is not that interesting either. If the entire transmission system slows down or speeds up, it's not that big a deal, and beside, you can measure that with frequency. What's more interesting, what PMUs are really all about, is measuring the phase difference *between* nodes in a system. Hence, my discussion of forwarding the time-stamped data to a server to display the result.

Strange you no sure enough about different xformer having different phase angle. Offcourse! I dunno, how (and if) you do that in USA (with ur strange power grid), but here in eu, we can have 3phase grid transformers connected various ways to alter the phase angle of a known amount. We call that here "vector group of transformer". So phase angle being measured in different places, gives different phase angle. You could only measure here (in eu) the deviation between two places on the grid. But i don't see the point of doing so, at least now.

Phase error which makes the 115/12V transformer he uses, is negligible, compared to his bad method of taking measurment of the waveform by comparing it to some voltage. The measured phase by his method is I think wrong, beacuse the measured value is directly affected by the input voltage amplitude. Even if he is comparing both polarities with the same voltage. Lower the amplitude, bigger phase delay being captured. Maybe I disregard something, so I will wait for his reply.

Yansi

• Super Contributor
• Posts: 3015
• Country:
• STM32, STM8, AVR, 8051
Re: SynchroPhasor PMU OSHW Project - open for negative feedback
« Reply #6 on: November 08, 2014, 10:28:13 pm »
Beware, that the Ube-referenced ZCD is also temperature dependent. Not much, but for getting precision, it must be also considered.  But it might work fine.
I'd advice to make way better protected the sensing input of this device. He has got almost no protection there. Good suggestion would be to use some basic esd protection for the OPAMP and run the signal through low pass, to supress HF noise, for example from cell phone near it. Even one single cap decoupling the comparator input would help a lot in terms of HF noise supression.

About the transforma phase angle - constant or not?  Lets look on the real transforme model:

The main varying factor is the transformer temperature. The small few watt trasformer, by which he is power his gizmo up, has got a quite high series resistances and also not small leakage inductance. The leakage inductance will not change much with temperature, is is dependent mostly on xformer winding geometry. Lets consider the series pass resistance of the windings change with temperature (it will - someone can measure how much - he can investigate it on his own transformer he is using). It is a series LR circuit in front of the measuring input. If R changes, so does the characteristical time constant of the circuit and corresponding phase angle.
Note: Distribution transformers works at almost constant temperature and load, therefore much of the error might come from the small transformer, through he is making the measurement.

From this point of view, I do not see as a good idea to measure the waveform on the supply transformer secondary.  The error might not be huge, but it would be there. Optoisolated precision detector is much better idea. There is huge amount of possibilities, how to make one:
for example, ground refferenced comparator (LM311) and output through fast optocoupler, like 6N137.  As an isolated supply, small 1-2VA like PCB xformer might be good choice. Or, when only low supply current needed (LM311 / 6N137 not the best for this option) series pass capacitor directly from mains might be used.
But there is a risk and danger, because this needs a design with mains voltage directly on the PCB. (But you in USA, you have only half our voltage, 115V~ is nothing, not so much danger  )

I would not recommend a beginner to play with mains. I saw a lot of black burnt PCBs and other stuff, luckily noone got hurt.

AJ, what do you say?
« Last Edit: November 08, 2014, 10:30:36 pm by Yansi »

AJ

• Contributor
• Posts: 9
• Country:
Re: SynchroPhasor PMU OSHW Project - open for negative feedback
« Reply #7 on: November 08, 2014, 11:00:21 pm »
Thank you very much for the feedback!  It is all valuable so far and I will take it to heart!

Regarding PCB design rules:  Although the current design evolved over a few spins from the original, it is my First PCB design; and it was my learning board.  Based on the positive feedback, it is worth it if I redesign it in an open source CAD package like KiCAD so others can Fix it.

This PMU is intended to be inexpensive and Open for Research.  It is not intended for actual grid Control applications.  It is single phase measurement.  I would think 3 of them would be needed for 3 phase measurements.  As far as I know, none of these have ever blown up.

The concept itself (see attached PDF for implementation details) is intentionally specific to the project so as not to infringe on other measurement techniques that may be patented or copyright.  Essentially this is a simplification of the method described in the patent http://www.google.com/patents/USRE31774

The simplified concept that this PMU uses only measures When the power signal crosses the +2.5Vref point in the curve; which is relatively close to the Zero Crossing typically considered the measurement point.  I probably would have used Zero Crossing, but I could not figure out how to actually Measure 0 Volts when my input and power source is AC!  After I developed the concept of using the OpAmp and Vref to do the square wave conversion, I discovered a project years earlier where the engineer simply fed the reduced AC signal into the inputs of an RS232 transceiver IC to get the square wave output to measure frequency!  I considered feeding the sine wave into the uC input, but realized there would be period of time where the voltage would be between the TTL transition levels in the undefined area.

Time for me to re-read your previous comments and make sure I address all the feedback items.  This is a fantastic forum for feedback!

//AJ
//AJ

Yansi

• Super Contributor
• Posts: 3015
• Country:
• STM32, STM8, AVR, 8051
Re: SynchroPhasor PMU OSHW Project - open for negative feedback
« Reply #8 on: November 08, 2014, 11:27:30 pm »
Firs PCB - so that looks fine. Just keep doing. As you wil be finishing your hundredth PCB, it will be way better. This is mainly about practice.

Not three of these units, but one bigger unit with three zero x-ing  detectors.

2.5V is NOT close to ground, if input signal has amplitude of barely 17 volts. Just try to calculate. With 17V amplitude (12V~), 2.5 volts are equal to 8.45°. If the mains voltage drops by lets say 20 percent (here in EU the mains voltage tolerance is +-10%), that is 13.6V amplitude and 2.5 volts are equal to angle about 10.59°. That is a difference of over 2 degs ! That is still below 1% precision (around 0.6 actually), but hey, could be much better if not using this detection method.

Quote
I discovered a project years earlier where the engineer simply fed the reduced AC signal into the inputs of an RS232 transceiver IC to get the square wave output to measure frequency!
That was ugly.
Methods u r considering are not really measurements. These are like some arduino childish hacks. Nobody ever told, that really measuring gizmo or kit is automatically expensive to build. No way. LM311 and the optocoupler I've suggested cost only a few cents maybe, but it would work way better. All it is about knowing how to do it properly. And no, running AC directly to uC input is not proper method. Just think about what I had written, about the optoisolated thingy. Really simple, only a few components, a few hundred volts directly in the circuit, but hey, cheap and workable.  If the dsPIC has three external IRQs, make this circuit three times for three phases! But, be extremely precise and cautious when working with three phases. (hi hi, in EU, we have here 400V between phases, that is really really bad touching that)

AJ

• Contributor
• Posts: 9
• Country:
Re: SynchroPhasor PMU OSHW Project - open for negative feedback
« Reply #9 on: November 08, 2014, 11:45:10 pm »
To Do #1:  Prototype a LM311/6N137 version and check it out!
I am guessing that for this to work >  Will I need to GROUND the sensor to earth ground instead of letting it float in AC?  -- probably the reason they haven't blown up yet!  (reference: DJ's "How not to Blow Up your Oscilloscope" video).

//AJ

PS:   Here is my favorite primer on SynchroPhasor measurement applications:

"Real-Time Application of Synchrophasors for Improving Reliability" http://wiki.gridtrak.com/wiki/images/5/58/Rapir_final_20101017.pdf.  Note that this is the same vintage as the open source PMU project, so I'm a bit fond of its content.  More recent documents on SynchroPhasors are available.

For the latest in SynchroPhasor measurement technology, I think NASPI https://www.naspi.org/, is a good source.

It will probably take me a few days to make up a TO DO list from all this feedback.  I really appreciate the feedback and anymore you have.
Better to work out the kinks before doing something extreme like Kickstarting this project!

//AJ

djacobow

• Super Contributor
• Posts: 1062
• Country:
• takin' it apart since the 70's
Re: SynchroPhasor PMU OSHW Project - open for negative feedback
« Reply #10 on: November 09, 2014, 03:53:14 am »
Note: Distribution transformers works at almost constant temperature and load, therefore much of the error might come from the small transformer, through he is making the measurement.

Nope. The types of transformers in substations that convert from transmission voltages to distribution voltages may run within a reasonably tight temperature range (many are actively cooled with forced movement of oil and/or air through radiators), but the load they see has strong daily variation. It's obviously very situation dependent. The load on a transformer feeding an industrial park might see a very high load during the day and almost none at night. A feeder into a residential area might have almost no load during the day and peaks in the morning and evening. This is a problem because the load on the transmission system -- which is the load of "interest" -- varies with a similar patterns, so cannot be easily disentangled.

The situation is much worse on the pole can transformer that takes the distribution voltage to the normal "mains" voltage in your home. The load variation on that thing can go from a few watts in the dead of night to very heavy in the evening/afternoon with air conditioning and cooking loads, etc. Moreover, that transformer has no active cooling, so whatever temperature it gets to, it gets to. Further, the transformer is physically small, so changes in ambient air conditions affect it strongly and quickly. Heck, where I live a lot of people have PV systems and there are pole transformers that see reverse power flow for much of the day -- and I've heard of this being the case at some feeders, too.

Basically, the more I think about it, the less useful a PMU connected to a household outlet seems to me. Which is something of a bummer. I used to live near high tension power lines. It might be more interesting to inductively couple a signal from them.

By the way, regarding the phase difference from the secondary of the small transformer powering the gizmo, I feel like the current is going to be negligible, making the effect of most series element also negligible. The current for the PIC is close to nothing; I would not be surprised if the magnetization current through the parallel elements in the diagram were 10x that. Nevertheless, I agree with your overall assessment that this is just one more source of error you don't need.

I was also thinking about the effect of temperature on an optoisolator, and it occurs to me that you can get a bit more precision by using two. You could just use two optos with the LEDs wired opposite. When one is stopping conduction just before ZC, the other will shortly start shortly after. If you use both of the pulses you can split the difference and that will be your true ZC. Temperature variation my widen or narrow that gap, but the true ZC should be 1/2 in between -- *IF* the H->L propagation time is the same as the L->H propagation time. For the 6N137 it's close but for othera it is like 10x different, so watch out. (You could do this with one opto with two LEDs, like the H11AA1, but that's the one I checked and it has way different Tphl and Tplh.)

It may all be more precision than you need. 1/10 of a degree at 60 Hz is still 4.6 uS. The max propagation time on the 6N137 for any transition when using a 350 ohm pullup was 100ns.

djacobow

• Super Contributor
• Posts: 1062
• Country:
• takin' it apart since the 70's
Re: SynchroPhasor PMU OSHW Project - open for negative feedback
« Reply #11 on: November 09, 2014, 03:58:44 am »
I think Yansi has already pushed the optoisolated ZC detector. That's the way to go.

My other bit of advice would be to avoid IRQs if you can and use timer/counters that have an input capture mode or similar. Basically, a mode where the pin transition causes the counter value to be copied to another register and the counter optionally simultaneously zeroed. It's OK to have it *also* fire an interrupt so that a handler can copy the value somewhere else but to rely on the interrupt handler alone is going to introduce delay and jitter into your code, depending on how long it takes that interrupt to be recognized and for the beginning handler to be loaded and executed.

I'm not a PIC guy, but most uCs have it. I'm guessing PIC does, too.

AJ

• Contributor
• Posts: 9
• Country:
Re: SynchroPhasor PMU OSHW Project - open for negative feedback
« Reply #12 on: November 09, 2014, 04:19:59 am »

Phasor Oscillation is caused when controls are applied to correct fluctuations in the grid frequency.  When controls are working properly and providing "negative feedback", the oscillation is damped.  When controls become "positive feedback", the oscillation expands and things go bad.

When I developed the open source synchrophasor PMU project, the definitive source for information was NASPI - North American SynchroPhasor Initiative.  Their current documents repository is:

NAPI Documents = https://www.naspi.org/documents

Kosterev D., J Undrill. June 2011. NASPI update to the NERC Operating Committee; "Oscillations in Power Systems"
https://www.naspi.org/File.aspx?fileID=521

Bialek, J. 2013. Large Disturbance in the European Power System on the 4th of November 2006 presented at the PES General Meeting in Vancouver, Canada
https://www.naspi.org/File.aspx?fileID=1284
and refering to the same outage:  "Synchrophasor Applications in the Croatian Power System"

A bit of project history:  My project used to be called the "openPMU Project" until I discovered a similar project with that name had already been initiated 1 year earlier!  That will teach me to google First before naming a project!

The other open source PMU project which is in the European Union (I think) is found at http://www.openpmu.org.  The openPMU system is much higher tech than this [GridTrak] Open Source PMU.  But, it is much more expensive and more difficult for students to reproduce in student projects.

-----
My comments:  I also am not a power grid expert.  I am simply inquisitive and this is an unusual evolution of my second electronics project.  It is also Fun     I submitted the project to this forum for feedback because I am considering the project's life cycle and should I refine it further.  From yours and others' feedback, I think I should refine the design.  My opinion is:  It can't be perfect - because I designed it!

My thinking for the concept:
Using 2.5Vref (actually about 2.5Vref + 0.7Vdiode?) on the 12V sine wave provides me with 4 reference points per cycle that can be used for both timing and curve fitting.  I make several assumptions: 1) the signal approximates a sine wave and is repeating at close to its fundamental frequency my PMU's tolerance is about +/- 2% fundamental frequency of either 60 Hz or 50 Hz.  and 2) Once the signal is outside of the +/- 1% tolerance, chances are things have gone so bad, the measurements are no longer AC (e.g. Power Outage).  In other words, if the Next 2.5Vref crossing does not occur within the fundamental cycle time +/- 2%, then the input capture timer values and math calculations will go out of bounds and not result in a valid measurement.  The algorithm will ignore these errors, and if it was a transient error, the measurements will resume when the cycles come back into tolerance.  The 2% tolerance is due to the resolution at which I configure the timers, oscillator, PLL, etc. in the micro controller.

Others in this thread have proposed the use of a zero voltage comparator.  This will require a redesign of the circuit or an additional sub circuit because the rectifier eliminates the bottom half of the sine wave in the current design.  However, I am very interested in making a zero crossing comparator circuit to verify the validity of my concept above.  After thinking about this some and reviewing my notes - I definitely want to keep the 2.5Vref or similar concept.  However, if I get a cleaner frequency and phase measurement with a zero crossing comparator, then Fantastic!  It would simplify the algorithm and it will still work with the 2 capture compare channels on the dsPIC30F3013 MCU.

When I designed the PMU, I didn't even know about decoupling as an option.  I will look into this.  However, I thought an AC/AC step down transformer should be decoupled enough.  One design artifact is the use of individual diodes in the rectifier instead of an IC.  I did not know the AC/AC transformer to rectifier to LM7805 voltage regulator required decoupling because none of the reference designs I have seen for AC/DC transformer to LM7805 ever had decoupling.  If you have a reference circuit describing what you mean, I would be interested.
« Last Edit: November 09, 2014, 04:56:42 am by AJ »
//AJ

AJ

• Contributor
• Posts: 9
• Country:
Re: SynchroPhasor PMU OSHW Project - open for negative feedback
« Reply #13 on: November 09, 2014, 04:57:04 am »
Quote
My other bit of advice would be to avoid IRQs if you can and use timer/counters that have an input capture mode or similar. Basically, a mode where the pin transition causes the counter value to be copied to another register and the counter optionally simultaneously zeroed. It's OK to have it *also* fire an interrupt so that a handler can copy the value somewhere else but to rely on the interrupt handler alone is going to introduce delay and jitter into your code, depending on how long it takes that interrupt to be recognized and for the beginning handler to be loaded and executed.

I'm pretty sure I programmed it as you described.  The input square wave edge timing is measured by input capture compare timers so the running time is steady and the interrupts immediately transfer the values to work registers in a deterministic way so I can program in a time tick "offset" calibration value based on how many clock cycles are required to execute the ISR even trigger and value transfer.
Once the values are "captured" and saved, then the outer loop can process the calculation by picking up the data and handle UART data transmission and commands reception.  The reason this Can work is because of the cyclic nature of the data processing and the range of measurements the algorithm is designed to work with.  As long as the interrupt completes before the next half cycle of the fundamental frequency (+/- about 2%) the measurements are processed and transmitted on time in a deterministic sequence.  Outside of that range, then the algorithms break and simply start over with the next regular cycle.  The algorithm requires 1.5 cycles to complete the first measurement, and measurements occur every half cycle after that.  It is a limitation of the design concept.

The 2 non-deterministic functions that the MCU performs are Command Processing, i.e. "user interface", and GPS PPS Interrupt and arbitrary time base calculations.  In this PMU implementation, it is assumed that if the PMU is processing a command, it does not need to be transmitting data.  GPS PPS and arbitrary time base interrupts for periodic calculations potentially interfere with the measurement processing algorithm.  The level of interference can be measured by "dropped" measurements due to missed interrupts.

It is not a Perfect PMU, for sure!  The algorithm can theoretically process 2 samples per cycle.  However, when using an arbitrary time base, the sample calculation and transmission reliability drops.  10 samples per second (for 60Hz signal) is pretty reliable and 30 samples per second is the maximum usable in the current design.  The current design does not implement any "filtering" beyond simple rejection of measurements outside of the algorithm's tolerances.  The intention is that any filtering or data massaging is really outside the scope of the PMU and should be in the researcher's domain.

This PMU design (GridTrak Model A Open Source PMU) uses a dsPIC30F3013 (16bit) micro controller and a 12.000MHz oscillator running with PLLx8 for 96MHz process clock frequency.  The maximum possible dsPIC clock frequency is 120MHz.  The maximum input oscillator frequency for dsPIC is 25MHz (I think).  Each PIC instruction requires 4 cycles to execute.  The IEEE C37.118-2005 standard which I used for the design requirements, specifies the measurements periods for 60Hz and 50Hz.  I selected the 12MHz oscillator because it is evenly divisible by 2, 3, 5, 6, 10, 25, 50, and 60.
« Last Edit: November 09, 2014, 05:03:34 am by AJ »
//AJ

johansen

• Frequent Contributor
• Posts: 730
Re: SynchroPhasor PMU OSHW Project - open for negative feedback
« Reply #14 on: November 09, 2014, 09:19:51 am »
the phase error of a small transformer should be sufficiently constant as to not matter concerning your intent here.. the problem is the phase displacement is Dependant on the line voltage.. small transformers often approach 50% efficiency and the secondary voltage has the top 20% of the sine wave chopped off, so if your grid changes more than 10% voltage, then the phase change crossing through a small 5 watt transformer might change up to, oh, 5?! degrees between 110vac and 120vac.
--but by the time the grid dips that much, you've already lost dozens of cycles as the grid frequency also drops..

however, if you're on the end of a lossy transmission line and 10% voltage changes are normal, when the main grid has not changed one iota.. then you're going to have a lot more phase noise.. but whatever, i don't think its enough to matter.

Yansi

• Super Contributor
• Posts: 3015
• Country:
• STM32, STM8, AVR, 8051
Re: SynchroPhasor PMU OSHW Project - open for negative feedback
« Reply #15 on: November 09, 2014, 11:03:08 am »
Curve fitting instead of directly measuring it is bad idea.  Thats sounds to me as some student working at college lab, doing measurements by scratching his right ear with his left hand, because someone told him to do that way.

Please, consider using (any) zero crossing detector. Much better, not affected by amplitude changes.

AJ

• Contributor
• Posts: 9
• Country:
Re: SynchroPhasor PMU OSHW Project - open for negative feedback
« Reply #16 on: November 09, 2014, 03:54:31 pm »
Quote
Curve fitting instead of directly measuring it is bad idea.  Thats sounds to me as some student working at college lab, doing measurements by scratching his right ear with his left hand, because someone told him to do that way.

It is not possible for this PMU to Measure the magnitude of the signal for the simple reason that local load and transforms affect the wave form.  The only possible magnitude measurement by this PMU design is the calculation of an ideal sine wave based on 2 points in the sine wave slope.  On the bench oscilloscope, this is the equivalent of superimposing a true sine wave form over the existing signal to see the true sine wave's magnitude.  This PMU calculates the ideal magnitude and measures frequency and phase to provide the data records required by the IEEE C37.118 protocol.

In other words, actually making analog measurements of magnitude is outside of the scope of this particular PMU project's design.  If anyone interested in a PMU that can observe analog magnitude Measurements rather than calculated ideal interpolations, should not consider this PMU as a candidate.  The other open source PMU that I am aware of is the http://www.openPMU.org project.  OpenPMU uses commercial NI data acquisition for true analog signal measurement and is much better suited to the needs of experimenters interested in the signal's magnitude.

The Zero Crossing in this PMU concept would still be the most favorable measurement point because that is where the rate of voltage change is maximum with respect to time when the voltage signal is a sine wave.  Measuring Zero Volts was elusive to me when I originally developed the concept - which was actually as you described: a student project in a college lab. with the exception that: I did it myself and take full responsibility for the design concept = No one ever Told me How to do it.  Your observation is almost spot on - except I lost most of my hair (not my ear) developing the concepts!

You and others suggest it is possible to measure ZC simply with a comparator.  I want to re-investigate that now to find a ZC comparator that can operate in a circuit that does not have an earth ground.  Anyone feeling like providing me with a schematic on a silver tray (OK, I would accept a schematic handed to me on a college cafeteria tray) is welcome to.

This is all great feedback!  This will take me a while to design and test what I have learned from this forum thread.  I might not get to it during the scope of this forum thread.  However, unless the thread gets deleted, I will include all of this feedback in the next spin of the project.
« Last Edit: November 09, 2014, 04:05:12 pm by AJ »
//AJ

djacobow

• Super Contributor
• Posts: 1062
• Country:
• takin' it apart since the 70's
Re: SynchroPhasor PMU OSHW Project - open for negative feedback
« Reply #17 on: November 11, 2014, 02:36:36 am »

You and others suggest it is possible to measure ZC simply with a comparator.  I want to re-investigate that now to find a ZC comparator that can operate in a circuit that does not have an earth ground.  Anyone feeling like providing me with a schematic on a silver tray (OK, I would accept a schematic handed to me on a college cafeteria tray) is welcome to.

Look at ZC detectors for lamp dimmer projects.

The AC mains can go through current limiting resistors directly to the LED in the opto -- no earth referencing at all. On the other side of the opto, you are free to safely reference to whatever you like -- it is totally isolated from the mains. So, use a USB charger, any power supply at all that provides isolation, and you're good to go. You could, for example, base your circuit on 5V Vcc, use a voltage divider to put one input of the comparator at 2.5V (or whatever you like) and then use the output of the opto, pulled up with a resistor , as the other input. Heck, you don't even really need the comparator; you could go right into the input pin of a uC, but the comparator with voltage divider will give you some control of the trip point.

« Last Edit: November 17, 2014, 01:26:41 am by djacobow »

AJ

• Contributor
• Posts: 9
• Country:
Re: SynchroPhasor PMU OSHW Project - open for negative feedback
« Reply #18 on: November 11, 2014, 05:56:20 pm »
Quote
The AC mains can go through current limiting resistors directly to the LED in the opto -- no earth referencing at all. On the other side of the opto, you are free to safely to whatever you like -- it is totally isolated from the mains. So, use a USB charger, any power supply at all that provides isolation, and you're good to go.

THAT is exceptional feedback this time; or maybe my thinking is clearing up?

I didn't think to use opto isolators on the AC input before, because I was tapping the rectifier for the uC's 5V power.  I really did not want to use both AC and DC transformers.

The Microchip MCP1525 Vref I'm using now for 2.5V has been very stable.  There is a 4.1V version, but that is getting a bit far from the ZC for this PMU's algorithm handle; and the higher up on the signal, the more local loads and disturbances influence the measurements.

The last time I checked, this PMU uses about 300mA (AC) while operating.  However, if I use a reasonably stable 5V AC/DC transformer, opto isolated AC signal, and the ZC and +2.5Vref points, I can get rid of the rectifier and voltage regulator portion of the circuit - which I'm sure is a power burner (because I need a heat sink on the LM7805).

If  next, I embed the RS232 to USB converter (instead of using GearMO USB/RS232 cables), with the new power savings, I could tap the USB's power for the DC circuit and be back to only having one AC/AC Transformer.

It will be a while before I get to dig in and do these things.  However, after I do them, I will post the results back into this thread.

Excellent feedback!  Thanks!!
//AJ

David Hess

• Super Contributor
• Posts: 10486
• Country:
• DavidH
Re: SynchroPhasor PMU OSHW Project - open for negative feedback
« Reply #19 on: November 12, 2014, 05:48:28 pm »
Oscilloscopes commonly use transformer isolation when the trigger source is the line.  The ones I am familiar with operate with a high impedance so the transformer acts as a current transformer instead of a voltage transformer.

The precision power line phase measurement circuits I have seen phase lock a local oscillator to the power line either through an isolation transformer or on the line side.  This has the advantage of removing noise and amplitude variations.

Smf