ModelingToolkitStandardLibrary: Electrical Components

Index

Electrical Utilities

ModelingToolkitStandardLibrary.Electrical.OnePort — Function
OnePort(; name, v = nothing, i = nothing)

Component with two electrical pins p and n and current i flows from p to n.

States:

  • v(t): [V] The voltage across component p.v - n.v
  • i(t): [A] The current passing through positive pin

Connectors:

  • p Positive pin
  • n Negative pin
source
ModelingToolkitStandardLibrary.Electrical.DigitalPin — Function
DigitalPin(; name)

A pin in a digital circuit.

States:

  • v(t): [V] The voltage at this pin
  • i(t): [A] The current passing through this pin
  • val(t): The binary value of the pin at this point. A voltage from 0V to 0.8V is a binary value of 0.

A voltage in the range 2.0V to 5.0V is 1. Any other value is X.

source

Analog Components

ModelingToolkitStandardLibrary.Electrical.Resistor — Function
Resistor(; name, R = 1.0, T_ref = 300.15, alpha = 0, T_dep = false)

Generic resistor with optional temperature dependency.

States:

  • See OnePort
  • R(t): [Ω] Resistance (temperature dependent if T_dep = true)

Connectors:

  • p Positive pin
  • n Negative pin
  • heat_portHeatPort (only if T_dep = true) Heat port to model the temperature dependency

Parameters:

  • R: [Ω] Reference resistance
  • T_ref: [K] Reference temperature
  • alpha: [K⁻¹] Temperature coefficient of resistance
  • T_dep: [bool] Temperature dependency
source
ModelingToolkitStandardLibrary.Electrical.IdealOpAmp — Function
IdealOpAmp(; name)

Ideal operational amplifier (norator-nullator pair). The ideal OpAmp is a two-port. The left port is fixed to v1 = 0 and i1 = 0 (nullator). At the right port both any voltage v2 and any current i2 are possible (norator).

States:

See ModelingToolkitStandardLibrary.Magnetic.FluxTubes.TwoPort.

Connectors:

  • p1 Positive pin (left port)
  • p2 Positive pin (right port)
  • n1 Negative pin (left port)
  • n2 Negative pin (right port)
source
ModelingToolkitStandardLibrary.Electrical.Diode — Function
Diode(; name, Is = 1e-6, n = 1, T = 300.15, T_dep = false)

Generic diode with optional temperature dependency.

States

- See [`OnePort`](@ref)

Connectors

- `p` Positive pin
- `n` Negative pin
- `port` [`HeatPort`](@ref) (only if `T_dep = true`) Heat port to model variable temperature dependency

Parameters:

- `Is`: [`A`] Saturation current
- `n`: Ideality factor
- `T`: [K] Constant ambient temperature - only used if T_dep=false
- `T_dep`: [bool] Temperature dependency
source
ModelingToolkitStandardLibrary.Electrical.VariableResistor — Function
VariableResistor(; name, R_ref = 1.0, T_ref = 300.15, R_const = 1e-3, T_dep = false)

Variable resistor with optional temperature dependency.

The total resistance R ∈ [Rconst, Rconst + Rref], where pos is the position of the wiper and Rref is the variable resistance between p and n. The total resistance is then:

R = Rconst + pos * Rref

If T_dep is true, then R also depends on the temperature of the heat port with temperature coefficient alpha. The total resistance is then:

R = Rconst + pos * Rref * (1 + alpha * (port.T - T_ref))

States

- See [`OnePort`](@ref)
- `pos(t)`: Position of the wiper (normally 0-1)
- `R(t)`: Resistance

Connectors

    - `p` Positive pin
    - `n` Negative pin
    - `position` RealInput to set the position of the wiper
    - `port` [`HeatPort`](@ref) Heat port to model the temperature dependency

Parameters

    - `R_ref`: [`Ω`] Resistance at temperature T_ref when fully closed (pos=1.0)
    - `T_ref`: [K] Reference temperature
    - `R_const`: [`Ω`] Constant resistance between p and n
    - `T_dep`: Temperature dependency
    - `alpha`: [K⁻¹] Temperature coefficient of resistance
    - `enforce_bounds`: Enforce bounds for the position of the wiper (0-1)
source
ModelingToolkitStandardLibrary.Electrical.NMOS — Function
NMOS(;name, V_tn, R_DS, lambda)

Creates an N-type MOSFET transistor

# Structural Parameters
    - `use_transconductance`: If `true` the parameter `k_n` needs to be provided, and is used in the calculation of the current
    through the transistor. Otherwise, `mu_n`, `C_ox`, `W`, and `L` need to be provided and are used to calculate the transconductance.

    - `use_channel_length_modulation`: If `true` the channel length modulation effect is taken in to account. In essence this gives
    the drain-source current has a small dependency on the drains-source voltage in the saturation region of operation.

# Connectors
    - `d` Drain Pin
    - `g` Gate Pin
    - `s` Source Pin

# Parameters
    - `mu_n`: Electron mobility
    - `C_ox`: Oxide capacitance (F/m^2)
    - `W`: Channel width (m)
    - `L`: Channel length
    - `k_n`: MOSFET transconductance parameter

Based on the MOSFET models in (Sedra, A. S., Smith, K. C., Carusone, T. C., & Gaudet, V. C. (2021). Microelectronic circuits (8th ed.). Oxford University Press.)

source
ModelingToolkitStandardLibrary.Electrical.PMOS — Function
PMOS(;name, V_tp, R_DS, lambda)

Creates an N-type MOSFET transistor

# Structural Parameters
    - `use_transconductance`: If `true` the parameter `k_p` needs to be provided, and is used in the calculation of the current
    through the transistor. Otherwise, `mu_n`, `C_ox`, `W`, and `L` need to be provided and are used to calculate the transconductance.

    - `use_channel_length_modulation`: If `true` the channel length modulation effect is taken in to account. In essence this gives
    the drain-source current has a small dependency on the drains-source voltage in the saturation region of operation.

