TL431/Opto simulation for a SMPS

Thread Starter

Elerion

Joined Sep 11, 2017
125
I'm simulating in LTSpice a typical type II compensator for my first SMPS.
I get the pole, zero and gain where I want, but I'm having lots of trouble with some resistor values.
If I use a 20k pullup resistor for the opto collector, it works perfect. If I increase or decrease the value, it stops working (AC and DC).
Also, changing the base to ground resistor is troublesome. 2.2 Meg works, but most other values, even close to it, don't.
The bias resistor sets 1 mA for the TL431, and the photodiode bias resistor is low enough to make phototransistor fully saturate.

Could anyone help me understand what is happening / how to proceed ?

I attached a test circuit, and two different TL431 models.

Thank you!
 

Attachments

crutschow

Joined Mar 14, 2008
34,280
It appears to work okay with my TL431a model (attached).

Why do you have a resistor from the transistor base to ground on U1? Its main effect is to reduce the transfer gain of the opto.
Just leave that connection open.

upload_2018-11-30_14-14-29.png
 

Attachments

Thread Starter

Elerion

Joined Sep 11, 2017
125
Yes, your model works,... thanks.
I tried two different models, just to make sure that the problem was not the model, but apparently, two were not enough :)

Why do you have a resistor from the transistor base to ground on U1?
With my TL431 models, it didn't seem to work without the resistor. With the TL431 model you use, it is not needed. I really don't get why my models didn't work. In some situation they do. Apparently they are good ones (seemed to be used by other people. I downloaded one of them from texas instruments site).
 

Bordodynov

Joined May 20, 2015
3,177
I had a similar situation with an advanced model of this reference voltage source TL431ED (on transistors). I understood what was going on: it could not be included. I added breakdown voltage Base-Emitter and it began to turn on. I also changed the scheme a bit.
And further. I have a slightly different symbol in my collection, so don't be surprised.
Opto_AB.png
 

Attachments

Thread Starter

Elerion

Joined Sep 11, 2017
125
I added the rest of a simple Flyback converter, using average models.
I compensated for some phase margin, but I have the sensation that I'm doing something (or many things) wrong.
The transient tends to show some low amplitude oscilations. Sometimes I manage to eliminate them, but the circuit is very sensible to small changes in some componets values, like some resistors, the opamp, the duty cycle multiplier (B1), or the transformer turns ratio. Also, changes in load make the circuit stop working, instead of just regulating the output in a time according to the loop bandwith, and so on,...
It just feels buggy.

I used a unity gain opamp to connect the opto output to the average model, because most PWM controllers have an opamp at FB/COMP inputs, or equivalent.

After lot of time playing around, I'm not able to keep going.
How to simulate these kind of circuits? Any tip is very much appreciated.
 

Attachments

ian field

Joined Oct 27, 2012
6,536
I'm simulating in LTSpice a typical type II compensator for my first SMPS.
I get the pole, zero and gain where I want, but I'm having lots of trouble with some resistor values.
If I use a 20k pullup resistor for the opto collector, it works perfect. If I increase or decrease the value, it stops working (AC and DC).
Also, changing the base to ground resistor is troublesome. 2.2 Meg works, but most other values, even close to it, don't.
The bias resistor sets 1 mA for the TL431, and the photodiode bias resistor is low enough to make phototransistor fully saturate.

Could anyone help me understand what is happening / how to proceed ?

I attached a test circuit, and two different TL431 models.

Thank you!
AFAICR: the TL431 input resistance is 100k - for a 5V regulator; one of the setting resistors will usually be close to 4k7.

sometimes its worth remembering that the 431 is a comparator with internal 2.5V reference. Its almost snap action on the threshold voltage when operated open loop - in a complete system, there's a completed loop of negative feedback. The 431 is quite happy working in linear mode.

If you do it right - the 431 can make a wicked electret mic booster amp.
 

Bordodynov

Joined May 20, 2015
3,177
In the flyback.asc scheme there was a tran-analysis.
To determine the stability of the circuit, there is no need to change the circuit for signal injection. It is enough to apply the current source to any point of the circuit, and then get the resistance at this point.
Flayback_AB.png
 

Thread Starter

Elerion

Joined Sep 11, 2017
125
t is enough to apply the current source to any point of the circuit, and then get the resistance at this point.
I didn't know about it. Haven't seen it before.

Anyway, there're still problems with my simulation, because trans and ac fail quite easily, with minor component changes, and I'm almost sure that in real world they won't cause the circuit to fail. It seems a simulation problem under certain circustances (not obvious).

I've been looking into average model simulation of SMPS, and it seems to me like a very complex matter. Tried Basso PWM model and Copec average models, which are, on paper, very powerful, but I just can't make them work on a new design from scratch, if not expending a lot of time tweeking the values (most of the time, not making any sense) until LTSpice doesn't complain.

I'm curious,... I suppose there're many people in this forum building power supplies.
Do you simulate them? How do you usually do it?
 

Thread Starter

Elerion

Joined Sep 11, 2017
125
I tried the different solvers and some advanced parameters, without success.
I tried the demo version of InSpice, and all models I tried seemed to work perfect. But I find InSpice hard to learn/use, or at least, to have a step learning curve.
I'll ask in the LTSpice group. Thank you.
 

eetech00

