Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 19:33 06 Jul 2020 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Electronics : Poidas "Inverter Software Control" Topic.

     Page 1 of 6    
Author Message
wiseguy

Guru

Joined: 21/06/2018
Location: Australia
Posts: 470
Posted: 06:30am 03 Feb 2019
Copy link to clipboard 
Print this post

Poida has created what may well be the next (and best?) successful platform for an updated OZ inverter, of course this is if all goes to plan.

Last week I finally sent out for manufacture some prototype PCBs of my versions of a Mosfet Power board, and an inductance saturation tester. I am currently working on my version of the nano control PCB which I intend to be a standalone unit with voltage & current feedback. I am happy to provide further info if anyone is interested but would prefer to publish info once tested & working.

I am now looking into the voltage feedback design which has raised some questions which I am directing to Poida for clarification. Whilst I could have done this as a PM no one else learns anything from that so I chose to start a new topic to open for discussion. I am confident other questions about how & what the nano is up to as it drives the inverter will arise.

Poida, how does the nano control the output voltage ? I am aware we have a rectified filtered DC level (3V?) fed back to the nano. When does the nano read this level - can I assume you do an ADC read 5mS after the zero crossing ?
Is this done once for every complete mains cycle (20mS), or sampled every half cycle (10mS)?
How is the feedback managed, is the ADC reading averaged over 2 (or other number of) conversions or is it used directly ?

My reasons for wanting to know more is that I fancy using a simple precision rectifier for the AC feedback signal, as I would like the inverter to make reasonably rapid real-time adjustments to a signal droop (large load turning on). If we have a DC level I perceive it will have a delayed response to output changes. If the nano measurement of an unfiltered 100Hz ripple signal were to occur at precisely 5mS after the beginning of a half cycle drive we can adjust for changes rapidly.

So, do I need to apply slow averaged DC or can (does) the nano measure at the peak of each cycle so I can feed it relatively unfiltered 100Hz feedback ? I look forward to hearing more about how the software works.

To clarify I am not suggesting output control occurs each half cycle as that could lead to flux walking, but perhaps rather read twice per cycle average the reading and control complete cycles (20mS).
Edited by wiseguy 2019-02-04
If at first you dont succeed, I suggest you avoid sky diving....
Cheers Mike
 
poida

Guru

Joined: 02/02/2017
Location: Australia
Posts: 750
Posted: 11:02am 03 Feb 2019
Copy link to clipboard 
Print this post

  wiseguy said  

Poida, how does the nano control the output voltage ? I am aware we have a rectified filtered DC level (3V?) fed back to the nano. When does the nano read this level - can I assume you do an ADC read 5mS after the zero crossing ?
Is this done once for every complete mains cycle (20mS), or sampled every half cycle (10mS)?
How is the feedback managed, is the ADC reading averaged over 2 (or other number of) conversions or is it used directly ?



The AC output is to be rectified and filtered, then scaled to approx. 3V for the desired output. This signal is ground coupled to the uC DC supply.
This way, the uC will see 3V with respect to it's internal ADC measurement system ground. OK, nothing new here...I term this Vfb.

The nano1 code runs one thread, with interrupts.

The main thread, executed aproximately 4,500Hz is seen in
loop() block of code. Loop() is called again as soon as it completes.

Within loop()
- I sample Vfb and convert to a floating point value from 0.0 to 1.0
- I put this new sample through a IIR digital low pass filter, that is designed to heavily attenuate most signal above 20 Hz. It is a 4 pole Butterworth LP filter.
The result from this gives us a nice, noise immune representation of Vfb.

If it is not time to apply Vfb to the closed loop PID controller, i.e. if a flag = true, just exit loop() and the Arduino bootloader will call loop() again within a few clocks.

It is time to use Vfb at each zero crossing of the 50Hz output, i.e. closed loop control is executed at 100Hz.
The time this happens with respect to the output AC waveform is close to zero, but always after it. Likely it's 1/4500 second plus some interrupt latency.
It is not synchronous to the output AC, but always about 1/4500 sec plus or minus a bit.

Each 100Hz cycle of this closed loop code,
- if it is in soft start mode, increase PWM duty% by 1/250, and stopping increasing when Vfb is greater than the setpoint or soft start has arrived at 100% duty cycle.
While in soft start, if Vfb is greater than the setpoint, reduce duty% by 1/250.
There might well be a period of time where the AC output is controlled by the soft start code only. This is a short period of time, in my testing it's maybe 1/2 to 1 second depending on the AC output voltage setpoint.

- if it is not in soft stop mode AND it has been in soft start mode for 250 of these 100Hz cycles, then change over to PID control.

