From: lempinen Date: Tue, 24 Aug 2010 07:54:52 +0000 (+0000) Subject: simple interpolate function that adds automatically one parameter needed for interpolate2 X-Git-Tag: simantics-1.2.0~85 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=470ba96548a7f8542eda49e3f38ccab30e2c0f24;p=simantics%2Fsysdyn.git simple interpolate function that adds automatically one parameter needed for interpolate2 git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@17494 ac1ea38d-2e2b-0410-8846-a27921b304fc --- diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/modelica/ModelicaWriter.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/modelica/ModelicaWriter.java index 7949b38d..d2e62434 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/modelica/ModelicaWriter.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/modelica/ModelicaWriter.java @@ -38,9 +38,17 @@ public class ModelicaWriter { if(!functionsWritten) { - // THIS INTERPOLATE DOESN'T WORK PROPERLY b.append( - "\nfunction Interpolate\n" + + "\nfunction interpolate\n" + + " input Real u \"in1;put value (first column of table)\";\n" + + " input Real table[:, :] \"table to be interpolated\";\n" + + " output Real y \"interpolated input value (icol column of table)\";\n" + + "algorithm \n" + + " y := interpolate2(u, table, 2);" + + "end interpolate;\n\n"); + + b.append( + "\nfunction interpolate2\n" + " input Real u \"in1;put value (first column of table)\";\n" + " input Real table[:, :] \"table to be interpolated\";\n" + " input Integer icol \"column of table to be interpolated\";\n" + @@ -81,7 +89,7 @@ public class ModelicaWriter { " y := y1 + (y2 - y1)*(u - u1)/(u2 - u1);\n" + " end if;\n" + " end if;\n" + - "end Interpolate;\n"); + "end interpolate2;\n"); b.append( "function xidz\n" + diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/expressions/WithLookupExpression.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/expressions/WithLookupExpression.java index b9137bd0..79620c28 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/expressions/WithLookupExpression.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/expressions/WithLookupExpression.java @@ -32,7 +32,7 @@ public class WithLookupExpression extends Expression { @Override public String getEquation(IndependentVariable variable) { return - " " + variable.getName() + " = Interpolate(" + equation + ", " + lookupTable + ", 2);\n"; + " " + variable.getName() + " = interpolate(" + equation + ", " + lookupTable + ");\n"; } }