Message Boards Message Boards

0
|
744 Views
|
0 Replies
|
0 Total Likes
View groups...
Share
Share this post:

SystemModelLinearize cannot linearize normally

Posted 7 months ago

The SystemModelLinearize instruction cannot be linearized properly, what is the reason for the following error after execution? enter image description here

model = ImportString[
   "model Circuit\n  parameter Modelica.SIunits.Resistance r = 22 \
\"Resistance\";\n  parameter Modelica.SIunits.Inductance l = 1 / 5 \
\"Inductance\";\n  parameter Modelica.SIunits.Capacitance c = 1e-5 \
\"Capacitance\";\n  parameter Boolean k1 = true \"If true, switch \
open\";\n  parameter Boolean k2 = false \"If true, switch1 open\";\n  \
Modelica.Electrical.Analog.Basic.Inductor inductor1(L = l, i.start = \
6 / 5) annotation(Placement(visible = true, transformation(origin = \
{-20, 15}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));\n  \
Modelica.Electrical.Analog.Basic.Capacitor capacitor1(C = c, v.start \
= 24) annotation(Placement(visible = true, transformation(origin = \
{-0.043, -0.088}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));\
\n  Modelica.Electrical.Analog.Basic.Resistor resistor1(R = r) \
annotation(Placement(visible = true, transformation(origin = {40, \
-0}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));\n  \
Modelica.Electrical.Analog.Basic.Ground ground1 \
annotation(Placement(visible = true, transformation(origin = {80, \
-40}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));\n  \
Modelica.Electrical.Analog.Ideal.IdealOpeningSwitch switch(Ron = 0, \
Goff = 0) annotation(Placement(visible = true, transformation(origin \
= {-60, 15}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));\n  \
Modelica.Electrical.Analog.Ideal.IdealOpeningSwitch switch1(Ron = 0, \
Goff = 0) annotation(Placement(visible = true, transformation(origin \
= {-40, 0}, extent = {{-10, -10}, {10, 10}}, rotation = -270)));\n  \
Modelica.Electrical.Analog.Sensors.VoltageSensor voltageSensor1 \
annotation(Placement(visible = true, transformation(origin = {80, 0}, \
extent = {{-10, 10}, {10, -10}}, rotation = 270)));\n  \
Modelica.Electrical.Analog.Sources.SignalVoltage signalVoltage1 \
annotation(Placement(visible = true, transformation(origin = {-80, \
0}, extent = {{10, -10}, {-10, 10}}, rotation = -270)));\n  \
Modelica.Blocks.Sources.BooleanConstant booleanConstant1(k = k1) \
annotation(Placement(visible = true, transformation(origin = {-80, \
40}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));\n  \
Modelica.Blocks.Sources.BooleanConstant booleanConstant2(k = k2) \
annotation(Placement(visible = true, transformation(origin = {-80, \
-40}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));\n  \
Modelica.Blocks.Interfaces.RealOutput Vc(final quantity = \
\"ElectricPotential\", final unit = \"V\") \"Measured voltage\" \
annotation(Placement(visible = true, transformation(origin = {120, \
0}, extent = {{-10, -10}, {10, 10}}, rotation = -360), \
iconTransformation(origin = {110, 0}, extent = {{-10, -10}, {10, \
10}}, rotation = 0)));\n  Modelica.Blocks.Interfaces.RealInput \
Vi(final quantity = \"ElectricPotential\", final unit = \"V\") \
\"Input voltage\" annotation(Placement(visible = true, \
transformation(origin = {-120, 0}, extent = {{-20, -20}, {20, 20}}, \
rotation = 0), iconTransformation(origin = {-120, 0}, extent = {{-20, \
-20}, {20, 20}}, rotation = 0)));\nequation\n  connect(ground1.p, \
voltageSensor1.n) annotation(Line(visible = true, origin = {80, -20}, \
points = {{0, -10}, {0, 10}}, color = {10, 90, 224}));\n  \
connect(signalVoltage1.p, switch.p) annotation(Line(visible = true, \
origin = {-76.667, 13.333}, points = {{-3.333, -3.333}, {-3.333, \
1.667}, {6.667, 1.667}}, color = {10, 90, 224}));\n  \
connect(switch.n, switch1.n) annotation(Line(visible = true, origin = \
{-43.333, 13.333}, points = {{-6.667, 1.667}, {3.333, 1.667}, {3.333, \
-3.333}}, color = {10, 90, 224}));\n  connect(switch1.n, inductor1.p) \
annotation(Line(visible = true, origin = {-36.667, 13.333}, points = \
{{-3.333, -3.333}, {-3.333, 1.667}, {6.667, 1.667}}, color = {10, 90, \
224}));\n  connect(inductor1.n, capacitor1.p) annotation(Line(visible \
= true, origin = {-3.362, 13.304}, points = {{-6.638, 1.696}, {3.319, \
1.696}, {3.319, -3.392}}, color = {10, 90, 224}));\n  \
connect(capacitor1.p, resistor1.p) annotation(Line(visible = true, \
origin = {19.979, 12.478}, points = {{-20.021, -2.566}, {-20.021, \
2.522}, {20.021, 2.522}, {20.021, -2.478}}, color = {10, 90, 224}));\n\
  connect(resistor1.p, voltageSensor1.p) annotation(Line(visible = \
true, origin = {60, 12.5}, points = {{-20, -2.5}, {-20, 2.5}, {20, \
2.5}, {20, -2.5}}, color = {10, 90, 224}));\n  \
connect(voltageSensor1.n, resistor1.n) annotation(Line(visible = \
true, origin = {60, -12.5}, points = {{20, 2.5}, {20, -2.5}, {-20, \
-2.5}, {-20, 2.5}}, color = {10, 90, 224}));\n  connect(resistor1.n, \
capacitor1.n) annotation(Line(visible = true, origin = {19.979, \
-12.566}, points = {{20.021, 2.566}, {20.021, -2.522}, {-20.021, \
-2.522}, {-20.021, 2.478}}, color = {10, 90, 224}));\n  \
connect(capacitor1.n, switch1.p) annotation(Line(visible = true, \
origin = {-20.021, -12.566}, points = {{19.979, 2.478}, {19.979, \
-2.522}, {-19.979, -2.522}, {-19.979, 2.566}}, color = {10, 90, \
224}));\n  connect(switch1.p, signalVoltage1.n) \
annotation(Line(visible = true, origin = {-60, -12.5}, points = {{20, \
2.5}, {20, -2.5}, {-20, -2.5}, {-20, 2.5}}, color = {10, 90, 224}));\n\
  connect(booleanConstant1.y, switch.control) annotation(Line(visible \
= true, origin = {-63, 34}, points = {{-6, 6}, {3, 6}, {3, -12}}, \
color = {255, 0, 255}));\n  connect(booleanConstant2.y, \
switch1.control) annotation(Line(visible = true, origin = {-61, -20}, \
points = {{-8, -20}, {-3, -20}, {-3, 20}, {14, 20}}, color = {255, 0, \
255}));\n  connect(Vi, signalVoltage1.v) annotation(Line(visible = \
true, origin = {-103.5, 0}, points = {{-16.5, 0}, {16.5, 0}}, color = \
{1, 37, 163}));\n  connect(Vc, voltageSensor1.v) \
annotation(Line(visible = true, origin = {105, 0}, points = {{15, 0}, \
{-15, 0}}, color = {1, 37, 163}));\n  annotation(experiment(StopTime \
= 10.0), Diagram(coordinateSystem(extent = {{-130, -60}, {130, 60}}, \
preserveAspectRatio = true, initialScale = 0.1, grid = {5, 5})), \
Icon(coordinateSystem(extent = {{-100.0, -100.0}, {100.0, 100.0}}, \
preserveAspectRatio = true, initialScale = 0.1, grid = {10, 10}), \
graphics = {Text(visible = true, fillPattern = FillPattern.Solid, \
extent = {{-100.0, -150.0}, {100.0, -110.0}}, textString = \"%name\", \
fontName = \"Arial\"), Rectangle(visible = true, fillColor = {119, \
163, 37}, pattern = LinePattern.None, fillPattern = \
FillPattern.Solid, lineThickness = 0, extent = {{-100.0, -100.0}, \
{100.0, 100.0}}), Rectangle(visible = true, origin = {0.1741, \
4.1776}, fillColor = {170, 85, 0}, fillPattern = FillPattern.Solid, \
lineThickness = 1, extent = {{2.5, 16.49}, {17.5, 50.0}}), \
Rectangle(visible = true, origin = {0.1741, 4.1776}, fillColor = \
{170, 85, 0}, fillPattern = FillPattern.Solid, lineThickness = 1, \
extent = {{2.5, -33.51}, {17.5, 0.0}}), Rectangle(visible = true, \
origin = {0.1741, 4.1776}, fillColor = {170, 85, 0}, fillPattern = \
FillPattern.Solid, lineThickness = 1, extent = {{42.5, 16.49}, {57.5, \
50.0}}), Rectangle(visible = true, origin = {0.1741, 4.1776}, \
fillColor = {170, 85, 0}, fillPattern = FillPattern.Solid, \
lineThickness = 1, extent = {{42.5, -33.51}, {57.5, 0.0}}), \
Ellipse(visible = true, fillColor = {170, 0, 0}, fillPattern = \
FillPattern.Solid, lineThickness = 1, extent = {{-70.0, -6.454}, \
{-40.0, 23.55}}), Line(visible = true, points = {{-70.0, -60.0}, \
{-40.0, -60.0}}, thickness = 2), Line(visible = true, origin = \
{-0.5222, -1.2185}, points = {{-62.51, -65.0}, {-47.1, -65.0}}, \
thickness = 2), Line(visible = true, origin = {-0.5222, -2.437}, \
points = {{-58.15, -70.0}, {-50.0, -70.0}}, thickness = 2), \
Line(visible = true, points = {{-54.657, 23.847}, {-55.0, 72.69}, \
{50.0, 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.1741, 4.1776}, points = {{10.0, 0.0}, {9.922000000000001, \
16.536}}, thickness = 0.5), Line(visible = true, origin = {-0.1741, \
4.1776}, points = {{50.0, 0.0}, {50.0, 16.57}}, thickness = 0.5), \
Line(visible = true, points = {{49.783, -29.243}, {50.0, -45.0}, \
{-55.0, -45.0}, {-55.0055, -6.4405}}, thickness = 0.5), Line(visible \
= true, points = {{10.096, -29.243}, {10.0, -45.0}}, thickness = \
0.5), Line(visible = true, points = {{-55.0, -45.0}, {-55.0, -60.0}}, \
thickness = 0.5)}));\nend Circuit;", "MO"];
SystemModelLinearize[model, 
  Method -> {"SymbolicDerivative", 
      "SymbolicParameters" -> {"r", "l", "c", "k1", "k2"}}]
POSTED BY: James James
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