- if soft stop is active, disable soft start and PID control AND reduce PWM duty% by 1/250, making sure not to reduce it below zero%

So the code uses Vfb twice each 50Hz output cycle, both times at approx zero crossing point. Vfb is digitally filtered to remove lots of rubbish.

An important point on the digital filtering:
Since we are sampling Vfb at approx 4500Hz, we will see aliases of frequencies over about 2,200Hz. This is a fact and it needs an input signal that does not contain much power of these frequencies and above.
Additionally, the cutoff frequency of the filter is about 40Hz.
The cutoff frequency interacts strongly with the gain and damping of the PID control loop. I have chosen values that are stable and work well. Of course all the above is dependent upon the Nano clock and these I have found to be no cause of concern.

There are 2 interrupts that may fire at any time. And there is no priority
for these interrupts (INT0 may fire and run within INT1 and vice versa)

I have coded INT0, the code that looks after phase lock on external AC signal, to be fast. It runs in about 8us. It has no detectable effect on the AC output in my testing WHEN RUNNING CORRECTLY.

INT1 runs at 20 kHz and is used for 2 things.
Firstly it applies the calculated PWM duty% to the output pins, looking after the correct pin signalling for either of the 2 halves of the 50Hz output.
Secondly, it sets a flag = true, to make the above 100Hz code that resides in loop() to fire the next time loop() is called. This flag is set when the PWM duty% lookup table counter resets to zero. It is zero crossing time.
Also, code looks at if mains sync has been achieved and if so, pull an output pin high or low to suit.
This code takes about 10us to run.

Of course a 20kHz PWM needs 50us so I can update the PWM duty% very quickly, on a cylce by cycle basis if need be. But since the calculated output power level (i.e. duty %) can only change after the 100Hz calculation code runs, the PWM duty% remains constant for each half cycle of the 50Hz output.
In testing I have found this to be optimal.

And by the way, the EG8010 only samples Vfb once each 50Hz output and at a very narrowly defined window in time too. I proved this in testing, see prior post by me.
This implies it drives PWM duty% constant for a complete 50Hz cycle...maybe it does something more sophisticated? I should investigate this.

wronger than a phone book full of wrong phone numbers
 
poida

Guru

Joined: 02/02/2017
Location: Australia
Posts: 750
Posted: 11:17am 03 Feb 2019
Copy link to clipboard 
Print this post

  wiseguy said  

So, do I need to apply slow averaged DC or can (does) the nano measure at the peak of each cycle so I can feed it relatively unfiltered 100Hz feedback ? I look forward to hearing more about how the software works.

To clarify I am not suggesting output control occurs each half cycle as that could lead to flux walking, but perhaps rather read twice per cycle average the reading and control complete cycles (20mS).


I could easily change from 100Hz control loop processing to 50Hz.
This would suit your requirements and prevent any risk of flux walking.
In practice I have not had an issue with 100Hz update rates.

The system loop response is in my opinion over damped.
This is for safety. But it means a slow response to transients.
look at the post I made at the bottom of page 6


When looking at inverter's transient response to loads, we need to consider some important things.
We could make an inverter with nearly zero DC resistance (MOSFET bridge Rds(on) minimal, huge primary winding conductor area, huge DC supply conductors and bulk capacitors), and nearly zero AC resistance with large area secondary winding.
This would probably be best described as an OZ-Inverter. They work well.
When large loads are applied, simply large DC currents flow immediately in response and little PWM duty% changes are required.

My test inverter has purposely inferior DC resistance, small bulk caps, small DC supply wires etc. When a load is applied on the AC output, the closed loop system has a bit of work to do to bring it back up to the setpoint.

In real life I have found there is no problem in my house when it's powered by an inverter that has 18mm2 primary winding (48V DC supply). when my wife prints to the laser printer, you see a short dimming and my computer's UPS switches in for 5 seconds thanks to a low AC supply condition. Fridges switching on do not even do this.

I see these inverters as a 2 way system of exchanging DC with AC. The current can flow both ways...It's sort of a magic DC/AC transformer, with in some cases very low losses. I know, this view is not "correct" or anything but it helps me understand what on earth is this thing on the bench doing right now.

In other words, if you build it with very low resistive losses, then the AC output control system will have little work to do.Edited by poida 2019-02-04
wronger than a phone book full of wrong phone numbers
 
wiseguy

Guru

Joined: 21/06/2018
Location: Australia
Posts: 470
Posted: 12:59pm 03 Feb 2019
Copy link to clipboard 
Print this post

So its all as simple as they hey, and I thought the software was complicated

Poida thank you very much for the detailed explanation - it is just what I needed to get a better handle on how it operates and what to expect. With regard to control of the loop at a 100Hz rate, I think the best/safe approach is to execute the control at a 50Hz rate. If it is possible I would even use the exact same sequence twice per complete cycle to ensure a precisely symmetrical sinusoid with precisely balanced flux. I know I am a bit painful, but I have a pefectionist approach as much as possible, especially if it is relatively simple to achieve and should be faultless despite whatever crap loads are thrown at it.

My AC signal for VFB will be from one of those small 2mA Ac/Ac voltage transformers with the primary connected to the mains output via 2 x 100K resistors. One on each side of the primary. Their high value R help tame (filter) switching transients very well. I am now thinking that after a precision rectify I will use a sample and hold to capture and quickly update VFB each new cycle with a stable DC representation of the AC peak output.

For anyone not familiar with these voltage transformers it is what most energy analysers use to measure the AC voltage. Their operation is similar to the current sense transformers except they have equal input and output windings and also operate with a balanced flux. Select resistors on the 240V AC side that will pass a current of say 1.5mA at the required nominal AC output and then select a load resistor that provide an output voltage around 1 to 1.5V (at the nominal mains output) at the primary current (in this case 1.5mA). Typical load resistor value will usually be around 0.5K - 1K. Obviously some gain after rectification is required to meet the VFB 3V feedback level.

If at first you dont succeed, I suggest you avoid sky diving....
Cheers Mike
 
mackoffgrid

Guru

Joined: 13/03/2017
Location: Australia
Posts: 460
Posted: 08:15pm 03 Feb 2019
Copy link to clipboard 
Print this post

Hi Mike

Good Post.
These might be useful links to those 2mA transformers.

Voltage Transformer Module

ZMPT101B 2mA/2mA Precision Phase voltage transformer

2mA/2mA High Precision Miniature Micro VoltagTransformer Sensor Isolation Voltage 3000V

Cheers
Andrew
 
Warpspeed
Guru

Joined: 09/08/2007
Location: Australia
Posts: 3261
Posted: 04:19am 04 Feb 2019
Copy link to clipboard 
Print this post

Poida,

Voltage feedback with suitably tuned PID constants certainly works, no argument about that.

But have you ever tried just direct input voltage feed forward correction ?
It can provide total correction for input voltage changes every 20mS, without worrying about damping or instability problems. Its much faster to correct, especially if the input dc source has considerable source impedance.

As you have already said, the inverter itself should offer a very low output impedance, and if the efficiency is high >90% as it usually is, most of any voltage surge or droop will be caused by the dc input voltage moving around.
Cheers, Tony.
 
wiseguy

Guru

Joined: 21/06/2018
Location: Australia
Posts: 470
Posted: 11:05am 04 Feb 2019
Copy link to clipboard 
Print this post

Hi Andrew, I had designed in the ZMPT107 it is ~ 19mm x 10mm. I am not using their module though as the output is still AC and needs rectifying and I will save space by using discrete parts.

I am a bit of a tightwad when developing so to get my best bang for buck with the likes of PCB Way I make my proto PCB's so I either fit 1, 2, 3 or 4 circuits on my 100mm X 100mm allocated space, delivered to Aus for $19AUD.

I brought a small table top diamond saw from aliexpress so cutting out the individual boards is a cinch. If there are 4 small modules I get 40 units for my trouble for ~ 47c ea. I am trying to squeeze my controller into 100 X 100mm.....Edited by wiseguy 2019-02-05
If at first you dont succeed, I suggest you avoid sky diving....
Cheers Mike
 
poida

Guru

Joined: 02/02/2017
Location: Australia
Posts: 750
Posted: 10:45pm 04 Feb 2019
Copy link to clipboard 
Print this post

  Warpspeed said   Poida,
Voltage feedback with suitably tuned PID constants certainly works, no argument about that.
But have you ever tried just direct input voltage feed forward correction ?
It can provide total correction for input voltage changes every 20mS, without worrying about damping or instability problems. Its much faster to correct, especially if the input dc source has considerable source impedance.


Are you suggesting a scheme such as the following:
let:
- Vfb = AC output signal
- setpoint = desired AC output, scaled to align with Vfb
- duty% = the magnitude of the sinewave PWM modulation depth, with 1.0 = max AC output voltage and 0.0 = zero output AC voltage
- g = some gain factor to make stuff work.
- The DC supply voltage and primary winding make for 240V AC RMS output when duty% = 0.8 and no load with nominal DC volts supply.

