Search code examples
modelicaopenmodelica

OpenModelica errors "Too few rows in data_2 matrix"


I have tried to simulate this simple example (in OpenModelica 1.9.1 Beta1 (r18938)):

model daadd

parameter Real tw1=32.1;

parameter Real tw2=36.4;

Real tk2;

equation

1=(tw2-tw1)/(2.3*log10((tk2-tw1)/(tk2-tw2)));

end sjoelund.se;

end daadd;

And then I got this message: Too few rows in data_2 matrix.
Then I also got another error-message:

LOG_NLS        | warning     | Error solving nonlinear system Nonlinear function (residualFunc5, size 1) at time 0 Debug more 
stdout        | warning     | Error in initialization. Storing results and exiting. 
Use -lv=LOG_INIT -w for more information. 
Process crashed 
Simulation process exited with code -1

Solution

  • Starting with r21400, OpenModelica will handle the inverse of log10. The non-linear solver has trouble finding the solution because a lot of numbers are not valid input for log10 (and it is quite hard to try to numerically linearise it).

    The generated code is now:

    tk2 = (tw2 * 10.0 ^ ((tw2 - tw1) / 2.3) - tw1) / (-1.0 + 10.0 ^ ((tw2 - tw1) / 2.3))