CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Inverter O/P voltage controlling problem

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
attabros



Joined: 28 Jul 2008
Posts: 35

View user's profile Send private message

Inverter O/P voltage controlling problem
PostPosted: Wed Jun 16, 2010 4:04 am     Reply with quote

I have designed an inverter 110-130 DC to 220-230 AC by using step Square Wave.
There are 32 different steps. In these 32 steps the voltage varies from 180-350 VAC.
I have made the steps selection through microcontroller as a closed loop control,
first by DC I/P voltage, second by LOAD CURRENT. Still I have faced the problem. I want the
step selection in a manner so that the voltages remain between 220-230 VAC. For that I step down the AC voltage to 0-5 VDC range for PIC 18F452 A/D converter as v_ac analog input.

Following is the routine I wrote,
Code:

int k=0;

if(v_ac > 455)
 {
 
  if(k > 0)  {k--;}
 }

 if(v_ac < 425)
 {
 
  if(k < 2)  {k++;}
 }
 out_step = out_step + k;

This works fine but at two or three load conditions the voltages fluctuates from 217-240 VAC which means it jumps 3 steps up & then 3 steps down.
Can anyone give me any suggestion how to fix it out.

Thanks
Ttelmah



Joined: 11 Mar 2010
Posts: 19498

View user's profile Send private message

PostPosted: Wed Jun 16, 2010 4:30 am     Reply with quote

You probably need to improve your control loop.
The problem is that things take time to respond. You increase k, this updates an output value, which then takes time to actually appear on the output. Then you measure the output, which has still not responded, so the k value is increased again....
This is a common problem. You need to look at the time delays involved in how long it takes a step inrease in 'k', to actually be 'seen' as an increase in voltage back at the processor.
In normal control algoritms, this is the 'point' behind things like the PID algorithm. With this there are three response 'terms'. The 'P' term (which yours corresponds to), making a response proportional to a perceived change, then the 'I' term, adding a 'baseline' value, changing much slower, based on the long term trend, and finally the 'D' term, acting the other way, and actually slowing the response, if the input is already changing in the right direction.
Now, you probably don't want/need to get so complex, but you could introduce something to give a similar result. So (for instance):
Code:


int k=0;
signed int last_move=0

if (last_move>0) --last_move;
else if(last_move<0) ++last_move;

if(v_ac > 455)
 {
  if (last_move>=0) {
    if(k > 0)  {
      k--;
      last_move=-3;
   }
 }

 if(v_ac < 425)
 {
  if (last_move<=0) {
    if(k < 2)  {
       k++;
       last_move=3;
    }
 }
 out_step = out_step + k;

Here 'last_move', acts like a rather odd 'D' term. Each time round the loop, if it is non zero, it is decreased in magnitude. When the voltage is seen to be 'out of range', if the last move was in the opposite direction, or the loop has gone round three times, 'k' is updated as normal. However if the last applied move was in the same direction, the update is delayed for three loops, slowing the response, if the signal may already be changing in the right direction. You may need to change the number used (possibly even have assymetric values - if the system actually responds faster to an increase in voltage, versus a decrease for example...).

Best Wishes
attabros



Joined: 28 Jul 2008
Posts: 35

View user's profile Send private message

PostPosted: Thu Jun 17, 2010 12:15 am     Reply with quote

The piece of code you provided working fine now the voltages are in range
as well as jumping factor reduced but not eliminated.

The O/P voltages are in Range 220-230 VAC but at lower Load conditions
such as No Load , 1 Ampere & 2 Ampere it jumps within one step up & one step down which ranges 220-224 VAC which is quite noticeable , the max: load is 11Ampere.

Kindly give suggestion.

Thanks.
Ttelmah



Joined: 11 Mar 2010
Posts: 19498

View user's profile Send private message

PostPosted: Thu Jun 17, 2010 2:05 am     Reply with quote

Try increasing the two numbers put into 'last_move'.
The value here is the number of loops that the code will delay after adjusting once, and the direction of the move (the sign).

Best Wishes
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group