Micro-Cap v7.1.6 / RM
.PDFWith respect to T (Time) only
SDT(y) Running integral of y with respect to T (Time). Integral begins at T = tmin
DDT(y) |
Numerical derivative of y with respect to T (Time) |
DEL(y) |
Change in y from the prior data point to the current |
|
point. A numerical derivative is formed by the ratio of |
|
two operators. For example, DEL(y)/DEL(t) |
|
approximates the numerical time derivative of y. |
Other functions |
|
ABS(z) |
Absolute value function = (|z|2)0.5 |
DIFA(u,v[,d]) |
DIFA reports differences between two analog curves. It |
|
compares the u expression with the v expression at every |
|
analysis point, and returns 1 if the absolute value of the |
|
result is more than d. Otherwise, it returns 0. U and v |
|
may be imported curves. See the IMPORT function. D is |
|
optional and defaults to 0. |
DIFD(u,v[,d]) |
DIFD reports differences between two digital curves. It |
|
compares the u level with the v level at every analysis |
|
point, and returns 1 if they differ for a time exceeding d. |
|
Otherwise, it returns 0. U and v may be imported curves. |
|
D is optional and defaults to 0. |
FACT(n) |
Factorial of the integer n. |
JN(n,z[,m]) |
N'th order Bessel function of the first kind of the |
|
complex expression z, compiled from the series using m |
|
terms. M defaults to 10. |
J0(z) |
Zero'th order Bessel function of the first kind of the |
|
complex expression z. Same as JN(0,z,10) |
J1(z) |
First order Bessel function of the first kind of the |
|
complex expression z. Same as JN(1,z,10) |
RND |
Returns a random value between 0 and 1. |
287
SERIES(n,n1,n2,z) Calculates the summation of the series of the complex expression z = z(n), for n = n1 to n = n2.
SGN(y) |
+1 (if y>0), 0 (if y=0), -1 (if y<0) |
SQRT(z) |
Complex square root = z0.5 |
STP(x) |
Step function of amplitude 1.0 starting at T >= x. |
TABLE(x,x1..xn,yn) This function performs a table lookup. It returns a value for y associated with the value of x, interpolated from the table. X values less than x1 generate an answer of y1. X values greater than xn generate an answer of yn.
IMPORT(f,y) |
Imports curve y from the file f. The file must be a |
|
SPICE or MC7 output text file with a table of values that |
|
includes the value F(frequency), T(Time), V(source |
|
voltage), or I(current source), and the value of the |
|
expression y. The expression y must be typed exactly as |
|
shown in the file and must contain an even number of |
|
parentheses. |
IMPULSE(y) |
Impulse function of amplitude y and area of 1.0. |
CURVEY("file","W") Imports the Y component of curve W from the User source filename. The file must be saved in standard format. MC7 can save curves for you using the Save Curves section of the Plot Properties dialog box. See User source in Chapter 22 for the file format.
CURVEX("file","W") Imports the X component of curve W from the User source filename.
|
YN(n,z[,m]) |
N'th order Bessel function of the second kind of the |
|
|
complex expression z, compiled from the series |
|
|
using m terms. M defaults to 10. |
|
Y0(z) |
Zero'th order Bessel function of the second kind of the |
|
|
complex expression z. Same as YN(0,z,10) |
|
Y1(z) |
First order Bessel function of the second kind of the |
|
|
complex expression z. Same as YN(1,z,10) |
288 |
Chapter 19: Expressions |
|
Sample expressions
Digital |
|
D(1) & D(2) |
AND of the digital state of node 1 with the |
|
digital state of node 2. |
D(1) | D(2) |
OR of the digital state of node 1 with the digital |
|
state of node 2. |
Hex(A,B,C,D)+Hex(R,S,T,U) |
Hex sum of two hex values. The first term is the |
|
hex value of the states on nodes A, B, C, D. The |
|
second term is the hex value of the states on |
|
nodes R, S, T, U. The result is the hex sum of |
|
these two hex values. |
Laplace source transfer functions |
|
1.0/(1.0+.001*s) |
Transfer function of a low pass filter |
1.0/(1.0+.001*s+1e-12*s*s) |
Transfer function of a second order filter |
exp(-(s*C*(R+s*L))**0.5) |
Transfer function equation for a lossy |
|
transmission line (R, L, and C are the per unit |
|
length values) |
Function sources |
|
exp(-T/.5)*sin(2*π *10*T) |
An exponentially damped 10 Hz sine wave |
-k*(v(p)-v(c)+mu*(v(g)-v(c)))**1.5
The current equation for a vacuum triode. The terms p, g, and c are the plate, grid, and cathode names. v(p), v(g), and v(c) are the voltage at the plate, grid, and cathode respectively.
Capacitance |
|
2pf/((1-v(p,n)/.7)**.5) |
Typical junction capacitance expression |
5.0pf*(1+2e-6*T) |
A time-dependent capacitor |
Resistance |
|
5*(1+2*(TEMP - 273)**2) |
A temperature-dependent resistance |
4.7K*(1+.3*V(P,M)) |
A voltage-dependent resistance |
289
Inductance |
|
1uh*coth(I(L1)/1ma) |
A nonlinear inductance |
2.6uh*(1+(t-1e-7)**2.0) |
A time-dependent inductance |
Power and energy |
|
V(VCC)*I(VCC) |
Instantaneous power from the source VCC |
PD(R1) |
Power dissipated in resistor R1 |
PS(Q1) |
Power stored in transistor Q1 |
PG(V1) |
Power generated by source V1 |
ED(D3) |
Energy dissipated in diode D3 |
ES(C2) |
Energy stored in capacitor C2 |
ES(L4) |
Energy stored in inductor L4 |
EG(VCC) |
Energy generated by source VCC |
EST |
Total stored energy in the circuit |
EDT |
Total dissipated energy in the circuit |
EGT |
Total generated energy in the circuit |
PST |
Total power stored in the circuit |
PDT |
Total power dissipated in the circuit |
PGT |
Total power generated in the circuit |
SUM(V(VCC)*I(VCC),T) |
Energy provided by the source VCC |
Miscellaneous |
|
FFT(V(A)+V(B)) |
Forward Fourier transform of V(A)+V(B) |
IFT(2*fmax*V(Out)) |
In AC analysis, using this Y expression and T |
|
as the X expression generates the impulse |
|
response of a network. V(Out) is the complex |
|
output voltage and fmax is the maximum |
|
frequency of the run. |
CC(V(1),V(2)) |
Cross correlation of V(1) and V(2) |
DEL(I(L1))/DEL(T) |
Numeric derivative of the current flowing in L1 |
SUM(V(Out),T) |
Numeric integral of the voltage curve V(Out) |
290 Chapter 19: Expressions
SUM(V(Out),T,5n) |
Numeric integral of the voltage waveform at |
|
the node Out with respect to time, from |
|
T = 5ns to end of tmax. |
SUM(V(A),V(B),2) |
Numeric integral of the voltage waveform at |
|
the node A with respect to V(B), from V(B) >= |
|
2 to the last value of V(B) at end of run. |
RMS(V(Out)) |
Running RMS value of the expression V(Out) |
5*(T>10ns AND T<20ns) |
A non-periodic, 5V pulse, from 10ns to 20ns |
5*((T mod 50)>10 AND |
A 5V pulse, from 10s to 20s, with period of 50s |
(T mod 50)<20) |
|
IM(V(7)) |
Imaginary part of the complex voltage V(7) |
VCE(Q1)*IC(Q1) |
Complex AC power in collector of device Q1 |
TABLE(V(1),-10,-1,10,1) |
This table function returns -1 if V(1) is less than |
|
-10, 0.1*V(1) if V(1) is between -10 and +10, |
|
and +1 otherwise. |
IMPORT(A.OUT,V(1)) |
Imports waveform V(1) from the file A.OUT. |
CURVEX("T1","I(V1)") |
Imports the X component of the curve "I(V1)" |
|
from the user source file "T1". |
CURVEY("T2","I(V1)") |
Imports the Y component of the curve "I(V1)" |
|
from the user source file "T2". |
FACT(5) |
Computes factorial(5) = 120. |
JN(5,1+J,6) |
Computes the fifth order Bessel function of the |
|
first kind, using the first 6 terms of the series. |
.DEFINE _EXP(X) (1+SERIES(N,1,10,POW(X,1)/FACT(N)))
Creates a macro to compute exp(x) from its series. _exp(1.0) returns 2.718282 = e.
291
Rules for using operators and variables
Here are some important rules to keep in mind when using expressions.
1.The relational and Boolean operators return 1.0 if true and 0.0 if false.
2.The operators that use integration and differentiation, such as RMS, AVG, SUM, SD, DD, DEL, SDT, and DDT operators may be used only for printing and plotting. They can't be used in device parameter expressions.
3.ONOISE and INOISE should only be used in AC analysis and never mixed with other variables like V(somenode).
4.In AC analysis, all intermediate calculations are performed on complex values. After the expression is completely evaluated, the magnitude of the complex result is printed or plotted. For example, V(1)*V(2) prints or plots the magnitude after the complex multiplication. To print the imaginary part use IM(V(1)*V(2)). To print the real part use RE(V(1)*V(2)). To plot the magnitude use V(1)*V(2), or if you prefer, MAG(V(1)*V(2)).
5.The value of the time variable, T, is set to zero in AC and DC analysis. The value of the frequency variable, F, is set to zero in transient and DC analysis.
6.Transfer function expressions for a Laplace source use only the complex frequency variable, S. No other variables should be used. If the S is missing, an error will result. Do not use Laplace sources for constant gain blocks.
Use independent sources, SPICE poly sources, or function sources.
7.You can use symbolic variables in model statements, if the variable is used only for the parameter value, and not for the parameter name. For example, this will work:
.define VALUE 111
.model Q1 NPN (BF=VALUE ...)
After expansion, the model statement becomes
.model Q1 NPN (BF=111 ...)
This is syntactically correct and meaningful.
292 Chapter 19: Expressions
8. Define statements expand literally. For example:
.define a |
4+c |
.define b |
a*x |
You might expect that b would expand to (4+c)*x but it actually expands to 4+c*x. That is because the expansion of define statements is literally a text replacement. It replaces the text 'a' with the text '4+c'.
To avoid such problems, use parentheses around the defined quantity, such as in the following define statements:
.define a |
(4+c) |
.define b |
a*x |
Now b expands to (4+c)*x.
293
294 Chapter 19: Expressions
Chapter 20 Command Statements
What's in this chapter
Command statements are text strings which begin with a period. They are implemented by placing grid text in a schematic page or in the text area, or ordinary text in a SPICE circuit.
Features new in Micro-Cap 7
•.TR command
•.FUNC command
•.HELP command
295
.AC
General Form (SPICE files only)
.AC [[DEC] | [OCT] | [LIN]] <data points> <fmin> <fmax>
Examples
.AC DEC 30 20 20K
.AC LIN 10 100 200
The .AC command arguments are mapped into the appropriate MC7 Analysis Limits dialog box fields upon selecting AC from the Analysis menu. DEC (decade), OCT (octal), and LIN (linear) specify the type of fixed frequency step to be used during the AC analysis. DEC and OCT select the Log Frequency Step option and LIN selects the Linear Frequency Step option on the AC Analysis Limits dialog box.
<data points> specifies the number of data points per decade for the decade option or the total number of data points for the linear option. It is mapped into the Number of Points field. <fmin> specifies the first frequency of the run and <fmax> specifies the last. These are mapped into the Frequency Range field.
A waveform source need not be present in the circuit, but if there is no source, all output will be zero. For waveform sources, the small signal model is simply an AC voltage or current source. The AC value of the source is determined from the parameter line for SPICE components and from the attribute value for schematic components.
SPICE V or I sources:
The AC magnitude value is specified as a part of the device parameter. For example, a source with the value attribute "DC 5.5 AC 2.0" has an AC magnitude of 2.0 volts.
Pulse and sine sources:
These sources have their AC magnitude fixed at 1.0 volt.
User sources: User sources provide a signal comprised of the real and imaginary parts specified in their files.
Function sources: These sources create an AC signal only if a FREQ expression is specified.
296 Chapter 20: Command Statements