Sunday, 13 January 2019

spice - LTSpice - How to specify the component model name through .param directive


I have some subcircuits that I want to define as components, but still be able to specify the component models used internally, for a much quicker testing of the design's performance under different set of models.


I know how to change the attributes of internal parts by passing the numeric notation on the SpiceLine of a symbol (.asy) to which the names of the variables are the same as the variable names of attribute values in a .subckt model definition of a model .included in a schematic.


So here's a simple subcircuit


vdrop_diode.txt:


.SUBCKT vdrop_diode 1 2


D1 1 2 1N4148

.ends vdrop_diode

here's the snapshot of the symbol: enter image description here


The only attributes filled out were:


Prefix: X
Value: vdrop_diode




Then here I want to be able to change the model of the component


vdrop_diode2.txt:


.SUBCKT vdrop_diode 1 2

D1 1 2 {D_model}

.ends vdrop_diode

snapshot: enter image description here


The only attributes filled out were:



Prefix: X
Value: vdrop_diode
SpiceLine: D_model=1n4148



The default model is 1N4148 (as specified in SpiceLine), but I to be able to simply change to any model I wish. The first problem was 1N4148 passed in SpiceLine was being interpreted as 1.4148e-9. It takes the N as nano, like it was just numeric notation. But, when I tried model names that cannot be interpreted as numbers, like say BAT54 it outputs:


WARNING: Can't resolve .param d_model=(bat54)

Am I not wrapping it in quotation marks or something? Or can this just not be done.


I'm not looking to stepping through a list of model names, just specify a model name for a subcircuit definition.





No comments:

Post a Comment

arduino - Can I use TI's cc2541 BLE as micro controller to perform operations/ processing instead of ATmega328P AU to save cost?

I am using arduino pro mini (which contains Atmega328p AU ) along with cc2541(HM-10) to process and transfer data over BLE to smartphone. I...