Analog.Basic.VariableResistor
Ideal linear electrical resistor with variable resistance.
The resistance value R is provided as an external input signal. An optional linear temperature coefficient alpha adjusts the actual resistance based on the heat port temperature:
The electrical behavior follows Ohm's law:
Power dissipated in the resistor is transferred as heat through the thermal port heat_port.
Corresponds to Modelica.Electrical.Analog.Basic.VariableResistor.
This component extends from ElectricalComponents.Analog.Interfaces.OnePort
Usage
ElectricalComponents.Analog.Basic.VariableResistor(T_ref=300.15, alpha=0.0)
Parameters:
| Name | Description | Units | Default value |
|---|---|---|---|
T_ref | Reference temperature | K | 300.15 |
alpha | Linear temperature coefficient of resistance | 1/K | 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)R- This connector represents a real signal as an input to a component (RealInput)heat_port- This connector represents a thermal port with temperature and heat flow as the potential and flow variables, respectively. (HeatPort)
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 |
R_actual | Actual resistance accounting for temperature | Ω |
LossPower | Power dissipated in the resistor | W |
Behavior
Source
"""
Ideal linear electrical resistor with variable resistance.
The resistance value `R` is provided as an external input signal.
An optional linear temperature coefficient `alpha` adjusts the
actual resistance based on the heat port temperature:math R_{actual} = R \cdot (1 + \alpha \cdot (T_{heatPort} - T_{ref}))
The electrical behavior follows Ohm's law:math v = R_{actual} \cdot i
Power dissipated in the resistor is transferred as heat through
the thermal port `heat_port`.
Corresponds to `Modelica.Electrical.Analog.Basic.VariableResistor`.
"""
component VariableResistor
extends ElectricalComponents.Analog.Interfaces.OnePort
"Resistance input signal"
R = RealInput() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 450, "y1": -100, "x2": 550, "y2": 0, "rot": 90}
},
"tags": []
}
}
"Thermal port for heat exchange"
heat_port = HeatPort() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 460, "y1": 950, "x2": 560, "y2": 1050, "rot": 0}
},
"tags": []
}
}
"Reference temperature"
parameter T_ref::Temperature = 300.15
"Linear temperature coefficient of resistance"
parameter alpha::LinearTemperatureCoefficient = 0.0
"Actual resistance accounting for temperature"
variable R_actual::Resistance
"Power dissipated in the resistor"
variable LossPower::Power
relations
assert((1 + alpha * (heat_port.T - T_ref)) >= 1e-15, "Temperature outside scope of model!")
R_actual = R * (1 + alpha * (heat_port.T - T_ref))
v = R_actual * i
LossPower = v * i
heat_port.Q_flow = -LossPower
metadata {
"Dyad": {
"labels": [{"label": "$(instance)", "x": 500, "y": 1100, "rot": 0}],
"icons": {"default": "dyad://ElectricalComponents/Resistor.svg"}
}
}
endFlattened Source
"""
Ideal linear electrical resistor with variable resistance.
The resistance value `R` is provided as an external input signal.
An optional linear temperature coefficient `alpha` adjusts the
actual resistance based on the heat port temperature:math R_{actual} = R \cdot (1 + \alpha \cdot (T_{heatPort} - T_{ref}))
The electrical behavior follows Ohm's law:math v = R_{actual} \cdot i
Power dissipated in the resistor is transferred as heat through
the thermal port `heat_port`.
Corresponds to `Modelica.Electrical.Analog.Basic.VariableResistor`.
"""
component VariableResistor
"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
"Resistance input signal"
R = RealInput() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 450, "y1": -100, "x2": 550, "y2": 0, "rot": 90}
},
"tags": []
}
}
"Thermal port for heat exchange"
heat_port = HeatPort() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 460, "y1": 950, "x2": 560, "y2": 1050, "rot": 0}
},
"tags": []
}
}
"Reference temperature"
parameter T_ref::Temperature = 300.15
"Linear temperature coefficient of resistance"
parameter alpha::LinearTemperatureCoefficient = 0.0
"Actual resistance accounting for temperature"
variable R_actual::Resistance
"Power dissipated in the resistor"
variable LossPower::Power
relations
v = p.v - n.v
i = p.i
p.i + n.i = 0
assert((1 + alpha * (heat_port.T - T_ref)) >= 1e-15, "Temperature outside scope of model!")
R_actual = R * (1 + alpha * (heat_port.T - T_ref))
v = R_actual * i
LossPower = v * i
heat_port.Q_flow = -LossPower
metadata {
"Dyad": {
"labels": [{"label": "$(instance)", "x": 500, "y": 1100, "rot": 0}],
"icons": {"default": "dyad://ElectricalComponents/Resistor.svg"}
}
}
endTest Cases
No test cases defined.
Related
Examples
Experiments
Analyses