Impedance

model Impedance "Multiphase linear impedance"
    extends Interfaces.TwoPlug;

    parameter Modelica.SIunits.ComplexImpedance Z_ref[m](re(start = fill(1, m)), im(start = fill(0, m))) "Complex impedances R_ref + j*X_ref";
    parameter Modelica.SIunits.Temperature T_ref[m] = fill(293.15, m) "Reference temperatures";
    parameter Modelica.SIunits.LinearTemperatureCoefficient alpha_ref[m] = zeros(m) "Temperature coefficient of resistance (R_actual = R_ref*(1 + alpha_ref*(heatPort.T - T_ref))";

    extends Modelica.Electrical.MultiPhase.Interfaces.ConditionalHeatPort(final mh = m, T = T_ref);

    parameter Boolean frequencyDependent = false "Consider frequency dependency, if true"
        annotation (
            Evaluate = true,
            HideResult = true,
            choices(checkBox = true));
    parameter Modelica.SIunits.Frequency f_ref = 1 "Reference frequency, if frequency dependency is considered"
        annotation (Dialog(enable = frequencyDependent));
    Modelica.Electrical.QuasiStationary.SinglePhase.Basic.Impedance impedance[m](final Z_ref = Z_ref, final T_ref = T_ref, final alpha_ref = alpha_ref, final useHeatPort = fill(useHeatPort, m), final frequencyDependent = fill(frequencyDependent, m), final f_ref = fill(f_ref, m), final T = T_ref) annotation (Placement(transformation(extent = {
        {-10, -10}, 
        {10, 10}})));
equation
    connect(impedance.heatPort,heatPort) annotation (Line(
        points = {
            {0, -10}, 
            {0, -10}, 
            {0, -100}},
        color = {191, 0, 0}));
    connect(impedance.pin_n,plugToPins_n.pin_n) annotation (Line(
        points = {
            {10, 0}, 
            {39, 0}, 
            {68, 0}},
        color = {85, 170, 255}));
    connect(plugToPins_p.pin_p,impedance.pin_p) annotation (Line(
        points = {
            {-68, 0}, 
            {-53.5, 0}, 
            {-39, 0}, 
            {-10, 0}},
        color = {85, 170, 255}));

    annotation (
        Icon(graphics = {
            Text(
                extent = {
                    {150, -80}, 
                    {-150, -40}},
                textString = "m=%m"), 
            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), 
            Polygon(
                points = {
                    {-70, -30}, 
                    {70, 30}, 
                    {70, -30}, 
                    {-70, -30}},
                lineColor = {85, 170, 255},
                fillColor = {85, 170, 255},
                fillPattern = FillPattern.Solid), 
            Text(
                extent = {
                    {-150, 90}, 
                    {150, 50}},
                textString = "%name",
                lineColor = {0, 0, 255})}),
        Documentation(info = "<html>\n<p>The impedance model represents a <strong>series</strong> connection of a resistor and either an inductor or capacitor\nin each phase.<br>\n<img src=\"modelica://Modelica/Resources/Images/Electrical/QuasiStationary/SinglePhase/Basic/RX_impedance.png\"></p>\n\n<p>\nThe linear impedance connects the voltage <code><u>v</u></code> with the\ncurrent <code><u>i</u></code> by  <code><u>v</u> = <u>Z</u>*<u>i</u></code> in each phase, using <code>m</code>\n<a href=\"modelica://Modelica.Electrical.QuasiStationary.SinglePhase.Basic.Impedance\">singlephase impedances</a>.\nThe resistive\ncomponents are modeled temperature dependent, so the real parts <code>R_actual = real(<u>Z</u>)</code> are determined from\nthe actual operating temperatures and the reference input resistances <code>real(Z_ref)</code>.\n<a href=\"modelica://Modelica.Electrical.MultiPhase.Interfaces.ConditionalHeatPort\">Conditional heat ports</a> are considered.\nThe reactive components <code>X_actual = imag(<u>Z</u>)</code>\nare equal to <code>imag(Z_ref)</code> if <code>frequencyDependent = false</code>.\nFrequency dependency is considered by <code>frequencyDependent = true</code>, distinguishing two cases:\n</p>\n\n<dl>\n<dt>(a) <code>imag(Z_ref) &gt; 0</code>: inductive case</dt>\n<dd>The actual reactances <code>X_actual</code> are proportional to <code>f/f_ref</code></dd>\n<dt>(b) <code>imag(Z_ref) &lt; 0</code>: capacitive case</dt>\n<dd>The actual reactances <code>X_actual</code> are proportional to <code>f_ref/f</code></dd>\n</dl>\n\n<h4>See also</h4>\n<p>\n<a href=\"modelica://Modelica.Electrical.QuasiStationary.SinglePhase.Basic.Impedance\">Impedance</a>,\n<a href=\"modelica://Modelica.Electrical.QuasiStationary.MultiPhase.Basic.Resistor\">Resistor</a>,\n<a href=\"modelica://Modelica.Electrical.QuasiStationary.MultiPhase.Basic.Conductor\">Conductor</a>,\n<a href=\"modelica://Modelica.Electrical.QuasiStationary.MultiPhase.Basic.Capacitor\">Capacitor</a>,\n<a href=\"modelica://Modelica.Electrical.QuasiStationary.MultiPhase.Basic.Inductor\">Inductor</a>,\n<a href=\"modelica://Modelica.Electrical.QuasiStationary.MultiPhase.Basic.Admittance\">Admittance</a>,\n<a href=\"modelica://Modelica.Electrical.QuasiStationary.MultiPhase.Basic.VariableResistor\">Variable resistor</a>,\n<a href=\"modelica://Modelica.Electrical.QuasiStationary.MultiPhase.Basic.VariableConductor\">Variable conductor</a>,\n<a href=\"modelica://Modelica.Electrical.QuasiStationary.MultiPhase.Basic.VariableCapacitor\">Variable capacitor</a>,\n<a href=\"modelica://Modelica.Electrical.QuasiStationary.MultiPhase.Basic.VariableInductor\">Variable inductor</a>,\n<a href=\"modelica://Modelica.Electrical.QuasiStationary.MultiPhase.Basic.VariableImpedance\">Variable impedance</a>,\n<a href=\"modelica://Modelica.Electrical.QuasiStationary.MultiPhase.Basic.VariableAdmittance\">Variable admittance</a>\n</p>\n</html>"));
end Impedance;