Analog.ControlledIdealTwoWaySwitch ​
This component extends from ConditionalHeatPort
Usage ​
TranslatedComponents.Analog.ControlledIdealTwoWaySwitch(T=293.15, unitVoltage=1, unitCurrent=1, level=0.5, Ron=1.0e-5, Goff=1.0e-5)
Parameters: ​
| Name | Description | Units | Default value |
|---|---|---|---|
useHeatPort | – | false | |
T | K | 293.15 | |
unitVoltage | V | 1 | |
unitCurrent | A | 1 | |
level | V | 0.5 | |
Ron | Ω | 0.00001 | |
Goff | S | 0.00001 |
Connectors ​
heatPort- (HeatPort)p- This connector represents an electrical pin with voltage and current as the potential and flow variables, respectively. (Pin)n2- This connector represents an electrical pin with voltage and current as the potential and flow variables, respectively. (Pin)n1- This connector represents an electrical pin with voltage and current as the potential and flow variables, respectively. (Pin)control- This connector represents an electrical pin with voltage and current as the potential and flow variables, respectively. (Pin)
Variables ​
| Name | Description | Units |
|---|---|---|
LossPower | W | |
T_heatPort | K | |
s1 | – | |
s2 | – |
Behavior ​
Source ​
component ControlledIdealTwoWaySwitch
extends ConditionalHeatPort(T = 293.15)
p = Pin()
n2 = Pin()
n1 = Pin()
control = Pin()
parameter unitVoltage::Dyad.Voltage = 1
parameter unitCurrent::Dyad.Current = 1
parameter level::Dyad.Voltage = 0.5
parameter Ron::Dyad.Resistance(final min = 0) = 1.0e-5
parameter Goff::Dyad.Conductance(final min = 0) = 1.0e-5
variable s1::Real
variable s2::Real
relations
control.i = 0
0 = p.i + n2.i + n1.i
p.v - n1.v = s1 * (control.v > level ? unitVoltage : Ron * unitCurrent)
n1.i = -s1 * (control.v > level ? Goff * unitVoltage : unitCurrent)
p.v - n2.v = s2 * (control.v > level ? Ron * unitCurrent : unitVoltage)
n2.i = -s2 * (control.v > level ? unitCurrent : Goff * unitVoltage)
LossPower = p.i * p.v + n1.i * n1.v + n2.i * n2.v
endFlattened Source
component ControlledIdealTwoWaySwitch
heatPort = TranslatedComponents.HeatTransfer.HeatPort() if useHeatPort
structural parameter useHeatPort::Boolean = false
parameter T::Dyad.Temperature = 293.15
variable LossPower::Dyad.Power
variable T_heatPort::Dyad.Temperature
p = Pin()
n2 = Pin()
n1 = Pin()
control = Pin()
parameter unitVoltage::Dyad.Voltage = 1
parameter unitCurrent::Dyad.Current = 1
parameter level::Dyad.Voltage = 0.5
parameter Ron::Dyad.Resistance(final min = 0) = 1.0e-5
parameter Goff::Dyad.Conductance(final min = 0) = 1.0e-5
variable s1::Real
variable s2::Real
relations
if !(useHeatPort)
T_heatPort = T
else
initial heatPort.T = T_heatPort
initial heatPort.Q_flow = -LossPower
end
control.i = 0
0 = p.i + n2.i + n1.i
p.v - n1.v = s1 * (control.v > level ? unitVoltage : Ron * unitCurrent)
n1.i = -s1 * (control.v > level ? Goff * unitVoltage : unitCurrent)
p.v - n2.v = s2 * (control.v > level ? Ron * unitCurrent : unitVoltage)
n2.i = -s2 * (control.v > level ? unitCurrent : Goff * unitVoltage)
LossPower = p.i * p.v + n1.i * n1.v + n2.i * n2.v
metadata {}
endTest Cases ​
No test cases defined.
Related ​
Examples
Experiments
Analyses