NI Home > Community > NI Discussion Forums

Circuit Design Suite

Showing results for 
Search instead for 
Do you mean 
Reply
Member
mdwebster
Posts: 8
0 Kudos

SPICE simulation parameters

So I would like to have a pot model that I can "turn" the pot knob as part of a parameter sweep.

 

I have the following model:

 

.SUBCKT SIMPLEPOT__POT__1 1 T 2 PARAMS: VALUE=1k SET=0.5
RT 1 T {VALUE*(1-SET)+0.001}
RB T 2 {VALUE*SET + 0.001}

 

This works fine as a simple model and, in fact, when I go to "edit model" on the part on the schematic, it gives me a box for "Current instance parameters:" as PARAMS: VALUE=1k SET=0.5 that I can edit.

 

However, when I try to run a parameterized sweep, I can't get hold of VALUE or SET anywhere.  I can access rt & rb separately as part of "device parameters" (which doesn't really do any good since I want them to change simultaneously, not as a nested sweep), but I can't access the custom parameters.

 

Is there another way of setting a model up where I can access custom parameters in a sweep?

 

Best regards,

Mike

Active Participant
GarretF
Posts: 296
0 Kudos

Re: SPICE simulation parameters

Hi Mike,

 

The parameter sweep can only modify basic parameters for SPICE models. Essentially, by the time simulation starts, the equation has already been evaluted, which is why this approach doesn't work.

 

One alternative is to create a "voltage-controlled potentiometer." Then, vary the voltage through the parameter sweep to get the desired sweeping effect. eCircuit Center describes the basic idea for a voltage-controlled resistor. 

 

My SPICE is a little rusty, so if you've gotten this far, I'm guessing you can probably put this together faster than me. Let me know if you have questions or difficulties and I can definitely point you in the right direction.

Garret
Senior Software Developer
National Instruments
Circuit Design Community and Blog

If someone helped you, let them know. Mark as solved or give a kudo. :smileyhappy: