+ Post New Thread
Results 1 to 3 of 3
  1. #1
    Member level 3
    Points: 556, Level: 5

    Join Date
    Oct 2017
    Posts
    57
    Helped
    0 / 0
    Points
    556
    Level
    5

    Calculating Max deviation in C

    I am trying to implement above equation mentioned in link. I am using pic16F1938 for coding.

    https://zenatix.com/current-and-volt...nter-measures/

    Can someone help me or suggest me formula to calculate Max-deviation In c

    All the variable declared as Unsigned int. In the mentioned example for unbalance current how to keep percentage limit.

    •   AltAdvertisment

        
       

  2. #2
    Member level 5
    Points: 978, Level: 7

    Join Date
    Feb 2017
    Location
    Philippines
    Posts
    92
    Helped
    12 / 12
    Points
    978
    Level
    7

    Re: Calculating Max deviation in C

    If it's just C coding, you could place each sample in an array and create a function using 'for-loop'.

    [URL]https://www.programmingsimplified.com/c/source-code/c-program-find-maximum-element-in-array[\URL]



    •   AltAdvertisment

        
       

  3. #3
    Member level 3
    Points: 556, Level: 5

    Join Date
    Oct 2017
    Posts
    57
    Helped
    0 / 0
    Points
    556
    Level
    5

    Re: Calculating Max deviation in C

    I have implimented code considering the example. But in the example it not mentioned in which 2 phase unbalance has occurred.
    can someone guide me here.

    Code:
    unsigned int Max_Current=0;
    unsigned int Min_Current=0;
    unsigned int Unbalance_limit=10;
    unsigned int Max_Deviation=0;
    unsigned int Percentage_Unblance=0;
    
    
    
    void Unbalance_Check()
    
    {
    
    Imean_Current=(Rph_Current+Yph_Current+Bph_Current)/3;
    
    if((Rph_Current>Yph_Current)&&(Rph_Current>Bph_Current))
    {
    Max_Current=Rph_Current;
    
    }else if((Yph_Current>Rph_Current)&&(Yph_Current>Bph_Current))
    {
    Max_Current=Yph_Current;
    
    }else if((Bph_Current>Rph_Current)&&(Bph_Current>Yph_Current))
    {
    Max_Current=Bph_Current;
    
    }else if((Yph_CurrentUnbalance_limit)
    {
    CRUnblance_Flag=1;
    }else
    {
    CRUnblance_Flag=0; 
    }
    
    
    
    
    
    }
    https://www.schneider-electric.co.in/en/faqs/FA300885/



--[[ ]]--