So I think you mean every 20ms or each 50 Hz output cycle,
make duty% = 0.8 + g *(setpoint - Vfb)

When Vfb = setpoint, duty% = 0.8. No sweat, no need to increase or decrease output voltage

When Vfb < setpoint, duty% = 0.8 + some extra , to bring output voltage back up to 240V

thinking more better-er,
you would need to obtain a relationship between output AC voltage, DC supply volts and the load on the AC output.

Ok, we need:
- dcv = DC volts
- aci = AC load amps
- f() = a function that takes 3 variables, returns a fraction between 0 and 0.8

now duty% = 0.8 + f(dcv,aci,Vfb)

I would enjoy very much developing that function. It would be different for all inverters with differing transfer functions (thick or thin primary winding, etc.)

But I prefer closed loop control. I can do it in software.

The above scheme is to my mind similar to open loop control. I had a fuel injected motorbike that was open loop. Air density, throttle opening angle, engine temp and revs were used to determine fuel injection duration. No oxygen sensors.
Cars are closed loop (usually have oxygen sensors on the exhaust) in the main.

I agree, transient response could be much better in open loop, I think I need to experiment. There is enough non-volatile memory in the Nano to implement this.
I would use tri linear interpolation. Have about 5 x 5 x 5 data points for each of the dcv,dci and Vfb combinations.

The variation in mains voltage is handled easily by most household devices.
Things with offline SMPS (switch mode power supplies, TV, PC, printers,nearly everything..) manage fine with a wide range of input voltages. Fridges, ovens etc could not care less if the supply is + or - 5V
The one thing I have seen that is sensitive to less than +/5V changes to 240V are
incandescent lights. They flicker a little.
I do not think inverter output voltage needs to be maintained to finer tolerances than this, for my needs.

wronger than a phone book full of wrong phone numbers
 
Warpspeed
Guru

Joined: 09/08/2007
Location: Australia
Posts: 3261
Posted: 11:32pm 04 Feb 2019
Copy link to clipboard 
Print this post

All you need to do is measure the dc input voltage over a fixed range, for example +2.50v corresponds to the allowable minimum dc input voltage, 5.00v corresponds to the allowable maximum dc input voltage.

That will measure over any required dc voltages over a 2:1 span (set by the user with an external voltage divider) and a potentiometer for final fine output voltage adjustment.

All the software has to do is provide a nice clean sinewave going from 0% duty cycle to 100% duty cycle (peak to peak) at the minimum dc input voltage.

Maximum dc input voltage should provide a nice clean sine wave going from 25% duty cycle to 75% duty cycle (peak to peak) for the maximum allowed dc input voltage.

The transformer primary will then be fed with a constant amplitude 50Hz sine wave.
It will be totally immune to fairly drastic dc input voltage swings.
The output will drop very slightly under load, but not by very much.

My own 5Kw inverter gives no measurable output voltage change between 90v dc input and 180v dc input using this technique. The output falls by 2v per Kw loading, or about 10v drop flat out at 5Kw. That is not enough to be noticeable.

It responds very fast without any light flicker because voltage correction would be total every 20mS. None of this PID slow ramping to reduce the error stuff. It definitely works and well worth a try, and it should be very simple software to try it.

Very large step gain changes can be made right at the zero crossing point without introducing any waveform discontinuity.

Its probably better to average the dc measurement, but a single spot voltage measurement right at the zero crossing should be fairly immune to noise and simple to try out initially.
Cheers, Tony.
 
mackoffgrid

Guru

Joined: 13/03/2017
Location: Australia
Posts: 460
Posted: 09:37pm 09 Feb 2019
Copy link to clipboard 
Print this post

Hi Mike(wiseguy)
Is this the table saw you were referring to?
I'm not sure I can justify the cost, PCB are so cheap. But I'm tempted

Cheers
Andrew
 
wiseguy

Guru

Joined: 21/06/2018
Location: Australia
Posts: 470
Posted: 11:34pm 09 Feb 2019
Copy link to clipboard 
Print this post

Hi Andrew,,
That appears to be the exact unit I bought, however the unit you linked to has two extra pillars and a Perspex/polycarbonate shield that was not on offer when I brought mine.

The Power adaptor has 7 voltage settings via a slide switch on the side for speed control. From memory I think they are 12V - 24V inclusive in 2V steps - this was not clear from the description.

It has been quite handy for cutting & trimming lots of small things since purchase.
Takes a minimum space in the cupboard (and on the bench) and is ready for use in seconds.

If at first you dont succeed, I suggest you avoid sky diving....
Cheers Mike
 
Tinker

Guru

Joined: 07/11/2007
Location: Australia
Posts: 1904
Posted: 03:05pm 04 Mar 2019
Copy link to clipboard 
Print this post

  mackoffgrid said   Hi Mike(wiseguy)
Is this the table saw you were referring to?
I'm not sure I can justify the cost, PCB are so cheap. But I'm tempted

Cheers
Andrew


Andrew, if you happen to have an old 100 or 125mm angle grinder you could make your own PCB table saw. Mine had a wrecked motor but OK gear box, made a fitting to accept a power drill chuck at the gear box input shaft and mounted all under a little table, using those 1mm abrasive disks for cutting. Works a treat - cost nothing.
I think I posted about it somewhere.
Klaus
 
wiseguy

Guru

Joined: 21/06/2018
Location: Australia
Posts: 470
Posted: 08:39pm 27 May 2019
Copy link to clipboard 
Print this post

Ok time to revisit this topic, have had a sleepless night thinking about inverters and issues and decided to put pen to paper early.

Why does a hairdryer upset inverter operation so much ? The simple answer is due to the half wave rectification that some of the cheapies employ. I am confident that the older style sunbeam units with a synchronous motor and no half waving would work fine on our inverters.

I havent tried this but I believe I know the answer already. What if I get 2 identical largeish toroids, connect the 30V secondaries from each one together and drive 240VAC into one side, I get 240V (near as dammit) out the other side. What happens if I drive a half wave hair dryer from the transformed (x2) on the output secondary - nothing it just works with no fuss.

My theory for this is because the half waves making up a complete cycle are exactly matched from the mains. Is the mains immune from DC issues - no way, they hate DC injected back into the mains, but it can tolerate this a heap better than our inverters can. Why?

I'm glad you asked. What is so special about the mains - I think its because we dont really have any influence on it. It has an extremely low impedance and magnetises a transformer exactly equally in each half cycle. The analogy to our inverters is that to equate the mains to our inverters means we have to change the speed of a massive multi ton rotor each half cycle - yep that's right - its just not going to happen.

I recently played with an unloaded transformer primary connected to the mains through some diodes creating an unbalanced primary drive. I had the equivalent of 2 diodes drops in one direction and none in the other. I actually had 3 diodes in one direction and one in the other - 2 cancelled each other out. I noticed the primary current increased by a factor of around 10 times (with an open circuit secondary) at around 110VAC.

If we consider the unbalance a "distortion" 1.2V in 120V = 1% but this is a special distortion as it affects one half (the same half) of the waveform always.
Is it possible that when loaded to kilowatts of half wave that the same (10 times?) increase in magnetising current occurs?? (due to saturating in one direction?)

I have re-read Poidas control loop a number of times and I think the answer might have been there all along. I have always considered that the drive waveform has to be equally balanced for a complete mains cycle. I think it is fine that consecutive complete cycles can have different amplitudes during a correction event, but adjustments should be made at the 360 degree point for the next 2 x half cycle pairs.

In theory this could add a delay to our output correction if we suddenly load the inverter, but maybe its not as bad as you could expect. Providing the previous 2 cycles were matched, we can probably make an adjustment after the next following half cycle (if we detect a drop (or rise)in VFB) as long as we balance this for the next two half cycles.

It appears that the current Poida software can adjust the sinewave each half cycle which might not be the best choice. If it is a look up table, just use the same table for each pair of half waves. If calculated on the fly - this might not be a good choice. The only way to really balance the sinewave accurately (think large heavy rotor) is to look at the integrated energy of all the HF pulses for each half sinewave and they must match.

I look forward to some discussion - if there are any other or better or just different theories please contribute as we want these damn things to work just like the mains does !

I believe Warps inverter does not have this issue as his duty cycles for all the small events making up a sinewave are exactly matched. He has also created a large flywheel by using the battery voltage to control the output voltage and you are not going to change the battery voltage easily as it resembles the rock of Gibraltar - it aint gonna budge ! Perhaps if HF PWM used this approach and we are prepared to have a poorer output mains regulation the inverters might be more robust.

If Poida can give me a version of the nano code (I prefer the butterworth filtered version for now) with just matched pairs of half waves I would be happy to become the test bed and run some experiments to determine the effectiveness of this theory. If we are heading in the right direction, then we can look at modifying code further to hopefully effect a decrease in the response time to a change in load.

Could I also ask that the equal cycles applies to the soft start and soft stop please? I know this is a bit pedantic but once the code is there its probably quite easy to implement it in this manner?