# Connectors
    - `d` Drain Pin
    - `g` Gate Pin
    - `s` Source Pin

# Parameters
    - `mu_p`: Electron mobility
    - `C_ox`: Oxide capacitance (F/m^2)
    - `W`: Channel width (m)
    - `L`: Channel length
    - `k_p`: MOSFET transconductance parameter

Based on the MOSFET models in (Sedra, A. S., Smith, K. C., Carusone, T. C., & Gaudet, V. C. (2021). Microelectronic circuits (8th ed.). Oxford University Press.)

source
ModelingToolkitStandardLibrary.Electrical.PNP — Function
PNP(;name, B_F, B_R, Is, V_T, V_A, phi_C, phi_E, Z_C, Z_E, Tau_f, Tau_r, C_jC0, C_jE0, C_CS, gamma_C, gamma_E, NF, NR)

Creates a PNP Bipolar Junction Transistor following a modified Ebers-Moll model. Includes an optional substrate pin and optional Early voltage effect.

# Structural Parameters
    - `use_substrate`: If `true`, a substrate pin connector is available. If `false` it is 
    assumed the substrate is connected to the collector pin.

    - `use_Early`: If `true`, the Early effect is modeled, which takes in to account the effect 
    collector-base voltage variations have on the collector-base depletion region. In many cases this
    effectively means that the collector current has a dependency on the collector-emitter voltage.

    - `use_advanced_continuation`: When false, the `C_jC` and `C_jE` non-linear capacitance curves use 
    a simplified linear continuation starting when `V_CB` and `V_EB` are 0, respectively. If `true`, the `Z_C` and `Z_E` parameters 
    are used to start the linear continuation at `Phi_C - Z_C` and `Phi_E - Z_E`. 

# Connectors
    - `b` Base Pin
    - `c` Collector Pin
    - `e` Emitter Pin
    - `s` Substrate Pin, only available when `use_substrate = true`

# Parameters
    - `B_F`: Forward beta
    - `B_R`: Reverse beta
    - `Is`: Saturation current
    - `V_T`: Thermal voltage at 300K
    - `V_A`: Inverse Early voltage
    - `phi_C`: Collector junction exponent
    - `phi_E`: Emitter junction exponent
    - `Z_C`: Collector junction offset
    - `Z_E`: Emitter junction offset 
    - `Tau_f`: Forward transit time
    - `Tau_r`: Reverse transit time
    - `C_jC0`: Collector junction capacitance coefficient
    - `C_jE0`: Emitter junction capacitance coefficient
    - `C_CS`: Collector-substrate capacitance
    - `gamma_C`: Collector junction exponent
    - `gamma_E`: Emitter junction exponent
    - `NF`: Forward emission coefficient
    - `NR`: Reverse emission coefficient
source
ModelingToolkitStandardLibrary.Electrical.NPN — Function
NPN(;name, B_F, B_R, Is, V_T, V_A, phi_C, phi_E, Z_C, Z_E, Tau_f, Tau_r, C_jC0, C_jE0, C_CS, gamma_C, gamma_E, NF, NR)

Creates an NPN Bipolar Junction Transistor following a modified Ebers-Moll model. Includes an optional substrate pin and optional Early voltage effect.

# Structural Parameters
    - `use_substrate`: If `true`, a substrate pin connector is available. If `false` it is 
    assumed the substrate is connected to the collector pin.

    - `use_Early`: If `true`, the Early effect is modeled, which takes in to account the effect 
    collector-base voltage variations have on the collector-base depletion region. In many cases this
    effectively means that the collector current has a dependency on the collector-emitter voltage.

    - `use_advanced_continuation`: When false, the `C_jC` and `C_jE` non-linear capacitance curves use 
    a simplified linear continuation starting when `V_BC` and `V_BE` are 0, respectively. If `true`, the `Z_C` and `Z_E` parameters 
    are used to start the linear continuation at `Phi_C - Z_C` and `Phi_E - Z_E`. 

# Connectors
    - `b` Base Pin
    - `c` Collector Pin
    - `e` Emitter Pin
    - `s` Substrate Pin, only available when `use_substrate = true`

# Parameters
    - `B_F`: Forward beta
    - `B_R`: Reverse beta
    - `Is`: Saturation current
    - `V_T`: Thermal voltage at 300K
    - `V_A`: Inverse Early voltage
    - `phi_C`: Collector junction exponent
    - `phi_E`: Emitter junction exponent
    - `Z_C`: Collector junction offset
    - `Z_E`: Emitter junction offset 
    - `Tau_f`: Forward transit time
    - `Tau_r`: Reverse transit time
    - `C_jC0`: Collector junction capacitance coefficient
    - `C_jE0`: Emitter junction capacitance coefficient
    - `C_CS`: Collector-substrate capacitance
    - `gamma_C`: Collector junction exponent
    - `gamma_E`: Emitter junction exponent
    - `NF`: Forward emission coefficient
    - `NR`: Reverse emission coefficient
source

Analog Sensors

ModelingToolkitStandardLibrary.Electrical.VoltageSensor — Function

VoltageSensor(; name)

Creates a circuit component that measures the voltage across it. Analogous to an ideal voltmeter.

States:

  • v(t): [V] The voltage difference from positive to negative pin p.v - n.v

Connectors:

  • p Positive pin
  • n Negative pin
source
ModelingToolkitStandardLibrary.Electrical.PowerSensor — Function

PowerSensor(; name)

Combines a VoltageSensor and a CurrentSensor to measure the power being consumed by a circuit.

States:

Connectors:

source

Analog Sources