| 1 | within ;
|
|---|
| 2 | package MutualInductanceTesting
|
|---|
| 3 |
|
|---|
| 4 | model MutualInductorTest
|
|---|
| 5 | extends Modelica.Icons.Example;
|
|---|
| 6 |
|
|---|
| 7 | parameter Integer m=4 "Number of phases";
|
|---|
| 8 | parameter Modelica.SIunits.Voltage Vmax=0.5 "Peak supply voltage";
|
|---|
| 9 | parameter Modelica.SIunits.Frequency f=50 "Frequency";
|
|---|
| 10 | parameter Modelica.SIunits.Resistance R=2.50862436E-02;
|
|---|
| 11 | parameter Modelica.SIunits.Inductance L11=9.346575024E-04;
|
|---|
| 12 | parameter Modelica.SIunits.Inductance L12=3.186119548E-04;
|
|---|
| 13 | parameter Modelica.SIunits.Inductance L13=6.89656993E-04;
|
|---|
| 14 | parameter Modelica.SIunits.Inductance L14=4.550194689E-04;
|
|---|
| 15 | parameter Modelica.SIunits.Inductance L21=3.186119548E-04;
|
|---|
| 16 | parameter Modelica.SIunits.Inductance L22=9.346575024E-04;
|
|---|
| 17 | parameter Modelica.SIunits.Inductance L23=4.550194689E-04;
|
|---|
| 18 | parameter Modelica.SIunits.Inductance L24=6.89656993E-04;
|
|---|
| 19 | parameter Modelica.SIunits.Inductance L31=6.896570219E-04;
|
|---|
| 20 | parameter Modelica.SIunits.Inductance L32=4.550194784E-04;
|
|---|
| 21 | parameter Modelica.SIunits.Inductance L33=9.346544792E-04;
|
|---|
| 22 | parameter Modelica.SIunits.Inductance L34=6.896568904E-04;
|
|---|
| 23 | parameter Modelica.SIunits.Inductance L41=4.550194784E-04;
|
|---|
| 24 | parameter Modelica.SIunits.Inductance L42=6.896570219E-04;
|
|---|
| 25 | parameter Modelica.SIunits.Inductance L43=6.896568904E-04;
|
|---|
| 26 | parameter Modelica.SIunits.Inductance L44=9.346544792E-04;
|
|---|
| 27 | parameter Modelica.SIunits.Inductance L[m,m]={{L11,L12,L13,L14},{L21,L22,L23,L24},{L31,L32,L33,L34},{L41,L42,L43,L44}};
|
|---|
| 28 |
|
|---|
| 29 | MutualInductor mutualInductor(L=L, m=m,epsilon=1E-7) annotation (Placement(transformation(extent={{-20,20},{0,40}})));
|
|---|
| 30 | Modelica.Electrical.QuasiStationary.MultiPhase.Sources.VoltageSource voltageSource(
|
|---|
| 31 | m=m,
|
|---|
| 32 | V=fill(Vmax/sqrt(2), m),
|
|---|
| 33 | phi=fill(0, m),
|
|---|
| 34 | f=f) annotation (Placement(transformation(
|
|---|
| 35 | extent={{-10,-10},{10,10}},
|
|---|
| 36 | rotation=270,
|
|---|
| 37 | origin={-60,10})));
|
|---|
| 38 | Modelica.Electrical.QuasiStationary.MultiPhase.Basic.Resistor resistor(m=m, R_ref=fill(R, m)) annotation (Placement(transformation(extent={{-50,20},{-30,40}})));
|
|---|
| 39 | Modelica.Electrical.QuasiStationary.MultiPhase.Basic.Star star(m=m) annotation (Placement(transformation(
|
|---|
| 40 | extent={{-10,-10},{10,10}},
|
|---|
| 41 | rotation=270,
|
|---|
| 42 | origin={-60,-20})));
|
|---|
| 43 | Modelica.Electrical.QuasiStationary.SinglePhase.Basic.Ground ground annotation (Placement(transformation(extent={{-70,-60},{-50,-40}})));
|
|---|
| 44 | equation
|
|---|
| 45 | connect(ground.pin, star.pin_n) annotation (Line(points={{-60,-40},{-60,-35},{-60,-30}}, color={85,170,255}));
|
|---|
| 46 | connect(star.plug_p, voltageSource.plug_n) annotation (Line(points={{-60,-10},{-60,-5},{-60,0}}, color={85,170,255}));
|
|---|
| 47 | connect(voltageSource.plug_p, resistor.plug_p) annotation (Line(points={{-60,20},{-60,20},{-60,28},{-60,30},{-50,30}}, color={85,170,255}));
|
|---|
| 48 | connect(resistor.plug_n, mutualInductor.plug_p) annotation (Line(points={{-30,30},{-25,30},{-20,30}}, color={85,170,255}));
|
|---|
| 49 | connect(mutualInductor.plug_n, star.plug_p) annotation (Line(points={{0,30},{6,30},{10,30},{10,-4},{10,-10},{-60,-10}}, color={85,170,255}));
|
|---|
| 50 | end MutualInductorTest;
|
|---|
| 51 |
|
|---|
| 52 | model MutualInductor
|
|---|
| 53 | extends Modelica.Electrical.QuasiStationary.MultiPhase.Interfaces.OnePort;
|
|---|
| 54 | import Modelica.ComplexMath.j;
|
|---|
| 55 | parameter Real epsilon=1e-9
|
|---|
| 56 | "Relative accuracy tolerance of matrix symmetry";
|
|---|
| 57 | parameter Modelica.SIunits.Inductance L[m, m] "Mutual inductance matrix";
|
|---|
| 58 | initial equation
|
|---|
| 59 | if abs(Modelica.Math.Matrices.det(L)) < epsilon then
|
|---|
| 60 | Modelica.Utilities.Streams.print(
|
|---|
| 61 | "Warning: mutual inductance matrix singular!");
|
|---|
| 62 | end if;
|
|---|
| 63 | equation
|
|---|
| 64 | assert(sum(abs(L - transpose(L))) < epsilon*sum(abs(L)),
|
|---|
| 65 | "Mutual inductance matrix is not symmetric");
|
|---|
| 66 | for j in 1:m loop
|
|---|
| 67 | v[j] = sum(j*omega*L[j, k]*i[k] for k in 1:m);
|
|---|
| 68 | end for;
|
|---|
| 69 | annotation (Documentation(info="<html>
|
|---|
| 70 | <p>
|
|---|
| 71 | Model of a multi phase inductor providing a mutual inductance matrix model.
|
|---|
| 72 | </p>
|
|---|
| 73 | <H4>Implementation</H4>
|
|---|
| 74 | <pre>
|
|---|
| 75 | v[1] = j*omega*L[1,1]*i[1] + j*omega*L[1,2]*i[2] + ... + j*omega*L[1,m]*i[m]
|
|---|
| 76 | v[2] = j*omega*L[2,1]*i[1] + j*omega*L[2,2]*i[2] + ... + j*omega*L[2,m]*i[m]
|
|---|
| 77 | : : : :
|
|---|
| 78 | v[m] = j*omega*L[m,1]*i[1] + j*omega*L[m,2]*i[2] + ... + j*omega*L[m,m]*i[m]
|
|---|
| 79 | </pre>
|
|---|
| 80 |
|
|---|
| 81 | </html>"),
|
|---|
| 82 | Icon(graphics={
|
|---|
| 83 | Ellipse(extent={{30,-50},{60,10}}, lineColor={85,170,255}),
|
|---|
| 84 | Ellipse(extent={{0,-50},{30,10}}, lineColor={85,170,255}),
|
|---|
| 85 | Ellipse(extent={{-30,-50},{0,10}}, lineColor={85,170,255}),
|
|---|
| 86 | Ellipse(extent={{-60,-50},{-30,10}}, lineColor={85,170,255}),
|
|---|
| 87 | Line(points={{-80,20},{-80,-20},{-60,-20}}, color={85,170,255}),
|
|---|
| 88 | Line(points={{-80,20},{-60,20}}, color={85,170,255}),
|
|---|
| 89 | Ellipse(extent={{-60,-10},{-30,50}}, lineColor={85,170,255}),
|
|---|
| 90 | Ellipse(extent={{-30,-10},{0,50}}, lineColor={85,170,255}),
|
|---|
| 91 | Ellipse(extent={{0,-10},{30,50}}, lineColor={85,170,255}),
|
|---|
| 92 | Ellipse(extent={{30,-10},{60,50}}, lineColor={85,170,255}),
|
|---|
| 93 | Line(points={{60,20},{80,20}}, color={85,170,255}),
|
|---|
| 94 | Line(points={{80,20},{80,-20},{60,-20}}, color={85,170,255}),
|
|---|
| 95 | Rectangle(
|
|---|
| 96 | extent={{-60,0},{60,20}},
|
|---|
| 97 | fillColor={255,255,255},
|
|---|
| 98 | fillPattern=FillPattern.Solid,
|
|---|
| 99 | pattern=LinePattern.None),
|
|---|
| 100 | Rectangle(
|
|---|
| 101 | extent={{-60,-20},{60,0}},
|
|---|
| 102 | fillColor={255,255,255},
|
|---|
| 103 | fillPattern=FillPattern.Solid,
|
|---|
| 104 | pattern=LinePattern.None),
|
|---|
| 105 | Line(points={{-90,0},{-80,0}}, color={85,170,255}),
|
|---|
| 106 | Line(points={{80,0},{90,0}}, color={85,170,255}),
|
|---|
| 107 | Text(
|
|---|
| 108 | extent={{100,60},{-100,100}},
|
|---|
| 109 | textString="%name",
|
|---|
| 110 | lineColor={0,0,255}),
|
|---|
| 111 | Text(
|
|---|
| 112 | extent={{-100,-100},{100,-60}},
|
|---|
| 113 | lineColor={0,0,0},
|
|---|
| 114 | textString="m=%m")}));
|
|---|
| 115 | end MutualInductor;
|
|---|
| 116 | annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false)),
|
|---|
| 117 | uses(Modelica(version="3.2.2")));
|
|---|
| 118 | end MutualInductanceTesting;
|
|---|