- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » ERROR TEST FAILED REPEATEDLY message
ERROR TEST FAILED REPEATEDLY message
ERROR TEST FAILED REPEATEDLY message
Hello,
I have simple equations and I get this error. Could you help please with solving this issue?
Code:
class Coulomb
Real rx(start=0.1);
Real vx(start=2);
Real ax;
parameter Real q = 1;
parameter Real m = 1;
equation
m*ax = if (rx <> 0) then -(q*q)/rx else 0;
ax = der(vx);
vx = der(rx);
end Coulomb;
simulate(Coulomb, stopTime=5.0);
Error message:
Code:
simulationOptions = "startTime = 0.0, stopTime = 5.0, numberOfIntervals = 500, tolerance = 1e-006, method = 'dassl', fileNamePrefix = 'Coulomb', storeInTemp = false, noClean = false, options = '', outputFormat = 'mat', variableFilter = '.*', measureTime = false, cflags = ''",
messages = " DASSL-- AT T (=R1) AND STEPSIZE H (=R2) THE
In above, R1 = .1810005064331E+01 R2 = .1585671063154E-14
DASSL-- ERROR TEST FAILED REPEATEDLY OR WITH ABS(H)=HMIN
Error in Simulation. Solver exit with error.
| error | DDASRT: DDASSL had repeated error test failures on the last attempted step.
Thank you.
Re: ERROR TEST FAILED REPEATEDLY message
Did you see the pretty warning that says
Code:
rx <> 0.0
will not work as expected?
Anyway, you can tell DASSL what tolerance to use as when you get close to the 0, the system changes too fast. You also need to change the cutoff point from 0.0 to some epsilon close to zero.
Code:
loadString("
class Kulon
Real rx(start=0.1);
Real vx(start=2);
Real ax;
parameter Real q = 1;
parameter Real m = 1;
equation
m*ax = if noEvent(abs(rx) > 1e-12) then -(q*q)/rx else 0;
ax = der(vx);
vx = der(rx);
end Kulon;
");
simulate(Kulon,stopTime=5.0,tolerance=1e-3);getErrorString();
- sjoelund.se
- 1700 Posts
Re: ERROR TEST FAILED REPEATEDLY message
Thank you for help!
sjoelund.se wrote:
Did you see the pretty warning that saysCode:
rx <> 0.0will not work as expected?
Ah, I missed it, I stuck on that error... Thank you!
sjoelund.se wrote:
Anyway, you can tell DASSL what tolerance to use as when you get close to the 0, the system changes too fast. You also need to change the cutoff point from 0.0 to some epsilon close to zero.
Using this equations I'd like to move one particle (with negative charge) around another particle (with positive charge). For this I use Coulomb law (actually I had an error in my original equation, it should be rx^2 in denominator). So as particle is moving by circle it'll have rx=0 and ry=0 sometimes. How this task could be solved in Modelica?
sjoelund.se wrote:
Code:
loadString("
class Kulon
Real rx(start=0.1);
Real vx(start=2);
Real ax;
parameter Real q = 1;
parameter Real m = 1;
equation
m*ax = if noEvent(abs(rx) > 1e-12) then -(q*q)/rx else 0;
ax = der(vx);
vx = der(rx);
end Kulon;
");
simulate(Kulon,stopTime=5.0,tolerance=1e-3);getErrorString();
Thank you for corrections, it's working now! Unless rx == 0...
Re: ERROR TEST FAILED REPEATEDLY message
So you x=y=0 and the charges are opposite so they attract each other and should stick there? The problem is the infinite power and low resolution of double precision floating point (as you could have guessed). I'm not sure what the best approach would be. Something similar to the above approach or possibly a when-clause that uses an external C function (then you can deal with the case that you get infinite acceleration and you can reinit() rx and ry to 0).
- sjoelund.se
- 1700 Posts
Re: ERROR TEST FAILED REPEATEDLY message
sjoelund.se wrote:
So you x=y=0 and the charges are opposite so they attract each other and should stick there? The problem is the infinite power and low resolution of double precision floating point (as you could have guessed). I'm not sure what the best approach would be. Something similar to the above approach or possibly a when-clause that uses an external C function (then you can deal with the case that you get infinite acceleration and you can reinit() rx and ry to 0).
M, I thought it would be easier
That negative particle won't fall on positive particle because it have some speed, enough to compensate attraction force. So there is balance between attraction force (opposite charges attract each other) and repulsion force (centrifugal force). I use orthogonal coordinates and have 2 set of equations - for x and y projections. And when particle is flying around another particle, x and y will be equal to 0 periodically. Seems this is the reason why Modelica throws error.
- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » ERROR TEST FAILED REPEATEDLY message