spice: ideal transformer

Hello,

I've google/google groups'ed a bit but anyhow I cannot make an *ideal* transformer to work. The file

-- ideal transformator

.control ac dec 20 1k 1g plot vdb(3) .endc

.subckt transformer 1 2 3 4 vsense 1 2 dc 0 e1 1 2 3 4 1 f1 3 4 vsense -1 .ends

v1 1 0 dc 0 ac 1 r1 1 2 10 X1 2 0 3 0 transformer r2 3 0 1k

.end

--

makes Macspice hang... Please note that for my purpose I cannot use \'K\' 
coupled inductors. DC behaviour of the ideal transformer is of no interest.

Cheers,
Michael
Reply to
Michael Zedler
Loading thread data ...

On Mar 23, 10:41 am, Michael Zedler wrote: ...

...

OK, let's look just at the transformer. You have a short circuit (a DC voltage source set to zero volts) across nodes 1 and 2. And you have a dependent voltage source e1 which is also across those terminals. It is not a good idea to put two voltage sources in parallel. I would suggest you try putting them in series. Does that help? Then you can have a primary (1-2) voltage controlled by what the secondary voltage is, while still using vsense to sense the current in the primary.

Cheers, Tom

Reply to
Tom Bruhns

"Michael Zedler" schrieb im Newsbeitrag news:eu13g9$886$ snipped-for-privacy@news.lrz-muenchen.de...

Hello Michael,

It looks similar to the ideal transformer from this article.

formatting link

I have made a subcircuit from this example:

Plese change the voltage ratio "10" to the desired value. For a 1: transformer replace the 10 by 1 and the -10 by -1.

  • prim: (+)1 (-)2
  • sec: (+)3 (-)4
  • ratio Vsec/Vprim = 10 .SUBCKT TRAFO 1 2 3 4 F1 1 2 VSENSE -10 E1 30 4 1 2 10 VSENSE 3 30 0 .ENDS

Best regards, Helmut

PS: If you have some kind of Windows emulator, you could try LTspice. It also runs with WINE in Linux. LTspice has a state of the art graphical interface for schematics and waveforms.

formatting link
formatting link

A full blown version of the ideal trafo with parameter passing for LTspice

  • prim: (+)1 (-)2
  • sec: (+)3 (-)4
.SUBCKT TRAFO 1 2 3 4 N1={N}
  • N1 = N = Vsec/Vprim F1 1 2 VSENSE {-N1} E1 30 4 1 2 {N1} VSENSE 3 30 0 .ENDS

How a netlist for a TRAFO-instance could look in LTspice:

XU1 10 0 50 0 TRAFO N=1

Normally one would use a symbol in the schematic of course.

Symbol file, name it trafo.asy

Version 4 SymbolType BLOCK RECTANGLE Normal 80 64 -48 -80 TEXT -22 -48 Left 0 TRAFO WINDOW 39 17 24 Center 0 SYMATTR Prefix X SYMATTR SpiceModel TRAFO SYMATTR Description Ideal Transformer SYMATTR SpiceLine N=1 PIN -48 -64 NONE 8 PINATTR PinName 1 PINATTR SpiceOrder 1 PIN -48 48 NONE 8 PINATTR PinName 2 PINATTR SpiceOrder 2 PIN 80 -64 NONE 8 PINATTR PinName 3 PINATTR SpiceOrder 3 PIN 80 48 NONE 8 PINATTR PinName 4 PINATTR SpiceOrder 4

Reply to
Helmut Sennewald

How very strange, i am used to making ideal and real transformers with an Lm term coupling "normal" inductors. Almost sure to be a better simulation of any possible real circuit.

--
 JosephKK
 Gegen dummheit kampfen die Gotter Selbst, vergebens.  
  --Schiller
Reply to
joseph2k

Helmut Sennewald schrieb:

Works like a charm, thank you!

Michael

Reply to
Michael Zedler

joseph2k schrieb:

In most cases your statement may be correct, but not for this one: Joint simulation of some lumped elements together with a distributed microwave circuit (the latter represented by a canonical Foster equivalent circuit which requires ideal transformers).

Michael

Reply to
Michael Zedler

OK. What is going on with the Foster equivalent circuit that normal Lm ideal transfromers will not work.

--
 JosephKK
 Gegen dummheit kampfen die Gotter Selbst, vergebens.  
  --Schiller
Reply to
joseph2k

An ideal transformer is needed; no parasitic inductance, coupling of 1. Again, this is an *equivalent* circuit. It models the distributed circuit. And if non-ideal transformers were used essentially the transfer function of the destributed (physical) (multiport-)circuit were altered.

Michael

Reply to
Michael Zedler

OK, i do not understand "parasitic inductance" in this context. I have a little experience (near trivial) with "transmission line transformers" in PWB and MMIC arenas. Please elucidate.

--
 JosephKK
 Gegen dummheit kampfen die Gotter Selbst, vergebens.  
  --Schiller
Reply to
joseph2k

In the meantime i did some googling on Foster equivalent circuit. Wow, was i ever on the wrong track. Not only was my suggention of using standard Lm terms waste lots of simulation time to no good; it would actually completely destroy the integrity of the simulation. I have to admit though that the basic idea is wonderful, it makes analysis of something wierd like a fractal antenna doable.

--
 JosephKK
 Gegen dummheit kampfen die Gotter Selbst, vergebens.  
  --Schiller
Reply to
joseph2k

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.