got an ngspice question: i want to run 400 iterati...
# analog-design
j
got an ngspice question: i want to run 400 iterations of a loop. each iteration should run 3 transient simulations (each at a different temperature). each transient simulation should use the same random seed but from loop "n" to loop iteration "n+1", I want different seeds. I really just want to ensure that the 3 transient simulations use the same random variables and that these random variables change after my round of transient sims. i've tried this:
Copy code
.option SEED=random

.option temp=27
.tran 1n 11u
.option temp=0
.tran 1n 11u
.option temp=70
.tran 1n 11u

.control
  let run=1
  dowhile run <= 400
    let randomseed = $rndseed
    if run > 1
      reset
      set appendwrite
    end
    save all
    run
    write TESTTYPENAMEHERE_mc1_70degc_run_{$&run}.raw vbg randomseed 
    setplot tran2
    write TESTTYPENAMEHERE_mc1_0degc_run_{$&run}.raw vbg randomseed
    setplot tran1
    write TESTTYPENAMEHERE_mc1_27degc_run_{$&run}.raw vbg randomseed
    let run = run + 1
  end
but only the transient sim at 70degC is being run (i always see 
Doing analysis at TEMP = 70.000000 and TNOM = 27.000000
). edit: this script is still running in ngspice, so i don't know for sure if the 2 other temperatures were not simulated. i'd exepect every
.tran
statement to be run I also tried
Copy code
.option SEED=random

.control
  let run=1
  option SEED=random
  let indexvec = unitvec(400) * $rndseed
  let randomseedvec = rnd(indexvec)
  dowhile run <= 400

    if run > 1
      reset
      set appendwrite
    end
    save all
    set temp=27
    option SEED=randomseedvec[$&run-1]
    tran 1n 11u
    set temp=0
    option SEED=randomseedvec[$&run-1]
    tran 1n 11u
    set temp=70
    option SEED=randomseedvec[$&run-1]
    tran 1n 11u
    write TESTTYPENAMEHERE_mc1_70degc_run_{$&run}.raw vbg
    setplot tran2
    write TESTTYPENAMEHERE_mc1_0degc_run_{$&run}.raw vbg
    setplot tran1
    write TESTTYPENAMEHERE_mc1_27degc_run_{$&run}.raw vbg
    let run = run + 1
  end
but I realized this is not what I want to achieve since I set the seed 3 times, when I just want it to be set once (also, ngspice complains about setting the seed more than once) edit: could I just pick 1 seed value and use that across 3 separate spice testbenches, where each testbench handles 1 temperature? the ngspice manual does say that setting the seed value will determine a sequence of pseudo random numbers. so if each simulation uses the same numbers in that sequence, then this should achieve what i want?