next up previous contents
Next: B.5 Additional Stepping Control Up: B. The Stepping Module Previous: B.3 Conditional Stepping


B.4 Stepping Control

Stepping control is a powerful feature for influencing the step increments/decrements while the simulation is already running:

Basically, all stepping variables are subject to default stepping control schemes. These default schemes do literally nothing, so the deltas and boundaries remain constant. If one wants to apply non-trivial algorithms, the SteppingControl section has to be redefined. In the subsection Scheme, a section with the same name as the stepping variable must be added by inheriting the stepping algorithm:

SteppingControl
{
   Scheme
   {
      +time : SimpleTimestep;
   }  
}

In this example, the stepping variable time (obviously of a transient simulation) is assigned to the SimpleTimestep stepping control algorithm.

The default files not only provide the default algorithms (ConstantStep and StepCondDefault), but also the following non-trivial ones:

If the default algorithms do not serve the purpose, one is encouraged to define individual schemes. For delta steppings, the respective section consists of two independent subsections with predefined names: Failure and Converged. The former is addressed if the simulation of the current stepping configuration failed, the latter is addressed if the solution could be successfully calculated.

The author of the scheme is almost completely free in drawing the right conclusion for the respective simulation. The only constraint is that the characteristic of the stepping function must not be changed. Due to the unmodifiable start and stop boundaries, an increasing stepping function must always be increasing, a decreasing function must always be decreasing.

In order to calculate a new stepping delta, MINIMOS-NT provides the following input to the Failure and Converged section:


Table B.2: Information provided to delta stepping control algorithms.
Keyword Type Description
delta Real the current stepping delta
deltaOrig Real the original stepping delta as specified
deltaMin Real the minimum stepping delta as specified
deltaMax Real the maximum stepping delta as specified
deltaLog Boolean true if logarithmic stepping is activated
start Real the start value of the stepping
stop Real the stop value of the stepping
value Real the current value of the stepping


MINIMOS-NT reads/expects two variables from the respective stepping control section:


Table B.3: Information expected from delta stepping control algorithms.
Keyword Type Description
deltaNew Real the new stepping delta
print String information for the user


The termination of the stepping is indicated by specific values for deltaNew: one for the logarithmic and zero for the linear case. The author of the stepping algorithm is responsible to adhere to the boundaries deltaMin and deltaMax of the respective stepping function. These boundaries are not enforced by MINIMOS-NT.

A good starting point for writing a new stepping algorithm is to create a new section which is inherited from SchemeDefaults.ConstantStep. This section will look something like this:

NewStepping : SchemeDefaults.ConstantStep
{
   Failure   // => reduce the delta
   {
      aux d    = delta / 1.9;
      deltaNew = if(abs(d) < abs(deltaMin), if(deltaLog, 1.0, 0.0), d);

      aux printText = "Decrementing delta: " + delta + " -> " + deltaNew;
      print         = if(deltaNew == delta, "", printText);
   }
      
   Converged // => increase the delta
   {
      aux d = if (value == start, delta, delta * 2);
      deltaNew = if(abs(d) > abs(deltaMax), deltaMax, d);
         
      aux printText = "Increasing delta: " + delta + " -> " + deltaNew;
      print         = if(deltaNew == delta, "", printText);
   }
}

For the control of conditional steppings, a different kind of algorithm can be applied. MINIMOS-NT provides values for the following variables:


Table B.4: Information provided to conditional stepping control algorithms.
Keyword Type Description
valueLow Real the current lower stepping boundary
valueHigh Real the current higher stepping boundary
condLow Real the function value at the lower boundary
condHigh Real the function value at the higher boundary


MINIMOS-NT reads/expects three variables from the respective stepping control section:


Table B.5: Information expected from conditional stepping control algorithms.
valueLowNew Real the new lower stepping boundary
valueHighNew Real the new higher stepping boundary
print String information for the user


The stepping algorithm is always addressed in case valueLow and valueHigh have the same sign since then no zero point can be calculated in-between. This has different consequences for directly and indirectly proportional variables.

Thus, a typical algorithm looks like this:

StepCondDirect : StepCondDefault
{
   +checkSign = 1;
   valueLowNew  = if (sign(condLow) == checkSign, valueLow / 1.5, valueHigh);
   valueHighNew = if (sign(condLow) == checkSign, valueLow, valueHigh * 1.5);
   print        = if (sign(condLow) == checkSign, 
                      "Adaptation: bounds are too high => must be lower",
                      "Adaptation: bounds are too low => must be higher");
}

This algorithm is derived from the default one, inheriting all definitions of the input variables above. Depending on checkSign, the boundaries are either shifted up or down. Due to multiplication and division in this algorithm the sign of the boundaries is not changed. By using inheritance again, the indirect variant is very simple:

StepCondIndirect : StepCondDirect
{
  checkSign = -1;
}


next up previous contents
Next: B.5 Additional Stepping Control Up: B. The Stepping Module Previous: B.3 Conditional Stepping

S. Wagner: Small-Signal Device and Circuit Simulation