Simulating a buck-boost converter in LTspice

Thread Starter

vooper

Joined Dec 2, 2016
23
Hello

I've recently installed LTspice in order to try and simulate a simple buck-boost converter. From this simulation, I wanted to see the chaos properties that could be seen when changing around some parameters in the circuit i.e. the threshold current, resistor value and so on.
I want to simulate a buck-boost converter where the switch is either on or off depending on the current that flows through the coil and the clock frequency for the switch. In this instance, when the current flowing through the coil reaches 4A, the switch opens, and when the current through the coil reaches 0 or an increment of time = nT (n being an integer and T being 20μs or anything that would be viable) the switch closes.
However, I seem to be having some trouble figuring out exactly what to put where in order to realize these parameters and simulation. I've tried looking through multiple sites and books, but really only found tutorials on voltage controlled switches.
When trying to simulate the circuit, I get the error 'Multiple instances of "W1"'.
Thanks to anyone who may seem to be able to help.
 

Attachments

crutschow

Joined Mar 14, 2008
34,420
Post your .asc file.

Note that you're not going to get much current through the inductor with the 100 megohm resistor, R2, in series. :rolleyes:
 

crutschow

Joined Mar 14, 2008
34,420
Oh...I assumed from looking at a tutorial that I needed to put in some sort of either very large or very small resistor for the current's reference point.
Well I assume you want more than 60nA through the inductor, which is all the 6V can drive through the 100 megohm.
Currents don't have a reference point, only voltages have that.
 

Thread Starter

vooper

Joined Dec 2, 2016
23
Right....I want the current through the inductor to go up to the threshold current at most, and 0 at least.
So then I got rid of the resistor that's in series with the inductor completely and now the circuit looks like this.
 

Attachments

crutschow

Joined Mar 14, 2008
34,420
I also had a problem with the current switch (perhaps just an error in the syntax) so I changed to the voltage controlled switch, as shown below and sensed the voltage across the 1 milliohm shunt resistor (1mV = 1A).
I also changed the output capacitor and load resistor values so it settles to a low-ripple DC output voltage.

upload_2016-12-2_1-17-52.png
 

Attachments

Thread Starter

vooper

Joined Dec 2, 2016
23
Thank you very much
I suppose there's some sort of problem when using the csw function.

Some extra questions though, if you don't mind.
Is there a way to force the switch to change on and off states depending on a specific clock frequency in LTspice? (I want to try and recreate a chaos result for the current through the inductor)
What is that diode that you have in your fixed version? I'm not really aware of the many functions in ltspice.
 

crutschow

Joined Mar 14, 2008
34,420
Is there a way to force the switch to change on and off states depending on a specific clock frequency in LTspice? (I want to try and recreate a chaos result for the current through the inductor)
What is that diode that you have in your fixed version? I'm not really aware of the many functions in ltspice.
You could put a voltage source in series with the switch control pins and generate a pulse clock to override the signal from R2 (below).

If you right-click on the diode and then click on "Pick New.." a list of available diode models will show and you can select an appropriate one. You can do that for all the devices in your circuit.
You generally shouldn't use the default devices, since their behavior is sometimes unexpected.

I suggest you read one of the LTspice tutorials available from Linear Technology or one of the LTspice websites to better acquaint yourself with its features.

upload_2016-12-2_8-45-23.png
 

Thread Starter

vooper

Joined Dec 2, 2016
23
Thanks a lot guys!

I'll try and play around with the added voltage source to the switch to try and yield the results I was hoping for.

I've been playing with LTspice to work out how a CSW is used (the 'Help' is somewhat deficient). Here's a simple example :
So I should add a second voltage source in parallel with the CSW in order to control it?
 

Alec_t

Joined Sep 17, 2013
14,313
So I should add a second voltage source in parallel with the CSW in order to control it?
I can't get that to work. In series doesn't work either.
You would expect a current-controlled switch to be controllable by the current through any designated component but no, Spice insists on the controller being a Voltage source. Go figure.
 

eetech00

Joined Jun 8, 2013
3,946
I can't get that to work. In series doesn't work either.
You would expect a current-controlled switch to be controllable by the current through any designated component but no, Spice insists on the controller being a Voltage source. Go figure.
Hi

Looks like its working to me.
Just to make it easy to analyze, I changed R1 to match R2 and set Ih=0.

Switch W1 does not turn on and allow current to flow until 2ma is flowing thru Vx. When it turns on, the current flowing thru the W1 branch is then V(a)/(R1+ron).
 

Alec_t

Joined Sep 17, 2013
14,313
Looks like its working to me.
Perhaps we're not talking about the same "it". Agreed, the sim in post #10 works ok. But what was being discussed was instead putting Vx in parallel or in series with W1. Putting it in parallel means that unless Vx has near infinite resistance W1 is effectively bypassed. Putting it in series means that W1 will never switch on.
 

eetech00

Joined Jun 8, 2013
3,946
Hi

Well...for what its worth...I was able to get this working with a CSW.

I adjusted IT and IH for the OPs desired I(L1) range, added some serial resistance to L1, and initialized I(L1) to 0.
I didn't try to reduce ripple or anything like that...just trying to get it to work with CSW.

buckboost.png
 
Top