From: lempinen Date: Tue, 23 Oct 2012 07:15:04 +0000 (+0000) Subject: Removed duplicate initialization and added a check to setting the value of time varia... X-Git-Tag: simantics-1.10.1~115 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=d9acd889acdb124f1798a95ebc956eaa99693ab2;p=simantics%2Fsysdyn.git Removed duplicate initialization and added a check to setting the value of time variable. Time variable is added only in sysdyn. (fixes #3803) git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@26138 ac1ea38d-2e2b-0410-8846-a27921b304fc --- diff --git a/org.simantics.fmu.me.win32/libraries/FMUSimulator.dll b/org.simantics.fmu.me.win32/libraries/FMUSimulator.dll index dcd2d5ce..b07fd46a 100644 Binary files a/org.simantics.fmu.me.win32/libraries/FMUSimulator.dll and b/org.simantics.fmu.me.win32/libraries/FMUSimulator.dll differ diff --git a/org.simantics.fmu/FMUSolution/FMUSimulator/src/fmu_control.cpp b/org.simantics.fmu/FMUSolution/FMUSimulator/src/fmu_control.cpp index ded510b6..c5eb62aa 100644 --- a/org.simantics.fmu/FMUSolution/FMUSimulator/src/fmu_control.cpp +++ b/org.simantics.fmu/FMUSolution/FMUSimulator/src/fmu_control.cpp @@ -484,7 +484,6 @@ JNIEXPORT jint JNICALL Java_org_simantics_fmu_FMUControlJNI_initializeSimulation fmuStruct.callbacks.logger = fmuLogger; fmuStruct.callbacks.allocateMemory = calloc; fmuStruct.callbacks.freeMemory = free; - fmu.instantiateModel(getModelIdentifier(fmu.modelDescription), fmuStruct.guid, fmuStruct.callbacks, fmiFalse); fmuStruct.c = fmu.instantiateModel(getModelIdentifier(fmu.modelDescription), fmuStruct.guid, fmuStruct.callbacks, fmiFalse); if (!fmuStruct.c) return throwException(env, "could not instantiate model"); @@ -632,14 +631,16 @@ JNIEXPORT jint JNICALL Java_org_simantics_fmu_FMUControlJNI_simulateStep_1 fmiFlag = fmu.setTime(fmuStruct.c, fmuStruct.currentTime); if (fmiFlag > fmiWarning) throwException(env, "could not set time"); - vr = getReference(fmuStruct, "time"); - if(vr != NULL) { - fmu.setReal(fmuStruct.c, &vr, 1, &(fmuStruct.currentTime)); + if(referenceExists(fmuStruct, "time")) { + vr = getReference(fmuStruct, "time"); + if(vr != NULL) { + fmu.setReal(fmuStruct.c, &vr, 1, &(fmuStruct.currentTime)); + } } if(debug) printf("Actual time: %lf\n", fmuStruct.currentTime); - + if (fmiFlag > fmiWarning) return throwException(env, "could not set time");