InsideDarkWeb.com

SPICE .DC LIN sweep directive w/ variables for START, END, and INCREMENT args

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.

Electrical Engineering Asked by Jim Fischer on November 21, 2021

1 Answers

One Answer

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

Add your own answers!

Related Questions

What to study after discrete bjt amplifiers?

2  Asked on February 12, 2021 by nuggethead

   

Amplfying MCU 113kHz output

0  Asked on February 12, 2021 by zexanana

       

Measuring inductance of a cable

4  Asked on February 12, 2021 by yoomo

   

3.7 V to 12 V boost converter – effect on cell

3  Asked on February 10, 2021 by johnnie-nathan

         

Is there a proper way to enable a digital counter?

2  Asked on February 10, 2021 by thomas-m

     

Can propagation delays be simulated in Active-HDL?

1  Asked on February 10, 2021 by gacekky1

       

Is single PWM kind of AC voltage?

2  Asked on February 9, 2021 by seeker

     

Root locus region on real axis

1  Asked on February 9, 2021 by camilas-voice

   

How to hook four strain gauges ( 5 wire) to esp32

2  Asked on February 7, 2021 by mika

 

Li-Po Battery Balance Charging Circuit

0  Asked on February 7, 2021 by kivanc-gultekin

         

Separate amplified speakers for landline phone

0  Asked on February 6, 2021 by jamie-rogers

 

What type of touch button is this?

2  Asked on February 5, 2021 by berker-ik

   

Ask a Question

Get help from others!

© 2021 InsideDarkWeb.com. All rights reserved.