# Electrical modeling

Currently, JuliaSimStdLib contains basic electrical components, ideal electrical elements, sensors, and voltage/current sources.

## Basic electrical components

### Ground

Function: `Ground(;name)`

Description: Ground node with the potential of zero and connector `g`. Note that specifying the macro `@named sys = Ground()` is equivalent to setting `sys = Ground(;name, sys)`. Either method will suffice, and there is no need to type the name twice. The same principle applies to the other electrical components.

Connectors:

• `g`

### Resistor

Function: `Resistor(;name, R = 1.0)`

Observables:

• `R`: resistance (negative, zero, positive)

Connectors:

• positive pin

• negative pin

### Capacitor

Function: `Capacitor(;name, C = 1.0)`

Observables:

• `C`: capacitance (zero or positive)

Connectors:

• positive pin

• negative pin

## Ideal electrical elements

### Short

Function: `Short()`

Description: Short cut branch.

Connectors:

• positive pin

• negative pin

### IdealOpAmp

Function: `IdealOpAmp(;name)`

Description: The ideal operational amplifier.

Observables:

• `v1`: voltage of the left port

• `v2`: voltage of the right port

• `i1`: current of the left port

• `i2`: current of the right port

Connectors:

• positive pin (left port)

• negative pin (left port)

• positive pin (right port)

• negative pin (right port)

## Sensors

### CurrentSensor

Function: `CurrentSensor(;name)`

Connectors:

• positive pin

• negative pin

• current value from the positive to the negative pin

### PotentialSensor

Function: `PotentialSensor(;name, phi = 0.0)`

Observables:

• `phi`: absolute voltage potential

Connectors:

• pin (which is to be measured)

### VoltageSensor

Function: `VoltageSensor(;name)`

Connectors:

• positive pin

• negative pin

• value of voltage between the two pins

## Voltage/current sources

### ConstantVoltage

Function: `ConstantVoltage(;name, V = 1.0)`

Description: The source for an ideal constant voltage.

Observables:

• `V`: value of constant voltage

Connectors:

• positive pin

• negative pin

### StepVoltage

Function: `StepVoltage(;name, offset = 0.0, starttime = 0.0, height = 0.0)`

Description: Step voltage source.

Observables:

• `offset`: voltage offset

• `starttime`: time offset

• `height`: height of the step

Connectors:

• positive pin

• negative pin

### SineVoltage

Function: `SineVoltage(;name, offset = 0.0, amplitude = 0.0, frequency = 0.0, starttime = 0.0, phase = 0.0)`

Description: Sine voltage source.

Observables:

• `offset`: voltage offset

• `amplitude`: amplitude of the sine wave

• `frequency`: frequency of the sine wave

• `starttime`: time offset

• `phase`: phase of the sine wave

Connectors:

• positive pin

• negative pin