Languages

CommunityCategory: XMODELDifference between the ‘cap_sw’ and ‘cap_var’ primitives

XMODEL

Difference between the ‘cap_sw’ and ‘cap_var’ primitives

SA Support Team Staff 2020-06-10

What is the difference between the 'cap_sw' and 'cap_var' primitives?

1 Answers
Best Answer
SA Support Team Staff 2020-06-10

Both the 'cap_sw' and 'cap_var' primitives describe a capacitor of which capacitance can vary. The key difference between the two lies in what controls the capacitance. For example, the capacitance of the 'cap_sw' primitive is controlled by the input signal 'C'. On the other hand, the capacitance of the 'cap_var' primitive varies with the voltage across its two terminals, 'pos' and 'neg'.
The following two examples illustrate the difference between the two primitives. Both the examples measure the voltage Vout of a capacitor as it is charged by a fixed current of I0=3mA. The voltage is expected to increase linearly with a slope of I0/C, where C is the capacitance.
The first example uses the 'cap_sw' primitive, of which capacitance is controlled by the input signal 'C'. The 'C' signal starts at 30pF and switches to 60pF at 20ns. As expected, the slope of the Vout waveform changes from 3mA/30pF=0.1V/ns to 3mA/60pF=0.05V/ns at 20ns.


The second example uses the 'cap_var' primitive, of which capacitance varies with the voltage across its two terminals. The 'cap_var' primitive has its 'C' parameter defined as '\{30.0p, 3.0, 60.0p}, which means the capacitor has a capacitance of 30pF when the voltage is below 3.0V and 60pF above 3.0V. The simulated waveform shows that the Vout waveform initially rises with a slope of 3mA/30pF=0.1V/ns. As the capacitor voltage reaches 3.0V, the slope changes to 3mA/60pF=0.05V/ns.


For more information, please refer to the documentations on the 'cap_sw' (link) and 'cap_var' (link) primitives.