Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.81 KB | None | 0 0
  1. void pi_regler(void)
  2. {
  3.     //Differenzunterscheidung wegen Heizen und Kühlen
  4.     if(status==KUEHLEN) {regelabweichung=t_vorl-t_soll;}
  5.     if(status==HEIZEN) {regelabweichung=t_soll-t_vorl;}
  6.        
  7.        
  8.     //Proportionalregler
  9.     if(regelabweichung>0)
  10.         {
  11.         pband=(Pant*regelabweichung);
  12.     } else
  13.     {
  14.         pband=0;
  15.     }
  16.        
  17.     if(c_pid==0)
  18.     {
  19.         esum=esum+regelabweichung;
  20.         if(esum>Isat)esum=Isat;
  21.         if(esum<0)esum=0;
  22.         iband=(esum*Iant*Ta);
  23.         //Begrenzung des I-Anteils auf 20% der maximalen Stellgröße
  24.         if(iband>0.25*MAXOUT)iband=0.25*MAXOUT;    
  25.         c_pid=20;
  26.     }  
  27.        
  28.     fc302_soll = pband+iband;
  29.        
  30.     //Stellgrößenbegrenzung
  31.     if (fc302_soll > MAXOUT)                                 // Stellgröße auf 0..1023 begrenzen (10 bit PWM)
  32.     {
  33.         fc302_soll = MAXOUT;
  34.     }
  35.     if (fc302_soll < 1)
  36.     {
  37.         fc302_soll = 1;
  38.     }
  39.    
  40.        
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement