Message Boards Message Boards

GROUPS:

Modeling an electrical circuit with transformer in SystemModeler?

Posted 2 years ago
3500 Views
|
5 Replies
|
5 Total Likes
|

I am testing the System modeler with the electrical model. I took circuit 1 nd added a transformer after the sine wave source. But getting a singular error equation 0=0. I do not know how to get started trouble shooting

model ElectricCircuit2Jose "A component based model of an electrical circuit with an additional component"
  Modelica.Electrical.Analog.Basic.Ground ground1 annotation(Placement(visible = true, transformation(origin = {-22.5, -42.5}, extent = {{-7.5, -7.5}, {7.5, 7.5}}, rotation = 0)));
  Modelica.Electrical.Analog.Basic.Resistor resistor1(R = 1) annotation(Placement(visible = true, transformation(origin = {-0.0, 30.0}, extent = {{-10.0, -10.0}, {10.0, 10.0}}, rotation = 270)));
  Modelica.Electrical.Analog.Basic.Resistor resistor2(R = .2) annotation(Placement(visible = true, transformation(origin = {40.0, 30.0}, extent = {{-10.0, -10.0}, {10.0, 10.0}}, rotation = 270)));
  Modelica.Electrical.Analog.Basic.Inductor inductor1(L = 0.1) annotation(Placement(visible = true, transformation(origin = {40.0, -10.0}, extent = {{-10.0, -10.0}, {10.0, 10.0}}, rotation = 270)));
  Modelica.Electrical.Analog.Basic.Capacitor capacitor1(C = 0.01) annotation(Placement(visible = true, transformation(origin = {0.0, -10.0}, extent = {{-10.0, -10.0}, {10.0, 10.0}}, rotation = 270)));
  Modelica.Electrical.Analog.Basic.Capacitor capacitor2(C = 0.01) annotation(Placement(visible = true, transformation(origin = {15.0, 9.8828}, extent = {{-7.5, -7.5}, {7.5, 7.5}}, rotation = 0)));
  Modelica.Electrical.Analog.Basic.Capacitor capacitor(C(displayUnit = "mF") = .4) annotation(Placement(visible = true, transformation(origin = {20, -15}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
  Modelica.Electrical.Analog.Sources.SineVoltage sineVoltage(V = 110, freqHz = 60) annotation(Placement(visible = true, transformation(origin = {-50, 5}, extent = {{-10, 10}, {10, -10}}, rotation = 270)));
  Modelica.Electrical.Analog.Basic.Transformer transformer(L1 = 3, L2 = 1, M = .01) annotation(Placement(visible = true, transformation(origin = {-25, 10}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
  connect(transformer.n2, ground1.p) annotation(Line(visible = true, origin = {-14.8, -17.8}, points = {{-0.2, 22.8}, {4.8, 22.8}, {4.8, -7.2}, {-7.7, -7.2}, {-7.7, -17.2}}, color = {0, 0, 255}));
  connect(transformer.n1, sineVoltage.n) annotation(Line(visible = true, origin = {-42.421, -19.087}, points = {{7.421, 24.087}, {7.421, -4}, {0.315, -4}, {-7.579, -4}, {-7.579, 14.087}}, color = {0, 0, 255}));
  connect(transformer.p2, resistor1.p) annotation(Line(visible = true, origin = {-13.6, 39.4}, points = {{-1.4, -24.4}, {-5.4, -15.4}, {-5.4, 10.6}, {8.6, 10.6}, {13.6, 0.6}}, color = {0, 0, 255}));
  connect(sineVoltage.p, transformer.p1) annotation(Line(visible = true, origin = {-41.4, 30.4}, points = {{-8.6, -15.4}, {-8.6, 0.6}, {5.4, 0.6}, {5.4, -0.4}, {6.4, -15.4}}, color = {0, 0, 255}));
  connect(capacitor.n, ground1.p) annotation(Line(visible = true, origin = {-5, -34}, points = {{25, 9}, {25.48, -1}, {-12.354, -1}, {-17.5, -1}}, color = {0, 0, 255}));
  connect(capacitor2.n, capacitor.p) annotation(Line(visible = true, origin = {22.7, 2.153}, points = {{-0.2, 7.73}, {2.8, 7.73}, {2.8, -4.153}, {-2.7, -4.153}, {-2.7, -7.153}}, color = {0, 0, 255}));
  connect(resistor2.p, resistor1.p) annotation(Line(visible = true, origin = {35.0, 50.0}, points = {{5.0, -10.0}, {5.0, 0.0}, {-35.0, 0.0}, {-35.0, -10.0}}, color = {0, 0, 255}));
  connect(resistor2.n, inductor1.p) annotation(Line(visible = true, origin = {40.0, 10.0}, points = {{-0.0, 10.0}, {0.0, -10.0}}, color = {0, 0, 255}));
  connect(resistor1.n, capacitor1.p) annotation(Line(visible = true, origin = {-0.0, 10.0}, points = {{-0.0, 10.0}, {0.0, -10.0}}, color = {0, 0, 255}));
  connect(resistor1.n, capacitor2.p) annotation(Line(visible = true, origin = {5.0, 15.0}, points = {{-5.0, 5.0}, {-5.0, -5.1172}, {2.5, -5.1172}}, color = {0, 0, 255}));
  connect(capacitor2.n, resistor2.n) annotation(Line(visible = true, origin = {35, 15.117}, points = {{-12.5, -5.234}, {5, -5.117}, {5, 4.883}}, color = {0, 0, 255}));
  connect(inductor1.n, ground1.p) annotation(Line(visible = true, origin = {35, -30}, points = {{5, 10}, {5, -5}, {-57.5, -5}}, color = {0, 0, 255}));
  connect(capacitor1.n, ground1.p) annotation(Line(visible = true, origin = {-5, -30}, points = {{5, 10}, {5, -5}, {-17.5, -5}}, color = {0, 0, 255}));
  annotation(experiment(StopTime = 10.0), Documentation(info = "<html><p>This is the same model as the <a href=\"modelica://IntroductoryExamples.ComponentBased.ElectricCircuit\">ElectricCircuit model</a> but with an added capacitor.</p>
          <p>The following plot shows the signal current for both models:</p>
          <p><img src=\"modelica://IntroductoryExamples.ComponentBased.ElectricCircuit2/ComponentBased/image017.png\" alt=\"\" /></p>
         <p>For a step by step tutorial see <a href=\"wsm:///ref/GettingStarted/ComponentBasedSimpleCircuit.html\">Component-Based—Simple Circuit</a>.</p></html>", revisions = ""), Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {10, 10}), graphics = {Rectangle(visible = true, fillColor = {119, 163, 37}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, lineThickness = 0, extent = {{-100, -100}, {100, 100}}), Rectangle(visible = true, origin = {0.174, 4.178}, fillColor = {170, 85, 0}, fillPattern = FillPattern.Solid, lineThickness = 1, extent = {{2.5, 16.49}, {17.5, 50}}), Rectangle(visible = true, origin = {0.174, 4.178}, fillColor = {170, 85, 0}, fillPattern = FillPattern.Solid, lineThickness = 1, extent = {{2.5, -33.51}, {17.5, 0}}), Rectangle(visible = true, origin = {0.174, 4.178}, fillColor = {170, 85, 0}, fillPattern = FillPattern.Solid, lineThickness = 1, extent = {{42.5, 16.49}, {57.5, 50}}), Rectangle(visible = true, origin = {0.174, 4.178}, fillColor = {170, 85, 0}, fillPattern = FillPattern.Solid, lineThickness = 1, extent = {{42.5, -33.51}, {57.5, 0}}), Ellipse(visible = true, fillColor = {170, 0, 0}, fillPattern = FillPattern.Solid, lineThickness = 1, extent = {{-70, -6.454}, {-40, 23.55}}), Line(visible = true, points = {{-70, -60}, {-40, -60}}, thickness = 2), Line(visible = true, origin = {-0.522, -1.218}, points = {{-62.51, -65}, {-47.1, -65}}, thickness = 2), Line(visible = true, origin = {-0.522, -2.437}, points = {{-58.15, -70}, {-50, -70}}, thickness = 2), Line(visible = true, points = {{-54.657, 23.847}, {-55, 72.69}, {50, 72.69}, {50.132, 54.309}}, thickness = 0.5), Line(visible = true, points = {{9.922000000000001, 54.135}, {9.922000000000001, 72.76000000000001}}, thickness = 0.5), Line(visible = true, origin = {-0.174, 4.178}, points = {{10, 0}, {9.922000000000001, 16.536}}, thickness = 0.5), Line(visible = true, origin = {-0.174, 4.178}, points = {{50, 0}, {50, 16.57}}, thickness = 0.5), Line(visible = true, points = {{49.783, -29.243}, {50, -45}, {-55, -45}, {-55.005, -6.441}}, thickness = 0.5), Line(visible = true, points = {{10.096, -29.243}, {10, -45}}, thickness = 0.5), Line(visible = true, points = {{-55, -45}, {-55, -60}}, thickness = 0.5)}), Diagram(coordinateSystem(extent = {{-60.0, -60.0}, {60.0, 60.0}}, preserveAspectRatio = true, initialScale = 0.1, grid = {5, 5})));
end ElectricCircuit2Jose;
Attachments:
5 Replies
Posted 2 years ago

Jose, The short answer is that you need to add a transformer on the primary side.

I think you mean a ground component! (:

Posted 2 years ago

Yes, I do mean a ground component (Modelica.Electrical.Analog.Basic.Ground) on the primary side. Was typing too fast there

Thank you for you answer. But A Ground component on the primary side? This does not make sense. This is a Alternate AC source. In a practical scenario, this is like connecting one of the electrical outlets wire to the ground. What I am missing?

The circuit must look like this (shown below). The Modelica sine voltage is like a floating power supply. Unless you hook it up to a ground, it can't generate the sine wave on the positive terminal that you want. Think of it like hooking the earth tap on a variable power supply to the negative side so you can generate a voltage relative to ground. The sine wave voltage block says "I am going to enforce a voltage across my positive and negative terminals" but then you wired the positive and negative terminals to each other (the Transformer is a short). It needs to know if the sine wave is starting at 0v or 100v or 1000v -- its an unspecified degree of freedom. Modelica models always must have a reference frame -- for example mechanical models must reference a stationary reference frame at some point. Electrical models must always reference a ground at some point. Each side of your transformer must (at some point in the circuit) reference to a ground -- it could be after a DC voltage source and some resisters, etc. but it must be in the circuit or SystemModeler (or any solver) does not have enough information to solve it. Hope this helps.

sample circuit

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract