# ModelingToolkitStandardLibrary: Electrical Components

## Electrical Utilities

ModelingToolkitStandardLibrary.Electrical.OnePortFunction
OnePort(; name, v_start=0.0, i_start=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

Parameters:

• v_start: [V] Initial voltage across the component
• i_start: [A] Initial current through the component

Connectors:

• p Positive pin
• n Negative pin
ModelingToolkitStandardLibrary.Electrical.DigitalPinFunction
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.

## Analog Components

ModelingToolkitStandardLibrary.Electrical.CapacitorFunction
Capacitor(; name, C)

Creates an ideal capacitor.

States:

• v(t): [V] The voltage across the capacitor, given by D(v) ~ p.i / C

Connectors:

• p Positive pin
• n Negative pin

Parameters:

• C: [F] Capacitance
• v_start: [V] Initial voltage of capacitor
ModelingToolkitStandardLibrary.Electrical.InductorFunction
Inductor(; name, L)

Creates an ideal Inductor.

States:

See OnePort

Connectors:

• p Positive pin
• n Negative pin

Parameters:

• L: [H] Inductance
• i_start: [A] Initial current through inductor
ModelingToolkitStandardLibrary.Electrical.IdealOpAmpFunction
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 TwoPort

Connectors:

• p1 Positive pin (left port)
• p2 Positive pin (right port)
• n1 Negative pin (left port)
• n2 Negative pin (right port)

## Analog Sensors

ModelingToolkitStandardLibrary.Electrical.CurrentSensorFunction

CurrentSensor(; 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:

• p Positive pin
• n Negative pin
ModelingToolkitStandardLibrary.Electrical.VoltageSensorFunction

VoltageSensor(; name)

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

States:

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

Connectors:

• p Positive pin
• n Negative pin
ModelingToolkitStandardLibrary.Electrical.PowerSensorFunction

PowerSensor(; 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:

ModelingToolkitStandardLibrary.Electrical.MultiSensorFunction

MultiSensor(; name)

Combines a VoltageSensor and a CurrentSensor.

States:

Connectors:

## Analog Sources

Missing docstring.

Missing docstring for ConstantVoltage. Check Documenter's build log for details.

Missing docstring.

Missing docstring for SineVoltage. Check Documenter's build log for details.

Missing docstring.

Missing docstring for StepVoltage. Check Documenter's build log for details.

Missing docstring.

Missing docstring for RampVoltage. Check Documenter's build log for details.

Missing docstring.

Missing docstring for SquareVoltage. Check Documenter's build log for details.

Missing docstring.

Missing docstring for TriangularVoltage. Check Documenter's build log for details.

Missing docstring.

Missing docstring for CosineVoltage. Check Documenter's build log for details.

Missing docstring.

Missing docstring for ExpSineVoltage. Check Documenter's build log for details.

Missing docstring.

Missing docstring for ConstantCurrent. Check Documenter's build log for details.

Missing docstring.

Missing docstring for SineCurrent. Check Documenter's build log for details.

Missing docstring.

Missing docstring for StepCurrent. Check Documenter's build log for details.

Missing docstring.

Missing docstring for RampCurrent. Check Documenter's build log for details.

Missing docstring.

Missing docstring for SquareCurrent. Check Documenter's build log for details.

Missing docstring.

Missing docstring for TriangularCurrent. Check Documenter's build log for details.

Missing docstring.

Missing docstring for CosineCurrent. Check Documenter's build log for details.

Missing docstring.

Missing docstring for ExpSineCurrent. Check Documenter's build log for details.

## Digital Gates

Missing docstring.

Missing docstring for Not. Check Documenter's build log for details.

Missing docstring.

Missing docstring for And. Check Documenter's build log for details.

Missing docstring.

Missing docstring for Nand. Check Documenter's build log for details.

Missing docstring.

Missing docstring for Or. Check Documenter's build log for details.

Missing docstring.

Missing docstring for Nor. Check Documenter's build log for details.

Missing docstring.

Missing docstring for Xor. Check Documenter's build log for details.

Missing docstring.

Missing docstring for Xnor. Check Documenter's build log for details.

## Digital Components

Missing docstring.

Missing docstring for HalfAdder. Check Documenter's build log for details.

Missing docstring.

Missing docstring for FullAdder. Check Documenter's build log for details.

Missing docstring.

Missing docstring for MUX. Check Documenter's build log for details.

Missing docstring.

Missing docstring for DEMUX. Check Documenter's build log for details.

Missing docstring.

Missing docstring for Encoder. Check Documenter's build log for details.

Missing docstring.

Missing docstring for Decoder. Check Documenter's build log for details.

## Digital Sources

Missing docstring.

Missing docstring for PulseDiff. Check Documenter's build log for details.

Missing docstring.

Missing docstring for Set. Check Documenter's build log for details.

Missing docstring.

Missing docstring for Reset. Check Documenter's build log for details.

Missing docstring.

Missing docstring for Pulse. Check Documenter's build log for details.