Program: 72740
Project: 72740
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 FMU indicates a failure.
 */
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;
  if (_fmiModelDescription.modelExchange) {
    if (!_firstFire) {
      derivatives=_fmiGetDerivatives();
    }
    _fmiSetTime(currentTime);
  }
 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;
      }
    }
  }
  for (  Input input : _getInputs()) {
    if (input.port.isKnown(0)) {
      if (input.port.hasToken(0)) {
        Token token=input.port.get(0);
        _setFMUScalarVariable(input.scalarVariable,token);
        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) {
    if (_firstFire) {
      _fmiInitialize();
      _recordFMUState();
      _lastCommitTime=currentTime;
      _checkEventIndicators();
    }
    double currentTimeValue=currentTime.getDoubleValue();
    double states[]=_states.array();
    if (_newStates == null || _newStates.length != states.length) {
      _newStates=new double[states.length];
    }
    if (currentTimeValue > _lastCommitTime.getDoubleValue()) {
      if (states.length > 0) {
        double step=currentTimeValue - _lastCommitTime.getDoubleValue();
        for (int i=0; i < states.length; i++) {
          _newStates[i]=states[i] + derivatives[i] * step;
        }
        _fmiSetContinuousStates(_newStates);
        for (int i=0; i < states.length; i++)         System.out.println("String_Node_Str" + states[i]);
        _fmiSetContinuousStates(states);
      }
      boolean stateEventOccurred=_checkEventIndicators();
      boolean timeEventOccurred=false;
      _fmiCompletedIntegratorStep(stateEventOccurred || timeEventOccurred);
    }
 else {
    }
  }
  for (  Output output : _getOutputs()) {
    TypedIOPort port=output.port;
    if (_skipIfKnown() && port.isKnown(0)) {
      continue;
    }
    boolean foundUnknownInputOnWhichOutputDepends=false;
    if (output.dependencies != null) {
      for (      TypedIOPort inputPort : output.dependencies) {
        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 (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 (!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 FMU indicates a failure.
 */
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;
  if (_fmiModelDescription.modelExchange) {
    if (!_firstFire) {
      derivatives=_fmiGetDerivatives();
    }
    _fmiSetTime(currentTime);
    if (_firstFire) {
      _fmiInitialize();
      _recordFMUState();
      _lastCommitTime=currentTime;
      _checkEventIndicators();
    }
    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.isKnown(0)) {
      if (input.port.hasToken(0)) {
        Token token=input.port.get(0);
        _setFMUScalarVariable(input.scalarVariable,token);
        if ((_fmiVersion == 2.0) && _fmiModelDescription.modelExchange && _fmiModelDescription.continuousStates.contains(input.port.getName())) {
          _index=_fmiModelDescription.continuousStates.indexOf(input.port.getName());
          _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 (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;
      _fmiCompletedIntegratorStep(stateEventOccurred || timeEventOccurred);
    }
 else {
    }
  }
  for (  Output output : _getOutputs()) {
    TypedIOPort port=output.port;
    if (_skipIfKnown() && port.isKnown(0)) {
      continue;
    }
    boolean foundUnknownInputOnWhichOutputDepends=false;
    if (output.dependencies != null) {
      for (      TypedIOPort inputPort : output.dependencies) {
        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 (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 (!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;
}