Lastly the method of AC feedback to the inverter controller probably varies quite a bit for all the home grown inverters out there. Some use active filters, some use p-p rectification, some use full wave rectification (2 diodes and centre tap) and how they all react to a component of asymmetric drive is a bit unpredictable. Mine uses a sample and hold updating each half cycle. Perhaps having a long time constant in the feedback loop masks the issue most of the time but if it has a response - even 1% to a 10millisecond event we might be heading for trouble?

I need to add - I have no use for a hairdryer...... but my wife does. Even a paint stripper heat gun can cause this effect. Perhaps some small imbalance in the integrated HF energy of each half cycle from software - ignoring VFB can be setting us up for issues with some loads?Edited by wiseguy 2019-05-29
If at first you dont succeed, I suggest you avoid sky diving....
Cheers Mike
 
Warpspeed
Guru

Joined: 09/08/2007
Location: Australia
Posts: 3261
Posted: 12:00am 28 May 2019
Copy link to clipboard 
Print this post

Mike,
Transformers are very interesting things. The magnetic core and flux swing within only know about the applied voltages, Faraday's law says nothing about current.

The flux swing in the core, and the voltages across both primary and secondary never change (in theory) between zero load and full load.

The really interesting thing about that, is if the transformer is driven from a constant voltage low impedance sine wave source (like the grid), you can load up the secondary so it runs zero load on one half cycle, and full load on the other half cycle, and the transformer will work just fine.

A half wave rectifier does exactly that, without any problems, but only if its driven from a very low impedance voltage source.

Where we can really get into trouble is if there is any resistance involved in the sine wave power source. If you then load up the secondary with an asymmetrical load, such as a half wave rectifier, the voltage across the primary will now be uneven on each half cycle. One half cycle will see a higher voltage than the other half cycle due to voltage drop from the source.

That causes the magnetic flux in the core to have unequal swings, because the drive voltage has become unequal. And that leads to staircase saturation after several or many cycles.

How bad the problem is, depends on the source impedance driving the transformer. Now there is always going to be some series impedance there, even if its only the resistance of the actual primary winding itself. But it starts to get really bad if the source impedance driving the transformer becomes "significant".

So the golden rule of driving transformers is to always keep the +ve and -ve half cycles the same amplitude, and if you are going to do any violent step voltage correction, do it at the zero crossing, and keep both halves of each cycle the same both before and after the step change.

Another way around this problem is to place a very large series coupling capacitor in series with the primary. That will make both halves of the cycle symmetrical by assuming a net dc charge. This is very often done with high frequency switching power supplies using a bridge to drive a high frequency transformer as one method to guard against staircase saturation. This method would be hopelessly impractical at 50 Hz.

As you have discovered yourself, grid powered transformers are fairly immune to half cycle loading problems, but inverter powered transformers can be driven into staircase saturation far more readily, sometimes with disastrous results.

That is why the infamous hair dryer test can be pretty lethal for some transformer inverters.




Cheers, Tony.
 
poida

Guru

Joined: 02/02/2017
Location: Australia
Posts: 750
Posted: 12:04am 28 May 2019
Copy link to clipboard 
Print this post

No worries,
here is the code, based on v5 nano1 version.

I only made one change at line 236:

if(uf == 1 && v1low == 1) // this will execute at 50Hz


The stability of the closed loop control is yet to be determined.
There is some wriggle room with the PID gain and damping settings.
But still..
2019-05-28_100414_v5-wg.zip

wronger than a phone book full of wrong phone numbers
 
wiseguy

Guru

Joined: 21/06/2018
Location: Australia
Posts: 470
Posted: 12:32am 28 May 2019
Copy link to clipboard 
Print this post

Thanks Poida I can only start to play on my 300VA inverter, the larger one is still waiting on parts (and a PCB to arrive very soon). I am considering driving a resistive load with half wave at the lower power level to see what happens.

Tony thanks for your response. I admit my sleep deprived mind probably distorted the message a bit. I did talk currents voltages etc but they are all relative to the driving method - Mains versus FET inverter. Further though, the dynamic feedback's ability, to change the gain/amplitude of the drive signal on a half cycle basis can easily lead to flux walking with a half wave load?

I also wish to restate that if the integrated energy of the HF PWM modulated 50Hz half waves are not equal we may already have a flux walking tendency issue that is exacerbated by a half wave load.

Poida can you please tell me, do you calculate a look up table and then use it twice in this implementation? If not what method is used to create each half wave ? I am not asking to criticise only to aid in my understanding of whats going on under the hood. In your opinion do you have a take on how equal each pair of drive signals are ? Can there be any distortion due to interrupts/timing glitches in the background that could add skew - not sure of that is the right word but causing uneven width to output timing pulses ?
If at first you dont succeed, I suggest you avoid sky diving....
Cheers Mike
 