Joined Jun 8, 2013
3,856
I'm simulating in LTSpice a typical type II compensator for my first SMPS.
I get the pole, zero and gain where I want, but I'm having lots of trouble with some resistor values.
If I use a 20k pullup resistor for the opto collector, it works perfect. If I increase or decrease the value, it stops working (AC and DC).
Also, changing the base to ground resistor is troublesome. 2.2 Meg works, but most other values, even close to it, don't.
The bias resistor sets 1 mA for the TL431, and the photodiode bias resistor is low enough to make phototransistor fully saturate.

Could anyone help me understand what is happening / how to proceed ?

I attached a test circuit, and two different TL431 models.

Thank you!
Hi

I ran the sims with stepping and no stepping using each of the TL431 models.
They both completed and didn't "stop" or "hang".

The TI model has errors and needs to be converted for LTSpice. Don't use.
The TL431ED model looks OK.

A couple of suggestions for trans sim:
Set a small amount of series resistance for each voltage source (all voltage sources have some resistance).
Set IC=I(L1)=0 for inductor so it starts at 0 current
Use "startup" in trans statement so power supply ramps up.

eT
 

Thread Starter

Elerion

Joined Sep 11, 2017
125
What scheme are you talking about? If about the one that the first post, then I had no problems.
No, I meant the one in post #6.

The TL431ED model looks OK.
That one didn't work in the scheme attached to post #1. But the model recomended by crutschow worked, everything else untouched.

A couple of suggestions for trans sim:
Set a small amount of series resistance for each voltage source (all voltage sources have some resistance).
Now, this tip was very valuable! I managed to work in those situation where the simulation was failing, or the circuit was showing an abnormal (and not justified) behaviour. So far, it has solved all the problems I had. I keep on experimenting.
 

ebp

Joined Feb 8, 2018
2,332
I've designed a lot of switchers. I hate them with a passion. They are miserable, nasty things in terms of behavior, layout is often extremely critical, noise can masquerade as loop stability issues, they are hard to probe with real instruments, components detonate when things go wrong, EMI/RFI compliance can be a major pain, ... well, I hate them. I fully intend to die without ever doing another mains-powered switcher. There are some nice, easy-to-use low voltage integrated switcher ICs around. If you follow the manufacturers recommendations, they generally "just work."

I never used simulation because the sim packages available when I was doing switcher design were many thousands of dollars. Fabulous free packages like LTspice didn't exist. You could do a few useful things with the evaluation version of PSPICE.

One thing to be aware of in flyback converters is that if the inductor current becomes continuous (in this case meaning that the current in the output winding has not dropped to zero by the time the input side switch has turned on again - both input and output current are chopped and always go to zero, so continuous vs. discontinuous has to be viewed a little differently) a right half plane zero appears in the transfer function. There is no means of compensating a RHP, so you have to work around it with low bandwidth. This is also true of boost converters.

The 4N25 is a dismal optocoupler and hasn't been a reasonable choice for new design of any sort since well back in the last millennium. It's OK if you need a 6 pin thumbtack. ON Semi and Vishay and probably others have products much better suited for switchers. They have higher current transfer ratio (CTR), which can make them easier to drive and more importantly they have much better defined CTR, where min and max are not miles apart. This helps keep the noughts and crosses in the feedback circuit within a couple of octaves of where they should be. Versions with no connection to the base of the output transistor make them much less susceptible to noise pickup. (With a 4N25 and many other optocouplers, the primary reason for using a base-emitter resistor is to reduce fall time. This does come with the penalty of decreased CTR)

Many useful things in switcher design have been published by Unitrode, which was acquired by Texas Instruments. Some of the material is dated by virtue of new controller IC designs, but much of it is still applicable and still available on the TI website. It might also be worth having a look at Power Integrations ap notes. PI makes integrated high-voltage switcher ICs, most of which are most applicable to flyback converters. Their parts are weird because the control input does double duty as the input for the power for the IC itself. ON Semi and ST Micro also make integrated flyback ICs and should have some ap notes worth a look.
 

eetech00

Joined Jun 8, 2013
3,856
No, I meant the one in post #6.
That one didn't work in the scheme attached to post #1. But the model recomended by crutschow worked, everything else untouched
Hi

I just tested the schematic from post #1 (again) using the TL431ED and TL431a.
The TL431ED symbol was missing the "X" in the prefix attribute. I added the "X".
Once I added the "X", the trans and AC simulation results for both models were practically identical.

So I'm not sure what you mean by "that one didn't work".

eT
 

Bordodynov

Joined May 20, 2015
3,177
eetech.
Problem with TL431ED in AC, OP and DC analyzes. There was no entry into the regime. I fixed the model: added Base-Emitter breakdown voltage and added the Tr parameter (there are cranks who try to use this chip in key mode). There is no problem with an improved model. You can experience this model, see # 5. I will try to contact the author of the model.
 

Thread Starter

Elerion

Joined Sep 11, 2017
125
The TL431ED symbol was missing the "X" in the prefix attribute.
??
The X prefix is not missing in my schematic.
I just downloaded everything from post #1, open it, not making any modification, and it isn't missing either. Check the screen capture.
I don't know what's happening,...

I don't get the same behaviour from TL431a, which always works fine, while the ED doesn't.
See screen captures ED.png and a.png (I just disconnected the base resistor from the opto, but leaving it doesn't really change things).
 

Attachments

Top