Following the adaptations of variable resistors and inductors within PSIM, this article focuses on the creation of a variable capacitor model. This model will allow the users to navigate between different capacitances and even utilize cap value look-up tables in a structured manner.

Based on this article, there are four methods to construct a variable capacitor. The most obvious approach would involve modeling it as a controlled voltage source and incorporating feedback to ensure the source aligns with the capacitor equation:

So let’s do that!

Just like the variable inductor case it is advised to create a subcircuit and have your custom circuitry saved there. So again the first step it to create a new subsystem, double click into it, add a voltage controlled voltage source and add the necessary terminal ports for your capacitor:

Now the voltage of this source needs to be set as integral(I/C). This can be done by utilizing a unit value capacitor along with a (current-controlled) current source, according to Method 2 of the aforementioned article. With this method, the requested integral is just the voltage across the unit value capacitor.

What is left now is to measure this voltage and divide it by the value ‘C’ which will be an input to the subcircuit. To implement this math function, we will need two more controlled sources and a math function (2-input) block. The first source will measure the voltage (voltage-controlled voltage source block) and the other will apply the Cvalue based on user input:

To add the Cvalue as user input, a “Input Signal Port” is used for the subsystem along with a voltage-controlled voltage source:

The final step is to divide the two signals [integral(I) / C] and also define their derivatives into the ‘Divide’ block. Omitting the derivative definitions will lead to solver problems later on so don’t forget to add those here.

Now the variable capacitor is complete and is also wrapped in a subcircuit. You can load that subcircuit in a schematic by Navigating to “Subcircuit” and then “Load Subcircuit”. The mathematical expression that governs its operation is implemented using PSIM source and math blocks. To verify its operation the following circuit can be applied:

The simulation files are **attached** to this article.

The ** var_capacitor **subcircuit can be added to any PSIM schematic. The device can be also coupled with a lookup table in order to navigate between different real life capacitors from a vendor’s list.

**Learn More: **

You can find out how to create a variable inductor here

You can find out how to create a variable resistor here