poida

Guru

Joined: 02/02/2017
Location: Australia
Posts: 750
Posted: 01:28am 28 May 2019
Copy link to clipboard 
Print this post

  wiseguy said   Thanks Poida I can only start to play on my 300VA inverter, the larger one is still waiting on parts (and a PCB to arrive very soon). I am considering driving a resistive load with half wave at the lower power level to see what happens.

Tony thanks for your response. I admit my sleep deprived mind probably distorted the message a bit. I did talk currents voltages etc but they are all relative to the driving method - Mains versus FET inverter. Further though, the dynamic feedback's ability, to change the gain/amplitude of the drive signal on a half cycle basis can easily lead to flux walking with a half wave load?

I also wish to restate that if the integrated energy of the HF PWM modulated 50Hz half waves are not equal we may already have a flux walking tendency issue that is exacerbated by a half wave load.

Poida can you please tell me, do you calculate a look up table and then use it twice in this implementation? If not what method is used to create each half wave ? I am not asking to criticise only to aid in my understanding of whats going on under the hood. In your opinion do you have a take on how equal each pair of drive signals are ? Can there be any distortion due to interrupts/timing glitches in the background that could add skew - not sure of that is the right word but causing uneven width to output timing pulses ?


re. code changes
no worries, WG.

I will be looking at the nano1 code, using a particular type of PWM modulation
for both of the outputs (named V1 and V2) which go via a choke to the primary winding.
I just posted something to illustrate the different PWM modulation schemes

First, I suspect the nano1 code provides identical waveforms for both halves of the 50Hz output.
This is only when it is running under a steady state and no changes to the power output
are required.
But, the closed loop control continually alters the power output, plus or minus a little
to maintain close tracking of the setpoint. Certainly, there will be one half cycle recieving
a little more duty cycle % than the other. Duty cycle % is equivalent to power or current x time or whatever you like.
More % means more AC output voltage.
So at any one time, the half cycles will be unbalanced. But overall, both halves will be the same, as
the control loop converges to a stable situation.
IF it does not converge to an (somewhat) even energy situation, we would all have known about it by now! The Primary circuit has a resistance and this will dissipate some DC offset, how much? Ah, that is a question.

The small changes of +/- a bit for either half wave are a given in this work.
It would be a mistake to think the street supply is perfectly even from a cycle by cycle basis or over a longer time scale
of many cycles. It is not perfect. But over a long enough time scale it's even.
As are our inverters.

I was happy to modify the nano1 code to update only at the start of a 50Hz cycle since I think it will be
educational.

The nano1 code uses a lookup table, to save time from calulating the sine function.
The table is an array, named "l" (lower case L) and has 201 entries, of which 200 are used.
The PWM frequency is 20 kHz and I use each of the 200 entries in the array to determine duty cycle % for each half wave. 200 x (1/20kHz) = the period of 100Hz

I output the 20 kHz square wave, with changing duty cycle ON % periods out of Pin 9, holding Pin 10 to ground
for one half of the wave and then I use the same table, to produce the changing duty cycle % periods
to appear on pin 10 and holding Pin 9 to ground.

The indexing of the array is done via an interrupt that will never be delayed beyond about 8uS.
The delay source is the mains sync code, which also runs from an interrupt
and executes once only at the start of the 50 Hz wave.
The AtMega328 does not allow interrupt priority. First come first served is the way.
So the mains sync code can and does interrupt the PWM code.

In practice, I have seen zero evidence visible on the DSO looking at disturbances in the AC output,
when I enable or disable the mains sync interrupt. The 8uS delay just does not alter things.

The mains sync interrupt occurs at zero crossing, when the PWM duty cycle is going to be very small,
maybe 10 clock counts wide. Since the 20 kHz PWM square wave is 800 clocks, this means at zero crossing,
the PWM output is going to be low for 790 of these 800 clocks and high for the 10.
Clock rate is 16 Mhz, the mains sync interrupt is only 128 clocks.
So at zero crossing, there is time spare to do something else other than service the 20 kHz PWM interrupt.
There is time for mains sync to do it's job and it alters nothing apart from delaying, by a nearly fixed amount of time, the
first PWM pulse after zero crossing. The subsequent 199 PWM pulses are not delayed.

I disable the Arduino system timer, since I do not need it and can get completely determinable execution timing and event ordering without it.

The indexing throught the 200 item lookup table always completes, and always completes "on time", at the correct time.
There are never any skipped outputs, when running with mains sync disabled.

