Capacitive discharge

This is the place for any magazine-related discussions that don't fit in any of the column discussion boards below.
camino75080
Posts: 35
Joined: Mon Aug 02, 2004 1:01 am
Location: Richardson, Tx
Contact:

Re: Capacitive discharge

Post by camino75080 »

Oh man, you guys are a great help. Now i just need to figure out how to model a custom transformer in spice, any ideas :confused: ? But, thanks so much for the cap formulas.
User avatar
MrAl
Posts: 3862
Joined: Fri Jan 11, 2002 1:01 am
Location: NewJersey
Contact:

Re: Capacitive discharge

Post by MrAl »

Hi again,<p>The transformer is like a voltage controlled
voltage source AND a current controlled current
source so one way to model it is to use just
that: two dependent sources.
The voltage controlled voltage source gets it's
input from the two input terminals of the
transformer, and the current controlled current
source gets it's input from the current through
a constant voltage source in series with the
output. You can easily add resistors for input
and output winding resistance too.<p>For example:<p>-------------------------------------------------
.SUBCKT Transformer01 1 2 3 4 Params: ratio=3<p>E1 5 4 1 2 {ratio}
VM1 5 3
F2 1 2 VM1 {ratio}<p>.ENDS Transformer01
-------------------------------------------------<p>In the above 'ratio' is the turns ratio primary
to secondary (change as needed), and shown
above is a turns ratio of three.
Also, pins 1 and 2 are the primary, and pins
3 and 4 are the secondary.
If you need more secondaries you can follow the
same general idea.<p>Note that this thing works with dc too, which
could be an advantage or disadvantage, depending
on what you are doing. Another way is to simply
use mutual inductances.<p>
Take care,
Al
LEDs vs Bulbs, LEDs are winning.
camino75080
Posts: 35
Joined: Mon Aug 02, 2004 1:01 am
Location: Richardson, Tx
Contact:

Re: Capacitive discharge

Post by camino75080 »

Thanks Al, my transformer, has a center-tapped primary, a base feedback winding, and center-tapped secondary. And I have no idae how to model it, I have tried to use several transformers and set the turns ratio as needed, but the ratios are shared and I can't figure out how to make them unique. Please help me more.
User avatar
MrAl
Posts: 3862
Joined: Fri Jan 11, 2002 1:01 am
Location: NewJersey
Contact:

Re: Capacitive discharge

Post by MrAl »

Hi there,<p>Here's an idea how to go about creating
any kind you need:<p>
http://mral.peu.net/data/ExperimentalCi ... -CT-01.gif<p>Note that the secondary is shown with a load
resistor.
Also note that any additional winding is added
by simply adding another 'transformer' with
it's primary across the main primary winding,
and this includes the second 'primary' winding
used for a center tapped primary except for
the 'other' primary there is of course a 1:1
turns ratio only.<p>For example, to create a secondary with a center
tap (in addition to that center tapped primary
shown in the drawing) you would add another
subcircuit transformer whos 'primary' was connected
in parallel with the main primary (terminals 1&2)
just like the 'transformer03' shown, and the
secondary of the added subcircuit would connect
to the secondary that's already there such that
the top lead connects to the bottom of the
one that's already there.<p>To put this another way:<p>To add another secondary (center tapped or not)
first add another subcircuit transformer with
the primary leads 1 and 2 connected to the
existing transformer (shown) leads 1 and 2
and make the
value inside the brackets {} both the turns
ratio. The secondary of the subcircuit then
becomes the secondary winding you sought to
add on to the existing transformer.<p>For another example, to create your 'base'
winding you would simply add another subcircuit
with leads 1 and 2 also connected to all the
other 1 and 2 leads and then use the secondary
of the subcircuit as the required secondary after
changing the value inside the brackets {}
to the ratio needed.<p>Remember to change both values inside the
two sets of brackets to the same value for
any subcircuit.<p>It just so happens that the second winding of
the center tapped primary winding is just a 1:1 ratio
so that's why it has to be set to 1.<p>
If this isnt clear, let me know...<p>Take care,
Al<p>[ September 21, 2004: Message edited by: MrAl ]</p>
LEDs vs Bulbs, LEDs are winning.
camino75080
Posts: 35
Joined: Mon Aug 02, 2004 1:01 am
Location: Richardson, Tx
Contact:

Re: Capacitive discharge

Post by camino75080 »

Thanks so much for all the help Mr.Al. I think that I understand, so i will try it and see what happens. I'll keep you posted.
camino75080
Posts: 35
Joined: Mon Aug 02, 2004 1:01 am
Location: Richardson, Tx
Contact:

Re: Capacitive discharge

Post by camino75080 »

ikay, I tried the method with mutal inductors, which worked, but with limited success. The simulation would run for about 120ns and say "convegence problems at node (x)". Not knowing what that means, I rearranged the circut w/o saving and couldn't duplicate my results. So, where do I enter the code, I guess thats what it is, for the modle you sent me a daigram for?
User avatar
MrAl
Posts: 3862
Joined: Fri Jan 11, 2002 1:01 am
Location: NewJersey
Contact:

