AmesimKnowledge

Troubleshooting

20 consecutive restarts

The error message “20 consecutive restarts” indicates that the solver has difficulties to handle a discontinuity: each restart procedure initiated just “after” the discontinuity is immediately followed by a new discontinuity event. This makes the solver stall to the discontinuity point and should normally not happen.

The following figure shows the error message, followed by the last 20 discontinuity messages and the corresponding simulation time.

Figure 19: discontinuity error message

Such an error message usually means that the submodel registering the last discontinuities is badly coded, and that some regions are overlapping.

The following example of saturation can create such a trouble. The case x=xmax is included in the “limited to higher value” case and in the test for leaving this region. This means that when x=xmax, the submodel will stick to region “limited to higher value” but still register discontinuities as long as the solver restarts.

Copy

void saturation_(int *n, double *y, double *x, double rp[2],
                 int ic[1], int *flag)
{
   int logi;
   double xmax, xmin;

   xmax = rp[0];
   xmin = rp[1];
   logi = 0;

   if(*flag == 0)
   {
      if (*x >= xmax) /* Limited to higher value. */
      {
         ic[0] = 1;
      }
      else if (*x < xmin) /* Limited to lower value. */
      {
         ic[0] = -1;
      }
      else /* Unlimited. */
      {
         ic[0] = 0;
      }
   }

   if (ic[0] == 1) /* Limited to higher value. */
   {
      *y = xmax;

      /* Check if becoming free of upper limit. */
      logi = (*x <= xmax);
   }
   else if (ic[0] == -1) /* Limited to lower value. */
   {
      *y = xmin;

      /* Check if becoming free of lower limit. */
      logi = (*x >= xmin);
   }
   else /* Unlimited. */
   {
      *y = *x;

      /* Check if becoming limited at upper value ... */
      logi = (*x > xmax) || (*x < xmin);
   }

   if (logi) /* logi is true (1) when using wrong equation. */
   {
      /* Send a warning to the solver. */
      disloc_(&logi);
   }
/* <<<<<<<<<<<<End of Calculation Executable Statements. */
}

To prevent such mistake, always remember that discontinuity regions must be mutually exclusive.

Source: https://docs.sw.siemens.com/en-US/doc/254352342/PL20250521841123434.amesim_collection.TB121_Discontinuity_Handling/xid1849196 · retrieved 2026-07-17