<@U03DME2F2RG> put a `reset` instruction after `le...
# xschem
s
@StefanCK put a
reset
instruction after
let r_act = r_act + delta_r
within the loop.
s
I had tried reset at a few locations but I get these errors and again only the first run gets results. The rest give this.
s
@StefanCK I tried this example and it works. Execute with ngspice -i test.cir. Change the install path of spice model files according to your system
Copy code
Test multiple sweep using while loop and alter

r1 1 2 1k
D1 2 3 sky130_fd_pr__diode_pw2nd_11v0 area=1e12
c1 3 0  0.1n ic=0
v1 1 0 pwl 0 0 10n 1

.control
  save all
  let start_r = 1000
  let stop_r = 5000
  let delta_r = 1000
  let r_act = start_r
  while r_act le stop_r
    alter r1 r_act
    tran 1n 1u
    let r_act = r_act + delta_r
    reset
  end
  plot all.v(2)
.endc

*** TT corner only ***
.param mc_mm_switch=0
.param mc_pr_switch=0
.include /home/schippes/share/pdk/sky130A/libs.tech/ngspice/corners/tt.spice
.include /home/schippes/share/pdk/sky130A/libs.tech/ngspice/r+c/res_typical__cap_typical.spice
.include /home/schippes/share/pdk/sky130A/libs.tech/ngspice/r+c/res_typical__cap_typical__lin.spice
.include /home/schippes/share/pdk/sky130A/libs.tech/ngspice/corners/tt/specialized_cells.spice

.end
There are some warnings about unrecognized diode model parameters, but it works.
s
This example shows the same warnings but runs. I don't know what is happening, but my very simple circuit was not working even though it was nearly the same as your example. There was an ampmeter at the top and removing it solved my problem.