]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
Removed duplicate initialization and added a check to setting the value of time varia...
authorlempinen <lempinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Tue, 23 Oct 2012 07:15:04 +0000 (07:15 +0000)
committerlempinen <lempinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Tue, 23 Oct 2012 07:15:04 +0000 (07:15 +0000)
git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@26138 ac1ea38d-2e2b-0410-8846-a27921b304fc

org.simantics.fmu.me.win32/libraries/FMUSimulator.dll
org.simantics.fmu/FMUSolution/FMUSimulator/src/fmu_control.cpp

index dcd2d5ce74e1094e255f9d70486f060f9f4449a0..b07fd46a1771ab476f24602b29e4b50003811a18 100644 (file)
Binary files a/org.simantics.fmu.me.win32/libraries/FMUSimulator.dll and b/org.simantics.fmu.me.win32/libraries/FMUSimulator.dll differ
index ded510b6322f3db1031d64f97d1211f73e890c65..c5eb62aae95b7e2f9e06864b23e9742341daf84b 100644 (file)
@@ -484,7 +484,6 @@ JNIEXPORT jint JNICALL Java_org_simantics_fmu_FMUControlJNI_initializeSimulation
                fmuStruct.callbacks.logger = fmuLogger;\r
                fmuStruct.callbacks.allocateMemory = calloc;\r
                fmuStruct.callbacks.freeMemory = free;\r
-               fmu.instantiateModel(getModelIdentifier(fmu.modelDescription), fmuStruct.guid, fmuStruct.callbacks, fmiFalse);\r
                fmuStruct.c = fmu.instantiateModel(getModelIdentifier(fmu.modelDescription), fmuStruct.guid, fmuStruct.callbacks, fmiFalse);\r
                if (!fmuStruct.c) return throwException(env, "could not instantiate model");\r
     \r
@@ -632,14 +631,16 @@ JNIEXPORT jint JNICALL Java_org_simantics_fmu_FMUControlJNI_simulateStep_1
                        fmiFlag = fmu.setTime(fmuStruct.c, fmuStruct.currentTime);\r
                        if (fmiFlag > fmiWarning) throwException(env, "could not set time");\r
 \r
-                       vr = getReference(fmuStruct, "time");\r
-                       if(vr != NULL) {\r
-                               fmu.setReal(fmuStruct.c, &vr, 1, &(fmuStruct.currentTime));\r
+                       if(referenceExists(fmuStruct, "time")) {\r
+                               vr = getReference(fmuStruct, "time");\r
+                               if(vr != NULL) {\r
+                                       fmu.setReal(fmuStruct.c, &vr, 1, &(fmuStruct.currentTime));\r
+                               }\r
                        }\r
 \r
                        if(debug)\r
                                printf("Actual time: %lf\n", fmuStruct.currentTime);\r
-               \r
+\r
                        if (fmiFlag > fmiWarning) \r
                                return throwException(env, "could not set time");\r
 \r