ModelingToolkitStandardLibrary: Electrical Components
Index
- ModelingToolkitStandardLibrary.Electrical.Capacitor
- ModelingToolkitStandardLibrary.Electrical.Conductor
- ModelingToolkitStandardLibrary.Electrical.Current
- ModelingToolkitStandardLibrary.Electrical.CurrentSensor
- ModelingToolkitStandardLibrary.Electrical.Diode
- ModelingToolkitStandardLibrary.Electrical.Ground
- ModelingToolkitStandardLibrary.Electrical.IdealOpAmp
- ModelingToolkitStandardLibrary.Electrical.Inductor
- ModelingToolkitStandardLibrary.Electrical.MultiSensor
- ModelingToolkitStandardLibrary.Electrical.NMOS
- ModelingToolkitStandardLibrary.Electrical.NPN
- ModelingToolkitStandardLibrary.Electrical.OnePort
- ModelingToolkitStandardLibrary.Electrical.PMOS
- ModelingToolkitStandardLibrary.Electrical.PNP
- ModelingToolkitStandardLibrary.Electrical.Pin
- ModelingToolkitStandardLibrary.Electrical.PotentialSensor
- ModelingToolkitStandardLibrary.Electrical.PowerSensor
- ModelingToolkitStandardLibrary.Electrical.Resistor
- ModelingToolkitStandardLibrary.Electrical.VariableResistor
- ModelingToolkitStandardLibrary.Electrical.Voltage
- ModelingToolkitStandardLibrary.Electrical.VoltageSensor
- ModelingToolkitStandardLibrary.Electrical.DigitalPin
Electrical Utilities
ModelingToolkitStandardLibrary.Electrical.Pin — ConstantPin(; name)A pin in an analog circuit.
States:
- v(t): [- V] The voltage at this pin
- i(t): [- A] The current passing through this pin
ModelingToolkitStandardLibrary.Electrical.OnePort — ConstantOnePort(; name, v = 0.0, i = 0.0)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:
- pPositive pin
- nNegative pin
ModelingToolkitStandardLibrary.Electrical.DigitalPin — FunctionDigitalPin(; 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- 0Vto- 0.8Vis a binary value of- 0.
A voltage in the range 2.0V to 5.0V is 1. Any other value is X.
Analog Components
ModelingToolkitStandardLibrary.Electrical.Ground — ConstantGround(; name)Ground node with the potential of zero and connector g. Every circuit must have one ground node.
Connectors:
- g
ModelingToolkitStandardLibrary.Electrical.Resistor — ConstantResistor(; 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:
- pPositive pin
- nNegative 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
ModelingToolkitStandardLibrary.Electrical.Conductor — ConstantConductor(; name, G)Creates an ideal conductor.
States:
See OnePort
Connectors:
- pPositive pin
- nNegative pin
Parameters:
- G: [- S] Conductance
ModelingToolkitStandardLibrary.Electrical.Capacitor — ConstantCapacitor(; name, C, v)Creates an ideal capacitor. Initial voltage of capacitor can be set with v ([V])
States:
See OnePort
Connectors:
- pPositive pin
- nNegative pin
Parameters:
- C: [- F] Capacitance
ModelingToolkitStandardLibrary.Electrical.Inductor — ConstantInductor(; name, L, i)Creates an ideal Inductor. Initial current through inductor can be set with i ([A]).
States:
See OnePort
Connectors:
- pPositive pin
- nNegative pin
Parameters:
- L: [- H] Inductance
ModelingToolkitStandardLibrary.Electrical.IdealOpAmp — ConstantIdealOpAmp(; 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 TwoPort
Connectors:
- p1Positive pin (left port)
- p2Positive pin (right port)
- n1Negative pin (left port)
- n2Negative pin (right port)
ModelingToolkitStandardLibrary.Electrical.Diode — ConstantDiode(; 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 dependencyParameters:
- `Is`: [`A`] Saturation current
- `n`: Ideality factor
- `T`: [K] Constant ambient temperature - only used if T_dep=false
- `T_dep`: [bool] Temperature dependencyModelingToolkitStandardLibrary.Electrical.VariableResistor — ConstantVariableResistor(; 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)`: ResistanceConnectors
    - `p` Positive pin
    - `n` Negative pin
    - `position` RealInput to set the position of the wiper
    - `port` [HeatPort](@ref) Heat port to model the temperature dependencyParameters
    - `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)ModelingToolkitStandardLibrary.Electrical.NMOS — ConstantNMOS(;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 parameterBased 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.)
ModelingToolkitStandardLibrary.Electrical.PMOS — ConstantPMOS(;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 parameterBased 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.)
ModelingToolkitStandardLibrary.Electrical.PNP — ConstantPNP(;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 coefficientModelingToolkitStandardLibrary.Electrical.NPN — ConstantNPN(;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 coefficientAnalog Sensors
ModelingToolkitStandardLibrary.Electrical.CurrentSensor — ConstantCurrentSensor(; name)Creates a circuit component that measures the current flowing through it. Analogous to an ideal ammeter.
States:
- i(t): [- A] Current through the sensor
Connectors:
- pPositive pin
- nNegative pin
ModelingToolkitStandardLibrary.Electrical.PotentialSensor — ConstantPotentialSensor(; name)
Creates a circuit component which measures the potential at a pin.
States:
- phi(t): [- V] The measured potential at this point
Connectors:
- pPin at which potential is to be measured
ModelingToolkitStandardLibrary.Electrical.VoltageSensor — ConstantVoltageSensor(; 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:
- pPositive pin
- nNegative pin
ModelingToolkitStandardLibrary.Electrical.PowerSensor — ConstantPowerSensor(; name)
Combines a VoltageSensor and a CurrentSensor to measure the power being consumed by a circuit.
States:
- power(t): [- W] The power being consumed, given by the product of voltage and current
- See VoltageSensor
- See CurrentSensor
Connectors:
- pcCorresponds to the- ppin of the- CurrentSensor
- ncCorresponds to the- npin of the- CurrentSensor
- pvCorresponds to the- ppin of the- VoltageSensor
- nvCorresponds to the- npin of the- VoltageSensor
ModelingToolkitStandardLibrary.Electrical.MultiSensor — ConstantMultiSensor(; name)
Combines a VoltageSensor and a CurrentSensor.
States:
- v(t): [- V] The voltage across the- VoltageSensor. Defaults to 1.0.
- i(t): [- A] The current across the- CurrentSensor. Defaults to 1.0.
Connectors:
- pcCorresponds to the- ppin of the- CurrentSensor
- ncCorresponds to the- npin of the- CurrentSensor
- pvCorresponds to the- ppin of the- VoltageSensor
- nvCorresponds to the- npin of the- VoltageSensor
Analog Sources
ModelingToolkitStandardLibrary.Electrical.Voltage — ConstantVoltage(; name)Acts as an ideal voltage source with no internal resistance.
States:
See OnePort
Connectors:
- pPositive pin
- nNegative pin
- VRealInput Input for the voltage control signal, i.e.- V ~ p.v - n.v
ModelingToolkitStandardLibrary.Electrical.Current — ConstantCurrent(; name)Acts as an ideal current source with no internal resistance.
States:
See OnePort
Connectors:
- pPositive pin
- nNegative pin
- IRealInput Input for the current control signal, i.e. `I ~ p.i