"parameter" command


Set and view parameters.


param param-name value ...
parameter param-name value ... 


The bare command param lists all defined parameters and their values.

The value may be a number, the name of another parameter, or an expression. If it is another parameter, eventually it must resolve to a number. This depth can be set by the option recursion which has a default value of 20. The depth is limited to prevent infinite recursion.

All component values, numeric lists such as in PWL, component and model parameters can be numbers or expressions. Numeric arguments to most commands can also be parameters or expressions.

If the same parameter is set more than once, the most recent one prevails. All instances of the parameter will take the new value.

When a parameter name is used as a value, it may be enclosed by quotes or curly braces.

Parameter expressions use late evaluation and dynamic scoping, like a functional language.

For more information on parameter expressions, look here.


Suppose we have this circuit:

.model small npn (bf=beta)
Vpower (vcc 0) dc vcc
Vin    (in  0) generator
Q1 (c b e) small
Rc (vcc c) rc
Re (e 0) re
Rb1 (vcc b) rb1
Rb2 (b 0)   rb2

If I try to simulate it now, it will not be very useful. We need to give our circuit some values:

gnucap> param vcc=10 beta=100 rc=10k re=1k rb1=100k rb2=rc

Let's see what it does:

gnucap> print op v(nodes)
gnucap> op
#         v(b)     v(c)     v(e)     v(in)    v(vcc)
 27.      0.8941   8.3513   0.16652  0.       10.

What happens if I change beta?

gnucap> param beta=200
gnucap> op
#         v(b)     v(c)     v(e)     v(in)    v(vcc)
 27.      0.90128  8.2822   0.17264  0.       10.

Not much changes. Let's try to lower v(c). About 6 should be better.

gnucap> param rb1=68k
gnucap> op
#         v(b)     v(c)     v(e)     v(in)    v(vcc)
 27.      1.2602   4.9866   0.50385  0.       10.

Too low, try again:

gnucap> param rb1=82k
gnucap> op
#         v(b)     v(c)     v(e)     v(in)    v(vcc)
 27.      1.0724   6.7437   0.32726  0.       10.

Too high ..

gnucap> param rb1=75k
gnucap> op
#         v(b)     v(c)     v(e)     v(in)    v(vcc)
 27.      1.1586   5.9433   0.4077   0.       10.

Close enough.

gnucap/manual/commands/parameter.txt · Last modified: 2016/08/24 01:55 by aldavis
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Run by Debian Driven by DokuWiki