0
\$\begingroup\$

I have searched on google but I have not found a way to put different values in the variables of the same symbol placed more than once.

enter image description here

Each component "X11, X12..." etc, are the same, and in each have {RA} and {RB}, and I would like to simulate the entire circuit with different values of RA and RB in each.

\$\endgroup\$
5
  • \$\begingroup\$ So you want to set a global variable for RA/RB? When you created X# did you define RA/RB by editing their component attribute to "{X}",aka {RB} or {RA}? \$\endgroup\$
    – earl
    Commented May 20, 2022 at 16:42
  • \$\begingroup\$ you could try .param RA 1k and see if that works. \$\endgroup\$
    – earl
    Commented May 20, 2022 at 16:46
  • 1
    \$\begingroup\$ My global variables are {RA} and {RB}, and when I use the same symbol to create an "array" I can´t change {RA} and {RB} individually for each symbol that I use. If I use .param RA 1k or .param list RA 1k 10k 100k, all resistances on all symbols will change to the same, and I need change {RA} and {RB} for each symbol. \$\endgroup\$ Commented May 20, 2022 at 17:07
  • \$\begingroup\$ Can you edit your question to add an image of the "Component Attribute Editor" box that that pops up when you try to right-click on one of your instances? \$\endgroup\$
    – Ste Kulov
    Commented May 21, 2022 at 2:55
  • 1
    \$\begingroup\$ I know there's at least one other answer that deals with this, but you need to add, for example, {RA1} to the first subcircuit, {RA2} to the 2nd, etc, and define, each, separately, as .param RA1=1k RA2=2k ..... \$\endgroup\$ Commented May 21, 2022 at 18:07

2 Answers 2

3
\$\begingroup\$

These are the contents of the opamp.sub (installed by the LTSpice) file for an almost ideal opamp with two parameters:

.subckt opamp 1 2 3
G1 0 3 2 1 {Aol}
R3 3 0 1.
C3 3 0 {Aol/GBW/6.28318530717959}
.ends opamp

Whenever you use this model (".lib opamp.sub") you define these parameters at the "SpiceLines" of the parameter selection (right-click each symbol):

enter image description here

You can make them visible at the schematic by selecting the 'X's in the respective column.

\$\endgroup\$
1
\$\begingroup\$

Let's say you have this simple circuit. You would like to test the circuit by varying the values of R1 and checking the response at various points. model

Here's how you could do that:

  1. Define R1's component parameter with a variable (CTRL-right-click), and for "Value" enter your variable name "{X}" . You must include the curly braces because this tells spice it is a parameter you'd like to edit in the future. The component's displayed value should show up as "R1 {X}" now.
  2. Add a parameter command to define which values you'd like to assign to R1. You can define multiple values and use the .step command to "step" through each .step param X list 1k 2k
\$\endgroup\$
1
  • 1
    \$\begingroup\$ Lets say that you want to make a symbol of the resistor and diode, then, in another circuit, you´ll use that symbol many times. Now, you want vary the variable {X}, but this have to be different for each symbol instanced. I mean, you have the same symbol and in each, I want to define different values for the resistance {X}, but I only have the variable {X}, and I would like have a different {X} for each symbol. I don´t want to create a symbol for each elemnt of an array that have the same component cell. \$\endgroup\$ Commented May 20, 2022 at 17:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.