Skip to content
LIBRARY
Analog.Semiconductors.Diode2.md

Analog.Semiconductors.Diode2 ​

Diode with series resistance and reverse breakdown, translated from MSL.

The junction current has three branches in the junction voltage vd:

Misplaced &

with VdMax = Vf + N*Vt, and iVdMax/diVdMax the value and slope of the middle branch there. Both seams match in value and slope, so i_d(v_d) is C1.

The series resistance closes the loop implicitly:

Gp shunts the terminals, outside Rs.

use_heat_port makes Vt follow the port temperature as R T / F; otherwise the Vt parameter applies. It defaults to false, which reproduces MSL — unlike Diode, MSL's Diode2 leaves useHeatPort free rather than tying it to a temperature flag.

Connectors ​

  • p anode, n cathode

  • port heat port, active when use_heat_port = true

Reference ​

Modelica.Electrical.Analog.Semiconductors.Diode2, Modelica Standard Library. Parameter names and defaults are MSL's, verbatim. The simpler model without series resistance or breakdown is Diode.

This component extends from ElectricalComponents.Analog.Interfaces.OnePort

Usage ​

ElectricalComponents.Analog.Semiconductors.Diode2(T=293.15, Vf=0.7, Ids=1.0e-13, Rs=16.0, Vt=8.617333262440801e-5 * T, N=1.0, Bv=100.0, Gp=1.0e-6)

Parameters: ​

NameDescriptionUnitsDefault value
use_heat_portCouple to port; when true Vt follows the port temperature–false
TFixed device temperature, used when use_heat_port = falseK293.15
VfForward voltageV0.7
IdsReverse saturation currentA1.0e-13
RsOhmic series resistanceΩ16.0
VtThermal voltage R*T/F; used when use_heat_port = falseV8.617333262440801e-5 * T
NEmission coefficient. Capital N because the cathode pin is n–1.0
BvReverse breakdown voltage magnitudeV100.0
GpParallel conductance across the terminalsS1.0e-6

Connectors ​

  • p - This connector represents an electrical pin with voltage and current as the potential and flow variables, respectively. (Pin)

  • n - This connector represents an electrical pin with voltage and current as the potential and flow variables, respectively. (Pin)

  • port - This connector represents a thermal port with temperature and heat flow as the potential and flow variables, respectively. (HeatPort)

Variables ​

NameDescriptionUnits
vVoltage across the component (between pin p and pin n).V
iCurrent flowing through the component (from pin p to pin n).A
T_devDevice temperatureK
Vt_appliedThermal voltage in forceV
vdJunction voltage: the terminal voltage less the Rs dropV
idJunction currentA
VdMaxLinear-continuation threshold, Vf + N*VtV
iVdMaxJunction current at VdMaxA
diVdMaxJunction conductance at VdMaxS
LossPowerPower dissipated in the deviceW

Behavior ​

Source ​

dyad
"""
Diode with series resistance and reverse breakdown, translated from MSL.

The junction current has three branches in the junction voltage `vd`:
```math
i_d = \\begin{cases}
  -I_{ds}\\left(e^{-(v_d + B_v)/(N V_t)} + 1 - 2 e^{-B_v/(2 N V_t)}\\right)
    & v_d < -B_v/2 \\\\
  I_{ds}\\left(e^{v_d/(N V_t)} - 1\\right)
    & -B_v/2 \\le v_d < V_{dMax} \\\\
  i_{dMax} + (v_d - V_{dMax})\\, g_{dMax}
    & v_d \\ge V_{dMax}
\\end{cases}
```
with `VdMax = Vf + N*Vt`, and `iVdMax`/`diVdMax` the value and slope of the middle
branch there. Both seams match in value and slope, so `i_d(v_d)` is C1.

The series resistance closes the loop implicitly:
```math
v = v_d + i_d R_s, \\qquad i = i_d + v G_p
```
`Gp` shunts the terminals, outside `Rs`.

`use_heat_port` makes `Vt` follow the port temperature as `R T / F`; otherwise the `Vt`
parameter applies. It defaults to `false`, which reproduces MSL — unlike `Diode`, MSL's
`Diode2` leaves `useHeatPort` free rather than tying it to a temperature flag.

## Connectors

  * `p` anode, `n` cathode
  * `port` heat port, active when `use_heat_port = true`

## Reference

`Modelica.Electrical.Analog.Semiconductors.Diode2`, Modelica Standard Library.
Parameter names and defaults are MSL's, verbatim. The simpler model without series
resistance or breakdown is `Diode`.
"""
component Diode2
  extends ElectricalComponents.Analog.Interfaces.OnePort
  "Heat port for thermal-electric simulation"
  port = HeatPort() {"Dyad": {"placement": {"icon": {"x1": 450, "y1": 950, "x2": 550, "y2": 1050}}}}
  "Couple to `port`; when true `Vt` follows the port temperature"
  structural parameter use_heat_port::Boolean = false
  "Fixed device temperature, used when `use_heat_port = false`"
  parameter T::Temperature = 293.15
  "Forward voltage"
  parameter Vf::Voltage = 0.7
  "Reverse saturation current"
  parameter Ids::Current = 1.0e-13
  "Ohmic series resistance"
  parameter Rs::Resistance = 16.0
  "Thermal voltage `R*T/F`; used when `use_heat_port = false`"
  parameter Vt::Voltage = 8.617333262440801e-5 * T
  "Emission coefficient. Capital `N` because the cathode pin is `n`"
  parameter N::Real = 1.0
  "Reverse breakdown voltage magnitude"
  parameter Bv::Voltage = 100.0
  "Parallel conductance across the terminals"
  parameter Gp::Conductance = 1.0e-6
  "Device temperature"
  variable T_dev::Temperature
  "Thermal voltage in force"
  variable Vt_applied::Voltage
  "Junction voltage: the terminal voltage less the `Rs` drop"
  variable vd::Voltage
  "Junction current"
  variable id::Current
  "Linear-continuation threshold, `Vf + N*Vt`"
  variable VdMax::Voltage
  "Junction current at `VdMax`"
  variable iVdMax::Current
  "Junction conductance at `VdMax`"
  variable diVdMax::Conductance
  "Power dissipated in the device"
  variable LossPower::Power
relations
  assert(Bv > 0.0, "Diode2: Bv must be greater than zero")
  assert(Vf > 0.0, "Diode2: Vf must be greater than zero")
  assert(Vt > 0.0, "Diode2: Vt must be greater than zero")
  guess vd = 0
  if use_heat_port
    T_dev = port.T
    Vt_applied = 8.617333262440801e-5 * T_dev
    port.Q_flow = -LossPower
  else
    T_dev = T
    Vt_applied = Vt
    port.T = T
    port.Q_flow = 0
  end
  VdMax = Vf + N * Vt_applied
  iVdMax = Ids * (exp(VdMax / (N * Vt_applied)) - 1.0)
  diVdMax = Ids * exp(VdMax / (N * Vt_applied)) / (N * Vt_applied)
  "Breakdown, exponential, and linear-continuation branches"
  id = ifelse(vd < -Bv / 2.0, -Ids * (exp(-(vd + Bv) / (N * Vt_applied)) + 1.0 - 2.0 * exp(-Bv / (2.0 * N * Vt_applied))), ifelse(vd < VdMax, Ids * (exp(vd / (N * Vt_applied)) - 1.0), iVdMax + (vd - VdMax) * diVdMax))
  v = vd + id * Rs
  i = id + v * Gp
  LossPower = i * v
metadata {
  "Dyad": {
    "labels": [{"label": "$(instance)", "x": 500, "y": 830, "rot": 0}],
    "icons": {"default": "dyad://ElectricalComponents/Diode.svg"}
  }
}
end
Flattened Source
dyad
"""
Diode with series resistance and reverse breakdown, translated from MSL.

The junction current has three branches in the junction voltage `vd`:
```math
i_d = \\begin{cases}
  -I_{ds}\\left(e^{-(v_d + B_v)/(N V_t)} + 1 - 2 e^{-B_v/(2 N V_t)}\\right)
    & v_d < -B_v/2 \\\\
  I_{ds}\\left(e^{v_d/(N V_t)} - 1\\right)
    & -B_v/2 \\le v_d < V_{dMax} \\\\
  i_{dMax} + (v_d - V_{dMax})\\, g_{dMax}
    & v_d \\ge V_{dMax}
\\end{cases}
```
with `VdMax = Vf + N*Vt`, and `iVdMax`/`diVdMax` the value and slope of the middle
branch there. Both seams match in value and slope, so `i_d(v_d)` is C1.

The series resistance closes the loop implicitly:
```math
v = v_d + i_d R_s, \\qquad i = i_d + v G_p
```
`Gp` shunts the terminals, outside `Rs`.

`use_heat_port` makes `Vt` follow the port temperature as `R T / F`; otherwise the `Vt`
parameter applies. It defaults to `false`, which reproduces MSL — unlike `Diode`, MSL's
`Diode2` leaves `useHeatPort` free rather than tying it to a temperature flag.

## Connectors

  * `p` anode, `n` cathode
  * `port` heat port, active when `use_heat_port = true`

## Reference

`Modelica.Electrical.Analog.Semiconductors.Diode2`, Modelica Standard Library.
Parameter names and defaults are MSL's, verbatim. The simpler model without series
resistance or breakdown is `Diode`.
"""
component Diode2
  "Positive electrical pin."
  p = Pin() {
    "Dyad": {
      "placement": {"icon": {"iconName": "pos", "x1": -50, "y1": 450, "x2": 50, "y2": 550}}
    }
  }
  "Negative electrical pin."
  n = Pin() {
    "Dyad": {
      "placement": {"icon": {"iconName": "neg", "x1": 950, "y1": 450, "x2": 1050, "y2": 550}}
    }
  }
  "Voltage across the component (between pin p and pin n)."
  variable v::Voltage
  "Current flowing through the component (from pin p to pin n)."
  variable i::Current
  "Heat port for thermal-electric simulation"
  port = HeatPort() {"Dyad": {"placement": {"icon": {"x1": 450, "y1": 950, "x2": 550, "y2": 1050}}}}
  "Couple to `port`; when true `Vt` follows the port temperature"
  structural parameter use_heat_port::Boolean = false
  "Fixed device temperature, used when `use_heat_port = false`"
  parameter T::Temperature = 293.15
  "Forward voltage"
  parameter Vf::Voltage = 0.7
  "Reverse saturation current"
  parameter Ids::Current = 1.0e-13
  "Ohmic series resistance"
  parameter Rs::Resistance = 16.0
  "Thermal voltage `R*T/F`; used when `use_heat_port = false`"
  parameter Vt::Voltage = 8.617333262440801e-5 * T
  "Emission coefficient. Capital `N` because the cathode pin is `n`"
  parameter N::Real = 1.0
  "Reverse breakdown voltage magnitude"
  parameter Bv::Voltage = 100.0
  "Parallel conductance across the terminals"
  parameter Gp::Conductance = 1.0e-6
  "Device temperature"
  variable T_dev::Temperature
  "Thermal voltage in force"
  variable Vt_applied::Voltage
  "Junction voltage: the terminal voltage less the `Rs` drop"
  variable vd::Voltage
  "Junction current"
  variable id::Current
  "Linear-continuation threshold, `Vf + N*Vt`"
  variable VdMax::Voltage
  "Junction current at `VdMax`"
  variable iVdMax::Current
  "Junction conductance at `VdMax`"
  variable diVdMax::Conductance
  "Power dissipated in the device"
  variable LossPower::Power
relations
  v = p.v - n.v
  i = p.i
  p.i + n.i = 0
  assert(Bv > 0.0, "Diode2: Bv must be greater than zero")
  assert(Vf > 0.0, "Diode2: Vf must be greater than zero")
  assert(Vt > 0.0, "Diode2: Vt must be greater than zero")
  guess vd = 0
  if use_heat_port
    T_dev = port.T
    Vt_applied = 8.617333262440801e-5 * T_dev
    port.Q_flow = -LossPower
  else
    T_dev = T
    Vt_applied = Vt
    port.T = T
    port.Q_flow = 0
  end
  VdMax = Vf + N * Vt_applied
  iVdMax = Ids * (exp(VdMax / (N * Vt_applied)) - 1.0)
  diVdMax = Ids * exp(VdMax / (N * Vt_applied)) / (N * Vt_applied)
  "Breakdown, exponential, and linear-continuation branches"
  id = ifelse(vd < -Bv / 2.0, -Ids * (exp(-(vd + Bv) / (N * Vt_applied)) + 1.0 - 2.0 * exp(-Bv / (2.0 * N * Vt_applied))), ifelse(vd < VdMax, Ids * (exp(vd / (N * Vt_applied)) - 1.0), iVdMax + (vd - VdMax) * diVdMax))
  v = vd + id * Rs
  i = id + v * Gp
  LossPower = i * v
metadata {
  "Dyad": {
    "labels": [{"label": "$(instance)", "x": 500, "y": 830, "rot": 0}],
    "icons": {"default": "dyad://ElectricalComponents/Diode.svg"}
  }
}
end


Test Cases ​

No test cases defined.