Program: 74115
Project: 74115
Buggy source:
/** 
 * Perform an integration step. This invokes prefire() and fire() of actors (possibly repeatedly) and advances the local view of time by one step. This normally involves three nested iterative procedures. The outer procedure invokes the possibly multiple steps of the solver (if it is a multistep solver), unless the step size is zero.  The middle one iterates until a suitable step size is found. The inner one, implemented by the superclass, iterates until a fixed point is found at each time point. <p> If there is an enclosing ContinuousDirector, however, then this method simply performs the current round of execution of the enclosing director, using the step size of the enclosing director.
 * @exception IllegalActionException If an actor throws it.
 */
public void fire() throws IllegalActionException {
  if (_debugging) {
    _debug("String_Node_Str" + _currentTime + "String_Node_Str"+ _index);
  }
  ContinuousDirector enclosingContinuousDirector=_enclosingContinuousDirector();
  if (enclosingContinuousDirector != null) {
    _currentStepSize=enclosingContinuousDirector._currentStepSize;
    int round=enclosingContinuousDirector._ODESolver._getRound();
    _ODESolver._setRound(round);
    if (_debugging) {
      _debug("String_Node_Str" + _currentStepSize + "String_Node_Str"+ round+ "String_Node_Str");
    }
    _resetAllReceivers();
    _transferInputsToInside();
    super.fire();
    _transferOutputsToEnvironment();
    return;
  }
  if (_commitIsPending) {
    _transferOutputsToEnvironment();
    return;
  }
  _resetAllReceivers();
  if (_transferInputsToInside() || _currentStepSize == 0.0) {
    _currentStepSize=0.0;
    _ODESolver._reset();
    super.fire();
    _transferOutputsToEnvironment();
    return;
  }
  boolean outputsProduced=false;
  while (!_stopRequested) {
    _ODESolver._reset();
    if (_debugging) {
      _debug("String_Node_Str" + _iterationBeginTime + "String_Node_Str"+ _currentStepSize+ "String_Node_Str"+ _index+ "String_Node_Str");
    }
    int iterations=0;
    while (!_ODESolver._isStepFinished() && iterations < _maxIterations && !_stopRequested) {
      _resetAllReceivers();
      super.fire();
      if (!outputsProduced) {
        _transferOutputsToEnvironment();
        outputsProduced=true;
      }
      double timeIncrement=_ODESolver._getRoundTimeIncrement();
      _currentTime=_iterationBeginTime.add(_currentStepSize * timeIncrement);
      _index=0;
      if (_debugging) {
        _debug("String_Node_Str" + _currentTime + "String_Node_Str");
      }
      _ODESolver._setRound(_ODESolver._getRound() + 1);
      if (_debugging) {
        _debug("String_Node_Str" + _ODESolver._getRound());
      }
      iterations++;
    }
    if (isStepSizeAccurate() && iterations <= _maxIterations) {
      break;
    }
 else {
      if (iterations > _maxIterations) {
        _setCurrentStepSize(_currentStepSize / 2);
      }
 else {
        _setCurrentStepSize(refinedStepSize());
      }
      if (_debugging) {
        _debug("String_Node_Str" + _currentStepSize);
      }
      rollBackToCommittedState();
    }
  }
}

Fixed version (ground truth):
/** 
 * Perform an integration step. This invokes prefire() and fire() of actors (possibly repeatedly) and advances the local view of time by one step. This normally involves three nested iterative procedures. The outer procedure invokes the possibly multiple steps of the solver (if it is a multistep solver), unless the step size is zero.  The middle one iterates until a suitable step size is found. The inner one, implemented by the superclass, iterates until a fixed point is found at each time point. <p> If there is an enclosing ContinuousDirector, however, then this method simply performs the current round of execution of the enclosing director, using the step size of the enclosing director.
 * @exception IllegalActionException If an actor throws it.
 */
public void fire() throws IllegalActionException {
  if (_debugging) {
    _debug("String_Node_Str" + _currentTime + "String_Node_Str"+ _index);
  }
  ContinuousDirector enclosingContinuousDirector=_enclosingContinuousDirector();
  if (enclosingContinuousDirector != null) {
    _currentStepSize=enclosingContinuousDirector._currentStepSize;
    int round=enclosingContinuousDirector._ODESolver._getRound();
    _ODESolver._setRound(round);
    if (_debugging) {
      _debug("String_Node_Str" + _currentStepSize + "String_Node_Str"+ round+ "String_Node_Str");
    }
    _resetAllReceivers();
    _transferInputsToInside();
    super.fire();
    _transferOutputsToEnvironment();
    return;
  }
  if (_commitIsPending) {
    _transferOutputsToEnvironment();
    return;
  }
  _resetAllReceivers();
  if (_transferInputsToInside() || _currentStepSize == 0.0) {
    _currentStepSize=0.0;
    _ODESolver._reset();
    super.fire();
    _transferOutputsToEnvironment();
    return;
  }
  boolean outputsProduced=false;
  while (!_stopRequested) {
    _ODESolver._reset();
    if (_debugging) {
      _debug("String_Node_Str" + _iterationBeginTime + "String_Node_Str"+ _currentStepSize+ "String_Node_Str"+ _index+ "String_Node_Str");
    }
    int iterations=0;
    while (!_ODESolver._isStepFinished() && iterations < _maxIterations && !_stopRequested) {
      _resetAllReceivers();
      _transferInputsToInside();
      super.fire();
      if (!outputsProduced) {
        _transferOutputsToEnvironment();
        outputsProduced=true;
      }
      double timeIncrement=_ODESolver._getRoundTimeIncrement();
      _currentTime=_iterationBeginTime.add(_currentStepSize * timeIncrement);
      _index=0;
      if (_debugging) {
        _debug("String_Node_Str" + _currentTime + "String_Node_Str");
      }
      _ODESolver._setRound(_ODESolver._getRound() + 1);
      if (_debugging) {
        _debug("String_Node_Str" + _ODESolver._getRound());
      }
      iterations++;
    }
    if (isStepSizeAccurate() && iterations <= _maxIterations) {
      break;
    }
 else {
      if (iterations > _maxIterations) {
        _setCurrentStepSize(_currentStepSize / 2);
      }
 else {
        _setCurrentStepSize(refinedStepSize());
      }
      if (_debugging) {
        _debug("String_Node_Str" + _currentStepSize);
      }
      rollBackToCommittedState();
    }
  }
}