2
$\begingroup$

I'm trying to run a Modelica code in SystemModeler on Windows:

model code
  //constants
  constant Real pi = 2 * Modelica.Math.asin(1.0);
  parameter Real mukpc = 0.2;
  parameter Real muspc = 0.0;
  parameter Real mukps = 0.0;
  parameter Real musps = 0.0;
  parameter Real mukcs = 0.2;
  parameter Real muscs = 0.0;
  parameter Real mp = 1.0;
  parameter Real js = 2.0;
  parameter Real b1 = 0.01;
  parameter Real b2 = 0.01;
  parameter Real b3 = 0.015;
  parameter Real r1 = 0.01;
  parameter Real r2 = 0.003;
  parameter Real r3 = 0.003;
  parameter Real Ts = 1;
  parameter Real Tw = 0.9;
  parameter Real absTol = 0.01;
  //variables
  Real X1, X2, X3, Y1, Y2, Y3, tets, V1, V2, V3, omgs, A1, A2, A3, alps, Fp1, Fp2, Fp3, Fncp1, Fncp2, Fncp3, Ffcp1, Ffcp2, Ffcp3, Tcp1, Tcp2, Tcp3, Ffsp1, Ffsp2, Ffsp3, Fnsp1, Fnsp2, Fnsp3, Tfsp1, Tfsp2, Tfsp3, Text, Tfsc, Fscx, Fscy, T1, T2, T3;
initial equation
  tets = pi / 3;
  omgs = 0.1;
equation
  //inpute forces
  Fp1 = if mod(time, 3 * Ts) < Tw then 1000 else 0;
  Fp2 = if mod(time, 3 * Ts) < Tw + Ts and mod(time, 3 * Ts) > Ts then 1000 else 0;
  Fp3 = if mod(time, 3 * Ts) < Tw + 2 * Ts and mod(time, 3 * Ts) > 2 * Ts then 1000 else 0;
  Text = 0;
  //derivatives
  V1 = der(X1);
  V2 = der(X2);
  V3 = der(X3);
  A1 = der(V1);
  A2 = der(V2);
  A3 = der(V3);
  omgs = der(tets);
  alps = der(omgs);
  //kinematics
  X1 = r1 * cos(tets) + r2;
  Y1 = r1 * sin(tets);
  X2 = r1 * cos(tets + 2 * pi / 3) + r2;
  Y2 = r1 * sin(tets + 2 * pi / 3);
  X3 = r1 * cos(tets + 4 * pi / 3) + r2;
  Y3 = r1 * sin(tets + 4 * pi / 3);
  //dynamic equations
  //shaft
  js * alps = T1 + T2 + T3 - Text - Tfsc;
  Fscx = Fnsp1 + Fnsp2 + Fnsp3;
  Fscy = Ffsp1 + Ffsp2 + Ffsp3;
  //Fsc =sqrt(Fscx^2+Fscx^2);
  T1 = Fnsp1 * Y1 - Ffsp1 * X1 - Tfsp1;
  T2 = Fnsp1 * Y2 - Ffsp2 * X2 - Tfsp2;
  T3 = Fnsp3 * Y3 - Ffsp3 * X3 - Tfsp3;
  //p1
  mp * A1 = Fp1 - Ffcp1 - Fnsp1;
  Ffsp1 = Fncp1;
  Tfsp1 + Fnsp1 * (b2 / 2 - Y1) = Ffsp1 * b1 - Fp1 * b2 / 2 + Tcp1;
  //p2
  mp * A2 = Fp2 - Ffcp2 - Fnsp2;
  Ffsp2 = Fncp2;
  Tfsp2 + Fnsp2 * (b2 / 2 - Y2) = Ffsp2 * b1 - Fp2 * b2 / 2 + Tcp2;
  //p3
  mp * A3 = Fp3 - Ffcp3 - Fnsp3;
  Ffsp3 = Fncp3;
  Tfsp3 + Fnsp3 * (b2 / 2 - Y3) = Ffsp3 * b1 - Fp3 * b2 / 2 + Tcp3;
  //friction

  Ffcp1 = -mukpc * (abs(Fncp1) + abs(Tcp1 / b3)) * sign(V1);
  Ffcp2 = -mukpc * (abs(Fncp2) + abs(Tcp2 / b3)) * sign(V2);
  Ffcp3 = -mukpc * (abs(Fncp3) + abs(Tcp3 / b3)) * sign(V3);
  Tfsp1 = 0;
  Tfsp2 = 0;
  Tfsp3 = 0;
  Ffsp1 = 0;
  Ffsp2 = 0;
  Ffsp3 = 0;

  Tfsc = mukcs * sqrt(Fscx ^ 2 + Fscy ^ 2) * sign(omgs);

end code;

But I get the error:

Error

Simulation of foo exited with an error(-1073741819), see log window for details

enter image description here

and then:

Error: Could not read result file "C:/Users/foo/AppData/Local/Temp/WolframSystemModeler-5.0.0/sme.5.0.0_1510933977_23281.mat". Missing data_2 matrix, the file might be corrupt.

enter image description here

I would appreciate if you could help me understand what is the problem and how can I solve it?

$\endgroup$
2
$\begingroup$

Finally after two weeks of waiting and several emails with the Wolfram technical support support@wolfram.com I got an answer solving the problem. I quote them here:

The error messages that you get are due to an issue in WSM that has been reported and our developers are aware of the problem. The workaround for this would be to turn off "Tearing" in Preferences/Options: Preferences/ Global/ Translation/ Tearing

enter image description here

the experiment in the simulation center does not finish and changing the solver (to Euler) seems to resolve that problem.

P.S. I wish Wolfram WSM people could be more present here. Modelica has a bright future.

$\endgroup$
1
  • $\begingroup$ Which version of WSM you were using? $\endgroup$
    – Jack
    Dec 12 '20 at 5:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.