$(instance)R=$(R)ΩResistor Icon

Resistor

Linear electrical resistor following Ohm's Law.

This component represents an ideal linear resistor. The relationship between the voltage (v) across its terminals and the current (i) flowing through it is defined by Ohm's Law:

\[v = i \R\]

The resistance R is a configurable parameter. This component is intended to be used in electrical circuits where a constant resistance behavior is required.

OnePort

Usage

Resistor(R)

Parameters:

NameDescriptionUnitsDefault value
RThe electrical resistance value of the component.Ω

Connectors

  • p - This connector represents an electrical pin with voltage and current as the potential and flow variables, respectively. (Pin)
  • n - This connector represents an electrical pin with voltage and current as the potential and flow variables, respectively. (Pin)

Variables

NameDescriptionUnits
vVoltage across the component (between pin p and pin n).V
iCurrent flowing through the component (from pin p to pin n).A

Behavior

\[ \begin{align} v\left( t \right) &= \mathtt{p.v}\left( t \right) - \mathtt{n.v}\left( t \right) \\ i\left( t \right) &= \mathtt{p.i}\left( t \right) \\ \mathtt{n.i}\left( t \right) + \mathtt{p.i}\left( t \right) &= 0 \\ v\left( t \right) &= R i\left( t \right) \end{align} \]

Source

# Linear electrical resistor following Ohm's Law.
#
# This component represents an ideal linear resistor. The relationship between the
# voltage (`v`) across its terminals and the current (`i`) flowing through it is
# defined by Ohm's Law:
# ```math
# v = i \R
# ```
# The resistance `R` is a configurable parameter. This component is intended to be
# used in electrical circuits where a constant resistance behavior is required.
component Resistor
  extends OnePort
  # The electrical resistance value of the component.
  parameter R::Resistance
relations
  # Ohm's Law
  v = i*R
metadata {
  "Dyad": {
    "labels": [
      {"label": "$(instance)", "x": 500, "y": 1100, "rot": 0},
      {"label": "R=$(R)Ω", "x": 500, "y": 150, "rot": 0}
    ],
    "icons": {"default": "dyad://ElectricalComponents/Resistor.svg"}
  }
}
end
Flattened Source
# Linear electrical resistor following Ohm's Law.
#
# This component represents an ideal linear resistor. The relationship between the
# voltage (`v`) across its terminals and the current (`i`) flowing through it is
# defined by Ohm's Law:
# ```math
# v = i \R
# ```
# The resistance `R` is a configurable parameter. This component is intended to be
# used in electrical circuits where a constant resistance behavior is required.
component Resistor
  # Positive electrical pin.
  p = Pin() [{
    "Dyad": {
      "placement": {"icon": {"iconName": "pos", "x1": -50, "y1": 450, "x2": 50, "y2": 550}}
    }
  }]
  # Negative electrical pin.
  n = Pin() [{
    "Dyad": {
      "placement": {"icon": {"iconName": "neg", "x1": 950, "y1": 450, "x2": 1050, "y2": 550}}
    }
  }]
  # Voltage across the component (between pin p and pin n).
  variable v::Voltage
  # Current flowing through the component (from pin p to pin n).
  variable i::Current
  # The electrical resistance value of the component.
  parameter R::Resistance
relations
  v = p.v-n.v
  i = p.i
  p.i+n.i = 0
  # Ohm's Law
  v = i*R
metadata {
  "Dyad": {
    "labels": [
      {"label": "$(instance)", "x": 500, "y": 1100, "rot": 0},
      {"label": "R=$(R)Ω", "x": 500, "y": 150, "rot": 0}
    ],
    "icons": {"default": "dyad://ElectricalComponents/Resistor.svg"}
  }
}
end


Test Cases

No test cases defined.