Re: Capacitive discharge

Post by MrAl »

Hi again,<p>You'll have to find how your spice environment
accepts subcircuit definitions. You can then
enter the text (copy and paste) right into
the text area. All you have to do is
whenever you add another sub transformer call
it a different name, like trans1, trans2, etc.<p>For the program i use mostly there is a button
in one of the windows that's something like
"new part wizard".
Clicking that brings you through a bunch of dialogs
that asks you about the part you're entering,
like what file it's in (you can put the code
in a file for that particular method) and what
the part looks like on the schematic (from a
choice of a whole bunch of part drawings).<p>For this particular part (sub transformer) i
already had something that looked like a
transformer that was a subcircuit
(it was a general purpose function source that
i could change per design real quick) so what
i did was call up the part and simply erase
all the text and enter new text discribing the
sub transformer. All i had to do then is
arrange the transformers to create a ct primary,
secondary, ct secondary, etc.
I guess you already realized that doing it this
way is very versitile, because all you have to
do is add another sub circuit transformer when
you want to add another winding -- it's fast.
Primaries are done the same way, except for the
very first primary (i call the 'main' primary
which is always pins 1 and 2).<p>What program are you using for this?<p>Yes, the mutual inductance models are sometimes
hard to get to converge.<p>
Take care,
Al
LEDs vs Bulbs, LEDs are winning.
camino75080
Posts: 35
Joined: Mon Aug 02, 2004 1:01 am
Location: Richardson, Tx
Contact:

Re: Capacitive discharge

Post by camino75080 »

