3 phase supply detector challenge


Closed Thread
Results 1 to 7 of 7
  1. #1
    Join Date
    Feb 2005
    Location
    Holmfirth England
    Posts
    116

    Cool 3 phase supply detector challenge

    Hi guys,

    I have a little routine for checking a 3 phase supply that is connected to a transformer. You check the phase rotation using each phase as the reference in turn. If all 3 answers agree then the supply is ok, if any disagree then a phase is down. Here is the code
    Code:
    mainstest:'check phase rotation, using each phase as the ref, if all fwd or rev
    'then supply is ok, if any disagree then a phase is down
    let rot1 = 0
    let rot2 = 0
    let rot3 = 0
    jmp0:
        if phase1 = 1 then jmp0
    jmp5:
        if phase1 = 0 then jmp5   'wait for phase to go to beginning of a low cycle
    jmp6:
        if phase1 = 1 then jmp6
        if phase2 = 1 then let rot1 = 1 ' if next phase is high then rotation is fwd   
    'now test with phase2 as ref
    jmp7:
        if phase2 = 1 then jmp7
    jmp8:
        if phase2 = 0 then jmp8
    jmp9:
        if phase2 = 1 then jmp9
        if phase3 = 1 then let rot2 = 1
    'now test with phase 3 as ref
    jmp13:
        if phase3 = 1 then jmp13
    jmp14:
        if phase3 = 0 then jmp14
    jmp15:
        if phase3 = 1 then jmp15
        if phase1 = 1 then rot3 = 1
    'now test to see if all 3 rotations are the same
    let temp = rot1 + rot2 + rot3      'rotations should all be 0 or 1
    if (temp = 1) or (temp = 2) then 'so if a phase is down temp will be 1 or 2
    high supply      'turn on supply fault led, and go check again
    pause 100
    goto mainstest
    endif
    low supply
    return
    As you can see i'm no pic genius, and the code is a little messy.
    The challenge is who can come up with the neatest, most efficient code?
    As a prize the winner can give themselves a pat on the back

    Regards
    Bob...

  2. #2
    Join Date
    Nov 2005
    Location
    Bombay, India
    Posts
    947


    Did you find this post helpful? Yes | No

    Default

    a pat on the back
    is just a few inches away from a k... in the p....
    Your code will get stuck if any phase fails. This is your code as I interpret it.

    Code:
    mainstest:'check phase rotation, using each phase as the ref, if all fwd or rev
    'then supply is ok, if any disagree then a phase is down
    rot1 = 0:rot2 = 0:rot3 = 0
    while phase1 : wend
    while !phase1 : wend      'wait for phase to go to beginning of a low cycle
    while phase1 : wend
    if phase2 then rot1=1     ' if next phase is high then rotation is fwd   
    
    while phase2:wend
    while !phase2:wend
    while phase2:wend
    if phase3 then rot2 = 1
    
    while phase3:wend
    while !phase3:wend
    while phase3:wend
    if phase1 then rot3=1
    
    'now test to see if all 3 rotations are the same
    if rot1+rot2+rot3 & 3 then    ' either 1 or 2 is not acceptable
       high supply      'turn on supply fault led, and go check again
       pause 100
       goto mainstest
    endif
    low supply
    return
    And this is how it would work without hanging
    Code:
    mainstest:
    temp.0 = phase1
    temp.1 = phase2
    temp.2 = phase3
    temp = temp & 7     ' mask out the unwanted bits
    if temp <> 0 or temp <> 7 then
       high supply      'turn on supply fault led, and go check again
       pause 100
       goto mainstest
    endif
    low supply
    return

  3. #3
    Join Date
    Feb 2005
    Location
    Holmfirth England
    Posts
    116


    Did you find this post helpful? Yes | No

    Default

    Hi Jerson,

    When 2 phases are connected to a 3 phase transformer; there is enough magnetic field around to induce a voltage into the non connected phase, this is why it is traditionally very hard to detect a missing phase. I discovered quite by accident that this "induced" phase would always be out of phase. This is why i turned to the pic. I simply feed the 415 volt phases into the pic via 5 meg resistance, and use my code to do the test. For this reason my code does not hang.

    Using while/wend certainly looks nicer than my effort, not shure if it is more code efficient.
    Code:
    if rot1+rot2+rot3 & 3 then    ' either 1 or 2 is not acceptable
    I like the idea, but the answer 0 is also acceptable, since the incomming mains may be either fwd or reverse, it is only if the results are both fwd & rev that there is a problem.

    I'm afraid that your code would not work unless i'm missing something.
    temp would just be a snapshot of which phase(s) are high at any one time, not representing the rotation (or phase relationship) of the phases. Please correct me if i'm wrong.

    Thank you for having a go tho
    Bob...
    Last edited by BobEdge; - 29th April 2009 at 16:07.

  4. #4
    Join Date
    Nov 2005
    Location
    Bombay, India
    Posts
    947


    Did you find this post helpful? Yes | No

    Default

    Code:
    temp would just be a snapshot of which phase(s) are high at any one time, not representing the rotation (or phase relationship) of the phases. Please correct me if i'm wrong.
    True. What I've done is take an instantaneous snapshot of the phases and check. But, as you say, the induced voltage part.... I did not know.

  5. #5
    Join Date
    Oct 2004
    Posts
    448


    Did you find this post helpful? Yes | No

    Default

    Hi Bob, Jerson,

    I'd been working on something similar a while back, you'll find the thread at http://www.picbasic.co.uk/forum/show...=ardhuru+phase

    You might get some insight going thru' the replies I received.

    Also, I'd created an Excel sheet to draw the 3 sine waves against time, to help me visualise the waveform (raw, rectified and digital, as seen by the pic input). If you're interested, I could attach that.

    Regards,

    Anand

  6. #6
    Join Date
    Feb 2005
    Location
    Holmfirth England
    Posts
    116


    Did you find this post helpful? Yes | No

    Default

    Hi ardhru

    Thank you for the link, very interesting thread. Reminds me of when I was developing my 3ph phase angle firing circuit. So hard to get your head around the timings, and when your talking delta star transformers you have lead or lag from prim to secondaries, almost made my brain explode.

  7. #7
    Join Date
    Apr 2009
    Location
    Boise, Id
    Posts
    44


    Did you find this post helpful? Yes | No

    Default

    Checking for a loss of phase on a transformer or underground 3 phase lines can get tricky. The phases (s) that are still energized do induce voltage into the un-energized phases. If there is sufficient resistive load connected, the voltage will be small. If there is no or little load, then the un-energized phase can have voltage near the same magnitude of the energized phases.

    I've ran into this before, we didn't program a pic to solve the issue, but I'm sure it can be done. We used a programmable power monitor to watch the PHASE ANGLE of the incoming power. Ideally 3 phase will have angles 120 degree's apart. In reality it's not unusual to see 120 +/- 1 degree. I won't get into why in this discussion. So if the phases say get to 120 +/- 20 degrees for more than 30-45 seconds, something is wrong and we send the signal to transfer to the alternate source.

    Phase angles can and will swing from 120 degrees when there is a fault on the three phase line you are monitoring. For example, somewhere upstream a bird gets across 2 phases, those two phase's will no longer be 120 degrees apart, both phase shift toward each other and synch until the bird is well done and falls clear, then things return to normal. The time it takes for the phases to return to normal depends on the protective relaying. Generally a few milli-seconds to 5 seconds, reasons that can be discussed later if needed.

    So the point being, depending on where you are monitoring and where the "source" of the power is (utility substation, generator, etc.), you may want to modify your code accordingly. The primary trigger for the code should be phase angle, secondary would be voltage magnitude. If you’re protecting a motor, you don't want it to run on imbalanced voltage of more than 5% for more than a couple of minutes.

    Shane

Similar Threads

  1. 3 phase PWM with dsPIC30F2020
    By nemmard in forum mel PIC BASIC
    Replies: 1
    Last Post: - 21st January 2009, 14:19
  2. Understanding 3 phase sequencing
    By ardhuru in forum General
    Replies: 3
    Last Post: - 22nd June 2008, 10:14
  3. 3 phase sequencing
    By ardhuru in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 26th May 2007, 07:35
  4. Someone help me to simplify this
    By thrix in forum General
    Replies: 4
    Last Post: - 21st February 2004, 05:01
  5. Help wanted..
    By thrix in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 17th February 2004, 23:44

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts