]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
Small fixes (refs #4781).
authormiettinen <miettinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Fri, 21 Mar 2014 11:57:01 +0000 (11:57 +0000)
committermiettinen <miettinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Fri, 21 Mar 2014 11:57:01 +0000 (11:57 +0000)
git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@29186 ac1ea38d-2e2b-0410-8846-a27921b304fc

org.simantics.sysdyn.ontology/graph.tg
org.simantics.sysdyn.ontology/graph/SysdynFunctions.pgraph
org.simantics.sysdyn.ontology/src/org/simantics/sysdyn/SysdynResource.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ConfigurationTab.java
org.simantics.sysdyn/src/org/simantics/sysdyn/utils/Function.java

index 2fea7fa630e869c2a2d58414ff8d6debe75de3e2..716cc5ede4698112b3ef5eddc22baf77058de7ff 100644 (file)
Binary files a/org.simantics.sysdyn.ontology/graph.tg and b/org.simantics.sysdyn.ontology/graph.tg differ
index 111bd73bc330f077c411ba749fc936de3b728ab5..6fdcc8966825d28e741b22ed1d9490333c1f0478 100644 (file)
@@ -195,4 +195,27 @@ algorithm
         else\r
             y := y1 + (y2 - y1)*(u - u1)/(u2 - u1);\r
         end if;\r
-    end if;"""
\ No newline at end of file
+    end if;"""\r
+    \r
+    \r
+    \r
+FL.unitCast : SYSDYN.SysdynModelicaFunction\r
+    L0.HasDescription """unitCast(u)\r
+\r
+Casts the expression to ANY unit."""\r
+    SYSDYN.SysdynModelicaFunction.inputs _ : L0.List\r
+        @L0.list\r
+            FL.unitCast.u : SYSDYN.SysdynModelicaFunction.Input\r
+                SYSDYN.Variable.type "Real"\r
+                SYSDYN.SysdynModelicaFunction.optional false\r
+                SYSDYN.SysdynModelicaFunction.unit "ANY"\r
+                SYSDYN.SysdynModelicaFunction.definition "the expression to be casted"\r
+    SYSDYN.SysdynModelicaFunction.outputs _ : L0.List\r
+        @L0.list\r
+            FL.unitCast.y : SYSDYN.SysdynModelicaFunction.Output\r
+                SYSDYN.Variable.type "Real"\r
+                SYSDYN.SysdynModelicaFunction.unit "ANY"\r
+    SYSDYN.SysdynModelicaFunction.modelicaFunctionCode """    input Real u "the expression to be casted";\r
+    output Real y "the expression with unit ANY";\r
+algorithm\r
+    y := u;"""\r
index 4404c4215c258eeaeb181ff07a4f43c4f204a6be..2f37ffee9082f961150e3d165e4022ec56999aca 100644 (file)
@@ -302,6 +302,9 @@ public class SysdynResource {
     public final Resource Built$in_Functions_minmax_maximum;\r
     public final Resource Built$in_Functions_minmax_minimum;\r
     public final Resource Built$in_Functions_minmax_result;\r
+    public final Resource Built$in_Functions_unitCast;\r
+    public final Resource Built$in_Functions_unitCast_u;\r
+    public final Resource Built$in_Functions_unitCast_y;\r
     public final Resource Built$in_Functions_xidz;\r
     public final Resource Built$in_Functions_xidz_divident;\r
     public final Resource Built$in_Functions_xidz_divisor;\r
@@ -1074,6 +1077,9 @@ public class SysdynResource {
         public static final String Built$in_Functions_minmax_maximum = "http://www.simantics.org/Sysdyn-1.1/Built-in%20Functions/minmax/maximum";\r
         public static final String Built$in_Functions_minmax_minimum = "http://www.simantics.org/Sysdyn-1.1/Built-in%20Functions/minmax/minimum";\r
         public static final String Built$in_Functions_minmax_result = "http://www.simantics.org/Sysdyn-1.1/Built-in%20Functions/minmax/result";\r
+        public static final String Built$in_Functions_unitCast = "http://www.simantics.org/Sysdyn-1.1/Built-in%20Functions/unitCast";\r
+        public static final String Built$in_Functions_unitCast_u = "http://www.simantics.org/Sysdyn-1.1/Built-in%20Functions/unitCast/u";\r
+        public static final String Built$in_Functions_unitCast_y = "http://www.simantics.org/Sysdyn-1.1/Built-in%20Functions/unitCast/y";\r
         public static final String Built$in_Functions_xidz = "http://www.simantics.org/Sysdyn-1.1/Built-in%20Functions/xidz";\r
         public static final String Built$in_Functions_xidz_divident = "http://www.simantics.org/Sysdyn-1.1/Built-in%20Functions/xidz/divident";\r
         public static final String Built$in_Functions_xidz_divisor = "http://www.simantics.org/Sysdyn-1.1/Built-in%20Functions/xidz/divisor";\r
@@ -1856,6 +1862,9 @@ public class SysdynResource {
         Built$in_Functions_minmax_maximum = getResourceOrNull(graph, URIs.Built$in_Functions_minmax_maximum);\r
         Built$in_Functions_minmax_minimum = getResourceOrNull(graph, URIs.Built$in_Functions_minmax_minimum);\r
         Built$in_Functions_minmax_result = getResourceOrNull(graph, URIs.Built$in_Functions_minmax_result);\r
+        Built$in_Functions_unitCast = getResourceOrNull(graph, URIs.Built$in_Functions_unitCast);\r
+        Built$in_Functions_unitCast_u = getResourceOrNull(graph, URIs.Built$in_Functions_unitCast_u);\r
+        Built$in_Functions_unitCast_y = getResourceOrNull(graph, URIs.Built$in_Functions_unitCast_y);\r
         Built$in_Functions_xidz = getResourceOrNull(graph, URIs.Built$in_Functions_xidz);\r
         Built$in_Functions_xidz_divident = getResourceOrNull(graph, URIs.Built$in_Functions_xidz_divident);\r
         Built$in_Functions_xidz_divisor = getResourceOrNull(graph, URIs.Built$in_Functions_xidz_divisor);\r
index 9250126c4d94070a4d9d860fb9096155b276b4de..afee67e9a9702edf8d032cd56b38b0bdb60d72c3 100644 (file)
@@ -236,6 +236,7 @@ public class ConfigurationTab extends AdjustableTab {
                 Map<String, Object> map = new HashMap<String, Object>();\r
                 map.put("year", "year");\r
                 map.put("month", "month");\r
+                map.put("week", "week");\r
                 map.put("day", "day");\r
                 map.put("hour", "hour");\r
                 map.put("min", "min");\r
index ddec7b6589485f6300fefc6a74cda50d7ea4b6d4..21fce962f991ab0d4a7f7eb5a3889567efb4de6a 100644 (file)
@@ -72,7 +72,6 @@ public class Function implements Comparable<Function>{
                                output = (UnitCheckingNode) outputParser.expr();\r
                                outputReader.close();\r
                    result.appendResult(output.getUnits(null, functions, allowEquivalents));\r
-                               result.setUnitType(UnitType.NORMAL);\r
                        } catch (UnitCheckingException e) {\r
                                e.printStackTrace();\r
                        } catch (ParseException e) {\r