2
\$\begingroup\$

Is it possible to make a lossless resistor model in spice? I want to test the large signal model of my DCM SEPIC converter (without linearizing it). OrCad's PSpice library doesn't seem to have it, but is it possible to make a model somehow?

Image from "Fundementals of Power Electronics" by Erickson and Maksimović

The lossless resistor is a two port element consisting of a resistor and a power source, such that the power apparently consumed by the resistor is produced by the power source.

\$\endgroup\$
  • 1
    \$\begingroup\$ If you can draw this lossless resistor from components in a sim then sure it can be done. Have you got a circuit for a lossless resistor or some formula that describes it? \$\endgroup\$ – Andy aka Mar 15 '18 at 22:37
  • 5
    \$\begingroup\$ What is a "lossless resistor"? By definition, a resistor has a voltage across it proportional to the current through it, therefore it will consume power unless there is 0 V across it. \$\endgroup\$ – The Photon Mar 15 '18 at 22:39
  • 1
    \$\begingroup\$ The lossless resistor is a two port element consisting of a resistor and a power source, such that the power apparently consumed by the resistor is produced by the power source. I should probably add this to the question. \$\endgroup\$ – Filip Cvejic Mar 15 '18 at 22:39
  • 1
    \$\begingroup\$ What is a lossless resistor? \$\endgroup\$ – Barry Mar 15 '18 at 22:40
  • 1
    \$\begingroup\$ Real Cuk and SEPIC converters use transformers rather than lossless resistors --- maybe within a reasonable range of operating conditions you could use a transformer model in your simulation instead of a lossless resistor? \$\endgroup\$ – The Photon Mar 15 '18 at 22:44
2
\$\begingroup\$

I think I've worked this out for LTspice. I don't know how symbols are edited and created in PSpice, since I haven't had access to it before. For LTspice, I can make symbols (.ASY files) and also then the model files (.MOD, .LIB, etc.)

What I was thinking you need is about right. Here is the subckt model I wrote:

* Node 1 -- one end of resistor
* Node 2 -- other end of resistor
* Node 3 -- one end of power source
* node 4 -- other end of power source
.SUBCKT LR01 1 2 3 4 PARAMS: LR=1k
RX 1 2 {LR}
BY 4 3 I={V(1,2)**2/V(3,4)/{LR}}
.ENDS

The idea here is the call the model LR01 and it needs 4 nodes; two for the resistor and two for the power piece. The use of params: allows me to set up a default value for the resistor. But you can easily override it when calling the subckt.

I used a behavioral current source here. It was a LOT easier than trying to use some of the other devices (G, for example.)

Here is the .ASY file I developed for LTspice:

Version 4
SymbolType CELL
LINE Normal 16 24 16 16
LINE Normal 32 32 16 24
LINE Normal 0 48 32 32
LINE Normal 32 64 0 48
LINE Normal 0 80 32 64
LINE Normal 16 88 0 80
LINE Normal 16 96 16 88
LINE Normal 96 25 64 25
LINE Normal 96 88 96 25
LINE Normal 64 88 64 25
LINE Normal 96 88 64 88
LINE Normal 72 48 80 32
LINE Normal 88 48 72 48
LINE Normal 80 32 88 48
LINE Normal 88 64 72 64
LINE Normal 80 80 88 64
LINE Normal 72 64 80 80
LINE Normal 80 32 80 16
LINE Normal 80 80 80 96
WINDOW 0 112 32 Left 2
WINDOW 38 112 64 Left 2
WINDOW 3 -24 104 VLeft 2
SYMATTR SpiceModel LR01
SYMATTR Prefix X
SYMATTR Description Lossless Resistor
SYMATTR ModelFile LR.MOD
SYMATTR Value LR=10k
PIN 16 16 NONE 0
PINATTR PinName A
PINATTR SpiceOrder 1
PIN 16 96 NONE 0
PINATTR PinName B
PINATTR SpiceOrder 2
PIN 80 16 NONE 0
PINATTR PinName C
PINATTR SpiceOrder 3
PIN 80 96 NONE 8
PINATTR PinName D
PINATTR SpiceOrder 4

