Skip to content
LIBRARY
Analog.Basic.VariableResistor.md

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:

Ractual=R(1+α(TheatPortTref))

The electrical behavior follows Ohm's law:

v=Ractuali

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:

NameDescriptionUnitsDefault value
T_refReference temperatureK300.15
alphaLinear temperature coefficient of resistance1/K0

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

NameDescriptionUnits
vVoltage across the component (between pin p and pin n).V
iCurrent flowing through the component (from pin p to pin n).A
R_actualActual resistance accounting for temperatureΩ
LossPowerPower dissipated in the resistorW

Behavior

v(t)=p.v(t)n.v(t)i(t)=p.i(t)p.i(t)+n.i(t)=0R_actual(t)=(1+(T_ref+heat_port.T(t)) alpha) R(t)v(t)=i(t) R_actual(t)LossPower(t)=v(t) i(t)heat_port.Q_flow(t)=LossPower(t)

Source

dyad
"""
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"}
  }
}
end
Flattened Source
dyad
"""
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"}
  }
}
end


Test Cases

No test cases defined.

  • Examples

  • Experiments

  • Analyses