Unexpected NaN output from power block

10 次查看(过去 30 天)
While building my model I came across the following integrator error:
  • Derivative of state '1' in block 'simpie/Motor & PI Current Controller/Integrator' at time 4.519405258285984 is not finite. The simulation will be stopped. There may be a singularity in the solution. If not, try reducing the step size (either by reducing the fixed step size or by tightening the error tolerances)
After some investigation I found by setting the INF or NaN block output to warning that there are NaN values that are contaminating my feedback loop which in turn raises the integrator error. By setting the INF or NaN block output setting to warning I tried to figure out where the first NaN value comes from. This raises the following error:
An error occurred during simulation and the simulation was terminated
Caused by:
From reading the documentation about the power block, it became clear that the block will output a NaN value from an NaN input. I assume that there is no NaN input into the power block since this is the first NaN output. I tried to use the isnan block to monitor the generated NaN value without succes. The block does not recognice any NaN output. The error occurs at a specific point in time where the value into the power block for the base come close to zero (See the included figure). The exponent is a constant.
Strangely the simulation works fine for t<1 which also has an input of 0 for the power block.
Does anyone have a clue what causes this problem and how to fix it?
Thank you in advance
  3 个评论
Walter Roberson
Walter Roberson 2024-12-17
I suggest that instead of testing using isnan() that you instead test ~isfinite() as that also tests for +/- inf
Quint
Quint 2024-12-17
Here is my simulink model file with corresponding data. I tried the isfinite() function without succes. Additionally, the problem arises when the base of the power block is almost zero. I kind of fixed the issue to round the value before the powerblock to zero when it almost reaches zero. There are still some NaN values in my simulation but now it does not crash anymore.

请先登录,再进行评论。

采纳的回答

Vinay
Vinay 2024-12-18
编辑:Vinay 2024-12-18
Hi @Quint,
The occurrence of 'NaN' output when the base of the power block is close to zero is due to the "Power Signedness" functionality of the power block.
To avoid the 'NaN' output when an even order root is used as the power value, the "Signed power" option should be enabled.
Refer to the below documentation of power block for more details on the "Signed Power" functionality:
I hope this would resolve the issue!

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Simulink Functions 的更多信息

产品


版本

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by