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.