modelica-3rdparty / PowerSystems

Free (standard conform) library that is intended to model electrical power systems at different levels of detail both in transient and steady-state mode.
67 stars 36 forks source link

Understanding how AC1phDC works #33

Open ceraolo opened 7 years ago

ceraolo commented 7 years ago

To help understand how AC1ph_DC models work, I've prepared "CompareMSL.mo", that I enclose. It contains twin Power System and MSL models of a simple Ac1ph_DC system. I've added some "info" explaining the model.

Now to me everything is clear. But I had some difficulties in getting to this result. Just if this model it is deemed useful also for other users, I enclose it here. I would be glad if it is added in the Ac1ph_DC.Elementary set of examples.

model CompareMSL
  "Comparison of a simple AC1ph_DC system with MSL counterpart"
  import PowerSystems;
  import Modelica.Constants.pi;

  inner PowerSystems.System system(refType=PowerSystems.Types.ReferenceFrame.Inertial,
      dynType=PowerSystems.Types.Dynamics.FixedInitial)
    annotation (Placement(transformation(extent={{-100,30},{-80,50}})));
  PowerSystems.Blocks.Signals.TransientPhasor transPh(ph_start=-2.0943951023932,
      ph_end=-2.0943951023932)
    annotation (Placement(transformation(extent={{-52,16},{-32,36}})));
  PowerSystems.AC1ph_DC.Sources.ACvoltage uAC(use_vPhasor_in=true, V_nom=
        10000)
    annotation (Placement(transformation(extent={{-20,-10},{0,10}})));
  PowerSystems.AC1ph_DC.Impedances.Inductor ind(
    S_nom=1e6,
    r={0.6,0.1},
    V_nom=10000,
    xm=0.1)
    annotation (Placement(transformation(extent={{44,-10},{64,10}})));
  PowerSystems.AC1ph_DC.Sensors.PVImeter meter(
    S_nom=1e6,
    puUnits=false,
    V_nom=10000)
    annotation (Placement(transformation(extent={{10,-10},{30,10}})));
  PowerSystems.AC1ph_DC.Nodes.GroundOne grd1
    annotation (Placement(transformation(extent={{-76,-10},{-96,10}})));

  PowerSystems.AC1ph_DC.Nodes.Ground grd
    annotation (Placement(transformation(extent={{80,-10},{100,10}})));
  Modelica.Electrical.Analog.Sources.ConstantVoltage uDC(V=1000)
    annotation (Placement(transformation(extent={{-42,-10},{-62,10}})));
  Modelica.Electrical.Analog.Sources.ConstantVoltage uDCsl(V=1000)
    annotation (Placement(transformation(
        extent={{-10,-10},{10,10}},
        rotation=-90,
        origin={-44,72})));
  Modelica.Electrical.Analog.Basic.Ground ground
    annotation (Placement(transformation(extent={{70,32},{90,52}})));
  Modelica.Electrical.Analog.Sources.SineVoltage uACsl(
    V=sqrt(2)*10e3,
    freqHz=50,
    phase=-0.5235987755983)
    annotation (Placement(transformation(extent={{-4,72},{-24,92}})));
  Modelica.Electrical.Analog.Basic.Resistor resistor(R=60)
    annotation (Placement(transformation(extent={{8,74},{28,94}})));
  Modelica.Electrical.Analog.Basic.Resistor resistor1(R=10)
    annotation (Placement(transformation(extent={{8,50},{28,70}})));
  Modelica.Electrical.Analog.Basic.Ground ground1
    annotation (Placement(transformation(extent={{-54,38},{-34,58}})));
  Modelica.Electrical.Analog.Basic.Transformer line(
    L1=100/(2*pi*50),
    L2=100/(2*pi*50),
    M=10/(2*pi*50)) annotation (Placement(transformation(
        extent={{-10,-10},{10,10}},
        rotation=90,
        origin={52,72})));
equation 
  connect(transPh.y, uAC.vPhasor_in)
    annotation (Line(points={{-32,26},{-4,26},{-4,10}}, color={0,0,127}));
  connect(uDC.p, uAC.neutral)
    annotation (Line(points={{-42,0},{-31,0},{-20,0}}, color={0,0,255}));
  connect(uDC.n, grd1.term)
    annotation (Line(points={{-62,0},{-69,0},{-76,0}}, color={0,0,255}));
  connect(ind.term_p, meter.term_n)
    annotation (Line(points={{44,0},{37,0},{30,0}}, color={0,0,255}));
  connect(meter.term_p, uAC.term)
    annotation (Line(points={{10,0},{5,0},{0,0}}, color={0,0,255}));
  connect(ind.term_n, grd.term)
    annotation (Line(points={{64,0},{72,0},{80,0}}, color={0,0,255}));
  connect(uACsl.n, uDCsl.p)
    annotation (Line(points={{-24,82},{-34,82},{-44,82}}, color={0,0,255}));
  connect(resistor.p, uACsl.p) annotation (Line(points={{8,84},{2,84},{2,82},
          {-4,82}}, color={0,0,255}));
  connect(ground1.p, uDCsl.n)
    annotation (Line(points={{-44,58},{-44,62}}, color={0,0,255}));
  connect(resistor1.p, uACsl.n) annotation (Line(points={{8,60},{-8,60},{-24,
          60},{-24,82}}, color={0,0,255}));
  connect(line.p2, resistor.n) annotation (Line(points={{47,82},{46,82},{46,
          86},{46,84},{28,84}}, color={0,0,255}));
  connect(line.p1, resistor1.n) annotation (Line(points={{47,62},{46,62},{46,
          58},{46,60},{28,60}}, color={0,0,255}));
  connect(line.n2, ground.p) annotation (Line(points={{57,82},{58,82},{58,86},
          {58,84},{80,84},{80,52}}, color={0,0,255}));
  connect(line.n1, ground.p)
    annotation (Line(points={{57,62},{80,62},{80,52}}, color={0,0,255}));
  annotation (
    Documentation(info="<html>
<p>This example shows what happens when a mixed DC-AC signal is applied to an &QUOT;inductor&QUOT; component (actually a two conductor line with ground return).</p>
<p>Current i[1] and i[2] in AC terminals are the currents flowing in conductors 1 and 2, as can be verified also in the MSL version of the system.</p>
<p>The sum ind.i[1]+ind.i[2] can be seen also flowing in terminals of the DC part of Power Systems the model.</p>
<p>In the example provided the mutual between the two circuits is 10&percnt; of the inductance of each of them.</p>
<p><br><a href=\"modelica://PowerSystems.Examples.AC1ph_DC.Elementary\">up users guide</a></p>
</html>"),
    experiment(StopTime=0.2, Interval=0.0001),
    Diagram(coordinateSystem(extent={{-100,-20},{100,100}})),
    Icon(coordinateSystem(extent={{-100,-20},{100,100}})));
end CompareMSL;