Conductor

model Conductor "Single phase linear conductor"
    import Modelica.ComplexMath.real;
    import Modelica.ComplexMath.conj;

    extends Interfaces.OnePort;

    parameter Modelica.SIunits.Conductance G_ref(start = 1) "Reference conductance at T_ref";
    parameter Modelica.SIunits.Temperature T_ref = 293.15 "Reference temperature";
    parameter Modelica.SIunits.LinearTemperatureCoefficient alpha_ref = 0 "Temperature coefficient of conductance (G_actual = G_ref/(1 + alpha_ref*(heatPort.T - T_ref))";

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

    Modelica.SIunits.Conductance G_actual "Conductance = G_ref/(1 + alpha_ref*(heatPort.T - T_ref))";
equation
    assert(Modelica.Constants.eps <= 1 + alpha_ref * (T_heatPort - T_ref), "Temperature outside scope of model!");
    i = G_actual * v;
    G_actual = G_ref / (1 + alpha_ref * (T_heatPort - T_ref));
    LossPower = real(v * conj(i));

    annotation (
        Icon(graphics = {
            Line(
                points = {
                    {60, 0}, 
                    {90, 0}},
                color = {85, 170, 255}), 
            Line(
                points = {
                    {-90, 0}, 
                    {-60, 0}},
                color = {85, 170, 255}), 
            Rectangle(
                extent = {
                    {-70, 30}, 
                    {70, -30}},
                lineColor = {85, 170, 255},
                fillColor = {255, 255, 255},
                fillPattern = FillPattern.Solid), 
            Text(
                extent = {
                    {150, -40}, 
                    {-148, -80}},
                textString = "G=%G_ref"), 
            Text(
                extent = {
                    {-150, 90}, 
                    {150, 50}},
                textString = "%name",
                lineColor = {0, 0, 255})}),
        Documentation(info = "<html>\n\n<p>\nThe linear conductor connects the voltage <code><u>v</u></code> with the\ncurrent <code><u>i</u></code> by <code><u>i</u> = <u>v</u>*G</code>.\nThe conductance <code>G</code> is allowed to be positive, zero, or negative.\n</p>\n\n<p>\nThe conductor model also has an optional\n<a href=\"modelica://Modelica.Electrical.Analog.Interfaces.ConditionalHeatPort\">conditional heat port</a>.\nA linear temperature dependency of the conductance is also taken into account.\n</p>\n\n<h4>See also</h4>\n<p>\n<a href=\"modelica://Modelica.Electrical.QuasiStationary.SinglePhase.Basic.Resistor\">Resistor</a>,\n<a href=\"modelica://Modelica.Electrical.QuasiStationary.SinglePhase.Basic.Capacitor\">Capacitor</a>,\n<a href=\"modelica://Modelica.Electrical.QuasiStationary.SinglePhase.Basic.Inductor\">Inductor</a>,\n<a href=\"modelica://Modelica.Electrical.QuasiStationary.SinglePhase.Basic.Impedance\">Impedance</a>,\n<a href=\"modelica://Modelica.Electrical.QuasiStationary.SinglePhase.Basic.Admittance\">Admittance</a>,\n<a href=\"modelica://Modelica.Electrical.QuasiStationary.SinglePhase.Basic.VariableResistor\">Variable resistor</a>,\n<a href=\"modelica://Modelica.Electrical.QuasiStationary.SinglePhase.Basic.VariableConductor\">Variable conductor</a>,\n<a href=\"modelica://Modelica.Electrical.QuasiStationary.SinglePhase.Basic.VariableCapacitor\">Variable capacitor</a>,\n<a href=\"modelica://Modelica.Electrical.QuasiStationary.SinglePhase.Basic.VariableInductor\">Variable inductor</a>,\n<a href=\"modelica://Modelica.Electrical.QuasiStationary.SinglePhase.Basic.VariableImpedance\">Variable impedance</a>,\n<a href=\"modelica://Modelica.Electrical.QuasiStationary.SinglePhase.Basic.VariableAdmittance\">Variable admittance</a>\n</p>\n</html>"));
end Conductor;