The mains sync code profoundly alters the running of the PWM code. The PWM runs through the 200 entry list from a variable clock that has the speed controlled by the mains sync. This results in one or more of the final entries in the lookup
table being skipped when commanded to speed up the output frequency a lot.
When the mains sync is stable and locked ON, the PWM output alternates to some degree by maybe adding a 20kHz pause of no pulse or skipping a PWM pulse.
No flux walking occurs, because again, this effect is symmetrical about the 2 half waves over reasonable periods of time.
Edited by poida 2019-05-29
wronger than a phone book full of wrong phone numbers
 
wiseguy

Guru

Joined: 21/06/2018
Location: Australia
Posts: 470
Posted: 01:34am 28 May 2019
Copy link to clipboard 
Print this post

In an attempt to get a handle of the change caused by a 10A (2.4KW) asymmetrical load (halfwave).

Lets look at a scenario. With some back of the envelope calcs and guesses.

Source impedance of battery 400u OHm

Resistance of 2 leads from battery to inverter 2 x 400uOhm.

Resistance of choke and transformer primary 1milliohm.

Resistance of internal wiring circuit breakers and PCB tracks 1 milliohm.

Resistance of 4 x 3.0mohm FETs = 2 x 0.8 milliohm.(4 fets + 4 fets between transformer /choke & battery)

Secondary resistance effect 10A x 0.25 ohm = 2.5V

Primary losses effect 4.8 milliohms @ 50A = 240mV with a 1:5 step up ~ 1.2V

If we add that to the secondary effect = 3.7V error every half loaded cycle ?

I know these are not true measurements but I believe it would be well in the ballpark.
If at first you dont succeed, I suggest you avoid sky diving....
Cheers Mike
 
Warpspeed
Guru

Joined: 09/08/2007
Location: Australia
Posts: 3261
Posted: 01:38am 28 May 2019
Copy link to clipboard 
Print this post

Mike, Driving methods and correction methods definitely need to be thought through.

[quote] Further though, the dynamic feedback's ability, to change the gain/amplitude of the drive signal on a half cycle basis can easily lead to flux walking with a half wave load?[/quote]

I could imagine a situation where you measured the output voltage over one half cycle, and used that to correct the half cycle immediately following, in an attempt to get the fastest possible response.
The situation might arise where say the positive half cycles begin to grow in amplitude, while the negative half cycles begin to diminish in amplitude in an unstable way.
That would definitely present a problem for the transformer.

The only safe way to correct is to totally step correct once every full cycle, so both cycle halves always remain identical. Or else do it very gradually over many cycles , as with a normal slowly correcting PID.

Deriving a reliable feedback voltage is not that simple. A spot sample can be thrown into chaos by a single noise spike, or by output waveform phase changes due to reactive or non linear loads. The safest way is to rectify the ac, then low pass filter the resulting ripple voltage, as just about everyone now does.

That is not only going to be very slow to respond, it can lead to instability problems unless the PID gain and integral are both throttled right back.

My own belief is that feedforward is much better in many ways than than feedback. Measure the incoming dc voltage and correct instantly and totally for any changes, but do it no more frequently than once every full inverter cycle. Line correction will be excellent always full complete correction within 20mS, but load correction will not be perfect.

Load correction could be improved with a very slow voltage feedback integral correction that only needs to raise the output a very few volts for continuous heavy loading. All the fast dynamics would be handled by the input voltage feed forward correction, which is both extremely fast acting and can never become unstable.
Edited by Warpspeed 2019-05-29
Cheers, Tony.
 
wiseguy

Guru

Joined: 21/06/2018
Location: Australia
Posts: 470
Posted: 01:39am 28 May 2019
Copy link to clipboard 
Print this post

Thanks Poida that gives me enough information to be quiet for a few days while I read understand and experiment a bit. A very well written description ! I vote we should double your salary !! (and mine lol)

I just noticed a possible fundamental error in my scenario - I am unsure in a heat gun or hair dryer whether the element is half waved or just the motor ? So the 3.7V imbalance could be much less in reality.

Thanks for your thoughts too Tony I concur. For a small asymmetric drive error I suspect that the transformer flux reaches towards saturation on one end and when the losses of the slight unidirectional saturation equal the error of the drive asymmetry it doesn't go into saturation further just runs near that point?

Maybe we need to insert a hall effect sensor in the primary magnetic path for some real time measurement of what the bH curve is up to (would that work?) It might also indicate there is no real issue until we drive half wave loads.Edited by wiseguy 2019-05-29
If at first you dont succeed, I suggest you avoid sky diving....
Cheers Mike
 
     Page 1 of 6    
Print this page
© JAQ Software 2020