Ultracap charge and discharge simulation


I am trying to simulate a charge and discharge of ultracapacitors.
I put UC between a DC power source and resistor for the discharge.
I would like to add a switch which commutes between these positions.
For that, I use 2 mosfets driven from a square voltage source but I would like to invert one.
I don’ like this method, do someone has a better idea?

Thank you for your help!

Hi Guillaume

Please try the example circuit test - ultracapacitor (58F 16V).psimsch (231.7 KB)


Hi Albert

This is what I needed!

Thank you very much