Nano Power Inverter - Roll Your Own Style


Author Message
poida

Guru

Joined: 02/02/2017
Location: Australia
Posts: 1421
Posted: 07:53am 10 Jul 2022      

aw Jeez Wiseguy. you broke it.

last question:
Last query Peter, the 250 step code I believe takes 5 seconds, I expected the 1000 step code (un modified by me) to take 20 seconds but it only took 10 - something that I didn't quite get. It's probably something to do with 50 versus 100 Hz steps......
You are correct. I made a 1000 step version and that uses 100Hz updates
so it needs 10 seconds to get to PID change over.

The 50 Hz update version used 250 steps and needs 5 seconds (250/50..)
before PID takes over.

To change the step number here is what you need to do:
for instance, if it's 250 and you want 100 then

find all the "250" in the below code and change to "100"
find all the "251" and change it to "101"
find all the "250.0" and change it to "100.0"


..
void loop()
{
 float ch0;

 // sample channel..
 // In the past, I low pass filtered this. not now, no need thanks to active LP filter on Vfb
 ac_output = (float)analogRead(ADC_OUT) / 1024.0; // scale 0 - 5V to 0.0 to 1.0

 if(uf == 1  )    // this will execute at 100Hz
     {            // it runs at near zero volt crossing of AC output      
     uf=0;
     ac_setpoint = 0.55;       // for same Vfb as EG8010. change AC output voltage via Vfb voltage divider trimpot
     if (oen == 1) sst++;      // slow start. If output is enabled, keep starting up. sst = output pwm% or approx. voltage.
     if (sst > 251)sst = 251;  // stop increasing when sst has got to the end of slow start. when = 251, this enables PID. See below..
     if (oen == 0) sst--;      // if stopping, slow stop
     if (sst <= 0)             // once fully stopped, no more changes to sst needed
       {
       sst = 0;
       cbi(PORTD,5);     // pull IR2184 shutdown LOW to disable gate drive output
       }
     else
       sbi(PORTD,5);     // pull it HIGH, to enable output

     if(sst > 0 && sst < 250)     // slow start timer counts to 250 with gentle ramp up, then switches over to PID control. (gulp!)
       {                          // sst can increase or decrease, giving the slow start and slow stop.
       if (oen == 1)              // slow stop? I think of it as de-gauss
         {
         if(ac_output < ac_setpoint)
           pwr += 1.0/250.0;     // bang-bang control, should AC output reach setpoint prior to PID.
         else                    // During slow start need to ensure output is tracking setpoint
           pwr -= 1.0/250.0;     // should output get close enough to matter.
         }
       else
         pwr -= 1.0 /250.0;      // this will execute in slow stop
       }
       
     if (sst == 251)       // once sst = 251, run PID. the above bang-bang control will NOT have executed, because sst = 251
       {                  
       Setpoint = ac_setpoint;    
       Input = ac_output;  
       do_pid();
       pwr = pwr + Output;
       }
...


I could or maybe should have already provided a setting via the menu to
set the number of steps of the soft start/stop AND a setting for the
control loop update rate. I thought there would be no need for it.

When I changed sst = 200 it appeared to change the timing between when D8 got the start signal and when D5 enabled the outputs ( it actually behaved as though D5 was already high before D8 told it to start).

possibly you did not change all of the above and so the soft start did not progress to output nearly equal to setpoint which is when I only ever want to switch over to
PID control. And maybe D5 was enabled/HIGH at a bad time such as a sudden increase in PWM duty. I need to be the fly on the wall when you are doing your voodoo on the bench. I promise not to heckle.

Unmodified nano_1_v7_no_bessel is bullet proof. I run this on my home inverter
and it has restarted nearly daily for 3 years now and it still runs great.
I can't help recalling the air compressor tests I did with a 4 x 3 FET inverter
running nano_1_v7.. and seeing it do 12kW. No point to  be made, it just came to mind then. When you get it right, you can move mountains with this system.

I did the most testing on a 4 x 1 FET power board. 1kW load testing and lots of
looking at Gate drive details. This board had about 6 x 3900uF caps on it
and a current limited PS. The caps always would blow a FET if I got it wrong.
But so easy to diagnose and repair.

did I answer what you needed?
I'm tired. Had a huge day on the mountain bike, stopped riding due to no more strength in my fingers and I could not hang on. I ride until I can't, it's so much fun.