Program: 72562
Project: 72562
Buggy source:
/** 
 * Invoke fmiDoStep() of the slave FMU, if necessary to catch up to current time, and then set the (known) inputs of the FMU and retrieve and send out any outputs for which all inputs on which the output depends are known.
 * @exception IllegalActionException If the FMU indicates a failure.
 */
@Override public void fire() throws IllegalActionException {
  super.fire();
  Director director=getDirector();
  Time currentTime=director.getModelTime();
  int currentMicrostep=1;
  if (director instanceof SuperdenseTimeDirector) {
    currentMicrostep=((SuperdenseTimeDirector)director).getIndex();
  }
  if (_debugging) {
    _debugToStdOut("String_Node_Str" + currentTime + "String_Node_Str"+ currentMicrostep);
  }
  double derivatives[]=null;
  FMI20EventInfo.ByReference fmi20EventInfo=null;
  if (_fmiModelDescription.modelExchange) {
    if (!_firstFire) {
      derivatives=_fmiGetDerivatives();
    }
    if (_fmiVersion < 2.0) {
      _fmiSetTime(currentTime);
    }
    if (_firstFire) {
      _fmiInitialize();
      if (_fmiVersion >= 2.0) {
        FMI20ModelInstance fmi20ModelInstance=new FMI20ModelInstance(_fmiComponent);
        FMI20EventInfo fmi20EventInfoStruct=fmi20ModelInstance.eventInfo;
        fmi20EventInfo=new FMI20EventInfo.ByReference(fmi20EventInfoStruct);
        fmi20EventInfo.newDiscreteStatesNeeded=(byte)1;
        fmi20EventInfo.terminateSimulation=(byte)0;
        if (fmi20EventInfo.terminateSimulation == (byte)1) {
          double currentTimeValue=currentTime.getDoubleValue();
          System.out.println("String_Node_Str" + currentTimeValue);
          getDirector().finish();
          return;
        }
      }
      _recordFMUState();
      _lastCommitTime=currentTime;
      _checkEventIndicators();
    }
    if (_fmiVersion >= 2.0) {
      _enterEventMode();
    }
    double states[]=_states.array();
    if (_newStates == null || _newStates.length != states.length) {
      _newStates=new double[states.length];
    }
  }
 else {
    if (_firstFire) {
      for (      Input input : _getInputs()) {
        if (input.start != null) {
          _setFMUScalarVariable(input.scalarVariable,new DoubleToken(input.start.doubleValue()));
          if (_debugging) {
            _debug("String_Node_Str" + input.port.getName() + "String_Node_Str"+ input.start);
          }
        }
      }
    }
    double refinedStepSize=_fmiDoStep(currentTime,currentMicrostep);
    if (refinedStepSize >= 0.0) {
      _stepSizeRejected=true;
      if (_refinedStepSize < 0.0 || refinedStepSize < _refinedStepSize) {
        _refinedStepSize=refinedStepSize;
      }
    }
  }
  int _index;
  for (  Input input : _getInputs()) {
    if (input.port.getWidth() > 0 && input.port.isKnown(0)) {
      if (input.port.hasToken(0)) {
        Token token=input.port.get(0);
        _setFMUScalarVariable(input.scalarVariable,token);
        if ((_fmiVersion >= 2.0) && _fmiModelDescription.modelExchange && _fmiModelDescription.continuousStateNames.contains(input.scalarVariable.name)) {
          _index=_fmiModelDescription.continuousStateNames.indexOf(input.scalarVariable.name);
          _newStates[_index]=((DoubleToken)token).doubleValue();
        }
        if (_debugging) {
          _debugToStdOut("String_Node_Str" + input.scalarVariable.name + "String_Node_Str"+ token);
        }
      }
 else {
        boolean persistentInputsValue=((BooleanToken)persistentInputs.getToken()).booleanValue();
        if (!persistentInputsValue) {
          throw new IllegalActionException(this,"String_Node_Str" + input.scalarVariable.name + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
        }
 else {
          if (_debugging) {
            _debug("String_Node_Str" + input.port.getName() + "String_Node_Str");
          }
        }
      }
    }
 else {
      if (_debugging) {
        _debug("String_Node_Str" + input.port.getName() + "String_Node_Str");
      }
    }
  }
  if (_fmiModelDescription.modelExchange) {
    double currentTimeValue=currentTime.getDoubleValue();
    double states[]=_states.array();
    if (_fmiVersion >= 2.0) {
      _enterContinuousTimeMode();
    }
    if (currentTimeValue > _lastCommitTime.getDoubleValue()) {
      if (states.length > 0) {
        if (_fmiVersion < 2.0) {
          double step=currentTimeValue - _lastCommitTime.getDoubleValue();
          for (int i=0; i < states.length; i++) {
            _newStates[i]=states[i] + derivatives[i] * step;
          }
        }
        _fmiSetContinuousStates(_newStates);
      }
      boolean stateEventOccurred=_checkEventIndicators();
      boolean timeEventOccurred=false;
      if (_fmiVersion < 2.0) {
        _fmiCompletedIntegratorStep(stateEventOccurred || timeEventOccurred);
      }
 else {
        boolean noSetFMUStatePriorToCurrentPoint=true;
        boolean stepEvent=_fmiCompletedIntegratorStep(noSetFMUStatePriorToCurrentPoint);
        if (stepEvent) {
          _enterEventMode();
          if (stepEvent) {
            if (_debugging) {
              _debug("String_Node_Str" + currentTimeValue);
            }
          }
          fmi20EventInfo.newDiscreteStatesNeeded=(byte)1;
          fmi20EventInfo.terminateSimulation=(byte)0;
          System.out.println("String_Node_Str");
          if (fmi20EventInfo.terminateSimulation == (byte)1) {
            System.out.println("String_Node_Str" + currentTimeValue);
            getDirector().finish();
          }
          _enterContinuousTimeMode();
          if (_debugging) {
            if (fmi20EventInfo.valuesOfContinuousStatesChanged == (byte)1) {
              _debug("String_Node_Str" + currentTimeValue);
            }
            if (fmi20EventInfo.nominalsOfContinuousStatesChanged == (byte)1) {
              _debug("String_Node_Str" + currentTimeValue);
            }
          }
        }
      }
    }
 else {
    }
  }
  for (  Output output : _getOutputs()) {
    TypedIOPort port=output.port;
    if (_debugging) {
      _debugToStdOut("String_Node_Str" + port.getName());
    }
    if (_skipIfKnown() && port.isKnown(0)) {
      continue;
    }
    boolean foundUnknownInputOnWhichOutputDepends=false;
    if (output.dependencies != null) {
      for (      TypedIOPort inputPort : output.dependencies) {
        if (_debugging) {
          _debugToStdOut("String_Node_Str" + port.getName() + "String_Node_Str"+ inputPort.getName());
        }
        if (!inputPort.isKnown(0)) {
          if (_debugging) {
            _debugToStdOut("String_Node_Str" + "String_Node_Str" + port.getName() + "String_Node_Str"+ inputPort.getName()+ "String_Node_Str");
          }
          foundUnknownInputOnWhichOutputDepends=true;
          break;
        }
      }
    }
 else {
      List<TypedIOPort> inputPorts=inputPortList();
      for (      TypedIOPort inputPort : inputPorts) {
        if (_debugging) {
          _debugToStdOut("String_Node_Str" + port.getName() + "String_Node_Str"+ inputPort.getName());
        }
        if (inputPort.getWidth() < 0 || !inputPort.isKnown(0)) {
          foundUnknownInputOnWhichOutputDepends=true;
          if (_debugging) {
            _debugToStdOut("String_Node_Str" + "String_Node_Str" + port.getName() + "String_Node_Str"+ inputPort.getName()+ "String_Node_Str");
          }
          break;
        }
      }
    }
    if (_debugging) {
      _debugToStdOut("String_Node_Str" + port.getName() + "String_Node_Str"+ foundUnknownInputOnWhichOutputDepends);
    }
    if (!foundUnknownInputOnWhichOutputDepends) {
      Token token=null;
      FMIScalarVariable scalarVariable=output.scalarVariable;
      if (scalarVariable.type instanceof FMIBooleanType) {
        boolean result=scalarVariable.getBoolean(_fmiComponent);
        token=new BooleanToken(result);
      }
 else       if (scalarVariable.type instanceof FMIIntegerType) {
        int result=scalarVariable.getInt(_fmiComponent);
        token=new IntToken(result);
      }
 else       if (scalarVariable.type instanceof FMIRealType) {
        double result=scalarVariable.getDouble(_fmiComponent);
        token=new DoubleToken(result);
      }
 else       if (scalarVariable.type instanceof FMIStringType) {
        String result=scalarVariable.getString(_fmiComponent);
        token=new StringToken(result);
      }
 else {
        throw new IllegalActionException("String_Node_Str" + scalarVariable.type + "String_Node_Str");
      }
      if (_debugging) {
        _debugToStdOut("String_Node_Str" + scalarVariable.name + "String_Node_Str"+ token+ "String_Node_Str"+ currentTime+ "String_Node_Str"+ currentMicrostep);
      }
      port.send(0,token);
    }
  }
  _firstFireInIteration=false;
  _firstFire=false;
}

Fixed version (ground truth):
/** 
 * Invoke fmiDoStep() of the slave FMU, if necessary to catch up to current time, and then set the (known) inputs of the FMU and retrieve and send out any outputs for which all inputs on which the output depends are known.
 * @exception IllegalActionException If the FMU indicates a failure.
 */
@Override public void fire() throws IllegalActionException {
  super.fire();
  Director director=getDirector();
  Time currentTime=director.getModelTime();
  int currentMicrostep=1;
  if (director instanceof SuperdenseTimeDirector) {
    currentMicrostep=((SuperdenseTimeDirector)director).getIndex();
  }
  if (_debugging) {
    _debugToStdOut("String_Node_Str" + currentTime + "String_Node_Str"+ currentMicrostep);
  }
  double derivatives[]=null;
  FMI20EventInfo.ByReference fmi20EventInfo=null;
  if (_fmiModelDescription.modelExchange) {
    if (!_firstFire) {
      derivatives=_fmiGetDerivatives();
    }
    if (_fmiVersion < 2.0) {
      _fmiSetTime(currentTime);
    }
    if (_firstFire) {
      _fmiInitialize();
      if (_fmiVersion >= 2.0) {
        FMI20ModelInstance fmi20ModelInstance=new FMI20ModelInstance(_fmiComponent);
        fmi20EventInfo=new FMI20EventInfo.ByReference(fmi20ModelInstance.eventInfo);
        fmi20EventInfo.newDiscreteStatesNeeded=(byte)1;
        fmi20EventInfo.terminateSimulation=(byte)0;
        if (fmi20EventInfo.terminateSimulation == (byte)1) {
          double currentTimeValue=currentTime.getDoubleValue();
          System.out.println("String_Node_Str" + currentTimeValue);
          getDirector().finish();
          return;
        }
      }
      _recordFMUState();
      _lastCommitTime=currentTime;
      _checkEventIndicators();
    }
    if (_fmiVersion >= 2.0) {
      _enterEventMode();
    }
    double states[]=_states.array();
    if (_newStates == null || _newStates.length != states.length) {
      _newStates=new double[states.length];
    }
  }
 else {
    if (_firstFire) {
      for (      Input input : _getInputs()) {
        if (input.start != null) {
          _setFMUScalarVariable(input.scalarVariable,new DoubleToken(input.start.doubleValue()));
          if (_debugging) {
            _debug("String_Node_Str" + input.port.getName() + "String_Node_Str"+ input.start);
          }
        }
      }
    }
    double refinedStepSize=_fmiDoStep(currentTime,currentMicrostep);
    if (refinedStepSize >= 0.0) {
      _stepSizeRejected=true;
      if (_refinedStepSize < 0.0 || refinedStepSize < _refinedStepSize) {
        _refinedStepSize=refinedStepSize;
      }
    }
  }
  int _index;
  for (  Input input : _getInputs()) {
    if (input.port.getWidth() > 0 && input.port.isKnown(0)) {
      if (input.port.hasToken(0)) {
        Token token=input.port.get(0);
        _setFMUScalarVariable(input.scalarVariable,token);
        if ((_fmiVersion >= 2.0) && _fmiModelDescription.modelExchange && _fmiModelDescription.continuousStateNames.contains(input.scalarVariable.name)) {
          _index=_fmiModelDescription.continuousStateNames.indexOf(input.scalarVariable.name);
          _newStates[_index]=((DoubleToken)token).doubleValue();
        }
        if (_debugging) {
          _debugToStdOut("String_Node_Str" + input.scalarVariable.name + "String_Node_Str"+ token);
        }
      }
 else {
        boolean persistentInputsValue=((BooleanToken)persistentInputs.getToken()).booleanValue();
        if (!persistentInputsValue) {
          throw new IllegalActionException(this,"String_Node_Str" + input.scalarVariable.name + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
        }
 else {
          if (_debugging) {
            _debug("String_Node_Str" + input.port.getName() + "String_Node_Str");
          }
        }
      }
    }
 else {
      if (_debugging) {
        _debug("String_Node_Str" + input.port.getName() + "String_Node_Str");
      }
    }
  }
  if (_fmiModelDescription.modelExchange) {
    double currentTimeValue=currentTime.getDoubleValue();
    double states[]=_states.array();
    if (_fmiVersion >= 2.0) {
      _enterContinuousTimeMode();
    }
    if (currentTimeValue > _lastCommitTime.getDoubleValue()) {
      if (states.length > 0) {
        if (_fmiVersion < 2.0) {
          double step=currentTimeValue - _lastCommitTime.getDoubleValue();
          for (int i=0; i < states.length; i++) {
            _newStates[i]=states[i] + derivatives[i] * step;
          }
        }
        _fmiSetContinuousStates(_newStates);
      }
      boolean stateEventOccurred=_checkEventIndicators();
      boolean timeEventOccurred=false;
      if (_fmiVersion < 2.0) {
        _fmiCompletedIntegratorStep(stateEventOccurred || timeEventOccurred);
      }
 else {
        boolean noSetFMUStatePriorToCurrentPoint=true;
        boolean stepEvent=_fmiCompletedIntegratorStep(noSetFMUStatePriorToCurrentPoint);
        if (stepEvent) {
          _enterEventMode();
          if (stepEvent) {
            if (_debugging) {
              _debug("String_Node_Str" + currentTimeValue);
            }
          }
          fmi20EventInfo.newDiscreteStatesNeeded=(byte)1;
          fmi20EventInfo.terminateSimulation=(byte)0;
          System.out.println("String_Node_Str");
          if (fmi20EventInfo.terminateSimulation == (byte)1) {
            System.out.println("String_Node_Str" + currentTimeValue);
            getDirector().finish();
          }
          _enterContinuousTimeMode();
          if (_debugging) {
            if (fmi20EventInfo.valuesOfContinuousStatesChanged == (byte)1) {
              _debug("String_Node_Str" + currentTimeValue);
            }
            if (fmi20EventInfo.nominalsOfContinuousStatesChanged == (byte)1) {
              _debug("String_Node_Str" + currentTimeValue);
            }
          }
        }
      }
    }
 else {
    }
  }
  for (  Output output : _getOutputs()) {
    TypedIOPort port=output.port;
    if (_debugging) {
      _debugToStdOut("String_Node_Str" + port.getName());
    }
    if (_skipIfKnown() && port.isKnown(0)) {
      continue;
    }
    boolean foundUnknownInputOnWhichOutputDepends=false;
    if (output.dependencies != null) {
      for (      TypedIOPort inputPort : output.dependencies) {
        if (_debugging) {
          _debugToStdOut("String_Node_Str" + port.getName() + "String_Node_Str"+ inputPort.getName());
        }
        if (!inputPort.isKnown(0)) {
          if (_debugging) {
            _debugToStdOut("String_Node_Str" + "String_Node_Str" + port.getName() + "String_Node_Str"+ inputPort.getName()+ "String_Node_Str");
          }
          foundUnknownInputOnWhichOutputDepends=true;
          break;
        }
      }
    }
 else {
      List<TypedIOPort> inputPorts=inputPortList();
      for (      TypedIOPort inputPort : inputPorts) {
        if (_debugging) {
          _debugToStdOut("String_Node_Str" + port.getName() + "String_Node_Str"+ inputPort.getName());
        }
        if (inputPort.getWidth() < 0 || !inputPort.isKnown(0)) {
          foundUnknownInputOnWhichOutputDepends=true;
          if (_debugging) {
            _debugToStdOut("String_Node_Str" + "String_Node_Str" + port.getName() + "String_Node_Str"+ inputPort.getName()+ "String_Node_Str");
          }
          break;
        }
      }
    }
    if (_debugging) {
      _debugToStdOut("String_Node_Str" + port.getName() + "String_Node_Str"+ foundUnknownInputOnWhichOutputDepends);
    }
    if (!foundUnknownInputOnWhichOutputDepends) {
      Token token=null;
      FMIScalarVariable scalarVariable=output.scalarVariable;
      if (scalarVariable.type instanceof FMIBooleanType) {
        boolean result=scalarVariable.getBoolean(_fmiComponent);
        token=new BooleanToken(result);
      }
 else       if (scalarVariable.type instanceof FMIIntegerType) {
        int result=scalarVariable.getInt(_fmiComponent);
        token=new IntToken(result);
      }
 else       if (scalarVariable.type instanceof FMIRealType) {
        double result=scalarVariable.getDouble(_fmiComponent);
        token=new DoubleToken(result);
      }
 else       if (scalarVariable.type instanceof FMIStringType) {
        String result=scalarVariable.getString(_fmiComponent);
        token=new StringToken(result);
      }
 else {
        throw new IllegalActionException("String_Node_Str" + scalarVariable.type + "String_Node_Str");
      }
      if (_debugging) {
        _debugToStdOut("String_Node_Str" + scalarVariable.name + "String_Node_Str"+ token+ "String_Node_Str"+ currentTime+ "String_Node_Str"+ currentMicrostep);
      }
      port.send(0,token);
    }
  }
  _firstFireInIteration=false;
  _firstFire=false;
}