D

Diode

Physical Networks
Run the live example Free · no sign-up · runs in your browser

Nonlinear electrical diode for rectification, clamping, and inductive flyback protection in acausal MNA circuits. Supports both a numerically smooth piecewise-linear model (piecewise) and the physical exponential Shockley junction model (shockley).

Mathematical Model

Let Vd=V+−V−V_d = V_+ - V_- be the anode-to-cathode voltage and II the current flowing from anode (p) to cathode (n):

Vd≈{Vf+Ron(I−If)piecewise forwardI/Goffpiecewise reverseI=Is(eVj/(nVt)−1)+GoffVj,Vd=Vj+IRsV_d \approx \begin{cases} V_f + R_{\text{on}}(I - I_f) & \text{piecewise forward} \\ I / G_{\text{off}} & \text{piecewise reverse} \end{cases} \qquad I = I_s \left(e^{V_j / (n V_t)} - 1\right) + G_{\text{off}} V_j, \quad V_d = V_j + I R_s

Power dissipated as heat is Qdiss=Vd⋅IQ_{\text{diss}} = V_d \cdot I, exported on q_diss and the optional H thermal conserving port.

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
model Diode Model select piecewise Piecewise linear is fast and numerically well-conditioned; Shockley models the physical exponential junction
forwardVoltage Forward Voltage (Vf) number 0.7 Forward voltage drop threshold for the piecewise model
onResistance On Resistance (Ron) number 0.05 Forward-biased dynamic resistance in the piecewise model
offConductance Off Conductance (Goff) number 0.000001 Reverse-bias leakage conductance (1 / Roff)
saturationCurrent Saturation Current (Is) number 1e-12 Reverse saturation current for the Shockley model
idealityFactor Ideality Factor (n) number 1 Emission coefficient / ideality factor (typically 1.0 to 2.0)
seriesResistance Series Resistance (Rs) number 0.05 Ohmic bulk/contact resistance in the Shockley model
thermalVoltage Thermal Voltage (Vt) number 0.02585 Thermal voltage kT/q (~25.85 mV at 300 K)

Usage Examples

Example 1: Half-Wave Rectifier

Connect an AC VoltageSource through a Diode to a Resistor and Ground to rectify positive half-cycles.

Example 2: Flyback Protection

Place a Diode anti-parallel across a DCMotor or Inductor to clamp inductive voltage spikes.

Remarks & Best Practices

  • Smooth Transition: The piecewise model uses a C∞C^\infty smooth knee transition so Newton-Raphson converges reliably without chattering.
  • Thermal Coupling: Connect the optional H port to a ThermalMass to simulate diode self-heating.

Related Components