2
\$\begingroup\$

I am building my own simulation parts in Orcad 16.6: I can build a schematic and take the generated netlist to use as a stand-alone component, but I want to be able to change parameters inside the model. How do you pass parameters from capture to pspice?

As an example, a voltage source has a parameter that sets the voltage. A resistor has value, tolerance and other parameters, depending where you take the part from.

So, can anyone help me with the proper syntax and maybe other tips?

\$\endgroup\$
4
\$\begingroup\$

After a lot of searching online and reading the reference guide and user manual, I found the simple answer.

First, the definition of the circuit has to be like:

 .Subckt <name of main part> <name of pins, as used in net labels and definition …> <PARAMS: parameter1=default value parameter2=default value …>

Best way to see how this works is through an example, so I built a current limited voltage supply:

* source VDC_ILIM2
* voltage supply with current limitation
* parameters should be U_set and I_set
*
.subckt VDC_ILIM2 V_OUT PARAMS: U_set=5 I_set=10m
S_S1         V_INT2 V_OUT SW_CTRL 0 _S1
RS_S1         SW_CTRL 0 1G
.MODEL         _S1 VSWITCH Roff=1e6 Ron=1m Voff=0.0V Von=1.0V
V_V1         V_INT1 0 {U_set}
V_I_mon         V_INT1 V_INT2 0Vdc
E_ABM1         SW_CTRL 0 VALUE { {1e9*(I_set-abs(I(V_I_mon)))} }
R_R2         0 V_OUT R_R2 1g
.model        R_R2 RES R=1 DEV=0% TC1=0u     
.ends VDC_ILIM2

This works for +/- Voltage settings.

You might also notice that I avoid having sub-circuits defined in the main circuit. This way, you can add parameters in the sub-circuit. Otherwise, the definition of the parameters is not passed to the sub-circuits. This happens because in PSpice you define connections on the "outside" of the part and values are within the model, not accessible from an upper level (e.g. circuit definition or parameter).

I hope this helps someone else too :)

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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