Program: 72704
Project: 72704
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.
 */
public void simulate(String fmuFileName,double endTime,double stepSize,boolean enableLogging,char csvSeparator,String outputFileName) throws Exception {
  FMUDriver._setEnableLogging(enableLogging);
  FMIModelDescription fmiModelDescription=FMUFile.parseFMUFile(fmuFileName);
  String sharedLibrary=FMUFile.fmuSharedLibrary(fmiModelDescription);
  if (enableLogging) {
    System.out.println("String_Node_Str" + sharedLibrary);
  }
  _nativeLibrary=NativeLibrary.getInstance(sharedLibrary);
  _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;
  _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 {
    FMICallbackFunctions callbacks=new FMICallbackFunctions(new FMULibrary.FMULogger(fmiModelDescription),new FMULibrary.FMUAllocateMemory(),new FMULibrary.FMUFreeMemory(),new FMULibrary.FMUStepFinished());
    Function fmiInstantiateFunction=fmiModelDescription.getFmiFunction("String_Node_Str");
    byte toBeVisible=0;
    int fmiType=1;
    if (fmiModelDescription.modelExchange) {
      fmiType=0;
    }
    fmiComponent=(Pointer)fmiInstantiateFunction.invoke(Pointer.class,new Object[]{_modelIdentifier,fmiType,fmiModelDescription.guid,fmiModelDescription.fmuResourceLocation,callbacks,toBeVisible,loggingOn});
  }
  if (fmiComponent.equals(Pointer.NULL)) {
    throw new RuntimeException("String_Node_Str");
  }
  if (enableLogging) {
    System.out.println("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");
  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;
    byte _toleranceControlled=(byte)0;
    invoke(fmiModelDescription,"String_Node_Str",new Object[]{fmiComponent,_toleranceControlled,relativeTolerance,startTime,(byte)1,endTime},"String_Node_Str");
    invoke(setTime,new Object[]{fmiComponent,startTime},"String_Node_Str" + startTime + "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");
    eventInfo20.newDiscreteStatesNeeded=(byte)1;
    eventInfo20.terminateSimulation=(byte)0;
    System.out.println(eventInfo20.toString());
    while (eventInfo20.newDiscreteStatesNeeded == (byte)1 && !(eventInfo20.terminateSimulation == (byte)1)) {
      eventInfo20Reference=new FMI20EventInfo.ByReference(eventInfo20);
      System.out.println(eventInfo20Reference.toString());
      invoke(fmiModelDescription,"String_Node_Str",new Object[]{fmiComponent,eventInfo20Reference},"String_Node_Str");
    }
  }
  double time=startTime;
  if (eventInfo20.terminateSimulation != 0 || eventInfo20.terminateSimulation != 0) {
    System.out.println("String_Node_Str" + time);
    endTime=time;
  }
  if (eventInfo20.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 setContinuousStates=fmiModelDescription.getFmiFunction("String_Node_Str");
      boolean stateEvent=false;
      byte stepEvent=(byte)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=eventInfo20.nextEventTimeDefined == 1 && eventInfo20.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 stepEventReference=new ByteByReference(stepEvent);
          invoke(completedIntegratorStep,new Object[]{fmiComponent,stepEventReference},"String_Node_Str" + time + "String_Node_Str");
          for (int i=0; i < numberOfEventIndicators; i++) {
            preEventIndicators[i]=eventIndicators[i];
          }
        }
 else {
          ByteByReference stepEventReference=new ByteByReference(stepEvent);
          Byte terminateSimulation=(byte)0;
          ByteByReference terminateSimulationReference=new ByteByReference(terminateSimulation);
          invoke(completedIntegratorStep,new Object[]{fmiComponent,(byte)1,stepEventReference,terminateSimulationReference},"String_Node_Str" + time + "String_Node_Str");
          if (terminateSimulation != (byte)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 || stepEvent != (byte)0 || timeEvent) {
          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 (stepEvent != (byte)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 {
            eventInfo20.newDiscreteStatesNeeded=(byte)1;
            eventInfo20.terminateSimulation=(byte)0;
            while ((eventInfo20.newDiscreteStatesNeeded == (byte)1) && !(eventInfo20.terminateSimulation == (byte)1)) {
              eventInfo20Reference=new FMI20EventInfo.ByReference(eventInfo20);
              invoke(fmiModelDescription,"String_Node_Str",new Object[]{fmiComponent,eventInfo20Reference},"String_Node_Str");
            }
            if (eventInfo20.terminateSimulation != (byte)0) {
              System.out.println("String_Node_Str" + time);
              break;
            }
            invoke(fmiModelDescription,"String_Node_Str",new Object[]{fmiComponent},"String_Node_Str");
            if ((eventInfo20.valuesOfContinuousStatesChanged == (byte)1) && enableLogging) {
              System.out.println("String_Node_Str" + time);
            }
            if ((eventInfo20.nominalsOfContinuousStatesChanged == (byte)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("String_Node_Str",new Object[]{fmiComponent},"String_Node_Str");
        Function freeSlave=fmiModelDescription.getFmiFunction("String_Node_Str");
        int fmiFlag=((Integer)freeSlave.invoke(Integer.class,new Object[]{fmiComponent})).intValue();
        if (fmiFlag >= FMILibrary.FMIStatus.fmiWarning) {
          new Exception("String_Node_Str" + fmiFlag).printStackTrace();
        }
      }
 else {
        if (!(eventInfo20.terminateSimulation == 1)) {
          invoke(fmiModelDescription,"String_Node_Str",new Object[]{fmiComponent},"String_Node_Str");
        }
        invoke(fmiModelDescription,"String_Node_Str",new Object[]{fmiComponent},"String_Node_Str");
      }
    }
  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.
 */
public void simulate(String fmuFileName,double endTime,double stepSize,boolean enableLogging,char csvSeparator,String outputFileName) throws Exception {
  FMUDriver._setEnableLogging(enableLogging);
  FMIModelDescription fmiModelDescription=FMUFile.parseFMUFile(fmuFileName);
  String sharedLibrary=FMUFile.fmuSharedLibrary(fmiModelDescription);
  if (enableLogging) {
    System.out.println("String_Node_Str" + sharedLibrary);
  }
  _nativeLibrary=NativeLibrary.getInstance(sharedLibrary);
  _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;
  _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 {
    FMICallbackFunctions callbacks=new FMICallbackFunctions(new FMULibrary.FMULogger(fmiModelDescription),new FMULibrary.FMUAllocateMemory(),new FMULibrary.FMUFreeMemory(),new FMULibrary.FMUStepFinished());
    Function fmiInstantiateFunction=fmiModelDescription.getFmiFunction("String_Node_Str");
    byte toBeVisible=0;
    int fmiType=1;
    if (fmiModelDescription.modelExchange) {
      fmiType=0;
    }
    fmiComponent=(Pointer)fmiInstantiateFunction.invoke(Pointer.class,new Object[]{_modelIdentifier,fmiType,fmiModelDescription.guid,fmiModelDescription.fmuResourceLocation,callbacks,toBeVisible,loggingOn});
  }
  if (fmiComponent.equals(Pointer.NULL)) {
    throw new RuntimeException("String_Node_Str");
  }
  if (enableLogging) {
    System.out.println("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");
  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;
    byte _toleranceControlled=(byte)0;
    invoke(fmiModelDescription,"String_Node_Str",new Object[]{fmiComponent,_toleranceControlled,relativeTolerance,startTime,(byte)1,endTime},"String_Node_Str");
    invoke(setTime,new Object[]{fmiComponent,startTime},"String_Node_Str" + startTime + "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");
    eventInfo20.newDiscreteStatesNeeded=(byte)1;
    eventInfo20.terminateSimulation=(byte)0;
    System.out.println(eventInfo20.toString());
    while (eventInfo20.newDiscreteStatesNeeded == (byte)1 && !(eventInfo20.terminateSimulation == (byte)1)) {
      eventInfo20Reference=new FMI20EventInfo.ByReference(eventInfo20);
      System.out.println(eventInfo20Reference.toString());
      invoke(fmiModelDescription,"String_Node_Str",new Object[]{fmiComponent,eventInfo20Reference},"String_Node_Str");
    }
  }
  double time=startTime;
  if (eventInfo20 != null && (eventInfo20.terminateSimulation != 0 || eventInfo20.terminateSimulation != 0)) {
    System.out.println("String_Node_Str" + time);
    endTime=time;
  }
  if ((eventInfo20 != null && eventInfo20.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 setContinuousStates=fmiModelDescription.getFmiFunction("String_Node_Str");
      boolean stateEvent=false;
      byte stepEvent=(byte)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=eventInfo20.nextEventTimeDefined == 1 && eventInfo20.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 stepEventReference=new ByteByReference(stepEvent);
          invoke(completedIntegratorStep,new Object[]{fmiComponent,stepEventReference},"String_Node_Str" + time + "String_Node_Str");
          for (int i=0; i < numberOfEventIndicators; i++) {
            preEventIndicators[i]=eventIndicators[i];
          }
        }
 else {
          ByteByReference stepEventReference=new ByteByReference(stepEvent);
          Byte terminateSimulation=(byte)0;
          ByteByReference terminateSimulationReference=new ByteByReference(terminateSimulation);
          invoke(completedIntegratorStep,new Object[]{fmiComponent,(byte)1,stepEventReference,terminateSimulationReference},"String_Node_Str" + time + "String_Node_Str");
          if (terminateSimulation != (byte)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 || stepEvent != (byte)0 || timeEvent) {
          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 (stepEvent != (byte)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 {
            eventInfo20.newDiscreteStatesNeeded=(byte)1;
            eventInfo20.terminateSimulation=(byte)0;
            while ((eventInfo20.newDiscreteStatesNeeded == (byte)1) && !(eventInfo20.terminateSimulation == (byte)1)) {
              eventInfo20Reference=new FMI20EventInfo.ByReference(eventInfo20);
              invoke(fmiModelDescription,"String_Node_Str",new Object[]{fmiComponent,eventInfo20Reference},"String_Node_Str");
            }
            if (eventInfo20.terminateSimulation != (byte)0) {
              System.out.println("String_Node_Str" + time);
              break;
            }
            invoke(fmiModelDescription,"String_Node_Str",new Object[]{fmiComponent},"String_Node_Str");
            if ((eventInfo20.valuesOfContinuousStatesChanged == (byte)1) && enableLogging) {
              System.out.println("String_Node_Str" + time);
            }
            if ((eventInfo20.nominalsOfContinuousStatesChanged == (byte)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");
        int fmiFlag=((Integer)freeModelInstance.invoke(Integer.class,new Object[]{fmiComponent})).intValue();
        if (fmiFlag >= FMILibrary.FMIStatus.fmiWarning) {
          System.err.println("String_Node_Str" + FMIModelDescription.fmiStatusDescription(fmiFlag));
        }
      }
 else {
        if (!(eventInfo20.terminateSimulation == 1)) {
          invoke(fmiModelDescription,"String_Node_Str",new Object[]{fmiComponent},"String_Node_Str");
        }
        invoke(fmiModelDescription,"String_Node_Str",new Object[]{fmiComponent},"String_Node_Str");
      }
    }
  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();
}