MATLAB: How to specify initial conditions for a Capacitor (trapped charge) in the Power Systems Blockset 2.2 (R12.1)

Simscape Electrical

How can I specify initial conditions for a Capacitor (trapped charge) in the Power Systems Blockset 2.2 (R12.1)?
I wish to create a Resistor/Capacitor series circuit and examine the discharge rate of the Capacitor. Can I specify initial conditions (trappped charge) for a Capacitor?

Best Answer

You can use the Powergui Block to specify any initial condition ( Capacitor initial voltage, or Inductance initial current). Put the Powergui Block into the model then double-click on it. In the Tools menu, choose "Initial values of state variables" and "Display or modify initial values". The Powergui will now display the list of states variables for the circuit. The names of the states variables follow this rule:
Capacitor voltages start with the prefix : Uc_
Inductance current start with the prefix : Il_
The prefixes are followed by the name of the block where the device is found. Now you can reset to zero all the initial states by clicking on the appropriate button, then select "Uc_Series RLC Branch" variable and specify an initial voltage in the field on the top of the list. Click apply then start the simulation to see the effect of this initial conditions.