LT Spice resistor vs time

Is there a way to run a transient response and have a resistor value be a function of time?

I tried setting a resistor value to {50000*TIME} and it doesn't like that.

I can set a bv to V=TIME and get a voltage ramp. I want a br component.

I guess I could program Ohm's Law into a bi or something ugly like that.

--
John Larkin         Highland Technology, Inc 

Science teaches us to doubt. 
 Click to see the full signature
Reply to
jlarkin
Loading thread data ...

You will have to do something funky like that because parameters are only evaluated before a simulation run. Measure statements are evaluated after a simulation.

I think a resistor would be a voltage dependent current source, g or g2. If you can set that relation to a function of time, it might work.

--
  Rick C. 

  - Get 1,000 miles of free Supercharging 
 Click to see the full signature
Reply to
Ricketty C

Yes... Just create a voltage controlled resister in a behavioural subckt, and ramp the control voltage.

This one creates a linear resistance with control voltage. vmin is arbitrary to avoid a divide by zero at a control voltage of zero. The passed in paramter sets the v=1V resistance

.SUBCKT VCR cp cn ra rb res=1k

  • .param vmin=1e-4
  • B1 ra rb i=v(ra,rb)/(v(cp,cn) + {vmin})/{res} .ends

-- Kevin Aylward

formatting link
- SuperSpice
formatting link

Reply to
Kevin Aylward

Way back in DOS days, I used a netlist-based non-Spice simulator called ECA. It was of course slow and clumsy, but the documentation was superb, and it executed any expression that you could type. A resistor, cap, voltage, or inductor value could be a function of anything else in the circuit. That was very cool. I suppose it violated conservation of energy, and maybe causality, but nobody's perfect.

And it always converged. It might occasionally toss a warning (divide by zero!) but it kept going.

--
John Larkin         Highland Technology, Inc 

Science teaches us to doubt. 
 Click to see the full signature
Reply to
jlarkin

Am 30.05.2020 um 03:12 schrieb snipped-for-privacy@highlandsniptechnology.com:

Hello John,

A resistor varying over time can be specified by replacing the value of the resistor with a formuala as shown below.

R=10+time/1000

LTspice will internally replace this "resistor" with a B-source.

Best regards, Helmut

Reply to
Helmut Sennewald

That works! Thanks. I never understand the LT Spice syntax.

A resistor value

10K works

time doesn't

{time} doesn't

R=time does!

--
John Larkin         Highland Technology, Inc 

Science teaches us to doubt. 
 Click to see the full signature
Reply to
jlarkin

But

R=200k*time doesn't work

R=+200k*time doesn't work

whereas

R=1+200k*time does!

So, I still don't understand the syntax.

--
John Larkin         Highland Technology, Inc 

Science teaches us to doubt. 
 Click to see the full signature
Reply to
jlarkin

Am 30.05.20 um 17:31 schrieb snipped-for-privacy@highlandsniptechnology.com:

So this might be nothing about syntax, more about the value of R. The simulator can not cope with R=0 and 200k * time is at the very beginning zero ...

Reply to
Ingolf Pohl

Good point. The sim appears to run but nothing can be plotted. A polite pop-up warning wouldn't hurt.

Oops, not quite. R=0 is a legit current limiter value for the OPA547, so as a value for the current limit resistor...

0 works

R=0 works

R=time doesn't

R=2*time doesn't

R=1+time works.

R=time+1 works

R=1u+2*time works

so it really wants an add in the expression.

R=1-1+time doesn't work. The add probably gets optimized out.

LT Spice is an x86 compiler, with a few bugs. I managed to form an expression once that crashed it hard. I told Mike and he fixed it.

--
John Larkin         Highland Technology, Inc 

Science teaches us to doubt. 
 Click to see the full signature
Reply to
jlarkin

Resistances aren't allowed to be zero.

Cheers

Phil Hobbs

--
Dr Philip C D Hobbs 
Principal Consultant 
 Click to see the full signature
Reply to
Phil Hobbs

But I do that all the time.

Take a grounded 1 volt source and drive a string of three 1 ohm resistors to ground. You'll get 1/3 and 2/3 volts. Now sort of randomly change some of the resistors to zero. The number of nodes changes! But the divider works.

A two-resistor 1-ohm divider of course gives 0.5 volts, but if you change the lower resistor to 0, the mid node gets named 'ground' and can't be probed. But the current is 1 amp.

Maybe the explanation is that both nodes of a 0 ohm resistor get called the same node. LT treats a 0 ohm resistor as a piece of wire. You can't probe its current.

Numerical nodes must be assigned at compile time, when you hit 'run'.

--
John Larkin         Highland Technology, Inc 

Science teaches us to doubt. 
 Click to see the full signature
Reply to
jlarkin

g

I have set resistors to 0 value. Are you saying it won't respond to the sy ntax "R=0" while "0" works ok? If no one is typing the "R=" and it's j ust "200K+TIME" the reason it's not working isn't because it evaluates to 0 . I just changed the 2 ohm resistor in John's circuit to 0 ohms and it sti ll works. It runs very slowly, but it works.

--
  Rick C. 

  + Get 1,000 miles of free Supercharging 
 Click to see the full signature
Reply to
Ricketty C

In LTspice at least, there is a very small resistance even if you say

0 Ohms IIRC.... This may be adjustable in the settings ?
Reply to
boB

LT screams "zero ohm resistor not allowed" and refuses to run. Sometimes.

--
John Larkin         Highland Technology, Inc 

Science teaches us to doubt. 
 Click to see the full signature
Reply to
jlarkin

e
e

of

You might be thinking of some devices that if you don't specify a resistanc e will include a small amount. I added a voltage source to a schematic, se t the resistance to zero, put a small resistor in series with it and it see ms the voltage source has literally no resistance. I can measure the volta ge on that net and it is the voltage source setting to how many decimal pla ces that are used in LTspice? I think it is using zero ohms internally bec ause I set it to zero.

--
  Rick C. 

  -- Get 1,000 miles of free Supercharging 
 Click to see the full signature
Reply to
Ricketty C

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.