I'm trying to pass parameter to a subcircuit. This works:
.subckt AAA 1 2 PARAMS: v=1 f=440
V1 1 3 DC 0 AC 9 0 SIN(0 {v} {f} 0 0 0)
R1 3 2 100
.ends
X1 1 0 AAA v=10 f=100
But when I also want to parametrize the "9" after the AC, it shows error:
.subckt AAA 1 2 PARAMS: v=1 f=440
V1 1 3 DC 0 AC {v} 0 SIN(0 {v} {f} 0 0 0)
R1 3 2 100
.ends
X1 1 0 AAA v=10 f=100
The error is:
Error on line 0 :
v.x1.v1 1 x1.3 dc 0 ac ( 1 0 ) 1.000000000000000e+01 0 sin(0 1.000000000000000e+01 1.000000000000000e+02 0 0 0)
no such parameter on this device
Simulation interrupted due to error!
Entire example is:
* first line is ignored
.subckt AAA 1 2 PARAMS: v=1 f=440
V1 1 3 DC 0 AC {v} 0 SIN(0 {v} {f} 0 0 0)
R1 3 2 100
.ends
X1 1 0 AAA v=10 f=100
R1 1 0 1k
.options NOACCT NOPAGE
.control
set nobreak
set nopage
set width = 200
.endc
.print tran v(1)
.tran 0.0001 0.02 0
.end
ngspice 36 from ubuntu 22.04
This has been solved in ngspice-37. Please consider to update ngspice.