Nano Power Inverter - Roll Your Own Style


Author Message
poida

Guru

Joined: 02/02/2017
Location: Australia
Posts: 1404
Posted: 12:34am 12 Jul 2022      

46 V DC supply
31.2V AC RMS at your setpoint means 44.1V peak to peak

pwr needs to get to 44.1 / 46 or 0.96 to achieve your AC output setpoint

0.96
(This explains a few things now.)

So that means 960 of the 1000 steps are needed just to get to 235V AC output
because pwr is initialised at 0.0 at the start of every soft start.

you can experiment with different soft start ramps of course.
They are your FETs..

The change over to PID will not be very kind at all to your FETs if there is
a large difference in pwr's value from 0.96 when change over occurs.


look for three things below to change


void init_vars()      // called prior to setting oen = 1, as well as from setup()
 {
 ICR1 = PPWM;
 lv_stopped = 0;  
 sst = 0;      // slow start counter 0 - 1001.
 v1low = 1;    // half wave output flag, 0 or 1
 pcount = 0;   // counter for sine wave lookup table
 uf = 0;       // set to 1 to enable AC output voltage feedback code to execute
 pwr = 0.0;    // PWM duty cycle analog, 0.0 to 1.0
 // added this
 vpwr = (int)((float)PPWM * pwr);
 //in place of
 //vpwr= 0;      // integer equivalent of pwr, 0 to PPWM


You can start the ramp up at any value by changing sst
you can also start the sine wave modulation amplitude at any value by changing pwr

pwr needs to be between 0.0 and 0.99
sst can be from 0 to 200 or more.
Changing these things invalidates your warranty.