Capacitor
Physical NetworksThe Capacitor block represents an ideal linear two-terminal capacitor that stores energy in an electrostatic field. The component relates the current through its branch to the time rate of change of the voltage across its positive terminal p and negative terminal n.
As a dynamic physical element, the capacitor contributes a continuous state variable to the differential-algebraic equation (DAE) system. During simulation, the state variable is integrated alongside the nodal algebraic equations using stiff implicit numerical solvers such as TR-BDF2.
Real-World Analog: Represents an electrolytic filter capacitor, ceramic decoupling cap, or supercapacitor storing charge between two conductors.
Mathematical Model
The constituent equation for the linear capacitor is:
Where:
V_p(t)is the voltage at positive terminalp(V).V_n(t)is the voltage at negative terminaln(V).Cis the capacitance in Farads (F).i(t)is the current flowing frompinton(A).
Inputs & Outputs
| Direction | ID | Label | Type | Status |
|---|---|---|---|---|
| → In | p |
+ | number | Required |
| → In | n |
- | number | Required |
| → In | H |
H | number | Optional |
| ← Out | q_diss |
Q_diss | number | Output |
Parameters
| Parameters | Label | Type | Default | Description |
|---|---|---|---|---|
capacitance |
Capacitance (F) | number | 0.000001 |
|
initial_voltage |
Initial Voltage (V) | number | 0 |
|
esr |
Series Resistance (ESR) | number | 0 |
Equivalent Series Resistance in Ohms (0 = ideal lossless) |
leakage_resistance |
Leakage Resistance (R_leak) | number | 0 |
Parallel insulation/dielectric leakage resistance in Ohms (0 = infinite/lossless) |
Usage Examples
RC Charging Transient
In examples/basic-capacitor.json, a 10 V step charges a 1000 µF capacitor through a 1000 Ω resistor to Ground, displaying the exponential charging curve with time constant τ = 1.0 s.
Decoupling Capacitor
Smooth rapid voltage fluctuations on a power rail:
PowerRail → Capacitor(capacitance: 100e-6) → Ground
Remarks & Best Practices
- Continuous State: The capacitor voltage is tracked as an integrated continuous state variable.
- Initial Conditions: Setting
initial_voltagedefines the charge state before simulation starts. - Stiff Stability: Solved stably via implicit solvers without artificial parasitic resistances.
- Conserving Ports: Both terminals are acausal physical ports belonging to the electrical domain.
Related Components
- Resistor: Dissipative resistive component
- Inductor: Magnetic energy storage element
- VoltageSensor: Measure voltage across the capacitor
- Ground: Reference potential node