]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@13645 ac1ea38d-2e2b...
authorniemisto <niemisto@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Tue, 26 Jan 2010 15:41:25 +0000 (15:41 +0000)
committerniemisto <niemisto@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Tue, 26 Jan 2010 15:41:25 +0000 (15:41 +0000)
15 files changed:
org.simantics.modelica/.classpath [new file with mode: 0644]
org.simantics.modelica/.project [new file with mode: 0644]
org.simantics.modelica/.settings/org.eclipse.jdt.core.prefs [new file with mode: 0644]
org.simantics.modelica/META-INF/MANIFEST.MF [new file with mode: 0644]
org.simantics.modelica/Testi2.cpp [new file with mode: 0644]
org.simantics.modelica/Testi2.exe [new file with mode: 0644]
org.simantics.modelica/Testi2.libs [new file with mode: 0644]
org.simantics.modelica/Testi2.makefile [new file with mode: 0644]
org.simantics.modelica/Testi2_functions.cpp [new file with mode: 0644]
org.simantics.modelica/Testi2_init.txt [new file with mode: 0644]
org.simantics.modelica/Testi2_res.plt [new file with mode: 0644]
org.simantics.modelica/build.properties [new file with mode: 0644]
org.simantics.modelica/src/org/simantics/modelica/ModelicaManager.java [new file with mode: 0644]
org.simantics.modelica/src/org/simantics/modelica/data/DataSet.java [new file with mode: 0644]
org.simantics.modelica/src/org/simantics/modelica/data/SimulationResult.java [new file with mode: 0644]

