Program: 72567
Project: 72567
Buggy source:
/** 
 * Perform model exchange using the named Functional Mock-up Unit (FMU) file.
 * @param fmuFileName The pathname of the co-simulation .fmu file
 * @param endTime The ending time in seconds.
 * @param stepSize The step size in seconds.
 * @param enableLogging True if logging is enabled.
 * @param csvSeparator The character used for separating fields.Note that sometimes the decimal point in floats is converted to ','.
 * @param outputFileName The output file.
 * @exception Exception If there is a problem parsing the .fmu file or invokingthe methods in the shared library.
 */
@Override public void simulate(String fmuFileName,double endTime,double stepSize,boolean enableLogging,char csvSeparator,String outputFileName) throws Exception {
  _setEnableLogging(enableLogging);
  FMIModelDescription fmiModelDescription=FMUFile.parseFMUFile(fmuFileName);
  _nativeLibrary=fmiModelDescription.getNativeLibrary();
  _modelIdentifier=fmiModelDescription.modelIdentifier;
  new File(fmuFileName).toURI().toURL().toString();
  int numberOfStateEvents=0;
  int numberOfStepEvents=0;
  int numberOfSteps=0;
  int numberOfTimeEvents=0;
  byte loggingOn=enableLogging ? (byte)1 : (byte)0;
  int loggingOnFMI2=_enableLogging ? 1 : 0;
  _fmiVersion=Double.valueOf(fmiModelDescription.fmiVersion);
  Pointer fmiComponent=null;
  if (_fmiVersion < 1.5) {
    FMICallbackFunctions.ByValue callbacks=new FMICallbackFunctions.ByValue(new FMULibrary.FMULogger(fmiModelDescription),fmiModelDescription.getFMUAllocateMemory(),new FMULibrary.FMUFreeMemory(),new FMULibrary.FMUStepFinished());
    Function instantiateModelFunction;
    try {
      instantiateModelFunction=fmiModelDescription.getFmiFunction("String_Node_Str");
    }
 catch (    UnsatisfiedLinkError ex) {
      UnsatisfiedLinkError error=new UnsatisfiedLinkError("String_Node_Str" + _modelIdentifier + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
      error.initCause(ex);
      throw error;
    }
    fmiComponent=(Pointer)instantiateModelFunction.invoke(Pointer.class,new Object[]{_modelIdentifier,fmiModelDescription.guid,callbacks,loggingOn});
  }
 else {
    FMI20CallbackFunctions callbacks20=new FMI20CallbackFunctions(new FMULibrary.FMULogger(fmiModelDescription),fmiModelDescription.getFMUAllocateMemory(),new FMULibrary.FMUFreeMemory(),new FMULibrary.FMUStepFinished(),fmiComponent);
    Function fmiInstantiateFunction=fmiModelDescription.getFmiFunction("String_Node_Str");
    int toBeVisibleFMI2=0;
    int fmiType=1;
    if (fmiModelDescription.modelExchange) {
      fmiType=0;
    }
    fmiComponent=(Pointer)fmiInstantiateFunction.invoke(Pointer.class,new Object[]{_modelIdentifier,fmiType,fmiModelDescription.guid,fmiModelDescription.fmuResourceLocation,callbacks20,toBeVisibleFMI2,loggingOnFMI2});
  }
  if (fmiComponent.equals(Pointer.NULL)) {
    throw new RuntimeException("String_Node_Str");
  }
  final int numberOfStates=fmiModelDescription.numberOfContinuousStates;
  final int numberOfEventIndicators=fmiModelDescription.numberOfEventIndicators;
  double[] states=new double[numberOfStates];
  double[] derivatives=new double[numberOfStates];
  double[] eventIndicators=null;
  double[] preEventIndicators=null;
  if (numberOfEventIndicators > 0) {
    eventIndicators=new double[numberOfEventIndicators];
    preEventIndicators=new double[numberOfEventIndicators];
  }
  double startTime=0.0;
  Function setTime=fmiModelDescription.getFmiFunction("String_Node_Str");
  if (_fmiVersion < 2.0) {
    invoke(setTime,new Object[]{fmiComponent,startTime},"String_Node_Str" + startTime + "String_Node_Str");
  }
  byte toleranceControlled=0;
  FMIEventInfo eventInfo=null;
  FMI20EventInfo eventInfo20=null;
  FMI20EventInfo.ByReference eventInfo20Reference=null;
  if (_fmiVersion < 1.5) {
    eventInfo=new FMIEventInfo();
    invoke(setTime,new Object[]{fmiComponent,startTime},"String_Node_Str" + startTime + "String_Node_Str");
    invoke(fmiModelDescription,"String_Node_Str",new Object[]{fmiComponent,toleranceControlled,startTime,eventInfo},"String_Node_Str");
  }
 else {
    eventInfo20=new FMI20EventInfo();
    double relativeTolerance=1e-4;
    int _toleranceControlled=0;
    invoke(fmiModelDescription,"String_Node_Str",new Object[]{fmiComponent,_toleranceControlled,relativeTolerance,startTime,1,endTime},"String_Node_Str");
    invoke(fmiModelDescription,"String_Node_Str",new Object[]{fmiComponent},"String_Node_Str");
    invoke(fmiModelDescription,"String_Node_Str",new Object[]{fmiComponent},"String_Node_Str");
    eventInfo20Reference=new FMI20EventInfo.ByReference(eventInfo20);
    eventInfo20Reference.newDiscreteStatesNeeded=1;
    eventInfo20Reference.terminateSimulation=0;
    while (eventInfo20Reference.newDiscreteStatesNeeded == 1 && eventInfo20Reference.terminateSimulation == 0) {
      invoke(fmiModelDescription,"String_Node_Str",new Object[]{fmiComponent,eventInfo20Reference},"String_Node_Str");
    }
  }
  double time=startTime;
  if (eventInfo20Reference != null && eventInfo20Reference.terminateSimulation != 0) {
    System.out.println("String_Node_Str" + time);
    endTime=time;
  }
  if ((eventInfo20Reference != null && eventInfo20Reference.terminateSimulation != 1) || _fmiVersion < 1.5) {
    if (_fmiVersion > 1.5) {
      invoke(fmiModelDescription,"String_Node_Str",new Object[]{fmiComponent},"String_Node_Str");
    }
    PrintStream file=null;
    try {
      file=new PrintStream(outputFileName);
      if (enableLogging) {
        System.out.println("String_Node_Str");
      }
      OutputRow.outputRow(_nativeLibrary,fmiModelDescription,fmiComponent,startTime,file,csvSeparator,Boolean.TRUE);
      OutputRow.outputRow(_nativeLibrary,fmiModelDescription,fmiComponent,startTime,file,csvSeparator,Boolean.FALSE);
      Function completedIntegratorStep=fmiModelDescription.getFmiFunction("String_Node_Str");
      Function eventUpdate=null;
      if (_fmiVersion < 1.5) {
        eventUpdate=fmiModelDescription.getFmiFunction("String_Node_Str");
      }
      Function getContinuousStates=fmiModelDescription.getFmiFunction("String_Node_Str");
      Function getDerivatives=fmiModelDescription.getFmiFunction("String_Node_Str");
      Function getEventIndicators=fmiModelDescription.getFmiFunction("String_Node_Str");
      Function enterEventMode=null;
      if (_fmiVersion > 1.5) {
        enterEventMode=fmiModelDescription.getFmiFunction("String_Node_Str");
      }
      Function setContinuousStates=fmiModelDescription.getFmiFunction("String_Node_Str");
      boolean stateEvent=false;
      byte stepEventByte=(byte)0;
      int stepEventInt=0;
      while (time < endTime) {
        invoke(getContinuousStates,new Object[]{fmiComponent,states,numberOfStates},"String_Node_Str" + time + "String_Node_Str");
        invoke(getDerivatives,new Object[]{fmiComponent,derivatives,numberOfStates},"String_Node_Str" + time + "String_Node_Str");
        double stepStartTime=time;
        time=Math.min(time + stepSize,endTime);
        boolean timeEvent=false;
        if (_fmiVersion < 1.5) {
          timeEvent=eventInfo.upcomingTimeEvent == 1 && eventInfo.nextEventTime < time;
        }
 else {
          timeEvent=eventInfo20Reference.nextEventTimeDefined == 1 && eventInfo20Reference.nextEventTime < time;
        }
        if (timeEvent) {
          time=eventInfo.nextEventTime;
        }
        double dt=time - stepStartTime;
        invoke(setTime,new Object[]{fmiComponent,time},"String_Node_Str" + time + "String_Node_Str");
        for (int i=0; i < numberOfStates; i++) {
          states[i]+=dt * derivatives[i];
        }
        invoke(setContinuousStates,new Object[]{fmiComponent,states,numberOfStates},"String_Node_Str" + time + "String_Node_Str");
        if (enableLogging) {
          System.out.println("String_Node_Str" + numberOfSteps + "String_Node_Str"+ time);
        }
        if (_fmiVersion > 1.5) {
          for (int i=0; i < numberOfEventIndicators; i++) {
            preEventIndicators[i]=eventIndicators[i];
          }
          invoke(getEventIndicators,new Object[]{fmiComponent,eventIndicators,numberOfEventIndicators},"String_Node_Str" + time + "String_Node_Str");
          stateEvent=false;
          for (int i=0; i < numberOfEventIndicators; i++) {
            stateEvent=stateEvent || (preEventIndicators[i] * eventIndicators[i] < 0);
          }
        }
        if (_fmiVersion < 1.5) {
          ByteByReference stepEventByteReference=new ByteByReference(stepEventByte);
          invoke(completedIntegratorStep,new Object[]{fmiComponent,stepEventByteReference},"String_Node_Str" + time + "String_Node_Str");
          for (int i=0; i < numberOfEventIndicators; i++) {
            preEventIndicators[i]=eventIndicators[i];
          }
        }
 else {
          IntByReference stepEventIntReference=new IntByReference(stepEventInt);
          int terminateSimulation=0;
          IntByReference terminateSimulationReference=new IntByReference(terminateSimulation);
          invoke(completedIntegratorStep,new Object[]{fmiComponent,1,stepEventIntReference,terminateSimulationReference},"String_Node_Str" + time + "String_Node_Str");
          if (terminateSimulation != 0) {
            System.out.println("String_Node_Str" + time);
            break;
          }
        }
        if (_fmiVersion < 1.5) {
          invoke(getEventIndicators,new Object[]{fmiComponent,eventIndicators,numberOfEventIndicators},"String_Node_Str" + time + "String_Node_Str");
          stateEvent=Boolean.FALSE;
          for (int i=0; i < numberOfEventIndicators; i++) {
            stateEvent=stateEvent || preEventIndicators[i] * eventIndicators[i] < 0;
          }
        }
        if (stateEvent || stepEventByte != (byte)0 || stepEventInt != 0 || timeEvent) {
          if (_fmiVersion > 1.5) {
            invoke(enterEventMode,new Object[]{fmiComponent},"String_Node_Str" + time + "String_Node_Str");
          }
          if (stateEvent) {
            numberOfStateEvents++;
            if (enableLogging) {
              for (int i=0; i < numberOfEventIndicators; i++) {
                System.out.println("String_Node_Str" + (preEventIndicators[i] > 0 && eventIndicators[i] < 0 ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str"+ i+ "String_Node_Str"+ time);
              }
            }
          }
          if (stepEventByte != (byte)0 || stepEventInt != 0) {
            numberOfStepEvents++;
            if (enableLogging) {
              System.out.println("String_Node_Str" + time);
            }
          }
          if (timeEvent) {
            numberOfTimeEvents++;
            if (enableLogging) {
              System.out.println("String_Node_Str" + time);
            }
          }
          if (_fmiVersion < 1.5) {
            invoke(eventUpdate,new Object[]{fmiComponent,(byte)0,eventInfo},"String_Node_Str" + time + "String_Node_Str");
            if (eventInfo.stateValuesChanged != (byte)0 && enableLogging) {
              System.out.println("String_Node_Str" + time);
            }
            if (eventInfo.stateValueReferencesChanged != (byte)0 && enableLogging) {
              System.out.println("String_Node_Str" + time);
            }
          }
 else {
            eventInfo20Reference.newDiscreteStatesNeeded=1;
            eventInfo20Reference.terminateSimulation=0;
            while ((eventInfo20Reference.newDiscreteStatesNeeded == 1) && eventInfo20Reference.terminateSimulation == 0) {
              invoke(fmiModelDescription,"String_Node_Str",new Object[]{fmiComponent,eventInfo20Reference},"String_Node_Str");
            }
            if (eventInfo20Reference.terminateSimulation != 0) {
              System.out.println("String_Node_Str" + time);
              break;
            }
            invoke(fmiModelDescription,"String_Node_Str",new Object[]{fmiComponent},"String_Node_Str");
            if ((eventInfo20Reference.valuesOfContinuousStatesChanged == 1) && enableLogging) {
              System.out.println("String_Node_Str" + time);
            }
            if ((eventInfo20Reference.nominalsOfContinuousStatesChanged == 1) && enableLogging) {
              System.out.println("String_Node_Str" + time);
            }
          }
        }
        OutputRow.outputRow(_nativeLibrary,fmiModelDescription,fmiComponent,time,file,csvSeparator,Boolean.FALSE);
        numberOfSteps++;
      }
      if (_fmiVersion < 1.5) {
        invoke(fmiModelDescription,"String_Node_Str",new Object[]{fmiComponent},"String_Node_Str");
        Function freeModelInstance=fmiModelDescription.getFmiFunction("String_Node_Str");
        freeModelInstance.invoke(new Object[]{fmiComponent});
      }
 else {
        if (!(eventInfo20.terminateSimulation == 1)) {
          invoke(fmiModelDescription,"String_Node_Str",new Object[]{fmiComponent},"String_Node_Str");
        }
        Function function=fmiModelDescription.getFmiFunction("String_Node_Str");
        function.invoke(new Object[]{fmiComponent});
      }
    }
  finally {
      if (file != null) {
        file.close();
      }
      if (fmiModelDescription != null) {
        fmiModelDescription.dispose();
      }
    }
  }
  System.out.println("String_Node_Str" + startTime + "String_Node_Str"+ endTime+ "String_Node_Str");
  System.out.println("String_Node_Str" + numberOfSteps);
  System.out.println("String_Node_Str" + stepSize);
  System.out.println("String_Node_Str" + numberOfStateEvents);
  System.out.println("String_Node_Str" + numberOfStepEvents);
  System.out.println("String_Node_Str" + numberOfTimeEvents);
  System.out.flush();
}

Fixed version (ground truth):
/** 
 * Perform model exchange using the named Functional Mock-up Unit (FMU) file.
 * @param fmuFileName The pathname of the co-simulation .fmu file
 * @param endTime The ending time in seconds.
 * @param stepSize The step size in seconds.
 * @param enableLogging True if logging is enabled.
 * @param csvSeparator The character used for separating fields.Note that sometimes the decimal point in floats is converted to ','.
 * @param outputFileName The output file.
 * @exception Exception If there is a problem parsing the .fmu file or invokingthe methods in the shared library.
 */
@Override public void simulate(String fmuFileName,double endTime,double stepSize,boolean enableLogging,char csvSeparator,String outputFileName) throws Exception {
  _setEnableLogging(enableLogging);
  FMIModelDescription fmiModelDescription=FMUFile.parseFMUFile(fmuFileName);
  _nativeLibrary=fmiModelDescription.getNativeLibrary();
  _modelIdentifier=fmiModelDescription.modelIdentifier;
  new File(fmuFileName).toURI().toURL().toString();
  int numberOfStateEvents=0;
  int numberOfStepEvents=0;
  int numberOfSteps=0;
  int numberOfTimeEvents=0;
  byte loggingOn=enableLogging ? (byte)1 : (byte)0;
  int loggingOnFMI2=_enableLogging ? 1 : 0;
  _fmiVersion=Double.valueOf(fmiModelDescription.fmiVersion);
  Pointer fmiComponent=null;
  if (_fmiVersion < 1.5) {
    FMICallbackFunctions.ByValue callbacks=new FMICallbackFunctions.ByValue(new FMULibrary.FMULogger(fmiModelDescription),fmiModelDescription.getFMUAllocateMemory(),new FMULibrary.FMUFreeMemory(),new FMULibrary.FMUStepFinished());
    Function instantiateModelFunction;
    try {
      instantiateModelFunction=fmiModelDescription.getFmiFunction("String_Node_Str");
    }
 catch (    UnsatisfiedLinkError ex) {
      UnsatisfiedLinkError error=new UnsatisfiedLinkError("String_Node_Str" + _modelIdentifier + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
      error.initCause(ex);
      throw error;
    }
    fmiComponent=(Pointer)instantiateModelFunction.invoke(Pointer.class,new Object[]{_modelIdentifier,fmiModelDescription.guid,callbacks,loggingOn});
  }
 else {
    FMI20CallbackFunctions callbacks20=new FMI20CallbackFunctions(new FMULibrary.FMULogger(fmiModelDescription),fmiModelDescription.getFMUAllocateMemory(),new FMULibrary.FMUFreeMemory(),new FMULibrary.FMUStepFinished(),fmiComponent);
    Function fmiInstantiateFunction=fmiModelDescription.getFmiFunction("String_Node_Str");
    int toBeVisibleFMI2=0;
    int fmiType=1;
    if (fmiModelDescription.modelExchange) {
      fmiType=0;
    }
    fmiComponent=(Pointer)fmiInstantiateFunction.invoke(Pointer.class,new Object[]{_modelIdentifier,fmiType,fmiModelDescription.guid,fmiModelDescription.fmuResourceLocation,callbacks20,toBeVisibleFMI2,loggingOnFMI2});
  }
  if (fmiComponent.equals(Pointer.NULL)) {
    throw new RuntimeException("String_Node_Str");
  }
  final int numberOfStates=fmiModelDescription.numberOfContinuousStates;
  final int numberOfEventIndicators=fmiModelDescription.numberOfEventIndicators;
  double[] states=new double[numberOfStates];
  double[] derivatives=new double[numberOfStates];
  double[] eventIndicators=null;
  double[] preEventIndicators=null;
  if (numberOfEventIndicators > 0) {
    eventIndicators=new double[numberOfEventIndicators];
    preEventIndicators=new double[numberOfEventIndicators];
  }
  double startTime=0.0;
  Function setTime=fmiModelDescription.getFmiFunction("String_Node_Str");
  if (_fmiVersion < 2.0) {
    invoke(setTime,new Object[]{fmiComponent,startTime},"String_Node_Str" + startTime + "String_Node_Str");
  }
  byte toleranceControlled=0;
  FMIEventInfo eventInfo=null;
  FMI20EventInfo eventInfo20=null;
  FMI20EventInfo.ByReference eventInfo20Reference=null;
  if (_fmiVersion < 1.5) {
    eventInfo=new FMIEventInfo();
    invoke(setTime,new Object[]{fmiComponent,startTime},"String_Node_Str" + startTime + "String_Node_Str");
    invoke(fmiModelDescription,"String_Node_Str",new Object[]{fmiComponent,toleranceControlled,startTime,eventInfo},"String_Node_Str");
  }
 else {
    eventInfo20=new FMI20EventInfo();
    double relativeTolerance=1e-4;
    int _toleranceControlled=0;
    invoke(fmiModelDescription,"String_Node_Str",new Object[]{fmiComponent,_toleranceControlled,relativeTolerance,startTime,1,endTime},"String_Node_Str");
    invoke(fmiModelDescription,"String_Node_Str",new Object[]{fmiComponent},"String_Node_Str");
    invoke(fmiModelDescription,"String_Node_Str",new Object[]{fmiComponent},"String_Node_Str");
    eventInfo20Reference=new FMI20EventInfo.ByReference(eventInfo20);
    eventInfo20Reference.newDiscreteStatesNeeded=1;
    eventInfo20Reference.terminateSimulation=0;
    while (eventInfo20Reference.newDiscreteStatesNeeded == 1 && eventInfo20Reference.terminateSimulation == 0) {
      invoke(fmiModelDescription,"String_Node_Str",new Object[]{fmiComponent,eventInfo20Reference},"String_Node_Str");
    }
  }
  double time=startTime;
  if (eventInfo20Reference != null && eventInfo20Reference.terminateSimulation != 0) {
    System.out.println("String_Node_Str" + time);
    endTime=time;
  }
  if ((eventInfo20Reference != null && eventInfo20Reference.terminateSimulation != 1) || _fmiVersion < 1.5) {
    if (_fmiVersion > 1.5) {
      invoke(fmiModelDescription,"String_Node_Str",new Object[]{fmiComponent},"String_Node_Str");
    }
    PrintStream file=null;
    try {
      file=new PrintStream(outputFileName,Charset.defaultCharset().toString());
      if (enableLogging) {
        System.out.println("String_Node_Str");
      }
      OutputRow.outputRow(_nativeLibrary,fmiModelDescription,fmiComponent,startTime,file,csvSeparator,Boolean.TRUE);
      OutputRow.outputRow(_nativeLibrary,fmiModelDescription,fmiComponent,startTime,file,csvSeparator,Boolean.FALSE);
      Function completedIntegratorStep=fmiModelDescription.getFmiFunction("String_Node_Str");
      Function eventUpdate=null;
      if (_fmiVersion < 1.5) {
        eventUpdate=fmiModelDescription.getFmiFunction("String_Node_Str");
      }
      Function getContinuousStates=fmiModelDescription.getFmiFunction("String_Node_Str");
      Function getDerivatives=fmiModelDescription.getFmiFunction("String_Node_Str");
      Function getEventIndicators=fmiModelDescription.getFmiFunction("String_Node_Str");
      Function enterEventMode=null;
      if (_fmiVersion > 1.5) {
        enterEventMode=fmiModelDescription.getFmiFunction("String_Node_Str");
      }
      Function setContinuousStates=fmiModelDescription.getFmiFunction("String_Node_Str");
      boolean stateEvent=false;
      byte stepEventByte=(byte)0;
      int stepEventInt=0;
      while (time < endTime) {
        invoke(getContinuousStates,new Object[]{fmiComponent,states,numberOfStates},"String_Node_Str" + time + "String_Node_Str");
        invoke(getDerivatives,new Object[]{fmiComponent,derivatives,numberOfStates},"String_Node_Str" + time + "String_Node_Str");
        double stepStartTime=time;
        time=Math.min(time + stepSize,endTime);
        boolean timeEvent=false;
        if (_fmiVersion < 1.5) {
          timeEvent=eventInfo.upcomingTimeEvent == 1 && eventInfo.nextEventTime < time;
        }
 else {
          timeEvent=eventInfo20Reference.nextEventTimeDefined == 1 && eventInfo20Reference.nextEventTime < time;
        }
        if (timeEvent) {
          time=eventInfo.nextEventTime;
        }
        double dt=time - stepStartTime;
        invoke(setTime,new Object[]{fmiComponent,time},"String_Node_Str" + time + "String_Node_Str");
        for (int i=0; i < numberOfStates; i++) {
          states[i]+=dt * derivatives[i];
        }
        invoke(setContinuousStates,new Object[]{fmiComponent,states,numberOfStates},"String_Node_Str" + time + "String_Node_Str");
        if (enableLogging) {
          System.out.println("String_Node_Str" + numberOfSteps + "String_Node_Str"+ time);
        }
        if (_fmiVersion > 1.5) {
          for (int i=0; i < numberOfEventIndicators; i++) {
            preEventIndicators[i]=eventIndicators[i];
          }
          invoke(getEventIndicators,new Object[]{fmiComponent,eventIndicators,numberOfEventIndicators},"String_Node_Str" + time + "String_Node_Str");
          stateEvent=false;
          for (int i=0; i < numberOfEventIndicators; i++) {
            stateEvent=stateEvent || (preEventIndicators[i] * eventIndicators[i] < 0);
          }
        }
        if (_fmiVersion < 1.5) {
          ByteByReference stepEventByteReference=new ByteByReference(stepEventByte);
          invoke(completedIntegratorStep,new Object[]{fmiComponent,stepEventByteReference},"String_Node_Str" + time + "String_Node_Str");
          for (int i=0; i < numberOfEventIndicators; i++) {
            preEventIndicators[i]=eventIndicators[i];
          }
        }
 else {
          IntByReference stepEventIntReference=new IntByReference(stepEventInt);
          int terminateSimulation=0;
          IntByReference terminateSimulationReference=new IntByReference(terminateSimulation);
          invoke(completedIntegratorStep,new Object[]{fmiComponent,1,stepEventIntReference,terminateSimulationReference},"String_Node_Str" + time + "String_Node_Str");
          if (terminateSimulation != 0) {
            System.out.println("String_Node_Str" + time);
            break;
          }
        }
        if (_fmiVersion < 1.5) {
          invoke(getEventIndicators,new Object[]{fmiComponent,eventIndicators,numberOfEventIndicators},"String_Node_Str" + time + "String_Node_Str");
          stateEvent=Boolean.FALSE;
          for (int i=0; i < numberOfEventIndicators; i++) {
            stateEvent=stateEvent || preEventIndicators[i] * eventIndicators[i] < 0;
          }
        }
        if (stateEvent || stepEventByte != (byte)0 || stepEventInt != 0 || timeEvent) {
          if (_fmiVersion > 1.5) {
            invoke(enterEventMode,new Object[]{fmiComponent},"String_Node_Str" + time + "String_Node_Str");
          }
          if (stateEvent) {
            numberOfStateEvents++;
            if (enableLogging) {
              for (int i=0; i < numberOfEventIndicators; i++) {
                System.out.println("String_Node_Str" + (preEventIndicators[i] > 0 && eventIndicators[i] < 0 ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str"+ i+ "String_Node_Str"+ time);
              }
            }
          }
          if (stepEventByte != (byte)0 || stepEventInt != 0) {
            numberOfStepEvents++;
            if (enableLogging) {
              System.out.println("String_Node_Str" + time);
            }
          }
          if (timeEvent) {
            numberOfTimeEvents++;
            if (enableLogging) {
              System.out.println("String_Node_Str" + time);
            }
          }
          if (_fmiVersion < 1.5) {
            invoke(eventUpdate,new Object[]{fmiComponent,(byte)0,eventInfo},"String_Node_Str" + time + "String_Node_Str");
            if (eventInfo.stateValuesChanged != (byte)0 && enableLogging) {
              System.out.println("String_Node_Str" + time);
            }
            if (eventInfo.stateValueReferencesChanged != (byte)0 && enableLogging) {
              System.out.println("String_Node_Str" + time);
            }
          }
 else {
            eventInfo20Reference.newDiscreteStatesNeeded=1;
            eventInfo20Reference.terminateSimulation=0;
            while ((eventInfo20Reference.newDiscreteStatesNeeded == 1) && eventInfo20Reference.terminateSimulation == 0) {
              invoke(fmiModelDescription,"String_Node_Str",new Object[]{fmiComponent,eventInfo20Reference},"String_Node_Str");
            }
            if (eventInfo20Reference.terminateSimulation != 0) {
              System.out.println("String_Node_Str" + time);
              break;
            }
            invoke(fmiModelDescription,"String_Node_Str",new Object[]{fmiComponent},"String_Node_Str");
            if ((eventInfo20Reference.valuesOfContinuousStatesChanged == 1) && enableLogging) {
              System.out.println("String_Node_Str" + time);
            }
            if ((eventInfo20Reference.nominalsOfContinuousStatesChanged == 1) && enableLogging) {
              System.out.println("String_Node_Str" + time);
            }
          }
        }
        OutputRow.outputRow(_nativeLibrary,fmiModelDescription,fmiComponent,time,file,csvSeparator,Boolean.FALSE);
        numberOfSteps++;
      }
      if (_fmiVersion < 1.5) {
        invoke(fmiModelDescription,"String_Node_Str",new Object[]{fmiComponent},"String_Node_Str");
        Function freeModelInstance=fmiModelDescription.getFmiFunction("String_Node_Str");
        freeModelInstance.invoke(new Object[]{fmiComponent});
      }
 else {
        if (!(eventInfo20.terminateSimulation == 1)) {
          invoke(fmiModelDescription,"String_Node_Str",new Object[]{fmiComponent},"String_Node_Str");
        }
        Function function=fmiModelDescription.getFmiFunction("String_Node_Str");
        function.invoke(new Object[]{fmiComponent});
      }
    }
  finally {
      if (file != null) {
        file.close();
      }
      if (fmiModelDescription != null) {
        fmiModelDescription.dispose();
      }
    }
  }
  System.out.println("String_Node_Str" + startTime + "String_Node_Str"+ endTime+ "String_Node_Str");
  System.out.println("String_Node_Str" + numberOfSteps);
  System.out.println("String_Node_Str" + stepSize);
  System.out.println("String_Node_Str" + numberOfStateEvents);
  System.out.println("String_Node_Str" + numberOfStepEvents);
  System.out.println("String_Node_Str" + numberOfTimeEvents);
  System.out.flush();
}