OpenModelica导出FMU后仿真失败问题求助
FMU导出后仿真失败问题排查
OMEdit v1.21.0(64位)中,模型使用DASSL、Euler和CVODE求解器均可正常运行,但导出为FMU后,在OMEdit和FMPY中仿真均失败,错误信息如下:
assert | debug | Model error: Argument of log10(rn) was 0 should be > 0 stdout | warning | Non-Linear Solver try to handle a problem with a called assert. assert | debug | Solving non-linear system 38 failed at time=0.
模型代码
model experiment import Modelica.Units.Conversions.from_deg; import Modelica.Units.Conversions.to_deg; import Modelica.Constants.g_n; import Modelica.Constants.pi; import Modelica.Constants.small; parameter Modelica.Units.SI.Length Lw =10; parameter Modelica.Units.SI.Length B =3; parameter Modelica.Units.SI.Angle beta=0.35 ; parameter Modelica.Units.SI.Mass m =8000; parameter Modelica.Units.SI.Length xG =3; parameter Modelica.Units.SI.Length zG =1; parameter Modelica.Units.SI.Length fG =0; parameter Modelica.Units.SI.Angle eta =0; parameter Real U =18; parameter Real rho(unit = "kg/m3") = 1025; parameter Modelica.Units.SI.KinematicViscosity nu = 1.19 * 10 ^ (-6) ; parameter Modelica.Units.SI.Torque M = 0 ; parameter Modelica.Units.SI.Angle betaM = 0.01 ; //Unknowns Real fnb ; Real clb ; Real cl0; Real lam(start = 0.9, fixed = false) ; Real cld ; Modelica.Units.SI.Velocity UM ; Real rn "Reynold's number"; Modelica.Units.SI.Length lm ; Real cf ; Modelica.Units.SI.Area Af ; Modelica.Units.SI.Force Ff ; Modelica.Units.SI.Force rT ; Modelica.Units.SI.Force T ; Modelica.Units.SI.Force Fn ; Modelica.Units.SI.Length xP ; Modelica.Units.SI.Length aN ; Modelica.Units.SI.Length aF ; Modelica.Units.SI.Angle tau(start = 0.069, fixed = false) ; equation fnb = U / (g_n * B) ^ 0.5; clb = m * g_n / (0.5 * rho * U ^ 2 * B ^ 2); clb = cl0 - 0.0065 * to_deg(beta) * cl0 ^ 0.60; cl0 = to_deg(tau) ^ 1.1 * (0.012 * lam ^ (1 / 2) + 0.0055 * lam ^ (5 / 2) / fnb ^ 2); cld = 0.012 * lam ^ (1 / 2) * to_deg(tau) ^ 1.1 - 0.0065 * to_deg(beta) * (0.012 * lam ^ (1 / 2) * to_deg(tau) ^ 1.1) ^ 0.6; UM = U * (1 - cld / (lam * cos(tau)) ^ (1 / 2)); rn = lm * UM / nu; lm = B * lam; cf = 0.075 / (log10(rn) - 2) ^ 2; Af = B ^ 2 * lam / cos(beta); Ff = 0.5 * rho * UM ^ 2 * Af * (cf); M = T * fG - Fn * aN - Ff * aF ; 0 = T * cos(eta) - m * g_n * sin(tau) - Ff; rT = (m * g_n * tan(tau) + Ff / cos(tau)); 0 = Fn * cos(eta) - m * g_n * cos(tau + eta) + Ff * sin(eta); xP = lm * (0.75 - 1 / (5.21 * fnb ^ 2 / lam ^ 2 + 2.39)); aN = xG - xP; aF = zG - 1 / 4 * B * tan(beta); end experiment;
尝试的修改及新错误
怀疑是初始化问题,将log10(rn)修改为log10(rn+1000)后,出现新的仿真错误:
assert | debug | hullResistance_12jac.c:274: Invalid root: (0)^(-0.5) assert | debug | Solving non-linear system 38 failed at time=0.
已完成FMU合规性检查,结果无错误,寻求解决思路。
内容的提问来源于stack exchange,提问作者takanotsuru
相关产品推荐
相关产品推荐

