# Modeling an electrical circuit with transformer in SystemModeler?

Posted 2 years ago
3261 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 = "

This is the same model as the ElectricCircuit model but with an added capacitor.

The following plot shows the signal current for both models:

For a step by step tutorial see Component-Basedâ€”Simple Circuit.

", 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
Sort By:
Posted 2 years ago
 Jose, The short answer is that you need to add a transformer on the primary side.
Posted 2 years ago
 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