Program: 73879
Project: 73879
Buggy source:
/** 
 * Fire a complete iteration and advance time to the current time plus the period value. A complete iteration consists of several minor cycles. At each minor cycle, iterate actors in the corresponding minor cycle schedule. After iterating the actors, increment time by the minor cycle time. Also, update the receivers that are destinations of all actors that will be invoked in the next minor cycle of the schedule. This works because all actors in Giotto are invoked periodically, and the ones that will be invoked in the next cycle are the ones that are completing invocation at the end of this cycle.
 * @exception IllegalActionException If this director does not have acontainer.
 */
public void fire() throws IllegalActionException {
  TypedCompositeActor container=(TypedCompositeActor)getContainer();
  if (container == null) {
    throw new IllegalActionException(this,"String_Node_Str");
  }
  if (_debugging) {
    _debug("String_Node_Str");
  }
  if (!_readyToFire) {
    return;
  }
  while ((_unitIndex < _schedule.size()) && !_stopRequested) {
    setModelTime(_expectedNextIterationTime);
    Schedule unitSchedule=(Schedule)_schedule.get(_unitIndex);
    if (_synchronizeToRealTime) {
      long elapsedTime=System.currentTimeMillis() - _realStartTime;
      double elapsedTimeInSeconds=elapsedTime / 1000.0;
      if (_expectedNextIterationTime.getDoubleValue() > elapsedTimeInSeconds) {
        long timeToWait=(long)((_expectedNextIterationTime.getDoubleValue() - elapsedTimeInSeconds) * 1000.0);
        if (timeToWait > 0) {
          if (_debugging) {
            _debug("String_Node_Str" + timeToWait);
          }
          Scheduler scheduler=getScheduler();
synchronized (scheduler) {
            try {
              scheduler.wait(timeToWait);
            }
 catch (            InterruptedException ex) {
            }
          }
        }
      }
    }
    Iterator scheduleIterator=unitSchedule.iterator();
    while (scheduleIterator.hasNext()) {
      Actor actor=((Firing)scheduleIterator.next()).getActor();
      System.out.println("String_Node_Str" + actor.getFullName());
      Time thistime=getModelTime();
      System.out.println("String_Node_Str" + thistime.toString() + "String_Node_Str"+ thistime.getDoubleValue());
      if (_debugging) {
        _debug("String_Node_Str" + ((NamedObj)actor).getFullName());
      }
      List outputPortList=actor.outputPortList();
      Iterator outputPorts=outputPortList.iterator();
      while (outputPorts.hasNext()) {
        IOPort port=(IOPort)outputPorts.next();
        System.out.print("String_Node_Str" + port.getDisplayName());
        Receiver[][] channelArray=port.getRemoteReceivers();
        for (int i=0; i < channelArray.length; i++) {
          Receiver[] receiverArray=channelArray[i];
          for (int j=0; j < receiverArray.length; j++) {
            GiottoReceiver receiver=(GiottoReceiver)receiverArray[j];
            receiver.update();
          }
        }
      }
    }
    scheduleIterator=unitSchedule.iterator();
    while (scheduleIterator.hasNext()) {
      Actor actor=((Firing)scheduleIterator.next()).getActor();
      Attribute WCET=((Entity)actor).getAttribute("String_Node_Str");
      if (WCET == null) {
        System.out.println(actor.getFullName() + "String_Node_Str");
      }
 else {
        System.out.println("String_Node_Str" + ((DoubleToken)((Variable)WCET).getToken()).doubleValue());
      }
      if (_debugging) {
        _debug("String_Node_Str" + ((NamedObj)actor).getFullName());
      }
      if (actor.iterate(1) == STOP_ITERATING) {
        System.err.println("String_Node_Str" + "String_Node_Str" + actor.getFullName() + "String_Node_Str");
      }
    }
    System.out.println("String_Node_Str" + _unitIndex);
    _unitIndex++;
    _expectedNextIterationTime=_expectedNextIterationTime.add(_unitTimeIncrement);
    if (_unitIndex == _lcm) {
      _expectedNextIterationTime=new Time(this,_periodValue * (_iterationCount + 1));
    }
    if (_debugging) {
      _debug("String_Node_Str" + _expectedNextIterationTime + "String_Node_Str");
    }
  }
  if (_unitIndex >= _schedule.size()) {
    _unitIndex=0;
    if (_debugging) {
      _debug("String_Node_Str" + _iterationCount);
    }
    _iterationCount++;
  }
}

Fixed version (ground truth):
/** 
 * Fire a complete iteration and advance time to the current time plus the period value. A complete iteration consists of several minor cycles. At each minor cycle, iterate actors in the corresponding minor cycle schedule. After iterating the actors, increment time by the minor cycle time. Also, update the receivers that are destinations of all actors that will be invoked in the next minor cycle of the schedule. This works because all actors in Giotto are invoked periodically, and the ones that will be invoked in the next cycle are the ones that are completing invocation at the end of this cycle.
 * @exception IllegalActionException If this director does not have acontainer.
 */
public void fire() throws IllegalActionException {
  TypedCompositeActor container=(TypedCompositeActor)getContainer();
  if (container == null) {
    throw new IllegalActionException(this,"String_Node_Str");
  }
  if (_debugging) {
    _debug("String_Node_Str");
  }
  if (!_readyToFire) {
    return;
  }
  while ((_unitIndex < _schedule.size()) && !_stopRequested) {
    setModelTime(_expectedNextIterationTime);
    Schedule unitSchedule=(Schedule)_schedule.get(_unitIndex);
    if (_synchronizeToRealTime) {
      long elapsedTime=System.currentTimeMillis() - _realStartTime;
      double elapsedTimeInSeconds=elapsedTime / 1000.0;
      if (_expectedNextIterationTime.getDoubleValue() > elapsedTimeInSeconds) {
        long timeToWait=(long)((_expectedNextIterationTime.getDoubleValue() - elapsedTimeInSeconds) * 1000.0);
        if (timeToWait > 0) {
          if (_debugging) {
            _debug("String_Node_Str" + timeToWait);
          }
          Scheduler scheduler=getScheduler();
synchronized (scheduler) {
            try {
              scheduler.wait(timeToWait);
            }
 catch (            InterruptedException ex) {
            }
          }
        }
      }
    }
    Iterator scheduleIterator=unitSchedule.iterator();
    while (scheduleIterator.hasNext()) {
      Actor actor=((Firing)scheduleIterator.next()).getActor();
      if (_debugging) {
        _debug("String_Node_Str" + actor.getFullName());
      }
      Time thistime=getModelTime();
      if (_debugging) {
        _debug("String_Node_Str" + thistime.toString());
      }
      if (_debugging) {
        _debug("String_Node_Str" + ((NamedObj)actor).getFullName());
      }
      List outputPortList=actor.outputPortList();
      Iterator outputPorts=outputPortList.iterator();
      while (outputPorts.hasNext()) {
        IOPort port=(IOPort)outputPorts.next();
        if (_debugging) {
          _debug("String_Node_Str" + port.getDisplayName());
        }
        Receiver[][] channelArray=port.getRemoteReceivers();
        for (int i=0; i < channelArray.length; i++) {
          Receiver[] receiverArray=channelArray[i];
          for (int j=0; j < receiverArray.length; j++) {
            GiottoReceiver receiver=(GiottoReceiver)receiverArray[j];
            receiver.update();
          }
        }
      }
    }
    scheduleIterator=unitSchedule.iterator();
    while (scheduleIterator.hasNext()) {
      Actor actor=((Firing)scheduleIterator.next()).getActor();
      Attribute WCET=((Entity)actor).getAttribute("String_Node_Str");
      if (_debugging) {
        _debug("String_Node_Str" + ((NamedObj)actor).getFullName());
      }
      if (actor.iterate(1) == STOP_ITERATING) {
        System.err.println("String_Node_Str" + "String_Node_Str" + actor.getFullName() + "String_Node_Str");
      }
    }
    if (_debugging) {
      _debug("String_Node_Str" + _unitIndex);
    }
    _unitIndex++;
    _expectedNextIterationTime=_expectedNextIterationTime.add(_unitTimeIncrement);
    if (_unitIndex == _lcm) {
      _expectedNextIterationTime=new Time(this,_iterationCount + (_periodValue * (_unitIndex)));
      if (_debugging) {
        _debug("String_Node_Str");
        _debug("String_Node_Str" + _iterationCount);
      }
    }
    if (_debugging) {
      _debug("String_Node_Str" + _expectedNextIterationTime + "String_Node_Str");
    }
  }
  if (_unitIndex >= _schedule.size()) {
    _unitIndex=0;
    if (_debugging) {
      _debug("String_Node_Str" + _iterationCount);
    }
    _iterationCount++;
  }
}