NGSPICE 44. Did something change for .CSPARAM
? The usage below is discussed in the manual, Chapt. 2.12, p66.
.TITLE prinverter (Rashid ex. 13.2)
.csparam fs = 21.5kHz
.param Ts = 1/21.5k
V1 in 0 SIN(0 1 {fs})
.tran 0 10ms 0 10u
.control
run
listing e
fourier $&fs v(in)
.endc
.end
Output on Windows 11 from PowerShell:
PS D:\spice\mhx\MAGNETICS> spice64w .\test.cir
******
** ngspice-44 : Circuit level simulation program
** Compiled with KLU Direct Linear Solver
** The U. C. Berkeley CAD Group
** Copyright 1985-1994, Regents of the University of California.
** Copyright 2001-2024, The ngspice team.
** Please get your ngspice manual from https://ngspice.sourceforge.io/docs.html
** Please file your bug-reports at https://ngspice.sourceforge.io/bugrep.html
** Creation Date: Feb 9 2025 13:57:26
******
Warning: no graphics interface!
You may use command 'gnuplot'
if GnuPlot is installed.
Note: No compatibility mode selected!
Circuit: prinverter (Rashid ex. 13.2)
Netlist line no. 6:
Undefined parameter [fs]
Netlist line no. 6:
Cannot compute substitute
Numparam expansion errors: Run Spice anyway? y/n ?
n
ERROR: fatal error in ngspice, exit(1)
PS D:\spice\mhx\MAGNETICS>
There is no change.
.csparam does not define parameters. It just sends parameters into a .control section.
Thus line 6
is prone to failure as
fs
has not been defined as a parameter.Thanks, I have always struggled with understanding (or better, remembering) this. Reading it again, this is also what the manual says and has always said.
When I have time, I'll dig around to see if I can find out what the fundamental reason is that only one of the following lines works
while the following three are all ok