When you have the Visual Studio files:
Build from command-line our FMUSimulator.dll
-1) Open a terminal
-2) Navigate to org.simantics.fmil.core/native/FMUSimulator
-3) Run "msbuild.exe"
+1) Open a VS development terminal
+2) Navigate to org.simantics.fmil.core/native
+3) Run "windowsbuildsim.bat"
if (status == fmi1_status_error || status == fmi1_status_fatal) {
*error = "Error happened during stepping!";
return 1;
+ } else if (status == fmi1_status_pending) {
+ return 2;
}
return 0;
}
if (status == fmi2_status_error || status == fmi2_status_fatal) {
*error = "Error happened during stepping!";
return 1;
+ } else if (status == fmi2_status_pending) {
+ return 2;
}
return 0;
}
} else if (fmi.version == 2) {
returnValue = FMI2_CS_STEP(fmi.fmu, fmi.currentTime, fmi.timeStep, &error);
}
- if(returnValue != 0) {
+ if(returnValue == 1) {
string message = "Could not simulate step: ";
return throwException(env, message += error);
}
fmi.currentTime += fmi.timeStep;
- return 0;
+ return returnValue; //Pass return value up. 0 is OK, 1 is error, 2 is pending
/*
const char *fmuId = env->GetStringUTFChars(id, 0);
*/
private static int OK = 0;
private static int ERROR = 1;
+ private static int PENDING = 2;
private static String UNSATISFIED_LINK = "Method not found. DLL might not be loaded properly.";
public static final String TEMP_FMU_DIRECTORY_NAME = "fmil";
public static String TEMP_FMU_COMMON_DIRECTORY;
try {
- int ret = simulateStep_(getModelIDNew());
- if(ret != OK)
+ int ret = simulateStep_(getModelIDNew()); //0 is ok, 1 is error, 2 is pending
+ if(ret == PENDING)
+ LOGGER.warn("Pending status return from FMU. This is not implemented in our Simulator yet!");
+ else if(ret != OK)
LOGGER.warn("Function return value != OK, an exception should have been thrown from native code!");
-
} catch (FMILException e) {
throw e;
} catch (UnsatisfiedLinkError err) {