error in computing log values

31 ビュー (過去 30 日間)
F SHEFIN
F SHEFIN 2021 年 12 月 2 日
コメント済み: F SHEFIN 2021 年 12 月 6 日
Hi sir..My simulink model runs Good for certain values of input...but for some values it gives a complex computation error.I have used a algebraic constraint solver.
An error occurred while running the simulation and the simulation was terminated
Caused by:
  • Domain error. To compute complex results from real x, use 'log(complex(x))'.
  • Error in log.m (line 14) coder.internal.error('Coder:toolbox:ElFunDomainError',mfilename); Error in 'ExitMoles/OutletEnthalpy' (line 20)
  11 件のコメント
Walter Roberson
Walter Roberson 2021 年 12 月 2 日
Simulink models can be attached to posts here using the paperclip icon of the editor.
F SHEFIN
F SHEFIN 2021 年 12 月 2 日
Sir...i have attached the model..
there are 4 inputs..actualyy...T,Ratio,Fuel,Per the output is next to the solver...
pls keep T as 100 at every trail.
For all values of Ratio @ 1 per i am getting my answer..
When ratio changes to 1 simulink doesnt compute @ 0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9 ...but computes @ 1 per
when ratio changes ti 2 , simulink doesnt compute @ 0.3 to 0.9....but computes @ 0.1, 0.2,1 per.
similarly for ratio 3 and 4 some values are alone getting computed,
But when ratio is 5 i am able to compute @ all the per values.
It is not simulating for some values...i hope i was clear withe the problem. Thank you

サインインしてコメントする。

回答 (1 件)

Mathieu NOE
Mathieu NOE 2021 年 12 月 2 日
hello
the "log" error was just a consequence of an algebraic loop of OutletEnthalpy bloc : (its input is dependant of the P output)
so probably log of zero or NaN or negative Tad would trigger the error.
simply added a memory block on the P input signal of the OutletEnthalpy bloc and seems the simulation runs fine now (as far I can tell)
  13 件のコメント
Mathieu NOE
Mathieu NOE 2021 年 12 月 6 日
Congrats !
glad you found the bug...
it's chrismas already !
all the best
F SHEFIN
F SHEFIN 2021 年 12 月 6 日
Thank you sir....Merry Christmas

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeGeneral Applications についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by