Message Boards Message Boards

0
|
1377 Views
|
6 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Mathematica crashes during import of simple SystemModeler model

Posted 6 months ago

Hi all,

Currently using trial and playing with functionality. I did some simple battery cell model in SystemModeler: enter image description here

in Mathematica I am running:

celMdl = SystemModel["cell"]

in best case Mathematica produces error: SystemModel: cell is not loaded model Then I realized that I have to open this model in SystemModeler before trying to import it. But in that case Mathematica just crashes without any prompt.

Related Modelica code:

model cell "Одна батарейка батареї"
  Modelica.Electrical.Batteries.BatteryStacksWithSensors.CellRC cellRC(cellData = cellData, useHeatPort = true, SOC0 = initialSOC) annotation(Placement(visible = true, transformation(origin = {-0.038, 40}, extent = {{-55.962, -55.962}, {55.962, 55.962}}, rotation = 0)));
  parameter Modelica.Electrical.Batteries.ParameterRecords.TransientData.CellData cellData(rcData = {rcData}, Qnom = nominalChargeCapacity, Ri(nominal = 0.001) = internalResistance, OCVmax = OCVmax, OCVmin = 3.6, useLinearSOCDependency = false, OCV_SOC = OCVSOCtable) annotation(Placement(visible = true, transformation(origin = {-12.5, 80}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  parameter Modelica.Electrical.Batteries.ParameterRecords.TransientData.RCData rcData(R = equivalentCircuitResistance, C = equivalentCircuitCapacitance) = Modelica.Electrical.Batteries.ParameterRecords.TransientData.RCData(R = 0.0005, C = 0.0004) annotation(Placement(visible = true, transformation(origin = {12.5, 80}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Electrical.Batteries.Interfaces.CellBus cellBus annotation(Placement(visible = true, transformation(origin = {-33.62, -89.962}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {-54.067, -51.555}, extent = {{-10, -10}, {10, 10}}, rotation = -360)));
  Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a port_a annotation(Placement(visible = true, transformation(origin = {0, -90}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {-2.084, -52.596}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Electrical.Analog.Interfaces.PositivePin pin_p annotation(Placement(visible = true, transformation(origin = {-150, 40}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {-100, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Electrical.Analog.Interfaces.NegativePin pin_n annotation(Placement(visible = true, transformation(origin = {150, 40}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {100, -4.167}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Thermal.HeatTransfer.Components.HeatCapacitor heatCapacitor(C = heatCapacity, T.start = 293.15) annotation(Placement(visible = true, transformation(origin = {73.93, -18.93}, extent = {{-29.93, -29.93}, {29.93, 29.93}}, rotation = -90)));
  parameter Modelica.Units.SI.HeatCapacity heatCapacity = 980 * 0.06 "Питома теплоємність електричної батарейки" annotation(Dialog(tab = "Термофізичні властивості"));
  parameter Real initialSOC = 1 "Почтаковий стан заряду батареї";
  parameter Modelica.Units.NonSI.ElectricCharge_Ah nominalChargeCapacity = 5 "Ємність батареї";
  parameter Modelica.Units.SI.Resistance internalResistance = 0.001 "Внутрішній опір батареї";
  parameter Modelica.Units.SI.Voltage OCVmax = 4.2 "Максимальна напруга батареї";
  parameter Modelica.Units.SI.Resistance equivalentCircuitResistance = 0.0003;
  parameter Modelica.Units.SI.Capacitance equivalentCircuitCapacitance = 0.000001;
  parameter Real OCVSOCtable[:, 2] = {{0.0, 0.8571428571428571}, {1.0, 1.0}};
  Modelica.Thermal.HeatTransfer.Components.ThermalConductor thermalConductor(G = thermalConductivityCoeff * surfaceArea / radius) annotation(Placement(visible = true, transformation(origin = {0, -52.584}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
  parameter Modelica.Units.SI.Area surfaceArea = 2 * 3.14 * 0.016 * 0.08 "Площа поверхні батареї";
  parameter Real radius = 0.009 "Радіус батареї";
  parameter Modelica.Units.SI.ThermalConductivity thermalConductivityCoeff = 85 "Коефіцієнт теплопровідності батареї";
equation
  connect(cellRC.cellBus, cellBus) annotation(Line(visible = true, origin = {-33.617, -61.565}, points = {{0.002, 56.795}, {0.002, -28.397}, {-0.003, -28.397}}, color = {255, 204, 51}, thickness = 0.5));
  connect(cellRC.n, pin_n) annotation(Line(visible = true, origin = {102.962, 40}, points = {{-47.038, 0}, {47.038, 0}}, color = {0, 0, 255}));
  connect(cellRC.p, pin_p) annotation(Line(visible = true, origin = {-103, 40}, points = {{47, 0}, {-47, 0}}, color = {0, 0, 255}));
  connect(heatCapacitor.port, cellRC.heatPort) annotation(Line(visible = true, origin = {14.641, -17.941}, points = {{29.359, -0.989}, {-14.679, -0.989}, {-14.679, 1.979}}, color = {191, 0, 0}));
  connect(thermalConductor.port_a, cellRC.heatPort) annotation(Line(visible = true, origin = {-0.019, -33.429}, points = {{0.019, -9.156}, {0.019, -4.156}, {-0.019, -4.156}, {-0.019, 17.467}}, color = {191, 0, 0}));
  connect(port_a, thermalConductor.port_b) annotation(Line(visible = true, origin = {0, -76.292}, points = {{0, -13.708}, {0, 13.708}}, color = {191, 0, 0}));
  annotation(uses(Modelica(version = "4.0.0")), experiment(StopTime = 10.0), version = "1", Diagram(coordinateSystem(extent = {{-150, -90}, {150, 90}}, preserveAspectRatio = true, initialScale = 0.1, grid = {5, 5})), Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {10, 10}), graphics = {Rectangle(visible = true, rotation = -90, lineColor = {128, 0, 0}, fillColor = {55, 142, 255}, pattern = LinePattern.None, fillPattern = FillPattern.Sphere, extent = {{-50, -100}, {50, 100}}, radius = 25), Polygon(visible = true, origin = {-7.143, 14.286}, lineColor = {255, 255, 255}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, points = {{7.143, 33.315}, {7.143, -4.286}, {57.143, -4.286}, {7.143, -57.603}, {7.143, -24.286}, {-42.857, -24.286}})}));
end cell;
POSTED BY: Oleg Kmechak
6 Replies
Posted 6 months ago

Found line which causes an error in cellUnitTestWrapper.mo model. In attached model if only I remove from annotation this line:

experiment(StopTime = 11.0)

And vice versa. Adding - makes Mathematica to crash during running command: Please find attached notebook with SystemInforamtion and command which causes crash.

POSTED BY: Oleg Kmechak
Posted 6 months ago

deleted.

POSTED BY: Oleg Kmechak

What version of System Modeler & Mathematica are you using?

POSTED BY: Ankit Naik
Posted 6 months ago

For a moment I rebuild the model and was importing it step by step, so far no error. Was thinking that maybe some units SI were inconsistent at parameter specification. But so far new version seems ok.

Thank you for support!

POSTED BY: Oleg Kmechak

We are not able to reproduce the crash in Mathematica 13.0 nor 14.0. Feel free to reach out to support, with a notebook that includes the output of

SystemInformation[]

since the crash may indicate a more complicated issue related to your specific system setup.

POSTED BY: Sergio Vargas
Posted 6 months ago

Thank you for guidance.

POSTED BY: Oleg Kmechak
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