diff --git a/org.simantics.modelica/.classpath b/org.simantics.modelica/.classpath
new file mode 100644 (file)
index 0000000..8a8f166
--- /dev/null
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<classpath>\r
+       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>\r
+       <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>\r
+       <classpathentry kind="src" path="src"/>\r
+       <classpathentry kind="output" path="bin"/>\r
+</classpath>\r
diff --git a/org.simantics.modelica/.project b/org.simantics.modelica/.project
new file mode 100644 (file)
index 0000000..2d4d7aa
--- /dev/null
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<projectDescription>\r
+       <name>org.simantics.modelica</name>\r
+       <comment></comment>\r
+       <projects>\r
+       </projects>\r
+       <buildSpec>\r
+               <buildCommand>\r
+                       <name>org.eclipse.jdt.core.javabuilder</name>\r
+                       <arguments>\r
+                       </arguments>\r
+               </buildCommand>\r
+               <buildCommand>\r
+                       <name>org.eclipse.pde.ManifestBuilder</name>\r
+                       <arguments>\r
+                       </arguments>\r
+               </buildCommand>\r
+               <buildCommand>\r
+                       <name>org.eclipse.pde.SchemaBuilder</name>\r
+                       <arguments>\r
+                       </arguments>\r
+               </buildCommand>\r
+       </buildSpec>\r
+       <natures>\r
+               <nature>org.eclipse.pde.PluginNature</nature>\r
+               <nature>org.eclipse.jdt.core.javanature</nature>\r
+       </natures>\r
+</projectDescription>\r
diff --git a/org.simantics.modelica/.settings/org.eclipse.jdt.core.prefs b/org.simantics.modelica/.settings/org.eclipse.jdt.core.prefs
new file mode 100644 (file)
index 0000000..f25d3a6
--- /dev/null
@@ -0,0 +1,8 @@
+#Tue Jan 26 16:43:56 EET 2010\r
+eclipse.preferences.version=1\r
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled\r
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6\r
+org.eclipse.jdt.core.compiler.compliance=1.6\r
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error\r
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error\r
+org.eclipse.jdt.core.compiler.source=1.6\r
diff --git a/org.simantics.modelica/META-INF/MANIFEST.MF b/org.simantics.modelica/META-INF/MANIFEST.MF
new file mode 100644 (file)
index 0000000..5694d31
--- /dev/null
@@ -0,0 +1,7 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Modelica
+Bundle-SymbolicName: org.simantics.modelica
+Bundle-Version: 1.0.0.qualifier
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Require-Bundle: gnu.trove2;bundle-version="2.0.4"
diff --git a/org.simantics.modelica/Testi2.cpp b/org.simantics.modelica/Testi2.cpp
new file mode 100644 (file)
index 0000000..e1f28e0
--- /dev/null
@@ -0,0 +1,498 @@
+// Simulation code for Testi2 generated by the OpenModelica Compiler.\r
+#include "modelica.h"\r
+#include "assert.h"\r
+#include "string.h"\r
+#include "simulation_runtime.h"\r
+\r
+#if defined(_MSC_VER) && !defined(_SIMULATION_RUNTIME_H)\r
+  #define DLLExport   __declspec( dllexport ) \r
+#else \r
+  #define DLLExport /* nothing */\r
+#endif \r
+\r
+#include "Testi2_functions.cpp"\r
+\r
+extern "C" {\r
+\r
+}\r
+\r
+#define NHELP 0\r
+#define NG 0//number of zero crossing\r
+#define NX 1\r
+#define NY 0\r
+#define NP 0 // number of parameters\r
+#define NO 0 // number of outputvar on topmodel\r
+#define NI 0 // number of inputvar on topmodel\r
+#define NR 1 // number of residuals for initialialization function\r
+#define NEXT 0 // number of external objects\r
+#define MAXORD 5\r
+#define NYSTR 0 // number of alg. string variables\r
+#define NPSTR 0 // number of alg. string variables\r
+\r
+static DATA* localData = 0;\r
+#define time localData->timeValue\r
+extern "C" { /* adrpo: this is needed for Visual C++ compilation to work! */\r
+  char *model_name="Testi2";\r
+  char *model_dir="";\r
+}\r
+char* state_names[1]={"$dummy"};\r
+char* derivative_names[1]={"der($dummy)"};\r
+char* algvars_names[1] = {""};\r
+char* input_names[1] = {""};\r
+char* output_names[1] = {""};\r
+char* param_names[1] = {""};\r
+char* string_alg_names[1] = {""};\r
+char* string_param_names[1] = {""};\r
+\r
+char* state_comments[1]={""};\r
+char* derivative_comments[1]={""};\r
+char* algvars_comments[1] = {""};\r
+char* input_comments[1] = {""};\r
+char* output_comments[1] = {""};\r
+char* param_comments[1] = {""};\r
+char* string_param_comments[1] = {""};\r
+char* string_alg_comments[1] = {""};\r
+\r
+#define $$dummy localData->states[0]\r
+#define $DER$$dummy localData->statesDerivatives[0]\r
+\r
+char* getName( double* ptr)\r
+{\r
+  if( &$DER$$dummy == ptr ) return derivative_names[0];\r
+  if( &$$dummy == ptr ) return state_names[0];\r
+  return "";\r
+}\r
+\r
+static char init_fixed[NX+NX+NY+NP]={\r
+       1/*$dummy*/, 1/*default*/\r
+};\r
+\r
+char var_attr[NX+NY+NP]={/*$dummy:*/1+0};\r
+\r
+#define DIVISION(a,b,c) ((b != 0) ? a / b : a / division_error(b,c))\r
+\r
+\r
+int encounteredDivisionByZero = 0;\r
+double division_error(double b,const char* division_str)\r
+{\r
+  if(!encounteredDivisionByZero){\r
+    fprintf(stderr,"ERROR: Division by zero in partial equation: %s.\n",division_str);\r
+    encounteredDivisionByZero = 1;\r
+   }\r
+   return b;\r
+}\r
+\r
+void setLocalData(DATA* data)\r
+{\r
+   localData = data;\r
+}\r
+\r
+DATA* initializeDataStruc(DATA_FLAGS flags)\r
+{\r
+  DATA* returnData = (DATA*)malloc(sizeof(DATA));\r
+\r
+  if(!returnData) //error check\r
+    return 0;\r
+\r
+  memset(returnData,0,sizeof(DATA));\r
+  returnData->nStates = NX;\r
+  returnData->nAlgebraic = NY;\r
+  returnData->nParameters = NP;\r
+  returnData->nInputVars = NI;\r
+  returnData->nOutputVars = NO;\r
+  returnData->nZeroCrossing = NG;\r
+  returnData->nInitialResiduals = NR;\r
+  returnData->nHelpVars = NHELP;\r
+  returnData->stringVariables.nParameters = NPSTR;\r
+  returnData->stringVariables.nAlgebraic = NYSTR;\r
+\r
+  if(flags & STATES && returnData->nStates) {\r
+    returnData->states = (double*) malloc(sizeof(double)*returnData->nStates);\r
+    returnData->oldStates = (double*) malloc(sizeof(double)*returnData->nStates);\r
+    returnData->oldStates2 = (double*) malloc(sizeof(double)*returnData->nStates);\r
+    assert(returnData->states&&returnData->oldStates&&returnData->oldStates2);\r
+    memset(returnData->states,0,sizeof(double)*returnData->nStates);\r
+    memset(returnData->oldStates,0,sizeof(double)*returnData->nStates);\r
+    memset(returnData->oldStates2,0,sizeof(double)*returnData->nStates);\r
+  } else {\r
+    returnData->states = 0;\r
+    returnData->oldStates = 0;\r
+    returnData->oldStates2 = 0;\r
+  }\r
+\r
+  if(flags & STATESDERIVATIVES && returnData->nStates) {\r
+    returnData->statesDerivatives = (double*) malloc(sizeof(double)*returnData->nStates);\r
+    returnData->oldStatesDerivatives = (double*) malloc(sizeof(double)*returnData->nStates);\r
+    returnData->oldStatesDerivatives2 = (double*) malloc(sizeof(double)*returnData->nStates);\r
+    assert(returnData->statesDerivatives&&returnData->oldStatesDerivatives&&returnData->oldStatesDerivatives2);\r
+    memset(returnData->statesDerivatives,0,sizeof(double)*returnData->nStates);\r
+    memset(returnData->oldStatesDerivatives,0,sizeof(double)*returnData->nStates);\r
+    memset(returnData->oldStatesDerivatives2,0,sizeof(double)*returnData->nStates);\r
+  } else {\r
+    returnData->statesDerivatives = 0;\r
+    returnData->oldStatesDerivatives = 0;\r
+    returnData->oldStatesDerivatives2 = 0;\r
+  }\r
+\r
+  if(flags & HELPVARS && returnData->nHelpVars) {\r
+    returnData->helpVars = (double*) malloc(sizeof(double)*returnData->nHelpVars);\r
+    assert(returnData->helpVars);\r
+    memset(returnData->helpVars,0,sizeof(double)*returnData->nHelpVars);\r
+  } else {\r
+    returnData->helpVars = 0;\r
+  }\r
+\r
+  if(flags & ALGEBRAICS && returnData->nAlgebraic) {\r
+    returnData->algebraics = (double*) malloc(sizeof(double)*returnData->nAlgebraic);\r
+    returnData->oldAlgebraics = (double*) malloc(sizeof(double)*returnData->nAlgebraic);\r
+    returnData->oldAlgebraics2 = (double*) malloc(sizeof(double)*returnData->nAlgebraic);\r
+    assert(returnData->algebraics&&returnData->oldAlgebraics&&returnData->oldAlgebraics2);\r
+    memset(returnData->algebraics,0,sizeof(double)*returnData->nAlgebraic);\r
+    memset(returnData->oldAlgebraics,0,sizeof(double)*returnData->nAlgebraic);\r
+    memset(returnData->oldAlgebraics2,0,sizeof(double)*returnData->nAlgebraic);\r
+  } else {\r
+    returnData->algebraics = 0;\r
+    returnData->oldAlgebraics = 0;\r
+    returnData->oldAlgebraics2 = 0;\r
+    returnData->stringVariables.algebraics = 0;\r
+  }\r
+\r
+  if (flags & ALGEBRAICS && returnData->stringVariables.nAlgebraic) {\r
+    returnData->stringVariables.algebraics = (char**)malloc(sizeof(char*)*returnData->stringVariables.nAlgebraic);\r
+    assert(returnData->stringVariables.algebraics);\r
+    memset(returnData->stringVariables.algebraics,0,sizeof(char*)*returnData->stringVariables.nAlgebraic);\r
+  } else {\r
+    returnData->stringVariables.algebraics=0;\r
+  }\r
+\r
+  if(flags & PARAMETERS && returnData->nParameters) {\r
+    returnData->parameters = (double*) malloc(sizeof(double)*returnData->nParameters);\r
+    assert(returnData->parameters);\r
+    memset(returnData->parameters,0,sizeof(double)*returnData->nParameters);\r
+  } else {\r
+    returnData->parameters = 0;\r
+  }\r
+\r
+  if (flags & PARAMETERS && returnData->stringVariables.nParameters) {\r
+         returnData->stringVariables.parameters = (char**)malloc(sizeof(char*)*returnData->stringVariables.nParameters);\r
+      assert(returnData->stringVariables.parameters);\r
+      memset(returnData->stringVariables.parameters,0,sizeof(char*)*returnData->stringVariables.nParameters);\r
+  } else {\r
+      returnData->stringVariables.parameters=0;\r
+  }\r
+\r
+  if(flags & OUTPUTVARS && returnData->nOutputVars) {\r
+    returnData->outputVars = (double*) malloc(sizeof(double)*returnData->nOutputVars);\r
+    assert(returnData->outputVars);\r
+    memset(returnData->outputVars,0,sizeof(double)*returnData->nOutputVars);\r
+  } else {\r
+    returnData->outputVars = 0;\r
+  }\r
+\r
+  if(flags & INPUTVARS && returnData->nInputVars) {\r
+    returnData->inputVars = (double*) malloc(sizeof(double)*returnData->nInputVars);\r
+    assert(returnData->inputVars);\r
+    memset(returnData->inputVars,0,sizeof(double)*returnData->nInputVars);\r
+  } else {\r
+    returnData->inputVars = 0;\r
+  }\r
+\r
+  if(flags & INITIALRESIDUALS && returnData->nInitialResiduals) {\r
+    returnData->initialResiduals = (double*) malloc(sizeof(double)*returnData->nInitialResiduals);\r
+    assert(returnData->initialResiduals);\r
+    memset(returnData->initialResiduals,0,sizeof(double)*returnData->nInitialResiduals);\r
+  } else {\r
+    returnData->initialResiduals = 0;\r
+  }\r
+\r
+  if(flags & INITFIXED) {\r
+    returnData->initFixed = init_fixed;\r
+  } else {\r
+    returnData->initFixed = 0;\r
+  }\r
+\r
+  /*   names   */\r
+  if(flags & MODELNAME) {\r
+    returnData->modelName = model_name;\r
+  } else {\r
+    returnData->modelName = 0;\r
+  }\r
+  \r
+  if(flags & STATESNAMES) {\r
+    returnData->statesNames = state_names;\r
+  } else {\r
+    returnData->statesNames = 0;\r
+  }\r
+\r
+  if(flags & STATESDERIVATIVESNAMES) {\r
+    returnData->stateDerivativesNames = derivative_names;\r
+  } else {\r
+    returnData->stateDerivativesNames = 0;\r
+  }\r
+\r
+  if(flags & ALGEBRAICSNAMES) {\r
+    returnData->algebraicsNames = algvars_names;\r
+  } else {\r
+    returnData->algebraicsNames = 0;\r
+  }\r
+\r
+  if(flags & PARAMETERSNAMES) {\r
+    returnData->parametersNames = param_names;\r
+  } else {\r
+    returnData->parametersNames = 0;\r
+  }\r
+\r
+  if(flags & INPUTNAMES) {\r
+    returnData->inputNames = input_names;\r
+  } else {\r
+    returnData->inputNames = 0;\r
+  }\r
+\r
+  if(flags & OUTPUTNAMES) {\r
+    returnData->outputNames = output_names;\r
+  } else {\r
+    returnData->outputNames = 0;\r
+  }\r
+\r
+  /*   comments  */\r
+  if(flags & STATESCOMMENTS) {\r
+    returnData->statesComments = state_comments;\r
+  } else {\r
+    returnData->statesComments = 0;\r
+  }\r
+\r
+  if(flags & STATESDERIVATIVESCOMMENTS) {\r
+    returnData->stateDerivativesComments = derivative_comments;\r
+  } else {\r
+    returnData->stateDerivativesComments = 0;\r
+  }\r
+\r
+  if(flags & ALGEBRAICSCOMMENTS) {\r
+    returnData->algebraicsComments = algvars_comments;\r
+  } else {\r
+    returnData->algebraicsComments = 0;\r
+  }\r
+\r
+  if(flags & PARAMETERSCOMMENTS) {\r
+    returnData->parametersComments = param_comments;\r
+  } else {\r
+    returnData->parametersComments = 0;\r
+  }\r
+\r
+  if(flags & INPUTCOMMENTS) {\r
+    returnData->inputComments = input_comments;\r
+  } else {\r
+    returnData->inputComments = 0;\r
+  }\r
+\r
+  if(flags & OUTPUTCOMMENTS) {\r
+    returnData->outputComments = output_comments;\r
+  } else {\r
+    returnData->outputComments = 0;\r
+  }\r
+\r
+  if (flags & EXTERNALVARS) {\r
+    returnData->extObjs = (void**)malloc(sizeof(void*)*NEXT);\r
+    if (!returnData->extObjs) {\r
+      printf("error allocating external objects\n");\r
+      exit(-2);\r
+    }\r
+    memset(returnData->extObjs,0,sizeof(void*)*NEXT);\r
+    setLocalData(returnData); /* must be set since used by constructors*/\r
+  }\r
+  return returnData;\r
+}\r
+\r
+void deInitializeDataStruc(DATA* data, DATA_FLAGS flags)\r
+{\r
+  if(!data)\r
+    return;\r
+\r
+  if(flags & STATES && data->states) {\r
+    free(data->states);\r
+    data->states = 0;\r
+  }\r
+\r
+  if(flags & STATESDERIVATIVES && data->statesDerivatives) {\r
+    free(data->statesDerivatives);\r
+    data->statesDerivatives = 0;\r
+  }\r
+\r
+  if(flags & ALGEBRAICS && data->algebraics) {\r
+    free(data->algebraics);\r
+    data->algebraics = 0;\r
+  }\r
+\r
+  if(flags & PARAMETERS && data->parameters) {\r
+    free(data->parameters);\r
+    data->parameters = 0;\r
+  }\r
+\r
+  if(flags & OUTPUTVARS && data->inputVars) {\r
+    free(data->inputVars);\r
+    data->inputVars = 0;\r
+  }\r
+\r
+  if(flags & INPUTVARS && data->outputVars) {\r
+    free(data->outputVars);\r
+    data->outputVars = 0;\r
+  }\r
+  \r
+  if(flags & INITIALRESIDUALS && data->initialResiduals){\r
+    free(data->initialResiduals);\r
+    data->initialResiduals = 0;\r
+  }\r
+  if (flags & EXTERNALVARS && data->extObjs) {\r
+    free(data->extObjs);\r
+    data->extObjs = 0;\r
+  }\r
+}\r
+\r
+int functionDAE_output()\r
+{\r
+  state mem_state;\r
+  mem_state = get_memory_state();\r
+  restore_memory_state(mem_state);\r
+  return 0;\r
+}\r
+\r
+int functionDAE_output2()\r
+{\r
+  state mem_state;\r
+  mem_state = get_memory_state();\r
+  restore_memory_state(mem_state);\r
+  return 0;\r
+}\r
+\r
+/*\r
+*/\r
+int input_function()\r
+{\r
+  return 0;\r
+}\r
+\r
+/*\r
+*/\r
+int output_function()\r
+{\r
+  return 0;\r
+}\r
+\r
+int functionDAE_res(double *t, double *x, double *xd, double *delta, long int *ires, double *rpar, long int* ipar)\r
+{\r
+  int i;\r
+  double temp_xd[NX];\r
+  double* statesBackup;\r
+  double* statesDerivativesBackup;\r
+  double timeBackup;\r
+  statesBackup = localData->states;\r
+  statesDerivativesBackup = localData->statesDerivatives;\r
+  timeBackup = localData->timeValue;\r
+  localData->states = x;\r
+  for (i=0; i<localData->nStates; i++) temp_xd[i]=localData->statesDerivatives[i];\r
+  \r
+  localData->statesDerivatives = temp_xd;\r
+  localData->timeValue = *t;\r
+  \r
+  functionODE();\r
+  /* get the difference between the temp_xd(=localData->statesDerivatives) and xd(=statesDerivativesBackup) */\r
+  for (i=0; i < localData->nStates; i++) delta[i]=localData->statesDerivatives[i]-statesDerivativesBackup[i];\r
+  \r
+  localData->states = statesBackup;\r
+  localData->statesDerivatives = statesDerivativesBackup;\r
+  localData->timeValue = timeBackup;\r
+  if (modelErrorCode) {\r
+      if (ires) *ires = -1;\r
+      modelErrorCode =0;\r
+  }\r
+  return 0;\r
+}\r
+\r
+int function_zeroCrossing(long *neqm, double *t, double *x, long *ng, double *gout, double *rpar, long* ipar)\r
+{\r
+  double timeBackup;\r
+  state mem_state;\r
+  mem_state = get_memory_state();\r
+  timeBackup = localData->timeValue;\r
+  localData->timeValue = *t;\r
+  functionODE();\r
+  functionDAE_output();\r
+  restore_memory_state(mem_state);\r
+  localData->timeValue = timeBackup;\r
+  return 0;\r
+}\r
+\r
+int handleZeroCrossing(long index)\r
+{\r
+  state mem_state;\r
+  mem_state = get_memory_state();\r
+  switch(index) {\r
+    default: break;\r
+  }\r
+  restore_memory_state(mem_state);\r
+  return 0;\r
+}\r
+\r
+int function_updateDependents()\r
+{\r
+  state mem_state;\r
+  inUpdate=initial()?0:1;\r
+  mem_state = get_memory_state();\r
+  $DER$$dummy = 0.0;\r
+  restore_memory_state(mem_state);\r
+  inUpdate=0;\r
+  return 0;\r
+}\r
+\r
+int function_when(int i)\r
+{\r
+  state mem_state;\r
+  mem_state = get_memory_state();\r
+  switch(i) {\r
+    default: break;\r
+  }\r
+  restore_memory_state(mem_state);\r
+  return 0;\r
+}\r
+\r
+int functionODE()\r
+{\r
+  state mem_state;\r
+  mem_state = get_memory_state();\r
+  $DER$$dummy = 0.0;\r
+  restore_memory_state(mem_state);\r
+  return 0;\r
+}\r
+\r
+int initial_function()\r
+{\r
+  return 0;\r
+}\r
+\r
+int initial_residual()\r
+{\r
+  int i=0;\r
+  state mem_state;\r
+  mem_state = get_memory_state();\r
+  localData->initialResiduals[i++] = $DER$$dummy;\r
+  restore_memory_state(mem_state);\r
+  return 0;\r
+}\r
+\r
+int bound_parameters()\r
+{\r
+  state mem_state;\r
+  mem_state = get_memory_state();\r
+  restore_memory_state(mem_state);\r
+  return 0;\r
+}\r
+\r
+int checkForDiscreteVarChanges()\r
+{\r
+  int needToIterate=0;\r
+  \r
+  for (long i = 0; i < localData->nHelpVars; i++) {\r
+    if (change(localData->helpVars[i])) { needToIterate=1; }\r
+  }\r
+  return needToIterate;\r
+}\r
diff --git a/org.simantics.modelica/Testi2.exe b/org.simantics.modelica/Testi2.exe
new file mode 100644 (file)
index 0000000..a2dc048
Binary files /dev/null and b/org.simantics.modelica/Testi2.exe differ
diff --git a/org.simantics.modelica/Testi2.libs b/org.simantics.modelica/Testi2.libs
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/org.simantics.modelica/Testi2.makefile b/org.simantics.modelica/Testi2.makefile
new file mode 100644 (file)
index 0000000..7eb0752
--- /dev/null
@@ -0,0 +1,13 @@
+#Makefile generated by OpenModelica\r
+\r
+CC=gcc\r
+CXX=g++\r
+LINK=gcc -shared -export-dynamic\r
+EXEEXT=.exe\r
+DLLEXT=.dll\r
+CFLAGS= -I"C:\OpenModelica1.5.0\/include" -msse2 -mfpmath=sse ${MODELICAUSERCFLAGS}\r
+LDFLAGS= -L"C:\OpenModelica1.5.0\/lib" -lc_runtime\r
+\r
+.PHONY: Testi2\r
+Testi2: Testi2.cpp\r
+        $(CXX) $(CFLAGS) -I. -o Testi2$(EXEEXT) Testi2.cpp -lsim $(LDFLAGS) -lf2c ${SENDDATALIBS} \r
diff --git a/org.simantics.modelica/Testi2_functions.cpp b/org.simantics.modelica/Testi2_functions.cpp
new file mode 100644 (file)
index 0000000..1e6303b
--- /dev/null
@@ -0,0 +1,7 @@
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
diff --git a/org.simantics.modelica/Testi2_init.txt b/org.simantics.modelica/Testi2_init.txt
new file mode 100644 (file)
index 0000000..0fb4f70
--- /dev/null
@@ -0,0 +1,12 @@
+0.0 // start value\r
+10.0 // stop value\r
+0.02 // step value\r
+0.0001 // tolerance\r
+"dassl" // method\r
+1 // n states\r
+0 // n alg vars\r
+0 //n parameters\r
+0 // n string-parameters\r
+0 // n string variables\r
+0.0 // $dummy\r
+0.0
\ No newline at end of file
diff --git a/org.simantics.modelica/Testi2_res.plt b/org.simantics.modelica/Testi2_res.plt
new file mode 100644 (file)
index 0000000..8d9cd83
--- /dev/null
@@ -0,0 +1,1520 @@
+#Ptolemy Plot file, generated by OpenModelica\r
+#IntervalSize=503\r
+TitleText: OpenModelica simulation plot\r
+XLabel: t\r
+\r
+DataSet: time\r
+0, 0\r
+2.220446049250313e-13, 2.220446049250313e-13\r
+0.02, 0.02\r
+0.04, 0.04\r
+0.06, 0.06\r
+0.08, 0.08\r
+0.1, 0.1\r
+0.12, 0.12\r
+0.14, 0.14\r
+0.16, 0.16\r
+0.18, 0.18\r
+0.2, 0.2\r
+0.22, 0.22\r
+0.24, 0.24\r
+0.26, 0.26\r
+0.28, 0.28\r
+0.3, 0.3\r
+0.32, 0.32\r
+0.34, 0.34\r
+0.36, 0.36\r
+0.3800000000000001, 0.3800000000000001\r
+0.4000000000000001, 0.4000000000000001\r
+0.4200000000000001, 0.4200000000000001\r
+0.4400000000000001, 0.4400000000000001\r
+0.4600000000000001, 0.4600000000000001\r
+0.4800000000000001, 0.4800000000000001\r
+0.5000000000000001, 0.5000000000000001\r
+0.5200000000000001, 0.5200000000000001\r
+0.5400000000000001, 0.5400000000000001\r
+0.5600000000000002, 0.5600000000000002\r
+0.5800000000000002, 0.5800000000000002\r
+0.6000000000000002, 0.6000000000000002\r
+0.6200000000000002, 0.6200000000000002\r
+0.6400000000000002, 0.6400000000000002\r
+0.6600000000000003, 0.6600000000000003\r
+0.6800000000000003, 0.6800000000000003\r
+0.7000000000000003, 0.7000000000000003\r
+0.7200000000000003, 0.7200000000000003\r
+0.7400000000000003, 0.7400000000000003\r
+0.7600000000000003, 0.7600000000000003\r
+0.7800000000000004, 0.7800000000000004\r
+0.8000000000000004, 0.8000000000000004\r
+0.8200000000000004, 0.8200000000000004\r
+0.8400000000000004, 0.8400000000000004\r
+0.8600000000000004, 0.8600000000000004\r
+0.8800000000000004, 0.8800000000000004\r
+0.9000000000000005, 0.9000000000000005\r
+0.9200000000000005, 0.9200000000000005\r
+0.9400000000000005, 0.9400000000000005\r
+0.9600000000000005, 0.9600000000000005\r
+0.9800000000000005, 0.9800000000000005\r
+1, 1\r
+1.02, 1.02\r
+1.04, 1.04\r
+1.06, 1.06\r
+1.080000000000001, 1.080000000000001\r
+1.100000000000001, 1.100000000000001\r
+1.120000000000001, 1.120000000000001\r
+1.140000000000001, 1.140000000000001\r
+1.160000000000001, 1.160000000000001\r
+1.180000000000001, 1.180000000000001\r
+1.200000000000001, 1.200000000000001\r
+1.220000000000001, 1.220000000000001\r
+1.240000000000001, 1.240000000000001\r
+1.260000000000001, 1.260000000000001\r
+1.280000000000001, 1.280000000000001\r
+1.300000000000001, 1.300000000000001\r
+1.320000000000001, 1.320000000000001\r
+1.340000000000001, 1.340000000000001\r
+1.360000000000001, 1.360000000000001\r
+1.380000000000001, 1.380000000000001\r
+1.400000000000001, 1.400000000000001\r
+1.420000000000001, 1.420000000000001\r
+1.440000000000001, 1.440000000000001\r
+1.460000000000001, 1.460000000000001\r
+1.480000000000001, 1.480000000000001\r
+1.500000000000001, 1.500000000000001\r
+1.520000000000001, 1.520000000000001\r
+1.540000000000001, 1.540000000000001\r
+1.560000000000001, 1.560000000000001\r
+1.580000000000001, 1.580000000000001\r
+1.600000000000001, 1.600000000000001\r
+1.620000000000001, 1.620000000000001\r
+1.640000000000001, 1.640000000000001\r
+1.660000000000001, 1.660000000000001\r
+1.680000000000001, 1.680000000000001\r
+1.700000000000001, 1.700000000000001\r
+1.720000000000001, 1.720000000000001\r
+1.740000000000001, 1.740000000000001\r
+1.760000000000001, 1.760000000000001\r
+1.780000000000001, 1.780000000000001\r
+1.800000000000001, 1.800000000000001\r
+1.820000000000001, 1.820000000000001\r
+1.840000000000001, 1.840000000000001\r
+1.860000000000001, 1.860000000000001\r
+1.880000000000001, 1.880000000000001\r
+1.900000000000001, 1.900000000000001\r
+1.920000000000001, 1.920000000000001\r
+1.940000000000001, 1.940000000000001\r
+1.960000000000001, 1.960000000000001\r
+1.980000000000001, 1.980000000000001\r
+2.000000000000001, 2.000000000000001\r
+2.020000000000001, 2.020000000000001\r
+2.040000000000001, 2.040000000000001\r
+2.060000000000001, 2.060000000000001\r
+2.080000000000001, 2.080000000000001\r
+2.100000000000001, 2.100000000000001\r
+2.120000000000001, 2.120000000000001\r
+2.140000000000001, 2.140000000000001\r
+2.160000000000001, 2.160000000000001\r
+2.180000000000001, 2.180000000000001\r
+2.200000000000002, 2.200000000000002\r
+2.220000000000002, 2.220000000000002\r
+2.240000000000002, 2.240000000000002\r
+2.260000000000002, 2.260000000000002\r
+2.280000000000002, 2.280000000000002\r
+2.300000000000002, 2.300000000000002\r
+2.320000000000002, 2.320000000000002\r
+2.340000000000002, 2.340000000000002\r
+2.360000000000002, 2.360000000000002\r
+2.380000000000002, 2.380000000000002\r
+2.400000000000002, 2.400000000000002\r
+2.420000000000002, 2.420000000000002\r
+2.440000000000002, 2.440000000000002\r
+2.460000000000002, 2.460000000000002\r
+2.480000000000002, 2.480000000000002\r
+2.500000000000002, 2.500000000000002\r
+2.520000000000002, 2.520000000000002\r
+2.540000000000002, 2.540000000000002\r
+2.560000000000002, 2.560000000000002\r
+2.580000000000002, 2.580000000000002\r
+2.600000000000002, 2.600000000000002\r
+2.620000000000002, 2.620000000000002\r
+2.640000000000002, 2.640000000000002\r
+2.660000000000002, 2.660000000000002\r
+2.680000000000002, 2.680000000000002\r
+2.700000000000002, 2.700000000000002\r
+2.720000000000002, 2.720000000000002\r
+2.740000000000002, 2.740000000000002\r
+2.760000000000002, 2.760000000000002\r
+2.780000000000002, 2.780000000000002\r
+2.800000000000002, 2.800000000000002\r
+2.820000000000002, 2.820000000000002\r
+2.840000000000002, 2.840000000000002\r
+2.860000000000002, 2.860000000000002\r
+2.880000000000002, 2.880000000000002\r
+2.900000000000002, 2.900000000000002\r
+2.920000000000002, 2.920000000000002\r
+2.940000000000002, 2.940000000000002\r
+2.960000000000002, 2.960000000000002\r
+2.980000000000002, 2.980000000000002\r
+3.000000000000002, 3.000000000000002\r
+3.020000000000002, 3.020000000000002\r
+3.040000000000002, 3.040000000000002\r
+3.060000000000002, 3.060000000000002\r
+3.080000000000002, 3.080000000000002\r
+3.100000000000002, 3.100000000000002\r
+3.120000000000002, 3.120000000000002\r
+3.140000000000002, 3.140000000000002\r
+3.160000000000002, 3.160000000000002\r
+3.180000000000002, 3.180000000000002\r
+3.200000000000002, 3.200000000000002\r
+3.220000000000002, 3.220000000000002\r
+3.240000000000002, 3.240000000000002\r
+3.260000000000002, 3.260000000000002\r
+3.280000000000002, 3.280000000000002\r
+3.300000000000002, 3.300000000000002\r
+3.320000000000003, 3.320000000000003\r
+3.340000000000003, 3.340000000000003\r
+3.360000000000003, 3.360000000000003\r
+3.380000000000003, 3.380000000000003\r
+3.400000000000003, 3.400000000000003\r
+3.420000000000003, 3.420000000000003\r
+3.440000000000003, 3.440000000000003\r
+3.460000000000003, 3.460000000000003\r
+3.480000000000003, 3.480000000000003\r
+3.500000000000003, 3.500000000000003\r
+3.520000000000003, 3.520000000000003\r
+3.540000000000003, 3.540000000000003\r
+3.560000000000003, 3.560000000000003\r
+3.580000000000003, 3.580000000000003\r
+3.600000000000003, 3.600000000000003\r
+3.620000000000003, 3.620000000000003\r
+3.640000000000003, 3.640000000000003\r
+3.660000000000003, 3.660000000000003\r
+3.680000000000003, 3.680000000000003\r
+3.700000000000003, 3.700000000000003\r
+3.720000000000003, 3.720000000000003\r
+3.740000000000003, 3.740000000000003\r
+3.760000000000003, 3.760000000000003\r
+3.780000000000003, 3.780000000000003\r
+3.800000000000003, 3.800000000000003\r
+3.820000000000003, 3.820000000000003\r
+3.840000000000003, 3.840000000000003\r
+3.860000000000003, 3.860000000000003\r
+3.880000000000003, 3.880000000000003\r
+3.900000000000003, 3.900000000000003\r
+3.920000000000003, 3.920000000000003\r
+3.940000000000003, 3.940000000000003\r
+3.960000000000003, 3.960000000000003\r
+3.980000000000003, 3.980000000000003\r
+4.000000000000003, 4.000000000000003\r
+4.020000000000002, 4.020000000000002\r
+4.040000000000002, 4.040000000000002\r
+4.060000000000001, 4.060000000000001\r
+4.080000000000001, 4.080000000000001\r
+4.100000000000001, 4.100000000000001\r
+4.12, 4.12\r
+4.14, 4.14\r
+4.159999999999999, 4.159999999999999\r
+4.179999999999999, 4.179999999999999\r
+4.199999999999998, 4.199999999999998\r
+4.219999999999998, 4.219999999999998\r
+4.239999999999998, 4.239999999999998\r
+4.259999999999997, 4.259999999999997\r
+4.279999999999997, 4.279999999999997\r
+4.299999999999996, 4.299999999999996\r
+4.319999999999996, 4.319999999999996\r
+4.339999999999995, 4.339999999999995\r
+4.359999999999995, 4.359999999999995\r
+4.379999999999995, 4.379999999999995\r
+4.399999999999994, 4.399999999999994\r
+4.419999999999994, 4.419999999999994\r
+4.439999999999993, 4.439999999999993\r
+4.459999999999993, 4.459999999999993\r
+4.479999999999992, 4.479999999999992\r
+4.499999999999992, 4.499999999999992\r
+4.519999999999992, 4.519999999999992\r
+4.539999999999991, 4.539999999999991\r
+4.559999999999991, 4.559999999999991\r
+4.57999999999999, 4.57999999999999\r
+4.59999999999999, 4.59999999999999\r
+4.619999999999989, 4.619999999999989\r
+4.639999999999989, 4.639999999999989\r
+4.659999999999989, 4.659999999999989\r
+4.679999999999988, 4.679999999999988\r
+4.699999999999988, 4.699999999999988\r
+4.719999999999987, 4.719999999999987\r
+4.739999999999987, 4.739999999999987\r
+4.759999999999986, 4.759999999999986\r
+4.779999999999986, 4.779999999999986\r
+4.799999999999986, 4.799999999999986\r
+4.819999999999985, 4.819999999999985\r
+4.839999999999985, 4.839999999999985\r
+4.859999999999984, 4.859999999999984\r
+4.879999999999984, 4.879999999999984\r
+4.899999999999983, 4.899999999999983\r
+4.919999999999983, 4.919999999999983\r
+4.939999999999983, 4.939999999999983\r
+4.959999999999982, 4.959999999999982\r
+4.979999999999982, 4.979999999999982\r
+4.999999999999981, 4.999999999999981\r
+5.019999999999981, 5.019999999999981\r
+5.03999999999998, 5.03999999999998\r
+5.05999999999998, 5.05999999999998\r
+5.07999999999998, 5.07999999999998\r
+5.099999999999979, 5.099999999999979\r
+5.119999999999979, 5.119999999999979\r
+5.139999999999978, 5.139999999999978\r
+5.159999999999978, 5.159999999999978\r
+5.179999999999978, 5.179999999999978\r
+5.199999999999977, 5.199999999999977\r
+5.219999999999977, 5.219999999999977\r
+5.239999999999976, 5.239999999999976\r
+5.259999999999976, 5.259999999999976\r
+5.279999999999975, 5.279999999999975\r
+5.299999999999975, 5.299999999999975\r
+5.319999999999975, 5.319999999999975\r
+5.339999999999974, 5.339999999999974\r
+5.359999999999974, 5.359999999999974\r
+5.379999999999973, 5.379999999999973\r
+5.399999999999973, 5.399999999999973\r
+5.419999999999972, 5.419999999999972\r
+5.439999999999972, 5.439999999999972\r
+5.459999999999972, 5.459999999999972\r
+5.479999999999971, 5.479999999999971\r
+5.499999999999971, 5.499999999999971\r
+5.51999999999997, 5.51999999999997\r
+5.53999999999997, 5.53999999999997\r
+5.559999999999969, 5.559999999999969\r
+5.579999999999969, 5.579999999999969\r
+5.599999999999969, 5.599999999999969\r
+5.619999999999968, 5.619999999999968\r
+5.639999999999968, 5.639999999999968\r
+5.659999999999967, 5.659999999999967\r
+5.679999999999967, 5.679999999999967\r
+5.699999999999966, 5.699999999999966\r
+5.719999999999966, 5.719999999999966\r
+5.739999999999966, 5.739999999999966\r
+5.759999999999965, 5.759999999999965\r
+5.779999999999965, 5.779999999999965\r
+5.799999999999964, 5.799999999999964\r
+5.819999999999964, 5.819999999999964\r
+5.839999999999963, 5.839999999999963\r
+5.859999999999963, 5.859999999999963\r
+5.879999999999963, 5.879999999999963\r
+5.899999999999962, 5.899999999999962\r
+5.919999999999962, 5.919999999999962\r
+5.939999999999961, 5.939999999999961\r
+5.959999999999961, 5.959999999999961\r
+5.97999999999996, 5.97999999999996\r
+5.99999999999996, 5.99999999999996\r
+6.01999999999996, 6.01999999999996\r
+6.039999999999959, 6.039999999999959\r
+6.059999999999959, 6.059999999999959\r
+6.079999999999958, 6.079999999999958\r
+6.099999999999958, 6.099999999999958\r
+6.119999999999957, 6.119999999999957\r
+6.139999999999957, 6.139999999999957\r
+6.159999999999957, 6.159999999999957\r
+6.179999999999956, 6.179999999999956\r
+6.199999999999956, 6.199999999999956\r
+6.219999999999955, 6.219999999999955\r
+6.239999999999955, 6.239999999999955\r
+6.259999999999954, 6.259999999999954\r
+6.279999999999954, 6.279999999999954\r
+6.299999999999954, 6.299999999999954\r
+6.319999999999953, 6.319999999999953\r
+6.339999999999953, 6.339999999999953\r
+6.359999999999952, 6.359999999999952\r
+6.379999999999952, 6.379999999999952\r
+6.399999999999952, 6.399999999999952\r
+6.419999999999951, 6.419999999999951\r
+6.439999999999951, 6.439999999999951\r
+6.45999999999995, 6.45999999999995\r
+6.47999999999995, 6.47999999999995\r
+6.499999999999949, 6.499999999999949\r
+6.519999999999949, 6.519999999999949\r
+6.539999999999949, 6.539999999999949\r
+6.559999999999948, 6.559999999999948\r
+6.579999999999948, 6.579999999999948\r
+6.599999999999947, 6.599999999999947\r
+6.619999999999947, 6.619999999999947\r
+6.639999999999946, 6.639999999999946\r
+6.659999999999946, 6.659999999999946\r
+6.679999999999946, 6.679999999999946\r
+6.699999999999945, 6.699999999999945\r
+6.719999999999945, 6.719999999999945\r
+6.739999999999944, 6.739999999999944\r
+6.759999999999944, 6.759999999999944\r
+6.779999999999943, 6.779999999999943\r
+6.799999999999943, 6.799999999999943\r
+6.819999999999943, 6.819999999999943\r
+6.839999999999942, 6.839999999999942\r
+6.859999999999942, 6.859999999999942\r
+6.879999999999941, 6.879999999999941\r
+6.899999999999941, 6.899999999999941\r
+6.91999999999994, 6.91999999999994\r
+6.93999999999994, 6.93999999999994\r
+6.95999999999994, 6.95999999999994\r
+6.979999999999939, 6.979999999999939\r
+6.999999999999939, 6.999999999999939\r
+7.019999999999938, 7.019999999999938\r
+7.039999999999938, 7.039999999999938\r
+7.059999999999937, 7.059999999999937\r
+7.079999999999937, 7.079999999999937\r
+7.099999999999937, 7.099999999999937\r
+7.119999999999936, 7.119999999999936\r
+7.139999999999936, 7.139999999999936\r
+7.159999999999935, 7.159999999999935\r
+7.179999999999935, 7.179999999999935\r
+7.199999999999934, 7.199999999999934\r
+7.219999999999934, 7.219999999999934\r
+7.239999999999934, 7.239999999999934\r
+7.259999999999933, 7.259999999999933\r
+7.279999999999933, 7.279999999999933\r
+7.299999999999932, 7.299999999999932\r
+7.319999999999932, 7.319999999999932\r
+7.339999999999931, 7.339999999999931\r
+7.359999999999931, 7.359999999999931\r
+7.379999999999931, 7.379999999999931\r
+7.39999999999993, 7.39999999999993\r
+7.41999999999993, 7.41999999999993\r
+7.439999999999929, 7.439999999999929\r
+7.459999999999929, 7.459999999999929\r
+7.479999999999928, 7.479999999999928\r
+7.499999999999928, 7.499999999999928\r
+7.519999999999928, 7.519999999999928\r
+7.539999999999927, 7.539999999999927\r
+7.559999999999927, 7.559999999999927\r
+7.579999999999926, 7.579999999999926\r
+7.599999999999926, 7.599999999999926\r
+7.619999999999925, 7.619999999999925\r
+7.639999999999925, 7.639999999999925\r
+7.659999999999925, 7.659999999999925\r
+7.679999999999924, 7.679999999999924\r
+7.699999999999924, 7.699999999999924\r
+7.719999999999923, 7.719999999999923\r
+7.739999999999923, 7.739999999999923\r
+7.759999999999923, 7.759999999999923\r
+7.779999999999922, 7.779999999999922\r
+7.799999999999922, 7.799999999999922\r
+7.819999999999921, 7.819999999999921\r
+7.839999999999921, 7.839999999999921\r
+7.85999999999992, 7.85999999999992\r
+7.87999999999992, 7.87999999999992\r
+7.89999999999992, 7.89999999999992\r
+7.919999999999919, 7.919999999999919\r
+7.939999999999919, 7.939999999999919\r
+7.959999999999918, 7.959999999999918\r
+7.979999999999918, 7.979999999999918\r
+7.999999999999917, 7.999999999999917\r
+8.019999999999918, 8.019999999999918\r
+8.039999999999917, 8.039999999999917\r
+8.059999999999917, 8.059999999999917\r
+8.079999999999917, 8.079999999999917\r
+8.099999999999916, 8.099999999999916\r
+8.119999999999916, 8.119999999999916\r
+8.139999999999915, 8.139999999999915\r
+8.159999999999915, 8.159999999999915\r
+8.179999999999914, 8.179999999999914\r
+8.199999999999914, 8.199999999999914\r
+8.219999999999914, 8.219999999999914\r
+8.239999999999913, 8.239999999999913\r
+8.259999999999913, 8.259999999999913\r
+8.279999999999912, 8.279999999999912\r
+8.299999999999912, 8.299999999999912\r
+8.319999999999911, 8.319999999999911\r
+8.339999999999911, 8.339999999999911\r
+8.359999999999911, 8.359999999999911\r
+8.37999999999991, 8.37999999999991\r
+8.39999999999991, 8.39999999999991\r
+8.419999999999909, 8.419999999999909\r
+8.439999999999909, 8.439999999999909\r
+8.459999999999908, 8.459999999999908\r
+8.479999999999908, 8.479999999999908\r
+8.499999999999908, 8.499999999999908\r
+8.519999999999907, 8.519999999999907\r
+8.539999999999907, 8.539999999999907\r
+8.559999999999906, 8.559999999999906\r
+8.579999999999906, 8.579999999999906\r
+8.599999999999905, 8.599999999999905\r
+8.619999999999905, 8.619999999999905\r
+8.639999999999905, 8.639999999999905\r
+8.659999999999904, 8.659999999999904\r
+8.679999999999904, 8.679999999999904\r
+8.699999999999903, 8.699999999999903\r
+8.719999999999903, 8.719999999999903\r
+8.739999999999903, 8.739999999999903\r
+8.759999999999902, 8.759999999999902\r
+8.779999999999902, 8.779999999999902\r
+8.799999999999901, 8.799999999999901\r
+8.819999999999901, 8.819999999999901\r
+8.8399999999999, 8.8399999999999\r
+8.8599999999999, 8.8599999999999\r
+8.8799999999999, 8.8799999999999\r
+8.899999999999899, 8.899999999999899\r
+8.919999999999899, 8.919999999999899\r
+8.939999999999898, 8.939999999999898\r
+8.959999999999898, 8.959999999999898\r
+8.979999999999897, 8.979999999999897\r
+8.999999999999897, 8.999999999999897\r
+9.019999999999897, 9.019999999999897\r
+9.039999999999896, 9.039999999999896\r
+9.059999999999896, 9.059999999999896\r
+9.079999999999895, 9.079999999999895\r
+9.099999999999895, 9.099999999999895\r
+9.119999999999894, 9.119999999999894\r
+9.139999999999894, 9.139999999999894\r
+9.159999999999894, 9.159999999999894\r
+9.179999999999893, 9.179999999999893\r
+9.199999999999893, 9.199999999999893\r
+9.219999999999892, 9.219999999999892\r
+9.239999999999892, 9.239999999999892\r
+9.259999999999891, 9.259999999999891\r
+9.279999999999891, 9.279999999999891\r
+9.299999999999891, 9.299999999999891\r
+9.31999999999989, 9.31999999999989\r
+9.33999999999989, 9.33999999999989\r
+9.359999999999889, 9.359999999999889\r
+9.379999999999889, 9.379999999999889\r
+9.399999999999888, 9.399999999999888\r
+9.419999999999888, 9.419999999999888\r
+9.439999999999888, 9.439999999999888\r
+9.459999999999887, 9.459999999999887\r
+9.479999999999887, 9.479999999999887\r
+9.499999999999886, 9.499999999999886\r
+9.519999999999886, 9.519999999999886\r
+9.539999999999885, 9.539999999999885\r
+9.559999999999885, 9.559999999999885\r
+9.579999999999885, 9.579999999999885\r
+9.599999999999884, 9.599999999999884\r
+9.619999999999884, 9.619999999999884\r
+9.639999999999883, 9.639999999999883\r
+9.659999999999883, 9.659999999999883\r
+9.679999999999882, 9.679999999999882\r
+9.699999999999882, 9.699999999999882\r
+9.719999999999882, 9.719999999999882\r
+9.739999999999881, 9.739999999999881\r
+9.759999999999881, 9.759999999999881\r
+9.77999999999988, 9.77999999999988\r
+9.79999999999988, 9.79999999999988\r
+9.819999999999879, 9.819999999999879\r
+9.839999999999879, 9.839999999999879\r
+9.859999999999879, 9.859999999999879\r
+9.879999999999878, 9.879999999999878\r
+9.899999999999878, 9.899999999999878\r
+9.919999999999877, 9.919999999999877\r
+9.939999999999877, 9.939999999999877\r
+9.959999999999877, 9.959999999999877\r
+9.979999999999876, 9.979999999999876\r
+9.999999999999876, 9.999999999999876\r
+10, 10\r
+\r
+DataSet: $dummy\r
+0, 0\r
+2.220446049250313e-13, 0\r
+0.02, 0\r
+0.04, 0\r
+0.06, 0\r
+0.08, 0\r
+0.1, 0\r
+0.12, 0\r
+0.14, 0\r
+0.16, 0\r
+0.18, 0\r
+0.2, 0\r
+0.22, 0\r
+0.24, 0\r
+0.26, 0\r
+0.28, 0\r
+0.3, 0\r
+0.32, 0\r
+0.34, 0\r
+0.36, 0\r
+0.3800000000000001, 0\r
+0.4000000000000001, 0\r
+0.4200000000000001, 0\r
+0.4400000000000001, 0\r
+0.4600000000000001, 0\r
+0.4800000000000001, 0\r
+0.5000000000000001, 0\r
+0.5200000000000001, 0\r
+0.5400000000000001, 0\r
+0.5600000000000002, 0\r
+0.5800000000000002, 0\r
+0.6000000000000002, 0\r
+0.6200000000000002, 0\r
+0.6400000000000002, 0\r
+0.6600000000000003, 0\r
+0.6800000000000003, 0\r
+0.7000000000000003, 0\r
+0.7200000000000003, 0\r
+0.7400000000000003, 0\r
+0.7600000000000003, 0\r
+0.7800000000000004, 0\r
+0.8000000000000004, 0\r
+0.8200000000000004, 0\r
+0.8400000000000004, 0\r
+0.8600000000000004, 0\r
+0.8800000000000004, 0\r
+0.9000000000000005, 0\r
+0.9200000000000005, 0\r
+0.9400000000000005, 0\r
+0.9600000000000005, 0\r
+0.9800000000000005, 0\r
+1, 0\r
+1.02, 0\r
+1.04, 0\r
+1.06, 0\r
+1.080000000000001, 0\r
+1.100000000000001, 0\r
+1.120000000000001, 0\r
+1.140000000000001, 0\r
+1.160000000000001, 0\r
+1.180000000000001, 0\r
+1.200000000000001, 0\r
+1.220000000000001, 0\r
+1.240000000000001, 0\r
+1.260000000000001, 0\r
+1.280000000000001, 0\r
+1.300000000000001, 0\r
+1.320000000000001, 0\r
+1.340000000000001, 0\r
+1.360000000000001, 0\r
+1.380000000000001, 0\r
+1.400000000000001, 0\r
+1.420000000000001, 0\r
+1.440000000000001, 0\r
+1.460000000000001, 0\r
+1.480000000000001, 0\r
+1.500000000000001, 0\r
+1.520000000000001, 0\r
+1.540000000000001, 0\r
+1.560000000000001, 0\r
+1.580000000000001, 0\r
+1.600000000000001, 0\r
+1.620000000000001, 0\r
+1.640000000000001, 0\r
+1.660000000000001, 0\r
+1.680000000000001, 0\r
+1.700000000000001, 0\r
+1.720000000000001, 0\r
+1.740000000000001, 0\r
+1.760000000000001, 0\r
+1.780000000000001, 0\r
+1.800000000000001, 0\r
+1.820000000000001, 0\r
+1.840000000000001, 0\r
+1.860000000000001, 0\r
+1.880000000000001, 0\r
+1.900000000000001, 0\r
+1.920000000000001, 0\r
+1.940000000000001, 0\r
+1.960000000000001, 0\r
+1.980000000000001, 0\r
+2.000000000000001, 0\r
+2.020000000000001, 0\r
+2.040000000000001, 0\r
+2.060000000000001, 0\r
+2.080000000000001, 0\r
+2.100000000000001, 0\r
+2.120000000000001, 0\r
+2.140000000000001, 0\r
+2.160000000000001, 0\r
+2.180000000000001, 0\r
+2.200000000000002, 0\r
+2.220000000000002, 0\r
+2.240000000000002, 0\r
+2.260000000000002, 0\r
+2.280000000000002, 0\r
+2.300000000000002, 0\r
+2.320000000000002, 0\r
+2.340000000000002, 0\r
+2.360000000000002, 0\r
+2.380000000000002, 0\r
+2.400000000000002, 0\r
+2.420000000000002, 0\r
+2.440000000000002, 0\r
+2.460000000000002, 0\r
+2.480000000000002, 0\r
+2.500000000000002, 0\r
+2.520000000000002, 0\r
+2.540000000000002, 0\r
+2.560000000000002, 0\r
+2.580000000000002, 0\r
+2.600000000000002, 0\r
+2.620000000000002, 0\r
+2.640000000000002, 0\r
+2.660000000000002, 0\r
+2.680000000000002, 0\r
+2.700000000000002, 0\r
+2.720000000000002, 0\r
+2.740000000000002, 0\r
+2.760000000000002, 0\r
+2.780000000000002, 0\r
+2.800000000000002, 0\r
+2.820000000000002, 0\r
+2.840000000000002, 0\r
+2.860000000000002, 0\r
+2.880000000000002, 0\r
+2.900000000000002, 0\r
+2.920000000000002, 0\r
+2.940000000000002, 0\r
+2.960000000000002, 0\r
+2.980000000000002, 0\r
+3.000000000000002, 0\r
+3.020000000000002, 0\r
+3.040000000000002, 0\r
+3.060000000000002, 0\r
+3.080000000000002, 0\r
+3.100000000000002, 0\r
+3.120000000000002, 0\r
+3.140000000000002, 0\r
+3.160000000000002, 0\r
+3.180000000000002, 0\r
+3.200000000000002, 0\r
+3.220000000000002, 0\r
+3.240000000000002, 0\r
+3.260000000000002, 0\r
+3.280000000000002, 0\r
+3.300000000000002, 0\r
+3.320000000000003, 0\r
+3.340000000000003, 0\r
+3.360000000000003, 0\r
+3.380000000000003, 0\r
+3.400000000000003, 0\r
+3.420000000000003, 0\r
+3.440000000000003, 0\r
+3.460000000000003, 0\r
+3.480000000000003, 0\r
+3.500000000000003, 0\r
+3.520000000000003, 0\r
+3.540000000000003, 0\r
+3.560000000000003, 0\r
+3.580000000000003, 0\r
+3.600000000000003, 0\r
+3.620000000000003, 0\r
+3.640000000000003, 0\r
+3.660000000000003, 0\r
+3.680000000000003, 0\r
+3.700000000000003, 0\r
+3.720000000000003, 0\r
+3.740000000000003, 0\r
+3.760000000000003, 0\r
+3.780000000000003, 0\r
+3.800000000000003, 0\r
+3.820000000000003, 0\r
+3.840000000000003, 0\r
+3.860000000000003, 0\r
+3.880000000000003, 0\r
+3.900000000000003, 0\r
+3.920000000000003, 0\r
+3.940000000000003, 0\r
+3.960000000000003, 0\r
+3.980000000000003, 0\r
+4.000000000000003, 0\r
+4.020000000000002, 0\r
+4.040000000000002, 0\r
+4.060000000000001, 0\r
+4.080000000000001, 0\r
+4.100000000000001, 0\r
+4.12, 0\r
+4.14, 0\r
+4.159999999999999, 0\r
+4.179999999999999, 0\r
+4.199999999999998, 0\r
+4.219999999999998, 0\r
+4.239999999999998, 0\r
+4.259999999999997, 0\r
+4.279999999999997, 0\r
+4.299999999999996, 0\r
+4.319999999999996, 0\r
+4.339999999999995, 0\r
+4.359999999999995, 0\r
+4.379999999999995, 0\r
+4.399999999999994, 0\r
+4.419999999999994, 0\r
+4.439999999999993, 0\r
+4.459999999999993, 0\r
+4.479999999999992, 0\r
+4.499999999999992, 0\r
+4.519999999999992, 0\r
+4.539999999999991, 0\r
+4.559999999999991, 0\r
+4.57999999999999, 0\r
+4.59999999999999, 0\r
+4.619999999999989, 0\r
+4.639999999999989, 0\r
+4.659999999999989, 0\r
+4.679999999999988, 0\r
+4.699999999999988, 0\r
+4.719999999999987, 0\r
+4.739999999999987, 0\r
+4.759999999999986, 0\r
+4.779999999999986, 0\r
+4.799999999999986, 0\r
+4.819999999999985, 0\r
+4.839999999999985, 0\r
+4.859999999999984, 0\r
+4.879999999999984, 0\r
+4.899999999999983, 0\r
+4.919999999999983, 0\r
+4.939999999999983, 0\r
+4.959999999999982, 0\r
+4.979999999999982, 0\r
+4.999999999999981, 0\r
+5.019999999999981, 0\r
+5.03999999999998, 0\r
+5.05999999999998, 0\r
+5.07999999999998, 0\r
+5.099999999999979, 0\r
+5.119999999999979, 0\r
+5.139999999999978, 0\r
+5.159999999999978, 0\r
+5.179999999999978, 0\r
+5.199999999999977, 0\r
+5.219999999999977, 0\r
+5.239999999999976, 0\r
+5.259999999999976, 0\r
+5.279999999999975, 0\r
+5.299999999999975, 0\r
+5.319999999999975, 0\r
+5.339999999999974, 0\r
+5.359999999999974, 0\r
+5.379999999999973, 0\r
+5.399999999999973, 0\r
+5.419999999999972, 0\r
+5.439999999999972, 0\r
+5.459999999999972, 0\r
+5.479999999999971, 0\r
+5.499999999999971, 0\r
+5.51999999999997, 0\r
+5.53999999999997, 0\r
+5.559999999999969, 0\r
+5.579999999999969, 0\r
+5.599999999999969, 0\r
+5.619999999999968, 0\r
+5.639999999999968, 0\r
+5.659999999999967, 0\r
+5.679999999999967, 0\r
+5.699999999999966, 0\r
+5.719999999999966, 0\r
+5.739999999999966, 0\r
+5.759999999999965, 0\r
+5.779999999999965, 0\r
+5.799999999999964, 0\r
+5.819999999999964, 0\r
+5.839999999999963, 0\r
+5.859999999999963, 0\r
+5.879999999999963, 0\r
+5.899999999999962, 0\r
+5.919999999999962, 0\r
+5.939999999999961, 0\r
+5.959999999999961, 0\r
+5.97999999999996, 0\r
+5.99999999999996, 0\r
+6.01999999999996, 0\r
+6.039999999999959, 0\r
+6.059999999999959, 0\r
+6.079999999999958, 0\r
+6.099999999999958, 0\r
+6.119999999999957, 0\r
+6.139999999999957, 0\r
+6.159999999999957, 0\r
+6.179999999999956, 0\r
+6.199999999999956, 0\r
+6.219999999999955, 0\r
+6.239999999999955, 0\r
+6.259999999999954, 0\r
+6.279999999999954, 0\r
+6.299999999999954, 0\r
+6.319999999999953, 0\r
+6.339999999999953, 0\r
+6.359999999999952, 0\r
+6.379999999999952, 0\r
+6.399999999999952, 0\r
+6.419999999999951, 0\r
+6.439999999999951, 0\r
+6.45999999999995, 0\r
+6.47999999999995, 0\r
+6.499999999999949, 0\r
+6.519999999999949, 0\r
+6.539999999999949, 0\r
+6.559999999999948, 0\r
+6.579999999999948, 0\r
+6.599999999999947, 0\r
+6.619999999999947, 0\r
+6.639999999999946, 0\r
+6.659999999999946, 0\r
+6.679999999999946, 0\r
+6.699999999999945, 0\r
+6.719999999999945, 0\r
+6.739999999999944, 0\r
+6.759999999999944, 0\r
+6.779999999999943, 0\r
+6.799999999999943, 0\r
+6.819999999999943, 0\r
+6.839999999999942, 0\r
+6.859999999999942, 0\r
+6.879999999999941, 0\r
+6.899999999999941, 0\r
+6.91999999999994, 0\r
+6.93999999999994, 0\r
+6.95999999999994, 0\r
+6.979999999999939, 0\r
+6.999999999999939, 0\r
+7.019999999999938, 0\r
+7.039999999999938, 0\r
+7.059999999999937, 0\r
+7.079999999999937, 0\r
+7.099999999999937, 0\r
+7.119999999999936, 0\r
+7.139999999999936, 0\r
+7.159999999999935, 0\r
+7.179999999999935, 0\r
+7.199999999999934, 0\r
+7.219999999999934, 0\r
+7.239999999999934, 0\r
+7.259999999999933, 0\r
+7.279999999999933, 0\r
+7.299999999999932, 0\r
+7.319999999999932, 0\r
+7.339999999999931, 0\r
+7.359999999999931, 0\r
+7.379999999999931, 0\r
+7.39999999999993, 0\r
+7.41999999999993, 0\r
+7.439999999999929, 0\r
+7.459999999999929, 0\r
+7.479999999999928, 0\r
+7.499999999999928, 0\r
+7.519999999999928, 0\r
+7.539999999999927, 0\r
+7.559999999999927, 0\r
+7.579999999999926, 0\r
+7.599999999999926, 0\r
+7.619999999999925, 0\r
+7.639999999999925, 0\r
+7.659999999999925, 0\r
+7.679999999999924, 0\r
+7.699999999999924, 0\r
+7.719999999999923, 0\r
+7.739999999999923, 0\r
+7.759999999999923, 0\r
+7.779999999999922, 0\r
+7.799999999999922, 0\r
+7.819999999999921, 0\r
+7.839999999999921, 0\r
+7.85999999999992, 0\r
+7.87999999999992, 0\r
+7.89999999999992, 0\r
+7.919999999999919, 0\r
+7.939999999999919, 0\r
+7.959999999999918, 0\r
+7.979999999999918, 0\r
+7.999999999999917, 0\r
+8.019999999999918, 0\r
+8.039999999999917, 0\r
+8.059999999999917, 0\r
+8.079999999999917, 0\r
+8.099999999999916, 0\r
+8.119999999999916, 0\r
+8.139999999999915, 0\r
+8.159999999999915, 0\r
+8.179999999999914, 0\r
+8.199999999999914, 0\r
+8.219999999999914, 0\r
+8.239999999999913, 0\r
+8.259999999999913, 0\r
+8.279999999999912, 0\r
+8.299999999999912, 0\r
+8.319999999999911, 0\r
+8.339999999999911, 0\r
+8.359999999999911, 0\r
+8.37999999999991, 0\r
+8.39999999999991, 0\r
+8.419999999999909, 0\r
+8.439999999999909, 0\r
+8.459999999999908, 0\r
+8.479999999999908, 0\r
+8.499999999999908, 0\r
+8.519999999999907, 0\r
+8.539999999999907, 0\r
+8.559999999999906, 0\r
+8.579999999999906, 0\r
+8.599999999999905, 0\r
+8.619999999999905, 0\r
+8.639999999999905, 0\r
+8.659999999999904, 0\r
+8.679999999999904, 0\r
+8.699999999999903, 0\r
+8.719999999999903, 0\r
+8.739999999999903, 0\r
+8.759999999999902, 0\r
+8.779999999999902, 0\r
+8.799999999999901, 0\r
+8.819999999999901, 0\r
+8.8399999999999, 0\r
+8.8599999999999, 0\r
+8.8799999999999, 0\r
+8.899999999999899, 0\r
+8.919999999999899, 0\r
+8.939999999999898, 0\r
+8.959999999999898, 0\r
+8.979999999999897, 0\r
+8.999999999999897, 0\r
+9.019999999999897, 0\r
+9.039999999999896, 0\r
+9.059999999999896, 0\r
+9.079999999999895, 0\r
+9.099999999999895, 0\r
+9.119999999999894, 0\r
+9.139999999999894, 0\r
+9.159999999999894, 0\r
+9.179999999999893, 0\r
+9.199999999999893, 0\r
+9.219999999999892, 0\r
+9.239999999999892, 0\r
+9.259999999999891, 0\r
+9.279999999999891, 0\r
+9.299999999999891, 0\r
+9.31999999999989, 0\r
+9.33999999999989, 0\r
+9.359999999999889, 0\r
+9.379999999999889, 0\r
+9.399999999999888, 0\r
+9.419999999999888, 0\r
+9.439999999999888, 0\r
+9.459999999999887, 0\r
+9.479999999999887, 0\r
+9.499999999999886, 0\r
+9.519999999999886, 0\r
+9.539999999999885, 0\r
+9.559999999999885, 0\r
+9.579999999999885, 0\r
+9.599999999999884, 0\r
+9.619999999999884, 0\r
+9.639999999999883, 0\r
+9.659999999999883, 0\r
+9.679999999999882, 0\r
+9.699999999999882, 0\r
+9.719999999999882, 0\r
+9.739999999999881, 0\r
+9.759999999999881, 0\r
+9.77999999999988, 0\r
+9.79999999999988, 0\r
+9.819999999999879, 0\r
+9.839999999999879, 0\r
+9.859999999999879, 0\r
+9.879999999999878, 0\r
+9.899999999999878, 0\r
+9.919999999999877, 0\r
+9.939999999999877, 0\r
+9.959999999999877, 0\r
+9.979999999999876, 0\r
+9.999999999999876, 0\r
+10, 0\r
+\r
+DataSet: der($dummy)\r
+0, 0\r
+2.220446049250313e-13, 0\r
+0.02, 0\r
+0.04, 0\r
+0.06, 0\r
+0.08, 0\r
+0.1, 0\r
+0.12, 0\r
+0.14, 0\r
+0.16, 0\r
+0.18, 0\r
+0.2, 0\r
+0.22, 0\r
+0.24, 0\r
+0.26, 0\r
+0.28, 0\r
+0.3, 0\r
+0.32, 0\r
+0.34, 0\r
+0.36, 0\r
+0.3800000000000001, 0\r
+0.4000000000000001, 0\r
+0.4200000000000001, 0\r
+0.4400000000000001, 0\r
+0.4600000000000001, 0\r
+0.4800000000000001, 0\r
+0.5000000000000001, 0\r
+0.5200000000000001, 0\r
+0.5400000000000001, 0\r
+0.5600000000000002, 0\r
+0.5800000000000002, 0\r
+0.6000000000000002, 0\r
+0.6200000000000002, 0\r
+0.6400000000000002, 0\r
+0.6600000000000003, 0\r
+0.6800000000000003, 0\r
+0.7000000000000003, 0\r
+0.7200000000000003, 0\r
+0.7400000000000003, 0\r
+0.7600000000000003, 0\r
+0.7800000000000004, 0\r
+0.8000000000000004, 0\r
+0.8200000000000004, 0\r
+0.8400000000000004, 0\r
+0.8600000000000004, 0\r
+0.8800000000000004, 0\r
+0.9000000000000005, 0\r
+0.9200000000000005, 0\r
+0.9400000000000005, 0\r
+0.9600000000000005, 0\r
+0.9800000000000005, 0\r
+1, 0\r
+1.02, 0\r
+1.04, 0\r
+1.06, 0\r
+1.080000000000001, 0\r
+1.100000000000001, 0\r
+1.120000000000001, 0\r
+1.140000000000001, 0\r
+1.160000000000001, 0\r
+1.180000000000001, 0\r
+1.200000000000001, 0\r
+1.220000000000001, 0\r
+1.240000000000001, 0\r
+1.260000000000001, 0\r
+1.280000000000001, 0\r
+1.300000000000001, 0\r
+1.320000000000001, 0\r
+1.340000000000001, 0\r
+1.360000000000001, 0\r
+1.380000000000001, 0\r
+1.400000000000001, 0\r
+1.420000000000001, 0\r
+1.440000000000001, 0\r
+1.460000000000001, 0\r
+1.480000000000001, 0\r
+1.500000000000001, 0\r
+1.520000000000001, 0\r
+1.540000000000001, 0\r
+1.560000000000001, 0\r
+1.580000000000001, 0\r
+1.600000000000001, 0\r
+1.620000000000001, 0\r
+1.640000000000001, 0\r
+1.660000000000001, 0\r
+1.680000000000001, 0\r
+1.700000000000001, 0\r
+1.720000000000001, 0\r
+1.740000000000001, 0\r
+1.760000000000001, 0\r
+1.780000000000001, 0\r
+1.800000000000001, 0\r
+1.820000000000001, 0\r
+1.840000000000001, 0\r
+1.860000000000001, 0\r
+1.880000000000001, 0\r
+1.900000000000001, 0\r
+1.920000000000001, 0\r
+1.940000000000001, 0\r
+1.960000000000001, 0\r
+1.980000000000001, 0\r
+2.000000000000001, 0\r
+2.020000000000001, 0\r
+2.040000000000001, 0\r
+2.060000000000001, 0\r
+2.080000000000001, 0\r
+2.100000000000001, 0\r
+2.120000000000001, 0\r
+2.140000000000001, 0\r
+2.160000000000001, 0\r
+2.180000000000001, 0\r
+2.200000000000002, 0\r
+2.220000000000002, 0\r
+2.240000000000002, 0\r
+2.260000000000002, 0\r
+2.280000000000002, 0\r
+2.300000000000002, 0\r
+2.320000000000002, 0\r
+2.340000000000002, 0\r
+2.360000000000002, 0\r
+2.380000000000002, 0\r
+2.400000000000002, 0\r
+2.420000000000002, 0\r
+2.440000000000002, 0\r
+2.460000000000002, 0\r
+2.480000000000002, 0\r
+2.500000000000002, 0\r
+2.520000000000002, 0\r
+2.540000000000002, 0\r
+2.560000000000002, 0\r
+2.580000000000002, 0\r
+2.600000000000002, 0\r
+2.620000000000002, 0\r
+2.640000000000002, 0\r
+2.660000000000002, 0\r
+2.680000000000002, 0\r
+2.700000000000002, 0\r
+2.720000000000002, 0\r
+2.740000000000002, 0\r
+2.760000000000002, 0\r
+2.780000000000002, 0\r
+2.800000000000002, 0\r
+2.820000000000002, 0\r
+2.840000000000002, 0\r
+2.860000000000002, 0\r
+2.880000000000002, 0\r
+2.900000000000002, 0\r
+2.920000000000002, 0\r
+2.940000000000002, 0\r
+2.960000000000002, 0\r
+2.980000000000002, 0\r
+3.000000000000002, 0\r
+3.020000000000002, 0\r
+3.040000000000002, 0\r
+3.060000000000002, 0\r
+3.080000000000002, 0\r
+3.100000000000002, 0\r
+3.120000000000002, 0\r
+3.140000000000002, 0\r
+3.160000000000002, 0\r
+3.180000000000002, 0\r
+3.200000000000002, 0\r
+3.220000000000002, 0\r
+3.240000000000002, 0\r
+3.260000000000002, 0\r
+3.280000000000002, 0\r
+3.300000000000002, 0\r
+3.320000000000003, 0\r
+3.340000000000003, 0\r
+3.360000000000003, 0\r
+3.380000000000003, 0\r
+3.400000000000003, 0\r
+3.420000000000003, 0\r
+3.440000000000003, 0\r
+3.460000000000003, 0\r
+3.480000000000003, 0\r
+3.500000000000003, 0\r
+3.520000000000003, 0\r
+3.540000000000003, 0\r
+3.560000000000003, 0\r
+3.580000000000003, 0\r
+3.600000000000003, 0\r
+3.620000000000003, 0\r
+3.640000000000003, 0\r
+3.660000000000003, 0\r
+3.680000000000003, 0\r
+3.700000000000003, 0\r
+3.720000000000003, 0\r
+3.740000000000003, 0\r
+3.760000000000003, 0\r
+3.780000000000003, 0\r
+3.800000000000003, 0\r
+3.820000000000003, 0\r
+3.840000000000003, 0\r
+3.860000000000003, 0\r
+3.880000000000003, 0\r
+3.900000000000003, 0\r
+3.920000000000003, 0\r
+3.940000000000003, 0\r
+3.960000000000003, 0\r
+3.980000000000003, 0\r
+4.000000000000003, 0\r
+4.020000000000002, 0\r
+4.040000000000002, 0\r
+4.060000000000001, 0\r
+4.080000000000001, 0\r
+4.100000000000001, 0\r
+4.12, 0\r
+4.14, 0\r
+4.159999999999999, 0\r
+4.179999999999999, 0\r
+4.199999999999998, 0\r
+4.219999999999998, 0\r
+4.239999999999998, 0\r
+4.259999999999997, 0\r
+4.279999999999997, 0\r
+4.299999999999996, 0\r
+4.319999999999996, 0\r
+4.339999999999995, 0\r
+4.359999999999995, 0\r
+4.379999999999995, 0\r
+4.399999999999994, 0\r
+4.419999999999994, 0\r
+4.439999999999993, 0\r
+4.459999999999993, 0\r
+4.479999999999992, 0\r
+4.499999999999992, 0\r
+4.519999999999992, 0\r
+4.539999999999991, 0\r
+4.559999999999991, 0\r
+4.57999999999999, 0\r
+4.59999999999999, 0\r
+4.619999999999989, 0\r
+4.639999999999989, 0\r
+4.659999999999989, 0\r
+4.679999999999988, 0\r
+4.699999999999988, 0\r
+4.719999999999987, 0\r
+4.739999999999987, 0\r
+4.759999999999986, 0\r
+4.779999999999986, 0\r
+4.799999999999986, 0\r
+4.819999999999985, 0\r
+4.839999999999985, 0\r
+4.859999999999984, 0\r
+4.879999999999984, 0\r
+4.899999999999983, 0\r
+4.919999999999983, 0\r
+4.939999999999983, 0\r
+4.959999999999982, 0\r
+4.979999999999982, 0\r
+4.999999999999981, 0\r
+5.019999999999981, 0\r
+5.03999999999998, 0\r
+5.05999999999998, 0\r
+5.07999999999998, 0\r
+5.099999999999979, 0\r
+5.119999999999979, 0\r
+5.139999999999978, 0\r
+5.159999999999978, 0\r
+5.179999999999978, 0\r
+5.199999999999977, 0\r
+5.219999999999977, 0\r
+5.239999999999976, 0\r
+5.259999999999976, 0\r
+5.279999999999975, 0\r
+5.299999999999975, 0\r
+5.319999999999975, 0\r
+5.339999999999974, 0\r
+5.359999999999974, 0\r
+5.379999999999973, 0\r
+5.399999999999973, 0\r
+5.419999999999972, 0\r
+5.439999999999972, 0\r
+5.459999999999972, 0\r
+5.479999999999971, 0\r
+5.499999999999971, 0\r
+5.51999999999997, 0\r
+5.53999999999997, 0\r
+5.559999999999969, 0\r
+5.579999999999969, 0\r
+5.599999999999969, 0\r
+5.619999999999968, 0\r
+5.639999999999968, 0\r
+5.659999999999967, 0\r
+5.679999999999967, 0\r
+5.699999999999966, 0\r
+5.719999999999966, 0\r
+5.739999999999966, 0\r
+5.759999999999965, 0\r
+5.779999999999965, 0\r
+5.799999999999964, 0\r
+5.819999999999964, 0\r
+5.839999999999963, 0\r
+5.859999999999963, 0\r
+5.879999999999963, 0\r
+5.899999999999962, 0\r
+5.919999999999962, 0\r
+5.939999999999961, 0\r
+5.959999999999961, 0\r
+5.97999999999996, 0\r
+5.99999999999996, 0\r
+6.01999999999996, 0\r
+6.039999999999959, 0\r
+6.059999999999959, 0\r
+6.079999999999958, 0\r
+6.099999999999958, 0\r
+6.119999999999957, 0\r
+6.139999999999957, 0\r
+6.159999999999957, 0\r
+6.179999999999956, 0\r
+6.199999999999956, 0\r
+6.219999999999955, 0\r
+6.239999999999955, 0\r
+6.259999999999954, 0\r
+6.279999999999954, 0\r
+6.299999999999954, 0\r
+6.319999999999953, 0\r
+6.339999999999953, 0\r
+6.359999999999952, 0\r
+6.379999999999952, 0\r
+6.399999999999952, 0\r
+6.419999999999951, 0\r
+6.439999999999951, 0\r
+6.45999999999995, 0\r
+6.47999999999995, 0\r
+6.499999999999949, 0\r
+6.519999999999949, 0\r
+6.539999999999949, 0\r
+6.559999999999948, 0\r
+6.579999999999948, 0\r
+6.599999999999947, 0\r
+6.619999999999947, 0\r
+6.639999999999946, 0\r
+6.659999999999946, 0\r
+6.679999999999946, 0\r
+6.699999999999945, 0\r
+6.719999999999945, 0\r
+6.739999999999944, 0\r
+6.759999999999944, 0\r
+6.779999999999943, 0\r
+6.799999999999943, 0\r
+6.819999999999943, 0\r
+6.839999999999942, 0\r
+6.859999999999942, 0\r
+6.879999999999941, 0\r
+6.899999999999941, 0\r
+6.91999999999994, 0\r
+6.93999999999994, 0\r
+6.95999999999994, 0\r
+6.979999999999939, 0\r
+6.999999999999939, 0\r
+7.019999999999938, 0\r
+7.039999999999938, 0\r
+7.059999999999937, 0\r
+7.079999999999937, 0\r
+7.099999999999937, 0\r
+7.119999999999936, 0\r
+7.139999999999936, 0\r
+7.159999999999935, 0\r
+7.179999999999935, 0\r
+7.199999999999934, 0\r
+7.219999999999934, 0\r
+7.239999999999934, 0\r
+7.259999999999933, 0\r
+7.279999999999933, 0\r
+7.299999999999932, 0\r
+7.319999999999932, 0\r
+7.339999999999931, 0\r
+7.359999999999931, 0\r
+7.379999999999931, 0\r
+7.39999999999993, 0\r
+7.41999999999993, 0\r
+7.439999999999929, 0\r
+7.459999999999929, 0\r
+7.479999999999928, 0\r
+7.499999999999928, 0\r
+7.519999999999928, 0\r
+7.539999999999927, 0\r
+7.559999999999927, 0\r
+7.579999999999926, 0\r
+7.599999999999926, 0\r
+7.619999999999925, 0\r
+7.639999999999925, 0\r
+7.659999999999925, 0\r
+7.679999999999924, 0\r
+7.699999999999924, 0\r
+7.719999999999923, 0\r
+7.739999999999923, 0\r
+7.759999999999923, 0\r
+7.779999999999922, 0\r
+7.799999999999922, 0\r
+7.819999999999921, 0\r
+7.839999999999921, 0\r
+7.85999999999992, 0\r
+7.87999999999992, 0\r
+7.89999999999992, 0\r
+7.919999999999919, 0\r
+7.939999999999919, 0\r
+7.959999999999918, 0\r
+7.979999999999918, 0\r
+7.999999999999917, 0\r
+8.019999999999918, 0\r
+8.039999999999917, 0\r
+8.059999999999917, 0\r
+8.079999999999917, 0\r
+8.099999999999916, 0\r
+8.119999999999916, 0\r
+8.139999999999915, 0\r
+8.159999999999915, 0\r
+8.179999999999914, 0\r
+8.199999999999914, 0\r
+8.219999999999914, 0\r
+8.239999999999913, 0\r
+8.259999999999913, 0\r
+8.279999999999912, 0\r
+8.299999999999912, 0\r
+8.319999999999911, 0\r
+8.339999999999911, 0\r
+8.359999999999911, 0\r
+8.37999999999991, 0\r
+8.39999999999991, 0\r
+8.419999999999909, 0\r
+8.439999999999909, 0\r
+8.459999999999908, 0\r
+8.479999999999908, 0\r
+8.499999999999908, 0\r
+8.519999999999907, 0\r
+8.539999999999907, 0\r
+8.559999999999906, 0\r
+8.579999999999906, 0\r
+8.599999999999905, 0\r
+8.619999999999905, 0\r
+8.639999999999905, 0\r
+8.659999999999904, 0\r
+8.679999999999904, 0\r
+8.699999999999903, 0\r
+8.719999999999903, 0\r
+8.739999999999903, 0\r
+8.759999999999902, 0\r
+8.779999999999902, 0\r
+8.799999999999901, 0\r
+8.819999999999901, 0\r
+8.8399999999999, 0\r
+8.8599999999999, 0\r
+8.8799999999999, 0\r
+8.899999999999899, 0\r
+8.919999999999899, 0\r
+8.939999999999898, 0\r
+8.959999999999898, 0\r
+8.979999999999897, 0\r
+8.999999999999897, 0\r
+9.019999999999897, 0\r
+9.039999999999896, 0\r
+9.059999999999896, 0\r
+9.079999999999895, 0\r
+9.099999999999895, 0\r
+9.119999999999894, 0\r
+9.139999999999894, 0\r
+9.159999999999894, 0\r
+9.179999999999893, 0\r
+9.199999999999893, 0\r
+9.219999999999892, 0\r
+9.239999999999892, 0\r
+9.259999999999891, 0\r
+9.279999999999891, 0\r
+9.299999999999891, 0\r
+9.31999999999989, 0\r
+9.33999999999989, 0\r
+9.359999999999889, 0\r
+9.379999999999889, 0\r
+9.399999999999888, 0\r
+9.419999999999888, 0\r
+9.439999999999888, 0\r
+9.459999999999887, 0\r
+9.479999999999887, 0\r
+9.499999999999886, 0\r
+9.519999999999886, 0\r
+9.539999999999885, 0\r
+9.559999999999885, 0\r
+9.579999999999885, 0\r
+9.599999999999884, 0\r
+9.619999999999884, 0\r
+9.639999999999883, 0\r
+9.659999999999883, 0\r
+9.679999999999882, 0\r
+9.699999999999882, 0\r
+9.719999999999882, 0\r
+9.739999999999881, 0\r
+9.759999999999881, 0\r
+9.77999999999988, 0\r
+9.79999999999988, 0\r
+9.819999999999879, 0\r
+9.839999999999879, 0\r
+9.859999999999879, 0\r
+9.879999999999878, 0\r
+9.899999999999878, 0\r
+9.919999999999877, 0\r
+9.939999999999877, 0\r
+9.959999999999877, 0\r
+9.979999999999876, 0\r
+9.999999999999876, 0\r
+10, 0\r
+\r
diff --git a/org.simantics.modelica/build.properties b/org.simantics.modelica/build.properties
new file mode 100644 (file)
index 0000000..41eb6ad
--- /dev/null
@@ -0,0 +1,4 @@
+source.. = src/\r
+output.. = bin/\r
+bin.includes = META-INF/,\\r
+               .\r
diff --git a/org.simantics.modelica/src/org/simantics/modelica/ModelicaManager.java b/org.simantics.modelica/src/org/simantics/modelica/ModelicaManager.java
new file mode 100644 (file)
index 0000000..419b1ee
--- /dev/null
@@ -0,0 +1,140 @@
+package org.simantics.modelica;\r
+\r
+import java.io.File;\r
+import java.io.FileInputStream;\r
+import java.io.IOException;\r
+import java.io.InputStream;\r
+import java.io.PrintStream;\r
+\r
+import org.simantics.modelica.data.DataSet;\r
+import org.simantics.modelica.data.SimulationResult;\r
+\r
+public class ModelicaManager {\r
+\r
+    protected static File getOpenModelicaHome() {\r
+        String dir = System.getenv("OPENMODELICAHOMEe");\r
+        if(dir == null)\r
+            dir = "c:/OpenModelica1.5.0";\r
+        return new File(dir);\r
+    }\r
+    \r
+    protected static File createTempDirectory() throws IOException {\r
+        final File temp = File.createTempFile("temp", Long.toString(System.nanoTime()));\r
+        if(!(temp.delete()))\r
+            throw new IOException("Could not delete temp file: " + temp.getAbsolutePath());\r
+        if(!(temp.mkdir()))\r
+            throw new IOException("Could not create temp directory: " + temp.getAbsolutePath());\r
+        return (temp);\r
+    }\r
+    \r
+    protected static boolean recursiveDelete(File fileOrDir) {\r
+        if(fileOrDir.isDirectory())\r
+            for(File innerFile: fileOrDir.listFiles())\r
+                if(!recursiveDelete(innerFile))\r
+                    return false;\r
+        return fileOrDir.delete();\r
+    }\r
+    \r
+    protected static String readFile(File file) throws IOException {\r
+        InputStream stream = new FileInputStream(file);\r
+        byte[] buffer = new byte[(int)file.length()];\r
+        stream.read(buffer);\r
+        stream.close();\r
+        return new String(buffer);\r
+    }\r
+    \r
+    protected static void printProcessOutput(Process process) throws IOException {\r
+        InputStream stream = process.getInputStream();\r
+        while(true) {\r
+            int c = stream.read();\r
+            if(c <= 0)\r
+                break;\r
+            System.out.print((char)c);\r
+        }\r
+    }\r
+    \r
+    static class SimulationLocation {\r
+        File simulationDir;\r
+        File inputFile;\r
+        File outputFile;\r
+        \r
+        public SimulationLocation(File simulationDir, File inputFile,\r
+                File outputFile) {\r
+            this.simulationDir = simulationDir;\r
+            this.inputFile = inputFile;\r
+            this.outputFile = outputFile;\r
+        }\r
+    }\r
+    \r
+    protected static SimulationLocation createInputFiles(String modelName, String modelText) throws IOException {\r
+        File simulationDir = createTempDirectory();\r
+        File modelFile = new File(simulationDir, modelName + ".mo");\r
+        File scriptFile = new File(simulationDir, modelName + ".mos");\r
+        \r
+        {\r
+            PrintStream s = new PrintStream(modelFile);\r
+            s.print(modelText);\r
+            s.close();\r
+        }\r
+        \r
+        {\r
+            PrintStream s = new PrintStream(scriptFile);\r
+            s.println("loadFile(\"" + modelName + ".mo\");");\r
+            s.println("simulate("+modelName+\r
+                    ",startTime="+0.0+\r
+                    ",stopTime="+10.0+\r
+                    ");");\r
+            s.close();\r
+        }\r
+        \r
+        return new SimulationLocation(\r
+                simulationDir,\r
+                new File(simulationDir, modelName + ".mos"),\r
+                new File(simulationDir, modelName + "_res.plt")\r
+                );\r
+    }\r
+    \r
+    public static SimulationResult runModelica(String modelName, String modelText) throws IOException {\r
+        SimulationLocation simulationLocation = \r
+            createInputFiles(modelName, modelText);\r
+        \r
+        try {\r
+            File modelicaHome = getOpenModelicaHome();\r
+            File omc = new File(modelicaHome, "bin/omc.exe");\r
+\r
+            Process process = new ProcessBuilder(\r
+                    omc.getAbsolutePath(),\r
+                    simulationLocation.inputFile.getAbsolutePath()\r
+                    )\r
+                .directory(simulationLocation.simulationDir.getAbsoluteFile())\r
+                .redirectErrorStream(true)\r
+                .start();\r
+            printProcessOutput(process);\r
+            \r
+            SimulationResult result = new SimulationResult();\r
+            result.read(simulationLocation.outputFile);\r
+            \r
+            result.filter();\r
+            \r
+            for(DataSet set : result.getDataSets())\r
+                System.out.println(set.name);\r
+            \r
+            return result;\r
+        } catch(IOException e) {\r
+            e.printStackTrace();\r
+        } finally {\r
+            recursiveDelete(simulationLocation.simulationDir);            \r
+        }       \r
+        return null;\r
+    }\r
+    \r
+    public static void main(String[] args) {\r
+        try {\r
+            runModelica("Testi2", "model Testi2 end Testi2;");\r
+        } catch (IOException e) {\r
+            // TODO Auto-generated catch block\r
+            e.printStackTrace();\r
+        }\r
+    }\r
+\r
+}\r
diff --git a/org.simantics.modelica/src/org/simantics/modelica/data/DataSet.java b/org.simantics.modelica/src/org/simantics/modelica/data/DataSet.java
new file mode 100644 (file)
index 0000000..4f02490
--- /dev/null
@@ -0,0 +1,17 @@
+package org.simantics.modelica.data;\r
+\r
+/**\r
+ * Simulation result for one variable.\r
+ * @author Hannu Niemistö\r
+ */\r
+public class DataSet {\r
+    public String name;\r
+    public double[] times;\r
+    public double[] values;\r
+    \r
+    public DataSet(String name, double[] times, double[] values) {\r
+        this.name = name;\r
+        this.times = times;\r
+        this.values = values;\r
+    }     \r
+}\r
diff --git a/org.simantics.modelica/src/org/simantics/modelica/data/SimulationResult.java b/org.simantics.modelica/src/org/simantics/modelica/data/SimulationResult.java
new file mode 100644 (file)
index 0000000..0676555
--- /dev/null
@@ -0,0 +1,105 @@
+package org.simantics.modelica.data;\r
+\r
+import gnu.trove.TDoubleArrayList;\r
+\r
+import java.io.File;\r
+import java.io.FileInputStream;\r
+import java.io.FileNotFoundException;\r
+import java.io.IOException;\r
+import java.io.InputStream;\r
+import java.util.ArrayList;\r
+import java.util.List;\r
+import java.util.regex.Matcher;\r
+import java.util.regex.Pattern;\r
+\r
+/**\r
+ * Class that reads OpenModelica result files.\r
+ * @author Hannu Niemistö\r
+ */\r
+public class SimulationResult {    \r
+    \r
+    List<DataSet> dataSets = new ArrayList<DataSet>();\r
+\r
+    static String getLine(InputStream stream) {\r
+        if(stream == null)\r
+            return null;\r
+        StringBuilder b = new StringBuilder();\r
+        try {\r
+            while(true) {\r
+                int c = stream.read();\r
+                if(c == -1) {\r
+                    stream = null;\r
+                    return b.toString();\r
+                }\r
+                else if(c == '\n') \r
+                    return b.toString();\r
+                else if(c == '\r')\r
+                    ;\r
+                else\r
+                    b.append((char)c);\r
+            }\r
+        } catch (IOException e) {\r
+            return null;\r
+        }           \r
+        \r
+    }\r
+    \r
+    final static Pattern p1 = Pattern.compile("DataSet: ([^ ]*)");\r
+    \r
+    public void read(File file) throws FileNotFoundException {\r
+        read(new FileInputStream(file));\r
+    }\r
+    \r
+    public void read(InputStream stream) {\r
+        while(true) {\r
+            String line = getLine(stream);\r
+            if(line == null)\r
+                return;\r
+            if(line.isEmpty())\r
+                break;\r
+        }\r
+        \r
+        // Data sets\r
+        while(true) {            \r
+            Matcher matcher = p1.matcher(getLine(stream));\r
+            if(!matcher.matches())\r
+                return;\r
+            String name = matcher.group(1);\r
+            \r
+            TDoubleArrayList times = new TDoubleArrayList();\r
+            TDoubleArrayList values = new TDoubleArrayList();\r
+            while(true) {\r
+                String line = getLine(stream);\r
+                if(line == null)\r
+                    return;\r
+                if(line.isEmpty())\r
+                    break;\r
+                String[] nn = line.split(", ", 2);\r
+                times.add(Double.parseDouble(nn[0]));\r
+                values.add(Double.parseDouble(nn[1]));\r
+            }\r
+            \r
+            dataSets.add(new DataSet(name, times.toNativeArray(), values.toNativeArray()));\r
+        }\r
+    }\r
+        \r
+    public void filter() {\r
+        ArrayList<DataSet> newDataSets = new ArrayList<DataSet>();\r
+        for(DataSet dataSet : dataSets) {\r
+            if(!dataSet.name.equals("time") && !dataSet.name.contains("$") && !dataSet.name.contains("der("))\r
+                newDataSets.add(dataSet);\r
+        }\r
+        dataSets = newDataSets;\r
+    }\r
+    \r
+    public List<DataSet> getDataSets() {\r
+        return dataSets;\r
+    }\r
+    \r
+    public DataSet getDataSet(String name) {\r
+        for(DataSet set : dataSets)\r
+            if(set.name.equals(name))\r
+                return set;\r
+        return null;\r
+    }\r
+}\r