Skip to content
LIBRARY
Analog.Semiconductors.Diode.md

Analog.Semiconductors.Diode ​

Exponential diode with a parallel ohmic resistance, translated from MSL.

R is a parallel resistance across the terminals, not a series resistance; it keeps the Jacobian non-singular in deep reverse, where the exponential has saturated at -Ids. No series resistance and no charge model, so no reverse recovery.

Temperature ​

With use_temperature_dependency = true the thermal voltage becomes k T / q and the saturation current carries the SPICE law:

With it false the junction uses the fixed Vt parameter.

Modes ​

Both flags default to false, which reproduces MSL. use_heat_port couples port; otherwise the device sits at T. MSL ties the two together through ConditionalHeatPort(useHeatPort = useTemperatureDependency), so set both true for a heated device.

Note that the MSL default card is leaky: Ids = 1 µA and Vt = 0.04, so 0.65 V is past the Maxexp knee at 7.4 A.

Connectors ​

  • p anode, n cathode

  • port heat port, active when use_heat_port = true

Reference ​

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

This component extends from ElectricalComponents.Analog.Interfaces.OnePort

Usage ​

ElectricalComponents.Analog.Semiconductors.Diode(Ids=1.0e-6, Vt=0.04, Maxexp=15.0, R=1.0e8, EG=1.11, N=1.0, TNOM=300.15, XTI=3.0, T=293.15)

Parameters: ​

NameDescriptionUnitsDefault value
use_heat_portCouple to port; when false the device sits at T and port can be left unconnected–false
use_temperature_dependencyScale the saturation current with temperature–false
IdsSaturation currentA1.0e-6
VtVoltage equivalent of temperature, k*T/(q*N); used only when use_temperature_dependency = falseV0.04
MaxexpMaximum exponent before the exponential is continued linearly–15.0
RParallel ohmic resistance across the terminalsΩ1.0e8
EGActivation energy (bandgap) in eV–1.11
NEmission coefficient–1.0
TNOMReference temperature at which Ids is quotedK300.15
XTITemperature exponent of the saturation current–3.0
TFixed device temperature, used when use_heat_port = falseK293.15

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_tThermal voltage k*T_dev/q at the device temperatureV
x_dArgument of the linearly-continued exponential–
e_dThe linearly-continued exponential itself–
idJunction current, without the parallel resistanceA
LossPowerPower dissipated in the deviceW

Behavior ​

Source ​

dyad
"""
Exponential diode with a parallel ohmic resistance, translated from MSL.

```math
i = I_{ds} \left( \mathrm{exlin}(v / V_t, M_{exp}) - 1 \right) + \frac{v}{R},
\qquad
\mathrm{exlin}(x, M) = \begin{cases}
  e^{M} (1 + x - M) & x > M \\
  e^{x}             & x \le M
\end{cases}
```
`R` is a *parallel* resistance across the terminals, not a series resistance; it keeps
the Jacobian non-singular in deep reverse, where the exponential has saturated at
`-Ids`. No series resistance and no charge model, so no reverse recovery.

## Temperature

With `use_temperature_dependency = true` the thermal voltage becomes `k T / q` and the
saturation current carries the SPICE law:
```math
i = i_d \left(\frac{T}{T_{NOM}}\right)^{X_{TI}/N}
    \exp\!\left(\frac{E_G}{N\,v_t(T)}\left(\frac{T}{T_{NOM}} - 1\right)\right)
    + \frac{v}{R}
```
With it false the junction uses the fixed `Vt` parameter.

## Modes

**Both flags default to `false`, which reproduces MSL.** `use_heat_port` couples `port`;
otherwise the device sits at `T`. MSL ties the two together through
`ConditionalHeatPort(useHeatPort = useTemperatureDependency)`, so set both true for a
heated device.

Note that the MSL default card is leaky: `Ids = 1 µA` and `Vt = 0.04`, so 0.65 V is past
the `Maxexp` knee at 7.4 A.

## Connectors

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

## Reference

`Modelica.Electrical.Analog.Semiconductors.Diode`, Modelica Standard Library. Parameter
names and defaults are MSL's, verbatim. The model with breakdown and series resistance
is `Diode2`.
"""
component Diode
  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 false the device sits at `T` and `port` can be left unconnected"
  structural parameter use_heat_port::Boolean = false
  "Scale the saturation current with temperature"
  structural parameter use_temperature_dependency::Boolean = false
  "Saturation current"
  parameter Ids::Current = 1.0e-6
  "Voltage equivalent of temperature, `k*T/(q*N)`; used only when `use_temperature_dependency = false`"
  parameter Vt::Voltage = 0.04
  "Maximum exponent before the exponential is continued linearly"
  parameter Maxexp::Real(min = eps(Float64)) = 15.0
  "Parallel ohmic resistance across the terminals"
  parameter R::Resistance = 1.0e8
  "Activation energy (bandgap) in eV"
  parameter EG::Real = 1.11
  "Emission coefficient"
  parameter N::Real = 1.0
  "Reference temperature at which `Ids` is quoted"
  parameter TNOM::Temperature = 300.15
  "Temperature exponent of the saturation current"
  parameter XTI::Real = 3.0
  "Fixed device temperature, used when `use_heat_port = false`"
  parameter T::Temperature = 293.15
  "Device temperature"
  variable T_dev::Temperature
  "Thermal voltage `k*T_dev/q` at the device temperature"
  variable vt_t::Voltage
  "Argument of the linearly-continued exponential"
  variable x_d::Real
  "The linearly-continued exponential itself"
  variable e_d::Real
  "Junction current, without the parallel resistance"
  variable id::Current
  "Power dissipated in the device"
  variable LossPower::Power
relations
  assert(T_dev > 0.0, "Diode: device temperature must be positive")
  if use_heat_port
    T_dev = port.T
    port.Q_flow = -LossPower
  else
    T_dev = T
    port.T = T
    port.Q_flow = 0
  end
  "Thermal voltage at the device temperature; `k/q` = 8.617333262145179e-5 V/K"
  vt_t = 8.617333262145179e-5 * T_dev
  if use_temperature_dependency
    x_d = v / (N * vt_t)
    "SPICE saturation-current temperature law, bandgap held at `EG`. Inert at `T_dev = TNOM`"
    i = id * (T_dev / TNOM) ^ (XTI / N) * exp((T_dev / TNOM - 1.0) * EG / (N * vt_t)) + v / R
  else
    x_d = v / Vt
    i = id + v / R
  end
  "Exponential continued linearly above `Maxexp`, so the current cannot overflow"
  e_d = ifelse(x_d > Maxexp, exp(Maxexp) * (1.0 + x_d - Maxexp), exp(x_d))
  id = Ids * (e_d - 1.0)
  LossPower = i * v
metadata {
  "Dyad": {
    "labels": [{"label": "$(instance)", "x": 500, "y": 830, "rot": 0}],
    "icons": {"default": "dyad://ElectricalComponents/Diode.svg"}
  }
}
end
Flattened Source
dyad
"""
Exponential diode with a parallel ohmic resistance, translated from MSL.

```math
i = I_{ds} \left( \mathrm{exlin}(v / V_t, M_{exp}) - 1 \right) + \frac{v}{R},
\qquad
\mathrm{exlin}(x, M) = \begin{cases}
  e^{M} (1 + x - M) & x > M \\
  e^{x}             & x \le M
\end{cases}
```
`R` is a *parallel* resistance across the terminals, not a series resistance; it keeps
the Jacobian non-singular in deep reverse, where the exponential has saturated at
`-Ids`. No series resistance and no charge model, so no reverse recovery.

## Temperature

With `use_temperature_dependency = true` the thermal voltage becomes `k T / q` and the
saturation current carries the SPICE law:
```math
i = i_d \left(\frac{T}{T_{NOM}}\right)^{X_{TI}/N}
    \exp\!\left(\frac{E_G}{N\,v_t(T)}\left(\frac{T}{T_{NOM}} - 1\right)\right)
    + \frac{v}{R}
```
With it false the junction uses the fixed `Vt` parameter.

## Modes

**Both flags default to `false`, which reproduces MSL.** `use_heat_port` couples `port`;
otherwise the device sits at `T`. MSL ties the two together through
`ConditionalHeatPort(useHeatPort = useTemperatureDependency)`, so set both true for a
heated device.

Note that the MSL default card is leaky: `Ids = 1 µA` and `Vt = 0.04`, so 0.65 V is past
the `Maxexp` knee at 7.4 A.

## Connectors

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

## Reference

`Modelica.Electrical.Analog.Semiconductors.Diode`, Modelica Standard Library. Parameter
names and defaults are MSL's, verbatim. The model with breakdown and series resistance
is `Diode2`.
"""
component Diode
  "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 false the device sits at `T` and `port` can be left unconnected"
  structural parameter use_heat_port::Boolean = false
  "Scale the saturation current with temperature"
  structural parameter use_temperature_dependency::Boolean = false
  "Saturation current"
  parameter Ids::Current = 1.0e-6
  "Voltage equivalent of temperature, `k*T/(q*N)`; used only when `use_temperature_dependency = false`"
  parameter Vt::Voltage = 0.04
  "Maximum exponent before the exponential is continued linearly"
  parameter Maxexp::Real(min = eps(Float64)) = 15.0
  "Parallel ohmic resistance across the terminals"
  parameter R::Resistance = 1.0e8
  "Activation energy (bandgap) in eV"
  parameter EG::Real = 1.11
  "Emission coefficient"
  parameter N::Real = 1.0
  "Reference temperature at which `Ids` is quoted"
  parameter TNOM::Temperature = 300.15
  "Temperature exponent of the saturation current"
  parameter XTI::Real = 3.0
  "Fixed device temperature, used when `use_heat_port = false`"
  parameter T::Temperature = 293.15
  "Device temperature"
  variable T_dev::Temperature
  "Thermal voltage `k*T_dev/q` at the device temperature"
  variable vt_t::Voltage
  "Argument of the linearly-continued exponential"
  variable x_d::Real
  "The linearly-continued exponential itself"
  variable e_d::Real
  "Junction current, without the parallel resistance"
  variable id::Current
  "Power dissipated in the device"
  variable LossPower::Power
relations
  v = p.v - n.v
  i = p.i
  p.i + n.i = 0
  assert(T_dev > 0.0, "Diode: device temperature must be positive")
  if use_heat_port
    T_dev = port.T
    port.Q_flow = -LossPower
  else
    T_dev = T
    port.T = T
    port.Q_flow = 0
  end
  "Thermal voltage at the device temperature; `k/q` = 8.617333262145179e-5 V/K"
  vt_t = 8.617333262145179e-5 * T_dev
  if use_temperature_dependency
    x_d = v / (N * vt_t)
    "SPICE saturation-current temperature law, bandgap held at `EG`. Inert at `T_dev = TNOM`"
    i = id * (T_dev / TNOM) ^ (XTI / N) * exp((T_dev / TNOM - 1.0) * EG / (N * vt_t)) + v / R
  else
    x_d = v / Vt
    i = id + v / R
  end
  "Exponential continued linearly above `Maxexp`, so the current cannot overflow"
  e_d = ifelse(x_d > Maxexp, exp(Maxexp) * (1.0 + x_d - Maxexp), exp(x_d))
  id = Ids * (e_d - 1.0)
  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.