VariableConductor

model VariableConductor "Ideal linear electrical conductor with variable conductance"
    parameter SI.Temperature T_ref = 300.15 "Reference temperature";
    parameter SI.LinearTemperatureCoefficient alpha = 0 "Temperature coefficient of conductance (G_actual = G/(1 + alpha*(T_heatPort - T_ref))";

    extends Modelica.Electrical.Analog.Interfaces.OnePort;
    extends Modelica.Electrical.Analog.Interfaces.ConditionalHeatPort(T = T_ref);

    SI.Conductance G_actual "Actual conductance = G/(1 + alpha*(T_heatPort - T_ref))";
    Modelica.Blocks.Interfaces.RealInput G(unit = "S") annotation (Placement(transformation(
        origin = {0, 120},
        extent = {
            {-20, -20}, 
            {20, 20}},
        rotation = 270)));
equation
    assert(Modelica.Constants.eps <= 1 + alpha * (T_heatPort - T_ref), "Temperature outside scope of model!");
    i = G_actual * v;
    G_actual = G / (1 + alpha * (T_heatPort - T_ref));
    LossPower = v * i;

    annotation (
        defaultComponentName = "conductor",
        Documentation(
            info = "<html>\n<p>The linear conductor connects the branch voltage <em>v</em> with the branch current <em>i</em> by\n<br><em><strong>i = G*v</strong></em>\n<br>The Conductance <em>G</em> is given as input signal.\n<br><br><strong>Attention!!!</strong>\n<br>It is recommended that the G signal should not cross the zero value. Otherwise depending on the surrounding circuit the probability of singularities is high.</p>\n</html>",
            revisions = "<html>\n<ul>\n<li><em> August 07, 2009   </em>\n       by Anton Haumer<br> temperature dependency of conductance added<br>\n       </li>\n<li><em> March 11, 2009   </em>\n       by Christoph Clauss<br> conditional heat port added<br>\n       </li>\n<li><em>June 7, 2004   </em>\n       by Christoph Clauss<br> implemented<br>\n       </li>\n</ul>\n</html>"),
        Icon(
            coordinateSystem(
                preserveAspectRatio = true,
                extent = {
                    {-100, -100}, 
                    {100, 100}}),
            graphics = {
                Line(
                    points = {
                        {-90, 0}, 
                        {-70, 0}},
                    color = {0, 0, 255}), 
                Rectangle(
                    extent = {
                        {-70, 30}, 
                        {70, -30}},
                    lineColor = {0, 0, 255},
                    fillColor = {255, 255, 255},
                    fillPattern = FillPattern.Solid), 
                Line(
                    points = {
                        {70, 0}, 
                        {90, 0}},
                    color = {0, 0, 255}), 
                Text(
                    extent = {
                        {-150, 90}, 
                        {150, 50}},
                    textString = "%name",
                    lineColor = {0, 0, 255})}));
end VariableConductor;