For years I am using an automated potentiometer in LTSPICE that changes the position of the wiper from one side to another proportionally with time, I specify that time in two variables used in Subckt of the potentiometer, Tstart and Tstop. Those variables appear at the potentiometer.asy, so right clicking the part before the simulation I can change them according to my need. That in fact work very well for observing as a circuit behave when changing something like that. For other uses where a simple changing resistor value, I use a simple resistor and define its value as R=0.001+Time*10k, so if running a 100ms simulation, that resistor changes from 1mΩ to 1000.001Ω, what is neat for some testing and adjusting purposes. This approach with the resistor works, but its value depends on time, and I need to pay attention, for example running a simulation of 1s and wanting the resistor to change from 100Ω to 1kΩ during this 1s, I need to enter the correct formula, such R=100+time*900. This is not the case on the potentiometer subckt, since its total value is already defined, the change of the wiper must happen within a specific period of time, not just "time". What I wish is for the wiper to swing from 0 to 100% for the simulation time specified at the .TRAN
So, it is possible to use "time" as a value into a subckt calculation, what else can we use?
Now, I wish to use the potentiometer TSTART and TSTOP variables at my lib (potentiometer subckt) to copy the values stated at .TRAN "tstop" "tstart"... How can it use those values if I omit them at the ASY?
The potentiometer subckt used is:
.subckt potentiometerx 1 2 3
.param TFTI=Tstop-Tstart
R1 3 2 R={if(time>Tstop,Rtot,Rtot*(time-Tstart)/TFTI*int(0.9999+((time-Tstart)/TFTI))+1m)}
R0 1 3 R={if(time>Tstop,0.0001,Rtot-(Rtot*(time-Tstart)/TFTI*int(0.9999+((time-Tstart)/TFTI))+1m))}
.ENDS potentiometerx