Electrical Engineering Asked by Jim Fischer on November 21, 2021
According to most of the SPICE references I’ve read, the form of the .DC sweep directive is
.DC [LIN] <sweep variable name>
+ <start value> <end value> <increment value>
+ [nested sweep specification]
I’d like to know if it’s possible to use variable-based expressions for the START, END, and INCREMENT arguments.
For example, say I define parameters for a nominal resistance value (R_NOMINAL) and a sweep resistance value (R_SWEEP)
.PARAM r_nominal=560k,r_sweep={r_nominal}
and my goal is to a) perform a linear sweep of R_SWEEP’s value, and b) use the values assigned to R_NOMINAL and RTOL to define the START, END, and INCREMENT values for R_SWEEP, e.g.,
.DC LIN PARAM R_SWEEP
+ {R_NOMINAL*(1-RTOL)} {R_NOMINAL*(1+RTOL)} {R_NOMINAL/1000}
where RTOL is the resistor’s tolerance value (e.g., 5%). When I attempt to simulate with this statement, PSPICE emits the following error message in the output file:
*Analysis directives:
.DC LIN PARAM R_SWEEP {R_NOMINAL*(1-RTOL)} {R_NOMINAL*(1+RTOL)} {R_NOMINAL/1000}
----------------------$
ERROR(ORPSIM-16152): Invalid number: Error while converting token '{R_NOMINAL*(1-RTOL)}' to double value. Token can be a constant or expression
I’ve tried removing the curly braces from the expressions shown above, I’ve tried user-defined functions, etc., but so far it appears that the START, END, and INCREMENT argument values cannot be defined via expressions containing variables; they can only be defined via numeric constants or expressions containing only numeric constants. Is that correct?
FWIW, the schematic capture software I’m using is Cadence Design Systems’ Allegro Design Entry CIS (OrCAD), if that matters.
After some additional perusing through various SPICE reference books, I found the following statement at the bottom of page 202 in Paul Tuinenga's book titled SPICE: A Guide to Circuit Simulation & Analysis Using PSpice (2nd ed.) in the section that describes the .PARAM statement:
Parameters cannot be used in place of node numbers, nor can the values on analysis statements (.AC, .DC, .TRAN, etc.) be parameterized.
Answered by Jim Fischer on November 21, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP