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:
The resistance R is a configurable parameter. This component is intended to be used in electrical circuits where a constant resistance behavior is required.
This component extends from OnePort
Usage
Resistor(R)
Parameters:
| Name | Description | Units | Default value |
|---|---|---|---|
R | The 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
| Name | Description | Units |
|---|---|---|
v | Voltage across the component (between pin p and pin n). | V |
i | Current flowing through the component (from pin p to pin n). | A |
Behavior
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"}
}
}
endFlattened 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"}
}
}
endTest Cases
No test cases defined.
Related
Examples
Experiments
Analyses
Tests