instead of changing a parameter,
here you might get away using `alter'
a sketch for that looks like this
altering the second parameter of a `pulse' VSRC device
* (compile (concat "w32/src/ngspice " buffer-file-name) t)
vaph1 aph1 0 pulse 0v 0.042ns .50ns .01ns .01ns .99ns 2ns
.control
show vaph1
let pulse_v1 = @vaph1[pulse]
* print status quo
print pulse_v1 @vaph1[pulse]
* alter the second vaph1 pulse parameter
let pulse_v1[1] = 0.43ns
alter @vaph1[pulse] pulse_v1
* verify
show vaph1
print pulse_v1 @vaph1[pulse]
.endc
Robert
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Dear ngspice users,
I want to change a parameter within a simulation loop.
.param ph=1.2V
vaph1 aph1 0 pulse 0v ph .50ns .01ns .01ns .99ns 2ns
the parameter ph should be changed in a loop
(start of loop)
while loop < 5
let loop =1
ph=loop ??????
tran …..
let loop=loop+1
end
(end loop)
thanks for help
ho
Hello,
instead of changing a parameter,
here you might get away using `alter'
a sketch for that looks like this
Robert
Thanks Robert, you are great,
it' running
ho
Instead of assigning one at a time, like this:
let pulse_v1[1] = 0.43ns
can one assign the entire vector at once?
let pulse_v1 = [ 0 1 2 3 4 5 6 ]
?
Do I need to synthesize a vector first?
Hello Abhijit,
you can create a vector first, I think with
let pulse_v1 = vector(7)
and then change elements of this vector with
let pulse_v1[3] = 42
or you can `compose' a vector from scratch with
compose pulse_v1 values 11 12 13 14
print pulse_v1
by the way, Don Sauer has quite some examples
for ngspice on his web page,
http://www.idea2ic.com/NGSPICE_TEMPLATES/NGSPICE%20TEMPLATES.html
I think there is an example using
alter' to set a
pwl' voltage source.Regards,
Robert