ModelingToolkitStandardLibrary: Electrical Components
Index
ModelingToolkitStandardLibrary.Electrical.CapacitorModelingToolkitStandardLibrary.Electrical.ConductorModelingToolkitStandardLibrary.Electrical.CurrentModelingToolkitStandardLibrary.Electrical.CurrentSensorModelingToolkitStandardLibrary.Electrical.DiodeModelingToolkitStandardLibrary.Electrical.GroundModelingToolkitStandardLibrary.Electrical.IdealOpAmpModelingToolkitStandardLibrary.Electrical.InductorModelingToolkitStandardLibrary.Electrical.MultiSensorModelingToolkitStandardLibrary.Electrical.NMOSModelingToolkitStandardLibrary.Electrical.NPNModelingToolkitStandardLibrary.Electrical.OnePortModelingToolkitStandardLibrary.Electrical.PMOSModelingToolkitStandardLibrary.Electrical.PNPModelingToolkitStandardLibrary.Electrical.PinModelingToolkitStandardLibrary.Electrical.PotentialSensorModelingToolkitStandardLibrary.Electrical.PowerSensorModelingToolkitStandardLibrary.Electrical.ResistorModelingToolkitStandardLibrary.Electrical.VariableResistorModelingToolkitStandardLibrary.Electrical.VoltageModelingToolkitStandardLibrary.Electrical.VoltageSensorModelingToolkitStandardLibrary.Electrical.DigitalPin
Electrical Utilities
ModelingToolkitStandardLibrary.Electrical.Pin — ConstantPin(; name)A pin in an analog circuit.
States:
v(t): [V] The voltage at this pini(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 componentp.v - n.vi(t): [A] The current passing through positive pin
Connectors:
pPositive pinnNegative pin
ModelingToolkitStandardLibrary.Electrical.DigitalPin — FunctionDigitalPin(; name)A pin in a digital circuit.
States:
v(t): [V] The voltage at this pini(t): [A] The current passing through this pinval(t): The binary value of the pin at this point. A voltage from0Vto0.8Vis a binary value of0.
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 ifT_dep = true)
Connectors:
pPositive pinnNegative pinheat_portHeatPort (only ifT_dep = true) Heat port to model the temperature dependency
Parameters:
R: [Ω] Reference resistanceT_ref: [K] Reference temperaturealpha: [K⁻¹] Temperature coefficient of resistanceT_dep: [bool] Temperature dependency
ModelingToolkitStandardLibrary.Electrical.Conductor — ConstantConductor(; name, G)Creates an ideal conductor.
States:
See OnePort
Connectors:
pPositive pinnNegative 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 pinnNegative 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 pinnNegative 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 pinnNegative 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 pinp.v - n.v
Connectors:
pPositive pinnNegative 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 theppin of theCurrentSensorncCorresponds to thenpin of theCurrentSensorpvCorresponds to theppin of theVoltageSensornvCorresponds to thenpin of theVoltageSensor
ModelingToolkitStandardLibrary.Electrical.MultiSensor — ConstantMultiSensor(; name)
Combines a VoltageSensor and a CurrentSensor.
States:
v(t): [V] The voltage across theVoltageSensor. Defaults to 1.0.i(t): [A] The current across theCurrentSensor. Defaults to 1.0.
Connectors:
pcCorresponds to theppin of theCurrentSensorncCorresponds to thenpin of theCurrentSensorpvCorresponds to theppin of theVoltageSensornvCorresponds to thenpin of theVoltageSensor
Analog Sources
ModelingToolkitStandardLibrary.Electrical.Voltage — ConstantVoltage(; name)Acts as an ideal voltage source with no internal resistance.
States:
See OnePort
Connectors:
pPositive pinnNegative pinVRealInput 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 pinnNegative pinIRealInput Input for the current control signal, i.e. `I ~ p.i