Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

Warnings with equation number

Warnings with equation number

Hello all

Sometimes I get messages like this:

Running model...
LOG_NLS           | warning | Error solving nonlinear system 51 at time 5.76583
LOG_NLS           | warning | nonlinear system 51 fails: at t=5.76583

The problem is, how to know what is the equation 51?

Best regards
Koldo

Re: Warnings with equation number

What version of OpenModelica are you using? More recent ones will have a link "Debug more" that will open the debugger for you.

Re: Warnings with equation number

Hello Sjoelund.se

True. However when clicking the debug link the "Equations browser" is opened showing the line 51, but no code is highlighted. When clicking on other lines in the "Equations browser", their equation is highlighted in "Source browser".

I have compiled and run the code using omc directly and running the .exe. I have used checkModel(), instantiateModel() and dumpXMLDAE(). The .exe has been run with  -w  -lv=LOG_DEBUG,LOG_STATS options. I have not got more information.

checkModel() returns "Check of Wells completed successfully.Class Wells has 42 equation(s) and 42 variable(s).14 of these are trivial equation(s).", so it is more difficult to find nonlinear system 51 as there are only 42 equations.

Best regards
Koldo

PD. I have included you a "compact" one class version of the model. Here the equition number is 55.

class MyClass
  Real mes__port_p(start = 100000.0, fixed = true);
  Real mes__port_T(start = 300.0, fixed = true);
  Real mes__port_G;
  Real mes__port_H;
  Real mes__vol;
  parameter Real mes__sup = 0.0;
  Real mes__rho;
  parameter Real mes__vol_0 = 1500.0;
  parameter Real mes__A = 480.0;
  parameter Real mes__T = 10.0;
  parameter Real mes__phaseShift = 0.0;
  Real sys_one_p;
  Real sys_one_T;
  Real sys_one_G;
  Real sys_one_H;
  Real sys_two_p;
  Real sys_two_T;
  Real sys_two_G;
  Real sys_two_H;
  parameter Real sys_N = 8.0;
  parameter Real sys_c = 0.55;
  parameter Real sys_Rt = 1.25;
  parameter Real sys_Rh = 0.75;
  Real sys_rho;
  Real sys_U;
  Real sys_omega;
  Real sys_AT;
  Real sys_v1;
  Real sys_alpha_e(start = 0.01);
  Real sys_alpha_e_g;
  Real sys_Cx;
  Real sys_C_theta;
  Real sys_Cl;
  Real sys_Cd;
  Real sys_phi(start = 0.01);
  Real sys_Pm;
  Real sys_Pf;
  Real sys_eta_tt;
  Real sys_eta_ts;
  Real sys_deltaP;
  Real sys_v2y;
  Real sys_v2y_U;
  Real sys_alpha2(start = 1.570796326794897);
  Real sys_chi;
  Real sys_chi_a;
  Real sys_chi_pp;
  Real sys_epsilon;
  parameter Real sys_omega_0 = 209.4395102393195;
  parameter Real sys_Rm = 0.5 * (sys_Rt + sys_Rh);
  parameter Real sys_sigma = sys_N * sys_c / (sys_Rm * 6.283185307179586);
  Real atm_port_p;
  Real atm_port_T;
  Real atm_port_G;
  Real atm_port_H;
  parameter Real atm_p_cte = 100000.0;
  parameter Real atm_T_cte = 300.0;
