无法求解线性方程组

时间:2019-06-05 13:53:25

标签: modelica openmodelica

我正在尝试解决代码

model modelTest

// types
  type Mass = Real (unit = "Kg", min = 0);
  type Length = Real (unit = "m");
  type Area = Real (unit = "m2", min = 0);
  type Force = Real (unit = "Kg.m/s2");
  type Pressure = Real (unit = "Kg/m/s2");
  type Torque = Real (unit = "Kg.m2/s2");
  type Velocity = Real (unit = "m/s");
  type Time = Real (unit = "s");

// constants
  constant Real pi = 2 * Modelica.Math.asin(1.0);
  parameter Mass Mp = 0.01;
  parameter Length r1 = 0.010;
  parameter Integer n = 3;
  parameter Area A = 0.020 * 0.015;
  parameter Time Stepping = 0.1;
  parameter Real DutyCycle = 0.5;
  parameter Pressure Pin = 5000;
  parameter Real Js = 1;

// variables
  Length x[n];
  Velocity vx[n];
  Real theta;
  Real vt;
  Pressure P[n]; 

initial equation
  theta = 0;
  vt = 0;

algorithm
  for i in 1:n loop
    if noEvent((i - 1) * Stepping < mod(time, Stepping)) and noEvent(mod(time, Stepping) < (i - 1) * Stepping + Stepping * DutyCycle) then
      P[i] := Pin;
    else
      P[i] := 0;
    end if;
  end for;

equation
  vx = der(x);
  vt = der(theta);
  x = r1 * {sin(theta + (i -1) * 2 * pi / n) for i in 1:n};
  Js * der(theta) = r1 * sum((Mp * der(vx) + P * A) .* {cos(theta + (i -1) * 2 * pi / n) for i in 1:n});

annotation(
    experiment(StartTime = 0, StopTime = 10, Tolerance = 1e-6, Interval = 0.01),
    __OpenModelica_simulationFlags(lv = "LOG_STATS", outputFormat = "mat", s = "dassl"));
end modelTest;

但是求解器永远不会显示错误:

  

在时间上无法解出线性方程组(第51号)...余范数为...

     

默认的线性求解器失败,后备求解器在某个时间具有总枢转...可能会破坏plv LOG_LS。

如果您能帮助我知道问题出在哪里以及如何解决,我将不胜感激。感谢您的提前支持。

P.S.1。我在15个月前发现了this similar issue

P.S.2。。代码中有几个错误。可以找到here的修改版本。

0 个答案:

没有答案