Conductor
Ideal linear electrical conductor relating current and voltage through its conductance.
This component models an ideal electrical conductor where the electrical current flowing through it is directly proportional to the voltage difference across its terminals. The relationship is defined by Ohm's law:
where i
is the current, v
is the voltage, and G
is the conductance. The conductance G
is a parameter, representing the ease with which current flows through the material, and is the reciprocal of resistance. This model assumes linear behavior, meaning the conductance G
remains constant regardless of the voltage or current. It inherits from TwoPin
, implying it has two electrical connection points (pins) where voltage v
is measured across and current i
flows through.
This component extends from OnePort
Usage
Conductor(G)
Parameters:
Name | Description | Units | Default value |
---|---|---|---|
G | The electrical conductance of the material. | S |
Connectors
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
# Ideal linear electrical conductor relating current and voltage through its conductance.
#
# This component models an ideal electrical conductor where the electrical current flowing through it
# is directly proportional to the voltage difference across its terminals.
# The relationship is defined by Ohm's law:
# ```math
# i = G v
# ```
# where `i` is the current, `v` is the voltage, and `G` is the conductance.
# The conductance `G` is a parameter, representing the ease with which current
# flows through the material, and is the reciprocal of resistance. This model
# assumes linear behavior, meaning the conductance `G` remains constant
# regardless of the voltage or current. It inherits from `TwoPin`,
# implying it has two electrical connection points (pins) where voltage `v` is measured
# across and current `i` flows through.
component Conductor
extends OnePort
# The electrical conductance of the material.
parameter G::Conductance
relations
i = G*v
metadata {
"Dyad": {
"labels": [
{"label": "$(instance)", "x": 500, "y": 1100, "rot": 0},
{"label": "G=$(G)℧", "x": 500, "y": 150, "rot": 0}
],
"icons": {"default": "dyad://ElectricalComponents/Conductor.svg"}
}
}
end
Flattened Source
# Ideal linear electrical conductor relating current and voltage through its conductance.
#
# This component models an ideal electrical conductor where the electrical current flowing through it
# is directly proportional to the voltage difference across its terminals.
# The relationship is defined by Ohm's law:
# ```math
# i = G v
# ```
# where `i` is the current, `v` is the voltage, and `G` is the conductance.
# The conductance `G` is a parameter, representing the ease with which current
# flows through the material, and is the reciprocal of resistance. This model
# assumes linear behavior, meaning the conductance `G` remains constant
# regardless of the voltage or current. It inherits from `TwoPin`,
# implying it has two electrical connection points (pins) where voltage `v` is measured
# across and current `i` flows through.
component Conductor
# 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 conductance of the material.
parameter G::Conductance
relations
v = p.v-n.v
i = p.i
p.i+n.i = 0
i = G*v
metadata {
"Dyad": {
"labels": [
{"label": "$(instance)", "x": 500, "y": 1100, "rot": 0},
{"label": "G=$(G)℧", "x": 500, "y": 150, "rot": 0}
],
"icons": {"default": "dyad://ElectricalComponents/Conductor.svg"}
}
}
end
Test Cases
This is setup code, that must be run before each test case.
using ElectricalComponents
using ModelingToolkit, OrdinaryDiffEqDefault
using Plots
using CSV, DataFrames
snapshotsdir = joinpath(dirname(dirname(pathof(ElectricalComponents))), "test", "snapshots")
"/home/actions-runner-10/.julia/packages/ElectricalComponents/bmmPM/test/snapshots"
Related
Examples
Experiments
Analyses