Message Boards Message Boards

Read result file, avoid missing data matrix, the file might be corrupt?

GROUPS:

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

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.0151093397723281.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?

Answer
26 days ago

Group Abstract Group Abstract