]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
Merged trunk @29707, 29812, 29904, 29917 to branch 1.8
authorjsimomaa <jsimomaa@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Thu, 17 Jul 2014 09:21:50 +0000 (09:21 +0000)
committerjsimomaa <jsimomaa@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Thu, 17 Jul 2014 09:21:50 +0000 (09:21 +0000)
refs #4987
refs #5067
refs #5093
refs #5113

git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/branches@29923 ac1ea38d-2e2b-0410-8846-a27921b304fc

15 files changed:
1.8/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Solver.java
1.8/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/IndexVariable.java
1.8/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/ValueIndexVariable.java
1.8/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/ValueIndexVariableBase.java
1.8/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SimulateDurationJob.java
1.8/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynExperiments.java
1.8/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/utils/UnitUtils.java
1.8/org.simantics.sysdyn/src/org/simantics/sysdyn/unitParser/UnitCheckingNodeFactory.java
1.8/org.simantics.sysdyn/src/org/simantics/sysdyn/unitParser/nodes/LogicalExpression.java [new file with mode: 0644]
1.8/org.simantics.sysdyn/src/org/simantics/sysdyn/unitParser/nodes/LogicalFactor.java [new file with mode: 0644]
1.8/org.simantics.sysdyn/src/org/simantics/sysdyn/unitParser/nodes/LogicalTerm.java [new file with mode: 0644]
1.8/org.simantics.sysdyn/src/org/simantics/sysdyn/unitParser/nodes/Relation.java
1.8/org.simantics.sysdyn/src/org/simantics/sysdyn/utils/ModelUtils.java
1.8/org.simantics.sysdyn/src/org/simantics/sysdyn/utils/SheetUtils.java
1.8/org.simantics.sysdyn/src/org/simantics/sysdyn/utils/imports/ImportUtils.java

index e03b297deb789137e6c772064b6109ec14084ae4..6ea46d57300767a0b6291b6d0974406f7a2b8757 100644 (file)
@@ -249,7 +249,7 @@ public class Solver {
                \r
                long endNanos = System.nanoTime();\r
                \r
-               System.err.println("Prepared model in " + 1e-6*(endNanos-startNanos) + "ms.");\r
+//             System.err.println("Prepared model in " + 1e-6*(endNanos-startNanos) + "ms.");\r
                \r
        }\r
        \r
index cfd243eb92b950272e541f4a00f876880fc2a4f3..606b9f332c84469adf3660c18d7b8c36c3d79f30 100644 (file)
@@ -212,7 +212,7 @@ public abstract class IndexVariable<T> extends AbstractPropertyVariable {
         \r
         String test = rvi;\r
         if(indexes != null && !indexes.isEmpty()) {\r
-               String regexIndexes = indexes.trim().replaceAll("\\b_\\b", "[a-zA-Z0-9_]*"); // Why was there was ".replace('.', ',')" ? - Removed by Teemu 2.9.2012\r
+               String regexIndexes = indexes.trim().replaceAll(":", "[a-zA-Z0-9_]*"); // Why was there was ".replace('.', ',')" ? - Removed by Teemu 2.9.2012\r
                test = rvi + "\\[" + regexIndexes + "\\]";\r
         } else {\r
                test = rvi + "(\\[.*\\])?";\r
index 3b05dd71791a48400589be5d09642d98dd958e61..6fb6f77d5b7c1c40f1dca6716a60cdc32337345f 100644 (file)
@@ -4,16 +4,28 @@ import org.simantics.db.ReadGraph;
 import org.simantics.db.exception.DatabaseException;\r
 import org.simantics.db.layer0.variable.Variable;\r
 \r
-public class ValueIndexVariable extends ValueIndexVariableBase<double[]> {\r
-\r
+public class ValueIndexVariable extends ValueIndexVariableBase<Object> {\r
+       \r
+       private final boolean scalar;\r
+       \r
        public ValueIndexVariable(ReadGraph graph, Variable parent, String indexes)\r
                        throws DatabaseException {\r
            super(graph, parent, indexes);\r
+           scalar = indexes.indexOf(":") == -1;\r
        }\r
        \r
        @Override\r
-       public double[] getValue() {\r
-               return getValueFull();\r
+       public Object getValue() {\r
+               double[] value = getValueFull();\r
+               if (scalar) {\r
+                       if (value == UNRESOLVED) { \r
+                               return Double.NaN;\r
+                       } else {\r
+                               return value[0];\r
+                       }\r
+               } else {\r
+                       return value;\r
+               }\r
        }\r
        \r
 }\r
index 1e7bf51b6c7e99304b35f13726da6125942d87a7..0b308f70ef7564691982be8baa8b147cfb46651e 100644 (file)
@@ -58,10 +58,16 @@ abstract public class ValueIndexVariableBase<T> extends IndexVariable<T> {
                Variable var = parent.getParent(graph);\r
                Resource resource = var.getRepresents(graph);\r
                \r
-               if(!(value instanceof double[]) || resource == null)\r
+               if(!(value instanceof Double || value instanceof double[]) || resource == null)\r
                        return;\r
                \r
-               double[] values = (double[]) value;\r
+               double[] values = null;\r
+               if (value instanceof Double) {\r
+                       values = new double[1];\r
+                       values[0] = (Double)value;\r
+               } else if (value instanceof double[]) {\r
+                       values = (double[]) value;      \r
+               }\r
                \r
 //             FMUControlJNI control = null;\r
                if(experiment instanceof SysdynGameExperimentBase) { // Support only game experiments for now..\r
index 9ff49128954f234000755354b12e48a9b084cfe8..defe0698f1cf8ccb9fd08acdb4ace1b05cacd1df 100644 (file)
@@ -94,7 +94,7 @@ class SimulateDurationJob extends Job {
                }\r
                \r
                long end = System.nanoTime();\r
-               System.err.println("simulate duration took " + 1e-6*(end-start) + "ms.");\r
+//             System.err.println("simulate duration took " + 1e-6*(end-start) + "ms.");\r
 \r
                return Status.OK_STATUS;\r
                \r
index aaa959a5960c27a3921ebb800a5a1843c4450a6d..b48628f246cc75b0af86664f346e87c0deb53ede 100644 (file)
@@ -185,7 +185,7 @@ public class SysdynExperiments {
        }\r
 \r
     public static Resource saveIC(WriteGraph graph, Variable input, String name) throws DatabaseException {\r
-       \r
+        graph.markUndoPoint();\r
                Resource model = Variables.getModel(graph, input);\r
        Resource child = Layer0Utils.getPossibleChild(graph, model, name);\r
        SysdynResource SYSDYN = SysdynResource.getInstance(graph);\r
@@ -209,12 +209,13 @@ public class SysdynExperiments {
                graph.addLiteral(ic, SYSDYN.InitialCondition_HasInitialValues, SYSDYN.InitialCondition_HasInitialValues_Inverse, MOD.PartialIC, IC, PartialIC.BINDING);\r
                graph.claim(model, L0.ConsistsOf, ic);\r
                \r
+               Layer0Utils.addCommentMetadata(graph, "Saved new Initial Condition " + name + " " + ic);\r
                return ic;\r
        \r
     }\r
 \r
     public static void assignIC(WriteGraph graph, Variable experiment, String name) throws DatabaseException {\r
-\r
+        graph.markUndoPoint();\r
        System.err.println("assignIC " + experiment.getURI(graph));\r
 \r
                Layer0 L0 = Layer0.getInstance(graph);\r
@@ -233,7 +234,7 @@ public class SysdynExperiments {
        \r
                graph.deny(exp, SYSDYN.Experiment_ic);\r
                graph.claim(exp, SYSDYN.Experiment_ic, ic);\r
-       \r
+       Layer0Utils.addCommentMetadata(graph, "Assigned Initial Condition " + graph.getRelatedValue2(ic, L0.HasName, Bindings.STRING) + " to experiment " + graph.getRelatedValue2(exp, L0.HasName, Bindings.STRING));\r
     }\r
     \r
     public static void deassignIC(WriteGraph graph, Variable experiment) throws DatabaseException {\r
@@ -278,14 +279,14 @@ public class SysdynExperiments {
     }\r
     \r
     public static void deleteIC(WriteGraph graph, Variable input, String name) throws DatabaseException {\r
-\r
+        graph.markUndoPoint();\r
        Resource model = Variables.getModel(graph, input);\r
        Resource child = Layer0Utils.getPossibleChild(graph, model, name);\r
        SysdynResource SYSDYN = SysdynResource.getInstance(graph);\r
 \r
        if((child != null) && graph.isInstanceOf(child, SYSDYN.InitialCondition))\r
                RemoverUtil.remove(graph, child);\r
-       \r
+       Layer0Utils.addCommentMetadata(graph, "Deleted Initial Condition " + graph.getRelatedValue2(child, Layer0.getInstance(graph).HasName, Bindings.STRING));\r
     }\r
     \r
 }\r
index 5b63087588acfc1f1ac32b08b070f774116db821..8418b14fe91cee2f3b4d7d35e9b8b406b4b02173 100644 (file)
@@ -94,7 +94,8 @@ public class UnitUtils {
     public static String matchUnits(ReadGraph graph, SysdynModel model, Configuration configuration, String unit, String expression) {\r
         if(unit == null)\r
             return "Unit not defined";\r
-        \r
+        if (expression == null)\r
+            return "Expression not defined";\r
         try {\r
             StringReader rightReader = new StringReader(expression);\r
             UnitParser rightParser = new UnitParser(rightReader);\r
index 35f22dfb06252e233e7e4323e7ab5d23188da132..b24af37aa15d5e112b766d83a3b20552a6f15903 100644 (file)
@@ -8,6 +8,7 @@
  *\r
  * Contributors:\r
  *     Semantum Oy - initial API and implementation\r
+ *     VTT Technical Research Centre of Finland\r
  *******************************************************************************/\r
 package org.simantics.sysdyn.unitParser;\r
 \r
@@ -28,6 +29,9 @@ import org.simantics.sysdyn.unitParser.nodes.ForIndex;
 import org.simantics.sysdyn.unitParser.nodes.FunctionArguments;\r
 import org.simantics.sysdyn.unitParser.nodes.FunctionCall;\r
 import org.simantics.sysdyn.unitParser.nodes.IfThenElse;\r
+import org.simantics.sysdyn.unitParser.nodes.LogicalExpression;\r
+import org.simantics.sysdyn.unitParser.nodes.LogicalFactor;\r
+import org.simantics.sysdyn.unitParser.nodes.LogicalTerm;\r
 import org.simantics.sysdyn.unitParser.nodes.Multiplication;\r
 import org.simantics.sysdyn.unitParser.nodes.NamedArguments;\r
 import org.simantics.sysdyn.unitParser.nodes.ParenthesisExpression;\r
@@ -42,8 +46,11 @@ public class UnitCheckingNodeFactory {
     private static HashMap<String, Class<?>> constructors = new HashMap<String, Class<?>>();\r
     \r
     static {\r
+       constructors.put("logical_expression", LogicalExpression.class);\r
+        constructors.put("logical_term", LogicalTerm.class);\r
+        constructors.put("logical_factor", LogicalFactor.class);\r
         constructors.put("relation", Relation.class);\r
-        constructors.put("term", Term.class);\r
+       constructors.put("term", Term.class);\r
         constructors.put("factor", Factor.class);\r
         constructors.put("arithmetic_expression", Arithmetic.class);\r
         constructors.put("ifthenelse", IfThenElse.class);\r
diff --git a/1.8/org.simantics.sysdyn/src/org/simantics/sysdyn/unitParser/nodes/LogicalExpression.java b/1.8/org.simantics.sysdyn/src/org/simantics/sysdyn/unitParser/nodes/LogicalExpression.java
new file mode 100644 (file)
index 0000000..d154ec9
--- /dev/null
@@ -0,0 +1,49 @@
+/*******************************************************************************\r
+ * Copyright (c) 2014 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland\r
+ *******************************************************************************/\r
+package org.simantics.sysdyn.unitParser.nodes;\r
+\r
+import java.util.ArrayList;\r
+import java.util.HashMap;\r
+\r
+import org.simantics.sysdyn.unitParser.UnitCheckingException;\r
+import org.simantics.sysdyn.unitParser.UnitCheckingNode;\r
+import org.simantics.sysdyn.unitParser.nodes.UnitResult.UnitType;\r
+import org.simantics.sysdyn.utils.Function;\r
+\r
+/**\r
+ * See UnitCheckingNodeFactory for mapping\r
+ * @author Tuomas Miettinen\r
+ *\r
+ */\r
+public class LogicalExpression extends UnitCheckingNode {\r
+\r
+    public LogicalExpression(int id) {\r
+        super(id);\r
+    }\r
+\r
+    @Override\r
+    public UnitResult getUnits(HashMap<String, String> units, ArrayList<Function> functions, boolean allowEquivalents) throws UnitCheckingException {\r
+       UnitResult result;\r
+       \r
+       if (jjtGetNumChildren() == 1) {\r
+               result = ((UnitCheckingNode)jjtGetChild(0)).getUnits(units, functions, allowEquivalents);\r
+        } else {\r
+               // If the logical expression is of type logical_term or logical_term, allow\r
+               // all units as input and output unit is scalar\r
+               result = new UnitResult(allowEquivalents);\r
+            result.setUnitType(UnitType.SCALAR);\r
+        }\r
+    \r
+        return result;\r
+    }\r
+\r
+}\r
diff --git a/1.8/org.simantics.sysdyn/src/org/simantics/sysdyn/unitParser/nodes/LogicalFactor.java b/1.8/org.simantics.sysdyn/src/org/simantics/sysdyn/unitParser/nodes/LogicalFactor.java
new file mode 100644 (file)
index 0000000..ca304bb
--- /dev/null
@@ -0,0 +1,49 @@
+/*******************************************************************************\r
+ * Copyright (c) 2014 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland\r
+ *******************************************************************************/\r
+package org.simantics.sysdyn.unitParser.nodes;\r
+\r
+import java.util.ArrayList;\r
+import java.util.HashMap;\r
+\r
+import org.simantics.sysdyn.unitParser.UnitCheckingException;\r
+import org.simantics.sysdyn.unitParser.UnitCheckingNode;\r
+import org.simantics.sysdyn.unitParser.nodes.UnitResult.UnitType;\r
+import org.simantics.sysdyn.utils.Function;\r
+\r
+/**\r
+ * See UnitCheckingNodeFactory for mapping\r
+ * @author Tuomas Miettinen\r
+ *\r
+ */\r
+public class LogicalFactor extends UnitCheckingNode {\r
+\r
+    public LogicalFactor(int id) {\r
+        super(id);\r
+    }\r
+\r
+    @Override\r
+    public UnitResult getUnits(HashMap<String, String> units, ArrayList<Function> functions, boolean allowEquivalents) throws UnitCheckingException {\r
+       UnitResult result;\r
+       \r
+       if (jjtGetNumChildren() == 1) {\r
+               result = ((UnitCheckingNode)jjtGetChild(0)).getUnits(units, functions, allowEquivalents);\r
+        } else {\r
+               // If the logical factor is of type not relation, allow\r
+               // all units as input and output unit is scalar\r
+               result = new UnitResult(allowEquivalents);\r
+            result.setUnitType(UnitType.SCALAR);\r
+        }\r
+    \r
+        return result;\r
+    }\r
+\r
+}\r
diff --git a/1.8/org.simantics.sysdyn/src/org/simantics/sysdyn/unitParser/nodes/LogicalTerm.java b/1.8/org.simantics.sysdyn/src/org/simantics/sysdyn/unitParser/nodes/LogicalTerm.java
new file mode 100644 (file)
index 0000000..288a914
--- /dev/null
@@ -0,0 +1,49 @@
+/*******************************************************************************\r
+ * Copyright (c) 2014 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland\r
+ *******************************************************************************/\r
+package org.simantics.sysdyn.unitParser.nodes;\r
+\r
+import java.util.ArrayList;\r
+import java.util.HashMap;\r
+\r
+import org.simantics.sysdyn.unitParser.UnitCheckingException;\r
+import org.simantics.sysdyn.unitParser.UnitCheckingNode;\r
+import org.simantics.sysdyn.unitParser.nodes.UnitResult.UnitType;\r
+import org.simantics.sysdyn.utils.Function;\r
+\r
+/**\r
+ * See UnitCheckingNodeFactory for mapping\r
+ * @author Tuomas Miettinen\r
+ *\r
+ */\r
+public class LogicalTerm extends UnitCheckingNode {\r
+\r
+    public LogicalTerm(int id) {\r
+        super(id);\r
+    }\r
+\r
+    @Override\r
+    public UnitResult getUnits(HashMap<String, String> units, ArrayList<Function> functions, boolean allowEquivalents) throws UnitCheckingException {\r
+       UnitResult result;\r
+       \r
+       if (jjtGetNumChildren() == 1) {\r
+               result = ((UnitCheckingNode)jjtGetChild(0)).getUnits(units, functions, allowEquivalents);\r
+        } else {\r
+               // If the logical term is of type logical_factor and logical_factor, allow\r
+               // all units as input and output unit is scalar\r
+               result = new UnitResult(allowEquivalents);\r
+            result.setUnitType(UnitType.SCALAR);\r
+        }\r
+    \r
+        return result;\r
+    }\r
+\r
+}\r
index 5831092bab57b1e7b2142c9bd830795d737ccca4..878b53e1abb5fbc819573aa42c72ee8b4b526b2e 100644 (file)
@@ -17,6 +17,7 @@ import java.util.HashMap;
 \r
 import org.simantics.sysdyn.unitParser.UnitCheckingException;\r
 import org.simantics.sysdyn.unitParser.UnitCheckingNode;\r
+import org.simantics.sysdyn.unitParser.nodes.UnitResult.UnitType;\r
 import org.simantics.sysdyn.utils.Function;\r
 \r
 /**\r
@@ -40,8 +41,9 @@ public class Relation extends UnitCheckingNode {
         UnitCheckingNode candidateNode = null;\r
         \r
         base = ((UnitCheckingNode)jjtGetChild(0));\r
-        if(!(base instanceof Arithmetic) && jjtGetNumChildren() > 1)\r
+        if(!(base instanceof Arithmetic) && jjtGetNumChildren() > 1) {\r
             base = ((UnitCheckingNode)jjtGetChild(1));\r
+        }\r
             \r
         if(base instanceof Arithmetic) {\r
             result.appendResult(base.getUnits(units, functions, allowEquivalents));\r
@@ -53,15 +55,21 @@ public class Relation extends UnitCheckingNode {
                     operator = ((UnitCheckingNode)jjtGetChild(i-1));\r
                     UnitResult candidateUnits = candidateNode.getUnits(units, functions, allowEquivalents);\r
                     if(!result.equals(candidateUnits)) {\r
-                        result.equals(candidateUnits);\r
                         throw new UnitCheckingException("Not equals exception: " +\r
                                 base.printNode() + " [" + result.getFullUnit() + "] " + operator.printNode() + " " +\r
                                 candidateNode.printNode() + " [" + candidateUnits.getFullUnit() + "]"\r
                                 );\r
                     }\r
                 }\r
-\r
             }\r
+            \r
+            if (jjtGetNumChildren() > 1) {\r
+               // If there is an actual relation (e.g. a > b), the output\r
+               // unit is a scalar.\r
+               result = new UnitResult(allowEquivalents);\r
+                result.setUnitType(UnitType.SCALAR);\r
+            }\r
+\r
         }\r
         \r
         return result;\r
index e3212abadf01480148dd62e73eac509b6e5ca839..98fb37c0c6362a86eefd56afe3b806a0a6519ce2 100644 (file)
@@ -11,6 +11,7 @@ import org.simantics.db.common.utils.Logger;
 import org.simantics.db.common.utils.NameUtils;\r
 import org.simantics.db.exception.DatabaseException;\r
 import org.simantics.db.layer0.adapter.Template;\r
+import org.simantics.db.layer0.util.Layer0Utils;\r
 import org.simantics.document.DocumentResource;\r
 import org.simantics.issues.ontology.IssueResource;\r
 import org.simantics.layer0.Layer0;\r
@@ -56,6 +57,8 @@ public class ModelUtils {
 \r
     // TODO: remove this\r
     public static Resource createModelAt(WriteGraph g, Resource library) {\r
+        \r
+        g.markUndoPoint();\r
         try {\r
             Layer0 l0 = Layer0.getInstance(g);\r
             Layer0X L0X = Layer0X.getInstance(g);\r
@@ -178,6 +181,8 @@ public class ModelUtils {
             \r
             ProfileEntries.createStandardProfiles(g, model);\r
             \r
+            Layer0Utils.addCommentMetadata(g, "Created new Sysdyn Model '" + modelName + "' " + model.toString());\r
+            \r
             return model;\r
             \r
         } catch (DatabaseException e ) {\r
index 9bda6cab3deee055fd5af008caf7d285fac5b8ac..5525cc8d2598e0b002c28c09f4cd031e90e74e4e 100644 (file)
@@ -29,7 +29,6 @@ import org.simantics.spreadsheet.resource.SpreadsheetResource;
 public class SheetUtils {\r
 \r
     public static Resource createSheet(WriteGraph graph, Resource book, String name, String[] colNames, int[] colWidths) throws DatabaseException {\r
-\r
         Layer0 L0 = Layer0.getInstance(graph);\r
         SpreadsheetResource sr = SpreadsheetResource.getInstance(graph);\r
 \r
@@ -75,7 +74,6 @@ public class SheetUtils {
 //            graph.claim(result, L0.HasChildVariables, L0.HasChildVariables_Inverse, newCell);\r
 //            \r
 //        }\r
-\r
         return result;\r
 \r
     }\r
index 7523baeff6de50e561d408eb961ea4840bed347d..ceeff8aaefb53262cfa14a45a6e3a15a99e42fac 100644 (file)
@@ -50,6 +50,7 @@ import org.simantics.db.layer0.adapter.impl.DefaultPasteImportAdvisor;
 import org.simantics.db.layer0.migration.MigrationState;\r
 import org.simantics.db.layer0.migration.MigrationStateKeys;\r
 import org.simantics.db.layer0.migration.MigrationUtils;\r
+import org.simantics.db.layer0.util.Layer0Utils;\r
 import org.simantics.db.layer0.util.ModelDependenciesBean;\r
 import org.simantics.db.layer0.util.ModelDependency;\r
 import org.simantics.db.layer0.util.RemoverUtil;\r
@@ -148,7 +149,7 @@ public class ImportUtils {
         if(project == null) return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Import model: project not found", null);\r
 \r
         beginTask(monitor, "Import model", 10);\r
-        File importFile = new File(path);\r
+        final File importFile = new File(path);\r
         MigrationState state = MigrationUtils.newState();\r
         state.setProperty(MigrationStateKeys.BASE_URI, SysdynResource.URIs.Migration);\r
         state.setProperty(MigrationStateKeys.MODEL_FILE, importFile);\r
@@ -156,6 +157,17 @@ public class ImportUtils {
 \r
         Session session = Simantics.getSession();\r
         \r
+        //TODO\r
+        // With this empty write it is possible to group change sets nicely in undo view and make good undoable collection\r
+        session.syncRequest(new WriteRequest() {\r
+            \r
+            @Override\r
+            public void perform(WriteGraph graph) throws DatabaseException {\r
+                graph.markUndoPoint();\r
+                Layer0Utils.addCommentMetadata(graph, "Imported Sysdyn model from " + importFile.getName());\r
+            }\r
+        });\r
+        \r
         final ModelDependenciesBean dependenciesBean = getModelDependenciesBean(state);\r
         if(dependenciesBean != null) {\r
             for(ModelDependency dependency : dependenciesBean.dependencies) {\r