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 | = true, if heatPort is enabled | – | false |
T | Fixed device temperature if useHeatPort = false | K | 293.15 |
unitVoltage | V | 1 | |
unitCurrent | A | 1 | |
level | Switch level | V | 0.5 |
Ron | Closed switch resistance | Ω | 0.00001 |
Goff | Opened switch conductance | S | 0.00001 |
Connectors
heatPort- Thermal port for 1-dim. heat transfer
This component is translated by DyadAI (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 | Loss power leaving component via heatPort | W |
T_heatPort | Temperature of heatPort | K |
s1 | – | |
s2 | Auxiliary variables | – |
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
# Switch level
parameter level::Dyad.Voltage = 0.5
# Closed switch resistance
parameter Ron::Dyad.Resistance(final min = 0) = 1.0e-5
# Opened switch conductance
parameter Goff::Dyad.Conductance(final min = 0) = 1.0e-5
variable s1::Real
# Auxiliary variables
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
# = true, if heatPort is enabled
structural parameter useHeatPort::Boolean = false
# Fixed device temperature if useHeatPort = false
parameter T::Dyad.Temperature = 293.15
# Loss power leaving component via heatPort
variable LossPower::Dyad.Power
# Temperature of heatPort
variable T_heatPort::Dyad.Temperature
p = Pin()
n2 = Pin()
n1 = Pin()
control = Pin()
parameter unitVoltage::Dyad.Voltage = 1
parameter unitCurrent::Dyad.Current = 1
# Switch level
parameter level::Dyad.Voltage = 0.5
# Closed switch resistance
parameter Ron::Dyad.Resistance(final min = 0) = 1.0e-5
# Opened switch conductance
parameter Goff::Dyad.Conductance(final min = 0) = 1.0e-5
variable s1::Real
# Auxiliary variables
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