All that does is create a visual symbol to use in the schematic editor where the nodes are tied up right.

Here's the first test I tried out. You can see both the schematic as well as the graphed power figures.

enter image description here

You can see that the voltage supply on the left of the schematic is supplying power (the blue curve shows \$-10\:\text{mW}\$), that the resistor on the right of the schematic is consuming power (the green curve shows \$+10\:\text{mW}\$), and that the weird device you wanted (lossless resistor) nets out at zero power (red curve shows \$0\:\text{mW}\$.)

Here's another picture of a circuit I tried out.

enter image description here

The UIC keeps the circuit from finding the DC point, because I wanted to see "things happen" here. It seems to work fine. The power dissipation in the lossless resistor thing is "noisy" (picowatt spikes) but in general hovers near 0 all the time. Which is what you'd expect.

So I've tried a few things. One of them including an energy storage device. The results appear to be what I expected. So that's my shot at it so far.

If I discover something that needs changing, I'll update this post.


If you do use LTspice, then you need to do the following steps.

  1. Snap a copy of the subckt model at the top of my post here (you can ignore the lines that start with *) and put those four lines into a text editor. Then save the file onto the disk with the name of LR.MOD. This file needs to go into the installation directory of your LTspice program in a folder that is .\lib\sub\ so that LTspice can find it easily. (There are other ways. But that's more writing for me.)
  2. Snap a copy of the schematic image description also in my post here (it starts with "Version 4") and put that into a text editor, too. Then save the file onto the disk with the name of LR.ASY. This file needs to go into the installation directory of your LTspice program in a folder that is .\lib\sym\ so that LTspice can find that symbol easily. (Again. There are other ways. But that's more writing for me.)
  3. Close LTspice and re-start it. This will make certain that it re-reads the directories and makes itself an up-to-date set of things you can use to put on the schematic.
  4. Start a new schematic and add some parts. I suggest you start with simple tests, first. Find this part in the list of parts that LTspice presents (you should be able to see a part called "LR" in the list.) Place it on the schematic along with the other parts. Modify the value of LR to some other values to try. (Keep the "LR=" part at the front, though.) Run some tests.
|improve this answer|||||
\$\endgroup\$
  • \$\begingroup\$ You can set a behavioural source to simulate a constant power load/source (whn power is negative), see this for a short explanation: ltwiki.org/?title=Undocumented_LTspice#B-Sources (at Bn P=f(...)). E.g. for 1W load, P=1. \$\endgroup\$ – a concerned citizen Mar 19 '18 at 6:59
  • \$\begingroup\$ @aconcernedcitizen Ah. Maybe I can take one item out of the equation I use. That would be slightly simpler to do. But it would use an undocumented feature. \$\endgroup\$ – jonk Mar 19 '18 at 7:13
  • \$\begingroup\$ @aconcernedcitizen Just tried the idea using P=. I can't get it to work. No error messages. Just nothing but zero power all the time. I read the comments about (-) for power source and (+) for power sink. Tried both signs in the equation. No luck, at all. \$\endgroup\$ – jonk Mar 19 '18 at 7:23
  • \$\begingroup\$ @aconcernedcitizen Okay. I'm done testing that silly thing for now. I just created a B source and set it for a variety of P= values and zippo -- nothing happens much. No errors. So "P=-10m" and "P=10m" and "P={-10m}" and "P={10m}" all seem to do the same thing as "P=0". Now, if I put a node name in there that doesn't exist, I do get an error message. So it is parsing it. But I think either I have no clue how to use it and there is a way but I just cannot figure it out, or else this feature doesn't really do much in LTspice. If you see a web example, perhaps that might help me get it right. \$\endgroup\$ – jonk Mar 19 '18 at 7:36
  • \$\begingroup\$ @jonk Awesome! Thank you! I will try and figure out how to make it in PSpice and post it when I get the time. \$\endgroup\$ – Filip Cvejic Mar 19 '18 at 11:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.