Thanks Mr.Al, I'm using "B2 Spice A/D v4.2 Lite" becuase, it's free, but missing some parts :( . Hers what my code looks like:
************************
* B2 Spice Subcircuit
************************
* Pin # Pin Name
* 4 P2
* 5 P1
* 2 S1
* 1 S2
.Subckt Transformer 4 5 2 1 <p>***** subcircuit definitions<p>
***** main circuit
A0 1 2 3 2 secondary_lcouple
A 4 5 6 5 primary_lcouple
A1 6 3 core<p>.model primary_lcouple lcouple num_turns = 155 <p>.model core core area = .01 length = .01 H_array = [-1000 -500 -375 -250 -188 -125 -63 0 63 125 188 250 375 500 1000] B_array = [-3.13e-3 -2.63e-3 -2.33e-3 -1.93e-3 -1.5e-3 -6.25e-4 -2.5e-4 0 2.5e-4 6.25e-4 1.5e-3 1.93e-3 2.33e-3 2.63e-3 3.13e-3] <p>.model secondary_lcouple lcouple num_turns = 310 <p>.ends<p>Confuses me!<p>[ September 25, 2004: Message edited by: camino75080 ]</p>
camino75080
Posts: 35
Joined: Mon Aug 02, 2004 1:01 am
Location: Richardson, Tx
Contact:

Re: Capacitive discharge

Post by camino75080 »

I got it!!!!!!!!!!!!!
camino75080
Posts: 35
Joined: Mon Aug 02, 2004 1:01 am
Location: Richardson, Tx
Contact:

Re: Capacitive discharge

Post by camino75080 »

No, I don't. When i simulate an inverter that should produce in the range of about 220V, I get a few volts over the source.
User avatar
MrAl
Posts: 3862
Joined: Fri Jan 11, 2002 1:01 am
Location: NewJersey
Contact:

Re: Capacitive discharge

Post by MrAl »

Hi there,<p>I guess you're still having problems, so here's
a new procedure for setting up your transformer,
whatever windings it has.<p>In this procedure, we create a single subcircuit
that contains the entire transformer. This is
done by starting with the original subcircuit
of the transformer and adding more transformers
all within the same subcircuit.<p>
Say we want a center tapped primary transformer
with a turns ratio of 2...<p>
Start out with the model for a single transformer with
one primary and one secondary and with ratio
equal to 2:<p>SUBCKT Transformer 1 2 3 4
* 1,2 primary
* 3,4 secondary<p>E1 5 4 1 2 {2}
VM1 5 3
F1 1 2 VM1 {2}<p>.ENDS Transformer<p>Note all the sources are number 1, such as
E1, F1, VM1, and that 'VM1' occurs twice.<p>Now we know we need another identical transformer for the
primary except the turns ratio has to be 1 so we copy the
three lines that makes the actual spice code,
so we end up with this:<p>
SUBCKT Transformer 1 2 3 4
* 1,2 primary
* 3,4 secondary<p>E1 5 4 1 2 {2}
VM1 5 3
F1 1 2 VM1 {2}<p>E1 5 4 1 2 {1}
VM1 5 3
F1 1 2 VM1 {1}<p>.ENDS Transformer<p>Note all we did was copy and paste the three lines and change
'ratio' (inside brackets) to a 1 for the other primary winding.<p>Since we cant use the same source like that twice, next all
we have to do is renumber the sources by the next increment,
so we end up with this:<p>SUBCKT Transformer 1 2 3 4
* 1,2 primary
* 3,4 secondary<p>E1 5 4 1 2 {2}
VM1 5 3
F1 1 2 VM1 {2}<p>E2 5 4 1 2 {1}
VM2 5 3
F2 1 2 VM2 {1}<p>.ENDS Transformer<p>Note all we did was change the source numbering in the
second transformer lines, and didnt change anything else
yet.<p>Next, we renumber all the nodes associated with the second
transformer so that they arent the same as the first
transformer (otherwise the two are connected in parallel,
which wouldnt work for what we want). To do this, all
we have to do is simply prefix each node with the number 1
so that each node becomes the old node plus 10. Doing this
we end up with this:<p>SUBCKT Transformer 1 2 3 4
* 1,2 primary
* 3,4 secondary<p>E1 5 4 1 2 {2}
VM1 5 3
F1 1 2 VM1 {2}<p>E2 15 14 11 12 {1}
VM2 15 13
F2 11 12 VM2 {1}<p>.ENDS Transformer<p>Note all we did here was take each number in the second
transformer only and place the number 1 just ahead of it,
so that each node became the old node plus 10....thus
1 becomes 11, 2 becomes 12, etc.<p>Now we've succeeded in creating two totally independent
transformers within the same subcircuit, but now we need
to 'hook them up'.<p>Looking at the drawing in the link i provided earlier,
we can see that to get the second primary we need to connect
the two transformers together in the right manner.
Since all the 1 and 2 terminals connect together we first
will do that, then we'll connect pin 3 of the second trans
to pin 2 of the first to create the center tap, then finally
we'll add pin 4 of the second trans to the list in the
subcircuit definition to make up the second winding of
the center tapped primary (large number 3 in the drawing).<p>Ok, first we connect the two primaries. Since the second
transformer primary is 11 and 12, we change everything in
those three lines that is 11 or 12 to 1 or 2 respectively,
replacing 11 with 1 and 12 with 2. This gives us:<p>SUBCKT Transformer 1 2 3 4
* 1,2 primary
* 3,4 secondary<p>E1 5 4 1 2 {2}
VM1 5 3
F1 1 2 VM1 {2}<p>E2 15 14 1 2 {1}
VM2 15 13
F2 1 2 VM2 {1}<p>.ENDS Transformer<p>This was pretty simple too, cause all we had to do was
delete the '1' before each number. Note however that
EVERY occurance of 11 and 12 had to be changed to 1 or 2
but only in the second set of three lines that makes up
the second transformer.<p>Next we need to connect pin 3 of the second trans to the
pin 2 of the first (or now the second also). This is
pretty easy too, all we do is change the number 13 to
the number 2, and we end up with this:<p>SUBCKT Transformer 1 2 3 4
* 1,2 primary
* 3,4 secondary<p>E1 5 4 1 2 {2}
VM1 5 3
F1 1 2 VM1 {2}<p>E2 15 14 1 2 {1}
VM2 15 2
F2 1 2 VM2 {1}<p>.ENDS Transformer<p>Note we only changed one number...the number that represented
pin 3 of the second transformer.<p>Next we just need to bring out the terminal of
the second winding and this is done by simply adding
the number to the list in the subcircuit def, and
that last terminal is 14 which is 4 on the second trans,
so we end up with this:<p>SUBCKT Transformer 1 2 3 4 14
* 1,2,14 primary
* 3,4 secondary<p>E1 5 4 1 2 {2}
VM1 5 3
F1 1 2 VM1 {2}<p>E2 15 14 1 2 {1}
VM2 15 2
F2 1 2 VM2 {1}<p>.ENDS Transformer<p>Note the '14' was added to the text explanation of
the subcircuit too for future reference so we know
1,2, and 14 make up the primary center tapped winding.<p>That's all there is to it!<p>To add another transformer winding say with ratio 5, add<p>E3 25 24 21 22 {5}
VM3 25 23
F3 21 22 VM3 {5}<p>You can even use the same number as for the sources like this:<p>E3 35 34 31 32 {5}
VM3 35 33
F3 31 32 VM3 {5}<p>(Remember to change the second occurance of VM1 to VMx too)<p>
Here's an outline of the procedure of adding a winding:<p>Copy and paste the three lines from the original subcircuit.
Change the ratio to whatever is needed for the new winding.
Change ALL sources to next incremental number.
Prefix each node with a new number also, which can be same as incremental number.
Connect primaries x1 and x2 to existing 1 and 2 by changing all x1 and x2
to 1 and 2 respectively.
Connect one lead of secondary for CT output and add one pin to def,
or add both pins to def for non CT output.
Add new pins to text explanation in def.<p>
This kind of model is very well behaved in
spice environments.<p>To make the process a little more error free,
you may wish to draw up the entire transformer
you need first, using four terminal transformers
similar to the drawing i provided. You can then
number each transformer lead 1,2,3,4, and just
under it the numbers it will have once changed,
like 21,22,23,24. This should make it easier
to construct the whole thing.<p>Hope this helps this time :-)<p>Take care,
Al<p>[ October 01, 2004: Message edited by: MrAl ]</p>
LEDs vs Bulbs, LEDs are winning.
Post Reply

Who is online

Users browsing this forum: No registered users and 93 guests