From: miettinen Date: Fri, 21 Mar 2014 11:57:01 +0000 (+0000) Subject: Small fixes (refs #4781). X-Git-Tag: 1.8.1~108 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=35f9ac095fc8b26466ca33b83901d006705de936;p=simantics%2Fsysdyn.git Small fixes (refs #4781). git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@29186 ac1ea38d-2e2b-0410-8846-a27921b304fc --- diff --git a/org.simantics.sysdyn.ontology/graph.tg b/org.simantics.sysdyn.ontology/graph.tg index 2fea7fa6..716cc5ed 100644 Binary files a/org.simantics.sysdyn.ontology/graph.tg and b/org.simantics.sysdyn.ontology/graph.tg differ diff --git a/org.simantics.sysdyn.ontology/graph/SysdynFunctions.pgraph b/org.simantics.sysdyn.ontology/graph/SysdynFunctions.pgraph index 111bd73b..6fdcc896 100644 --- a/org.simantics.sysdyn.ontology/graph/SysdynFunctions.pgraph +++ b/org.simantics.sysdyn.ontology/graph/SysdynFunctions.pgraph @@ -195,4 +195,27 @@ algorithm else y := y1 + (y2 - y1)*(u - u1)/(u2 - u1); end if; - end if;""" \ No newline at end of file + end if;""" + + + +FL.unitCast : SYSDYN.SysdynModelicaFunction + L0.HasDescription """unitCast(u) + +Casts the expression to ANY unit.""" + SYSDYN.SysdynModelicaFunction.inputs _ : L0.List + @L0.list + FL.unitCast.u : SYSDYN.SysdynModelicaFunction.Input + SYSDYN.Variable.type "Real" + SYSDYN.SysdynModelicaFunction.optional false + SYSDYN.SysdynModelicaFunction.unit "ANY" + SYSDYN.SysdynModelicaFunction.definition "the expression to be casted" + SYSDYN.SysdynModelicaFunction.outputs _ : L0.List + @L0.list + FL.unitCast.y : SYSDYN.SysdynModelicaFunction.Output + SYSDYN.Variable.type "Real" + SYSDYN.SysdynModelicaFunction.unit "ANY" + SYSDYN.SysdynModelicaFunction.modelicaFunctionCode """ input Real u "the expression to be casted"; + output Real y "the expression with unit ANY"; +algorithm + y := u;""" diff --git a/org.simantics.sysdyn.ontology/src/org/simantics/sysdyn/SysdynResource.java b/org.simantics.sysdyn.ontology/src/org/simantics/sysdyn/SysdynResource.java index 4404c421..2f37ffee 100644 --- a/org.simantics.sysdyn.ontology/src/org/simantics/sysdyn/SysdynResource.java +++ b/org.simantics.sysdyn.ontology/src/org/simantics/sysdyn/SysdynResource.java @@ -302,6 +302,9 @@ public class SysdynResource { public final Resource Built$in_Functions_minmax_maximum; public final Resource Built$in_Functions_minmax_minimum; public final Resource Built$in_Functions_minmax_result; + public final Resource Built$in_Functions_unitCast; + public final Resource Built$in_Functions_unitCast_u; + public final Resource Built$in_Functions_unitCast_y; public final Resource Built$in_Functions_xidz; public final Resource Built$in_Functions_xidz_divident; public final Resource Built$in_Functions_xidz_divisor; @@ -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"; public static final String Built$in_Functions_minmax_minimum = "http://www.simantics.org/Sysdyn-1.1/Built-in%20Functions/minmax/minimum"; public static final String Built$in_Functions_minmax_result = "http://www.simantics.org/Sysdyn-1.1/Built-in%20Functions/minmax/result"; + public static final String Built$in_Functions_unitCast = "http://www.simantics.org/Sysdyn-1.1/Built-in%20Functions/unitCast"; + public static final String Built$in_Functions_unitCast_u = "http://www.simantics.org/Sysdyn-1.1/Built-in%20Functions/unitCast/u"; + public static final String Built$in_Functions_unitCast_y = "http://www.simantics.org/Sysdyn-1.1/Built-in%20Functions/unitCast/y"; public static final String Built$in_Functions_xidz = "http://www.simantics.org/Sysdyn-1.1/Built-in%20Functions/xidz"; public static final String Built$in_Functions_xidz_divident = "http://www.simantics.org/Sysdyn-1.1/Built-in%20Functions/xidz/divident"; public static final String Built$in_Functions_xidz_divisor = "http://www.simantics.org/Sysdyn-1.1/Built-in%20Functions/xidz/divisor"; @@ -1856,6 +1862,9 @@ public class SysdynResource { Built$in_Functions_minmax_maximum = getResourceOrNull(graph, URIs.Built$in_Functions_minmax_maximum); Built$in_Functions_minmax_minimum = getResourceOrNull(graph, URIs.Built$in_Functions_minmax_minimum); Built$in_Functions_minmax_result = getResourceOrNull(graph, URIs.Built$in_Functions_minmax_result); + Built$in_Functions_unitCast = getResourceOrNull(graph, URIs.Built$in_Functions_unitCast); + Built$in_Functions_unitCast_u = getResourceOrNull(graph, URIs.Built$in_Functions_unitCast_u); + Built$in_Functions_unitCast_y = getResourceOrNull(graph, URIs.Built$in_Functions_unitCast_y); Built$in_Functions_xidz = getResourceOrNull(graph, URIs.Built$in_Functions_xidz); Built$in_Functions_xidz_divident = getResourceOrNull(graph, URIs.Built$in_Functions_xidz_divident); Built$in_Functions_xidz_divisor = getResourceOrNull(graph, URIs.Built$in_Functions_xidz_divisor); diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ConfigurationTab.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ConfigurationTab.java index 9250126c..afee67e9 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ConfigurationTab.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ConfigurationTab.java @@ -236,6 +236,7 @@ public class ConfigurationTab extends AdjustableTab { Map map = new HashMap(); map.put("year", "year"); map.put("month", "month"); + map.put("week", "week"); map.put("day", "day"); map.put("hour", "hour"); map.put("min", "min"); diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/utils/Function.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/utils/Function.java index ddec7b65..21fce962 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/utils/Function.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/utils/Function.java @@ -72,7 +72,6 @@ public class Function implements Comparable{ output = (UnitCheckingNode) outputParser.expr(); outputReader.close(); result.appendResult(output.getUnits(null, functions, allowEquivalents)); - result.setUnitType(UnitType.NORMAL); } catch (UnitCheckingException e) { e.printStackTrace(); } catch (ParseException e) {