Electronics > Beginners
Seeking help with LTspice simulation of Variable Power Supply
mdszy:
--- Quote from: ChanceMcCrance on August 16, 2018, 01:36:05 am ---I wanted to create a simulation of a variable power supply that I had built which used a 5k variable resistor. I suppose using the .step command would be ok for now.
--- End quote ---
Variable resistor, or potentiometer? If you're using a potentiometer, you can replace it with two resistors that change along with each other to always be a constant 5k, but the resistance at each side of the "wiper" changes.
ChanceMcCrance:
It's technically a potentiometer, but I am only using the first two terminals of it. (like a rheostat)
mdszy:
--- Quote from: ChanceMcCrance on August 16, 2018, 01:43:48 am ---It's technically a potentiometer, but I am only using the first two terminals of it. (like a rheostat)
--- End quote ---
Ah, right. Then the .step command with a single resistor is exactly what you want.
Zero999:
An arrow can by drawn on the standard resistor symbol, to make it clear it's a variable resistor.
Other options are a time and voltage controlled resistor.
To make a variable resistor, which starts at 1Ohm and increases to just over 1k, over a second:
Set the value of the resistor to:
R=1+1k*time
Or: set the resistor value to:
R=V(V_res)
And create a voltage source with the net named V_res and set its value to:
PULSE(1 1k 0 1)
The time controlled resistor is the easiest, but least flexible and the voltage controlled resistor is a bit more difficult but more flexible, as it can be ramped up and down.
I've attached the .asc files.
Ian.M:
As Hero999 points out, a voltage controlled resistor or potentiometer is the most flexible, but a parameter controlled one is much simpler to simulate and is adequate if you only need to set or step its initial value, which is then fixed within each run.
If you need actual potentiometers, here are the models I use:
potentiometer.asy is parameter controlled - set the instance parameter Rtot to total track resistance and wiper to the wiper position (0 to 1). Use a .param or .step param command on your sim for control. e.g to sweep it 0% to 100% in 10% steps :
--- Code: ---.step param pot1 0 1 0.1
--- End code ---
and on the actual potentiometer instance:
--- Code: ---Rtot=10K wiper={pot1}
--- End code ---
potentiometerVC is voltage controlled with the wiper position set by a control voltage in the range 0 to 1V, with respect to the circuit universal ground node 0. Simply ground the control voltage source's negative terminal, drop a net label on its positive terminal, and the same net label on the potentiometerVC's control terminal (far end of dotted line opposite wiper). Its total track resistance is set by the instance parameter Rtot.
Both limit the effective wiper position to the range 0.001 to 0.999 as the LTspice SPICE engine cant handle resistances actually going to zero. When the wiper position is zero, its at the bottom end of the track if the symbol hasn't been rotated.
Navigation
[0] Message Index
[*] Previous page
Go to full version