CurrentSource
IconCurrentSource
Ideal current source driven by an external signal.
This component models an ideal current source where the current i
flowing from its positive pin (p
) to its negative pin (n
) is directly determined by an external real input signal I
. The component inherits the electrical pins p
and n
, the through-variable current i
, and the across-variable voltage v
from the TwoPin
base component. The input signal I
is a causal signal, typically provided by a control system or another signal source.
Usage
CurrentSource(uI=1.0)
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
)I
- This connector represents a real signal as an input to a component (RealInput
)
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
\[ \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 \\ i\left( t \right) &= \mathtt{uI} I\left( t \right) \end{align} \]
Source
# Ideal current source driven by an external signal.
#
# This component models an ideal current source where the current `i` flowing
# from its positive pin (`p`) to its negative pin (`n`) is directly determined
# by an external real input signal `I`. The component inherits the electrical
# pins `p` and `n`, the through-variable current `i`, and the across-variable
# voltage `v` from the `TwoPin` base component. The input signal `I` is a
# causal signal, typically provided by a control system or another signal source.
component CurrentSource
extends OnePort
# External real input signal that controls the magnitude of the current source.
I = RealInput() [{
"Dyad": {"placement": {"icon": {"x1": 450, "y1": -50, "x2": 550, "y2": 50, "rot": 90}}}
}]
# Unit parameter to balance units in current relation.
final parameter uI::Current = 1.0
relations
i = I*uI
metadata {"Dyad": {"labels": [{"label": "$(instance)", "x": 500, "y": 1000, "rot": 0}]}}
end
Flattened Source
# Ideal current source driven by an external signal.
#
# This component models an ideal current source where the current `i` flowing
# from its positive pin (`p`) to its negative pin (`n`) is directly determined
# by an external real input signal `I`. The component inherits the electrical
# pins `p` and `n`, the through-variable current `i`, and the across-variable
# voltage `v` from the `TwoPin` base component. The input signal `I` is a
# causal signal, typically provided by a control system or another signal source.
component CurrentSource
# 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
# External real input signal that controls the magnitude of the current source.
I = RealInput() [{
"Dyad": {"placement": {"icon": {"x1": 450, "y1": -50, "x2": 550, "y2": 50, "rot": 90}}}
}]
# Unit parameter to balance units in current relation.
final parameter uI::Current = 1.0
relations
v = p.v-n.v
i = p.i
p.i+n.i = 0
i = I*uI
metadata {"Dyad": {"labels": [{"label": "$(instance)", "x": 500, "y": 1000, "rot": 0}]}}
end
Test Cases
No test cases defined.
Related
- Examples
- Experiments
- Analyses