]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
refs #3511
authorlempinen <lempinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Tue, 31 Dec 2013 11:06:33 +0000 (11:06 +0000)
committerlempinen <lempinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Tue, 31 Dec 2013 11:06:33 +0000 (11:06 +0000)
git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@28581 ac1ea38d-2e2b-0410-8846-a27921b304fc

org.simantics.fmu/META-INF/MANIFEST.MF
org.simantics.fmu/src/org/simantics/fmu/FMUControlJNI.java
org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynGameExperiment.java

index 525a0185b16997bfacf816b9508d1dc1b7b4dd44..21efdee94fa3e3424575d8a4dd0dbccd2b52c30d 100644 (file)
@@ -6,7 +6,8 @@ Bundle-Version: 1.1.0.qualifier
 Bundle-Activator: org.simantics.fmu.Activator
 Bundle-Vendor: Semantum Oy
 Require-Bundle: org.eclipse.core.runtime,
- org.simantics.utils;bundle-version="1.1.0"
+ org.simantics.utils;bundle-version="1.1.0",
+ org.simantics;bundle-version="1.0.0"
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
 Bundle-ActivationPolicy: lazy
 Export-Package: org.simantics.fmu
index 716a864b0b8f71006e55e021d7ba08fd823cccf0..0ea50c2dc7d5d817724ff5c217bf6084bd89082b 100644 (file)
@@ -10,6 +10,7 @@ import java.util.UUID;
 import org.eclipse.core.runtime.FileLocator;\r
 import org.eclipse.core.runtime.Platform;\r
 import org.osgi.framework.Bundle;\r
+import org.simantics.Simantics;\r
 import org.simantics.utils.FileUtils;\r
 \r
 \r
@@ -21,7 +22,6 @@ public class FMUControlJNI {
     private static int      ERROR               = 0;\r
     private static int      OK                  = 1;\r
     private static String   UNSATISFIED_LINK    = "Method not found. DLL might not be loaded properly.";    \r
-    private static String   TEMP_DIRECTORY;\r
     private static String   TEMP_FMU_DIRECTORY_NAME = "fmu";    \r
     public static String    TEMP_FMU_COMMON_DIRECTORY;  \r
     public static String    LOCK_FILE_NAME      = "fmu.lock";\r
@@ -68,23 +68,8 @@ public class FMUControlJNI {
      * Static: initialize fmu temp folder\r
      */\r
     static {\r
-        try {\r
-            // Create a temp directory marker. This shows the system temp directory.\r
-            File temp = File.createTempFile("tempMarker", null);\r
-            TEMP_DIRECTORY = temp.getParentFile().getAbsolutePath();\r
-            // Delete the marker\r
-            temp.delete();\r
-\r
-            // Get common "fmu" directory in temp directory\r
-            File tempCommonDir = new File(TEMP_DIRECTORY, TEMP_FMU_DIRECTORY_NAME);\r
-            // If fmu is not a directory, create it\r
-            if(!tempCommonDir.isDirectory()) {\r
-                tempCommonDir.mkdir();\r
-            }\r
-            TEMP_FMU_COMMON_DIRECTORY = tempCommonDir.getAbsolutePath();\r
-        } catch (IOException e) {\r
-            e.printStackTrace();\r
-        }\r
+        File dir = Simantics.getTemporaryDirectory(TEMP_FMU_DIRECTORY_NAME);\r
+        TEMP_FMU_COMMON_DIRECTORY = dir.getAbsolutePath(); \r
     }\r
 \r
 \r
index 21e7ccb3fb8e438dda37637f7a4593b21144ff76..a5a9d7bc5ee89ae06c8ece5bb3823cb7bd631452 100644 (file)
@@ -376,20 +376,20 @@ public class SysdynGameExperiment extends OldSysdynExperiment {
                                monitor.worked(1);\r
                                \r
                                int stepNumber = 1;\r
-                               while(control.getTime() < eTime && !canceled) {\r
-                                   if(eTime - control.getTime() < stepLength)\r
-                                       control.setStepLength(eTime - control.getTime());\r
+                               while(time < eTime && !canceled) {\r
+                                   if(eTime - time < stepLength)\r
+                                       control.setStepLength(eTime - time);\r
                                    \r
-                                       monitor.subTask("Simulate step (time = " + control.getTime() + ")");\r
+                                       monitor.subTask("Simulate step (time = " + time + ")");\r
                                        control.simulateStep();\r
                                        monitor.worked(1);\r
                                        \r
                                        if(stepNumber % savePer == 0) {\r
-                                               monitor.subTask("Get results (time = " + control.getTime() + ")");\r
+                                               monitor.subTask("Get results (time = " + time + ")");\r
                                                currentValues = control.getSubscribedResults(currentValues);\r
                                                monitor.worked(1);\r
 \r
-                                               monitor.subTask("Save results (time = " + control.getTime() + ")");\r
+                                               monitor.subTask("Save results (time = " + time + ")");\r
                                                for(int k = 0; k < subscription.length; k++) {\r
                                                        SysdynGameExperiment.this.results.get(subscription[k]).add(currentValues[k]);\r
                                                }\r
@@ -398,6 +398,8 @@ public class SysdynGameExperiment extends OldSysdynExperiment {
                                        }\r
                                        stepNumber++;\r
                                        monitor.worked(1);\r
+                                       \r
+                                       time = control.getTime();\r
                                }\r
                                \r
                                monitor.subTask("Display results");\r