Derivative of state '1' in block 'model4/PMSM /Integrator' at time 1.09996 is not finite

17 views (last 30 days)
Could you please help me to solve the following error.
I am triing to find integrl squer error for pi controller and get this error
Error using fun (line 16) Derivative of state '1' in block 'model4/PMSM /Integrator' at time 1.09996 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)

Answers (3)

hardik on 17 Jul 2021
Use saturation block, because somewhere, the answer is getting zero.

Sign in to comment.

Peter O
Peter O on 18 Jul 2021
This error can occur when the feedback loop creates positive feedback. As you step through time your derivative input into the integrator looks something like:
  1. dx/dt = 0.12
  2. dx/dt = 123
  3. dx/dt = 1230
  4. dx/dt = 1.23e6
  5. dx/dt = 1.23e9
  6. dx/dt = 1.23e16
  7. dx/dt = 1.23e50
  8. dx/dt = 1.23e150
  9. dx/dt = 1.23e300
  10. dx/dt = Inf or NaN (Overflows the floating point)
To determine if this is the case, attach a scope to the input to the integrator. If you're blowing up, then you'll see a dramatic exponential curve ending at that incredibly high value. Less commonly, you might encounter a divide by zero condition which also sends a NaN into the integrator. Check your connections in the PI loop and make sure you're sending the controller negative feedback with appropriate gains.
Peter O
Peter O on 21 Jul 2021
Based on the photograph, you seem to be integrating the square of the summed error over time. It's a little tricky to troubleshoot your problem without a larger context. A couple ideas:
  1. Does this "SE" term feed back into the model before the time horizon ends or is it strictly informational for the optimizer, at the end of a defined period? If you're using it to tune a gain in real-time, know that all errors (under and overshoot) it passes back are going to show up as positive, so it doesn't matter what action it takes: the error will always seem to be increasing, which might cause the controller to drive something really, really hard and lose stability.
  2. If it's strictly informational (for instance, you're using a Monte-Carlo method to check out a bunch of gain constants), you might still get a couple "bad" gain sets which could cause this. Either adjust your bounds to operate within a more stable region or look into doing something like checking the model error for a maximum gain error and using the Stop Simulation block to kill it early.
Answering your question, you can encounter divide by zero if some term on the loop denominator goes to zero. If you have something like for a block and something earlier in the loop sets u to zero, then
y = 1/0
y = Inf
ans = logical
So either NaN or Inf is going to give you trouble. From what you've shown, I don't think a divide by zero problem is occuring here.

Sign in to comment.

Hussein shutari
Hussein shutari on 22 Jul 2021
Actually my work is summary as follows. 1-generate random gains by optimizater and send them to model and ckeck the ISE. 2-the ISE is sent to optimizer back to check the the stability. 3-then send new gain based on the value of ISE to the model, and check the new ISE. This proces is repeated till get the lowest ISE so as to sonsidered the corrisponding gain as the optimal gains for the model.


More Answers in the  Power Electronics Control

Community Treasure Hunt

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

Start Hunting!

Translated by