equation
  mes__vol = mes__vol_0 + mes__A * sin(6.283185307179586 * (time - mes__phaseShift) / mes__T);
  mes__port_p = 287.0024853296514 * mes__rho * mes__port_T;
  mes__vol * der(mes__rho) + mes__rho * der(mes__vol) + mes__port_G = 0.0;
  mes__vol * der(mes__port_p) + 1.4 * mes__port_p * der(mes__vol) + 0.3999999999999999 * mes__port_H = 0.0;
  sys_omega = sys_omega_0;
  sys_one_G + sys_two_G = 0.0;
  sys_one_H + sys_two_H = sys_Pf;
  sys_deltaP / (sys_U ^ 2.0 * sys_rho) = sys_v2y_U + 0.5 * (sys_v2y_U ^ 2.0 + sys_chi * (sys_phi ^ 2.0 + (1.0 + sys_v2y_U) ^ 2.0));
  sys_U = sys_omega * sys_Rm;
  sys_AT = 3.141592653589793 * (sys_Rt ^ 2.0 - sys_Rh ^ 2.0);
  sys_phi = sys_v1 / sys_U;
  sys_alpha_e = atan2(4.0 * sys_v1, 4.0 * sys_U + sys_sigma * (sys_U ^ 2.0 + sys_v1 ^ 2.0) * sys_Cl * sin(sys_alpha_e) / sys_v1);
  sys_Cx = sys_Cl * cos(sys_alpha_e) + sys_Cd * sin(sys_alpha_e);
  sys_C_theta = sys_Cl * sin(sys_alpha_e) - sys_Cd * cos(sys_alpha_e);
  sys_Pm / (sys_U ^ 3.0 * sys_rho * sys_AT) = 0.5 * sys_sigma * sys_C_theta * (1.0 + sys_phi ^ 2.0);
  sys_Pf / (sys_U ^ 3.0 * sys_rho * sys_AT) = sys_phi * (sys_v2y_U + 0.5 * sys_chi * (sys_phi ^ 2.0 + (1.0 + sys_v2y_U) ^ 2.0));
  if sys_Pm > 0.0 then
    sys_eta_tt = sys_Pm / sys_Pf;
    sys_eta_ts = 1.0 / (1.0 + 0.5 * (sys_chi * (sys_phi ^ 2.0 + (1.0 + sys_v2y_U) ^ 2.0) + sys_phi ^ 2.0 + sys_v2y_U ^ 2.0) / sys_v2y_U);
  else
    sys_eta_tt = 0.0;
    sys_eta_ts = 0.0;
  end if;
  sys_v2y_U = sys_v2y / sys_U;
  sys_v2y_U = 0.5 * sys_sigma * sys_C_theta * (1.0 + sys_phi ^ 2.0) / sys_phi;
  sys_chi_a = (sys_sigma * sys_Cx * (1.0 + sys_phi ^ 2.0)   -2.0 * sys_v2y_U - sys_v2y_U ^ 2.0) / (sys_phi ^ 2.0 + (1.0 + sys_v2y_U) ^ 2.0);
  sys_epsilon = 57.29577951308232 * (sys_alpha_e - sys_alpha2);
  sys_alpha2 = atan2(sys_phi, 1.0 + sys_v2y_U);
  sys_chi_pp = 0.007669 + 3.532e-006 * sys_epsilon + 2.816e-006 * sys_epsilon ^ 2.0   -6.806e-009 * sys_epsilon ^ 3.0;
  sys_chi = sys_chi_a + sys_chi_pp;
  if noEvent(sys_one_p >= sys_two_p) then
    sys_one_p = 287.0024853296514 * sys_rho * sys_one_T;
    sys_deltaP = sys_one_p   -0.5 * sys_rho * (sys_U * sys_phi) ^ 2.0 - sys_two_p;
    sys_two_G = sys_phi * sys_rho * sys_U * sys_AT;
    sys_one_H = 3.5 * sys_one_G * sys_one_p / sys_rho;
  else
    sys_two_p = 287.0024853296514 * sys_rho * sys_two_T;
    sys_deltaP = sys_two_p   -0.5 * sys_rho * (sys_U * sys_phi) ^ 2.0 - sys_one_p;
    sys_one_G = sys_phi * sys_rho * sys_U * sys_AT;
    sys_two_H = 3.5 * sys_two_G * sys_two_p / sys_rho;
  end if;
  if sys_alpha_e < 0.2099830057683906 then
    sys_Cl = 6.283185307179586 * sys_alpha_e;
  elseif sys_alpha_e < 0.4808936161475124 then
    sys_Cl = sys_alpha_e * (6.283185307179586   -23.19283581542516 * (-0.2099830057683906 + sys_alpha_e));
  else
    sys_Cl = 0.0;
  end if;
  sys_Cd = 0.0058 + 0.24 * sys_alpha_e ^ 2.0;
  sys_alpha_e_g = 57.29577951308232 * sys_alpha_e;
  atm_port_p = atm_p_cte;
  atm_port_T = atm_T_cte;
  mes__port_H + sys_one_H = 0.0;
  mes__port_G + sys_one_G = 0.0;
  atm_port_H + sys_two_H = 0.0;
  atm_port_G + sys_two_G = 0.0;
  mes__port_T = sys_one_T;
  mes__port_p = sys_one_p;
  atm_port_T = sys_two_T;
  atm_port_p = sys_two_p;
end MyClass;

Re: Warnings with equation number

A non-linear system is not a single equation, which is why it cannot highlight a single line of code. Click the little plus sign and equations 41..54 (?) will all line up. The residual equations are solved as a NLS, and the assignments are solved as normal (it is a torn NLS).

Re: Warnings with equation number

You are right. I did not realized that the "Equations" column in "Equations Browser" contains a copy of the equation. Just widening it the equation appear. Thank you.

There are 0 guests and 0 other users also viewing this topic
You are here: