]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
Preparing for 1.6 release: Input/Output tab tweaks, diagram chart size tweak, better...
authorlempinen <lempinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Wed, 2 May 2012 07:18:12 +0000 (07:18 +0000)
committerlempinen <lempinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Wed, 2 May 2012 07:18:12 +0000 (07:18 +0000)
git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@24847 ac1ea38d-2e2b-0410-8846-a27921b304fc

org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/editor/SysdynEditorNamingService.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ModuleInputTab.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ModuleOutputTab.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/modules/ParameterChildRule.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/chart/element/ChartElementFactory.java
org.simantics.sysdyn/src/org/simantics/sysdyn/manager/FunctionUtils.java
org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynModel.java
org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynResult.java
org.simantics.sysdyn/src/org/simantics/sysdyn/modelica/ModelicaWriter.java
org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Module.java

index ca386d6b2ee001bb3081aef9a8d7170fdf11ab7e..abb9f0b802a23ae6ce1f174dd8be21e3ecfd412f 100644 (file)
@@ -37,9 +37,9 @@ public class SysdynEditorNamingService extends EditorNamingService2 {
         if(in instanceof IResourceEditorInput2) {\r
                 IResourceEditorInput2 input = (IResourceEditorInput2) in;\r
                 \r
-             Resource model = g.getPossibleResource(input.getModelURI());\r
 \r
                 if(!input.getRVI().isEmpty()) {\r
+                 Resource model = g.getPossibleResource(input.getModelURI());\r
                         if(model != null) {\r
                                 Resource configuration = g.getPossibleObject(model, SimulationResource.getInstance(g).HasConfiguration);\r
                                 String configurationName = NameUtils.getSafeName(g, configuration);\r
@@ -54,10 +54,7 @@ public class SysdynEditorNamingService extends EditorNamingService2 {
                                 return name + " : " + instanceOf;\r
                         }\r
                         }\r
-\r
-                } else {\r
-                    return NameUtils.getSafeLabel(g, model);\r
-                }\r
+                } \r
         }\r
         return super.getName(g, editorId, in);\r
     }\r
index b29c03573dd155fd8a0113ad9362e75c39532c86..c4c92ac28bfbbb9cda2ee59a58a29b186a99622a 100644 (file)
@@ -43,7 +43,7 @@ public class ModuleInputTab extends LabelPropertyTabContributor {
         ReferenceTable referenceTable = new ReferenceTable(body, support, SWT.NONE);\r
         \r
         String[] titles = { FIRSTCOLUMN, SECONDCOLUMN};\r
-        int[] bounds = { 100, 100, 100, 100 };\r
+        int[] bounds = { 200, 200 };\r
         for (int i = 0; i < titles.length; i++) {\r
             TableViewerColumn column = new TableViewerColumn(referenceTable.getTableViewer(), SWT.NONE);\r
             column.getColumn().setText(titles[i]);\r
index 47a114e7684f3ad3f8f180e7dd2ba516abb97310..ef0e5cc4c2237b72852f31073b578753a6be0a9d 100644 (file)
@@ -43,7 +43,7 @@ public class ModuleOutputTab extends LabelPropertyTabContributor {
         ReferenceTable referenceTable = new ReferenceTable(body, support, SWT.NONE);\r
         \r
         String[] titles = { FIRSTCOLUMN, SECONDCOLUMN};\r
-        int[] bounds = { 100, 100, 100, 100 };\r
+        int[] bounds = { 200, 200 };\r
         for (int i = 0; i < titles.length; i++) {\r
             TableViewerColumn column = new TableViewerColumn(referenceTable.getTableViewer(), SWT.NONE);\r
             column.getColumn().setText(titles[i]);\r
index 3b270819f4054938eae9a1cfca2bb612657e2b7d..5d88453e0404c8cb7647faa3ccb19a16b258c2d5 100644 (file)
@@ -27,6 +27,7 @@ import org.simantics.sysdyn.manager.SysdynModelManager;
 import org.simantics.sysdyn.representation.Configuration;\r
 import org.simantics.sysdyn.representation.IElement;\r
 import org.simantics.sysdyn.representation.IndependentVariable;\r
+import org.simantics.sysdyn.representation.Stock;\r
 import org.simantics.sysdyn.representation.Variability;\r
 \r
 public class ParameterChildRule implements ChildRule {\r
@@ -58,7 +59,7 @@ public class ParameterChildRule implements ChildRule {
         \r
         for(Resource variable : graph.syncRequest(new ObjectsWithType(configuration, L0.ConsistsOf, sr.IndependentVariable))) {\r
             IElement element = model.getElement(variable);\r
-            if(element instanceof IndependentVariable) \r
+            if(element instanceof IndependentVariable && !(element instanceof Stock)\r
                 if(!Variability.CONTINUOUS.equals(Variability.getVariability((IndependentVariable)element, false, varConf)))\r
                     result.add(new ParameterNode(moduleInstance, varConf, variable, (IndependentVariable)element));\r
         }\r
index 0a153c930c7a50c680b73b956ddcfe7b6777c321..142774e766f513e9d2c701bdf8232b53a5d0560d 100644 (file)
@@ -98,7 +98,7 @@ public class ChartElementFactory extends SyncElementFactory {
                 DefaultTransform.INSTANCE,\r
                 StaticSymbolImageInitializer.INSTANCE,\r
                 new StaticSymbolImpl(STATIC_IMAGE),\r
-                new ChartBoundsOutline(new Rectangle2D.Double(-40, -40, 80, 80)),\r
+                new ChartBoundsOutline(new Rectangle2D.Double(-20, -20, 60, 40)),\r
                 new ElementPropertySetter(ChartSceneGraph.KEY_SG_NODE)\r
                 ).setId(CLASS_ID);\r
     }\r
index 91fb1cd9b6104df0f306f4a2bf5a49ac9b6fba7b..2a12c789b77cfef3c66eff25a15cc387c35557a7 100644 (file)
@@ -22,6 +22,7 @@ import java.util.HashSet;
 import java.util.List;\r
 import java.util.Set;\r
 \r
+import org.simantics.Simantics;\r
 import org.simantics.databoard.Bindings;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
@@ -29,7 +30,6 @@ import org.simantics.db.common.request.ObjectsWithType;
 import org.simantics.db.common.request.ReadRequest;\r
 import org.simantics.db.common.utils.NameUtils;\r
 import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.db.layer0.util.Simantics;\r
 import org.simantics.layer0.Layer0;\r
 import org.simantics.simulation.ontology.SimulationResource;\r
 import org.simantics.sysdyn.Activator;\r
@@ -58,7 +58,7 @@ public class FunctionUtils {
                                                        }\r
                                                } else {\r
                                                        String libraryname = NameUtils.getSafeName(graph, parent);\r
-                                                       paths.add("..\\\\..\\\\libraries\\\\functions\\\\" + libraryname + ".mo");\r
+                                                       paths.add("..\\\\\\\\..\\\\\\\\libraries\\\\\\\\functions\\\\\\\\" + libraryname + ".mo");\r
                                                }\r
                                        }\r
                                }\r
index eeff4a6b3de82f3731106402a66d03945638c49c..740ae5a2c3e7f1e86f04324e863ac998cfeb8899 100644 (file)
@@ -53,6 +53,7 @@ import org.simantics.sysdyn.representation.Configuration;
 import org.simantics.sysdyn.representation.IElement;\r
 import org.simantics.sysdyn.representation.IndependentVariable;\r
 import org.simantics.sysdyn.representation.Module;\r
+import org.simantics.sysdyn.representation.ParameterOverride;\r
 import org.simantics.sysdyn.representation.SysdynSchema;\r
 import org.simantics.sysdyn.representation.expressions.IExpression;\r
 import org.simantics.sysdyn.representation.expressions.ParameterExpression;\r
@@ -470,7 +471,11 @@ public class SysdynModel implements IMappingListener, IModel {
             if (element instanceof Module) {\r
                 Module module = (Module) element;\r
                 Configuration conf = module.getType().getConfiguration();\r
-                inits.putAll(getInits(conf, prefix + module.getName() + "."));\r
+                String prfx = prefix + module.getName() + ".";\r
+                inits.putAll(getInits(conf, prfx));\r
+                for(ParameterOverride po : module.getParameterOverrides()) {\r
+                       inits.put(prfx + po.getVariable().getName(), po.getExpression());\r
+                }\r
             } else if (element instanceof IndependentVariable) {\r
                 IndependentVariable variable = (IndependentVariable) element;\r
                 //FIXME: more general solution for finding out if the variable is a parameter\r
index 1bfe6621eac24a1678fa9cc337dbe0c89047397d..f081908e03ff207ef104922825679823c371c817 100644 (file)
@@ -238,8 +238,8 @@ public class SysdynResult {
                 double[] times_ = new double[size];\r
                 double[] values_ = new double[size];\r
                 for (int i=0; i<size; i++) {\r
-                    times_[i] = times[i];\r
-                    values_[i] = values[i];\r
+                    times_[i] = (times[i]!=null ? times[i] : 0);\r
+                    values_[i] = (values[i]!=null ? values[i] : 0);\r
                 }\r
 \r
                 return new SysdynDataSet(variable, resultName, times_, values_);\r
index ecbc5262ba4336b972c459e1f85a6956fcae3ce4..7783dbd08dba1f1a35be2bb20353a09dd7134fd1 100644 (file)
@@ -198,7 +198,7 @@ public class ModelicaWriter {
             Variable variable = (Variable)dependency.getTail();\r
             Module module = (Module)dependency.getHead();\r
             Input reference = (Input)dependency.refersTo();\r
-            if(reference != null && (reference.getVariability() == null || reference.getVariability().isEmpty())) {\r
+            if(reference != null && reference.getName() != null && (reference.getVariability() == null || reference.getVariability().isEmpty())) {\r
                 b.append("    " + module.getName() + "." + reference.getName() + " = " + variable.getName() + ";\n");\r
                 moduleInputs.get(module.getName()).remove(reference);\r
             }\r
index 8a6d416cbb9dcb65133898213841b633be560e0a..902a385c9dd1cb30e25652e6e514b5378248cfdd 100644 (file)
 package org.simantics.sysdyn.representation;\r
 \r
 import java.util.ArrayList;\r
+import java.util.HashSet;\r
 import java.util.Iterator;\r
 import java.util.List;\r
+import java.util.Set;\r
 \r
 import org.simantics.layer0.Layer0;\r
 import org.simantics.objmap.annotations.GraphType;\r
@@ -21,6 +23,7 @@ import org.simantics.objmap.annotations.RelatedElement;
 import org.simantics.objmap.annotations.RelatedElements;\r
 import org.simantics.objmap.annotations.RelatedValue;\r
 import org.simantics.sysdyn.SysdynResource;\r
+import org.simantics.sysdyn.representation.utils.RepresentationUtils;\r
 import org.simantics.sysdyn.representation.visitors.IElementVisitorVoid;\r
 import org.simantics.utils.datastructures.Pair;\r
 \r
@@ -32,212 +35,228 @@ import org.simantics.utils.datastructures.Pair;
 @GraphType(SysdynResource.URIs.Module)\r
 public class Module implements IElement {\r
 \r
-    @RelatedValue(Layer0.URIs.HasName)\r
-    private String name;\r
-\r
-    @RelatedElement(Layer0.URIs.PartOf)\r
-    private Configuration parentConfiguration;\r
-\r
-    @RelatedElement(Layer0.URIs.InstanceOf)\r
-    private ModuleType type;\r
-\r
-    @RelatedElements(SysdynResource.URIs.Module_redeclaration)\r
-    private List<Redeclaration> redeclarations;\r
-\r
-    @RelatedElements(Layer0.URIs.ConsistsOf)\r
-    private List<Entity> consistsOf;\r
-\r
-    @Override\r
-    public void accept(IElementVisitorVoid v) {\r
-        v.visit(this);\r
-    }\r
-\r
-    public String getName() {\r
-        return name;\r
-    }\r
-\r
-    public ModuleType getType() {\r
-        return type;\r
-    }\r
-\r
-    /**\r
-     * Returns the declaration of a module with possible redeclared enumerations and parameter assignments\r
-     *\r
-     * <p>\r
-     * Enumeration redeclaration:\r
-     * parameter Integer Enum__size = Enum.size; <br>\r
-     * parameter Integer Enum__elements[:] = Enum.elements; <br>\r
-     * ModuleType ModuleType1(Enum.size = Enum__size, Enum.elements = Enum__elements); <br>\r
-     * \r
-     * <p>\r
-     * Temporary parameter variables are needed to avoid name conflicts when redeclaring an \r
-     * enumeration with the same name.\r
-     * \r
-     * @return Declaration of a module instance\r
-     */\r
-    public String getDeclaration() {\r
-\r
-\r
-        String enumerationRedeclarations = getEnumerationRedeclarations();\r
-        Pair<String, String> inputRedeclarations = getInputRedeclarations();\r
-        String parameterOverrides = getParameterOverrides();\r
-\r
-        StringBuilder redeclarations = new StringBuilder();\r
-\r
-        if(!enumerationRedeclarations.isEmpty() || !inputRedeclarations.first.isEmpty() || !parameterOverrides.isEmpty()) {\r
-            redeclarations.append("(");\r
-            redeclarations.append(enumerationRedeclarations);\r
-\r
-            String ir = inputRedeclarations.first;\r
-            if(enumerationRedeclarations.isEmpty() && !inputRedeclarations.first.isEmpty())\r
-                // remove first ", " if no enumeration redeclarations\r
-                ir = inputRedeclarations.first.substring(2); \r
-            redeclarations.append(ir);\r
-\r
-            if(!parameterOverrides.isEmpty()) {\r
-                if(redeclarations.length() > 1)\r
-                    redeclarations.append(", ");\r
-                redeclarations.append(parameterOverrides);\r
-            }\r
-\r
-            redeclarations.append(")");\r
-        }\r
-\r
-        StringBuilder sb = new StringBuilder();\r
-\r
-        // Possible reference variables\r
-        if(inputRedeclarations.second != null && !inputRedeclarations.second.isEmpty()) {\r
-            sb.append(inputRedeclarations.second);\r
-        }\r
-\r
-        sb.append("    ");\r
-        sb.append(getType().getName());\r
-        sb.append(" ");\r
-        sb.append(getName());\r
-        sb.append(redeclarations.toString()); // possible redeclarations\r
-        sb.append(";\n");\r
-        return sb.toString();\r
-    }\r
-\r
-    /**\r
-     * Get possible enumeration redeclarations.\r
-     * @return enumeration redeclarations or empty string\r
-     */\r
-    private String getEnumerationRedeclarations() {\r
-        StringBuilder redeclarations = new StringBuilder();\r
-        if(!getRedeclarations().isEmpty()) {\r
-\r
-            Iterator<Redeclaration> i = getRedeclarations().iterator();\r
-            while(i.hasNext()) {\r
-                Redeclaration rd = i.next();\r
-                redeclarations.append(rd.getRedeclaration());\r
-                if(i.hasNext())\r
-                    redeclarations.append(",");\r
-            }\r
-        }\r
-        return redeclarations.toString();\r
-    }\r
-\r
-    /**\r
-     * Get possible input redeclarations\r
-     * @return input redeclarations or empty string\r
-     */\r
-    private Pair<String, String> getInputRedeclarations() {\r
-        StringBuilder declarations = new StringBuilder();\r
-        StringBuilder references = new StringBuilder();\r
-\r
-        for(IElement element : parentConfiguration.getElements()) {\r
-            if (element instanceof Dependency) {\r
-                Dependency dependency = (Dependency)element;\r
-                if(dependency.getHead().equals(this)){\r
-                    Input reference = (Input)dependency.refersTo();\r
-                    Variable outputVariable = (Variable)dependency.getTail();\r
-                    String name = outputVariable.getName();\r
-\r
-                    Module module = (Module)dependency.getHead();\r
-\r
-                    if(reference != null && reference.getName() != null) {\r
-                        if(reference.getVariability() == null || reference.getVariability().isEmpty())\r
-                            continue; // Only parameters and constants are redeclared\r
-\r
-                        for(IElement e : module.getType().getConfiguration().getElements()) {\r
-                            if(e instanceof Variable) {\r
-                                Variable v = (Variable)e;\r
-\r
-                                if(v.getName() != null && outputVariable.getName().equals(v.getName())) {\r
-                                    /*\r
-                                     *  The target module contains a variable with the same name. Need to\r
-                                     *  avoid Module(variable = variable) situations \r
-                                     */\r
-                                    String declaration;\r
-                                    if(outputVariable instanceof Input)\r
-                                        declaration = ((Input)outputVariable).getDeclaration();\r
-                                    else\r
-                                        declaration = ((IndependentVariable)outputVariable).getDeclaration();\r
-\r
-                                    if(declaration.contains("="))\r
-                                        declaration = declaration.substring(0, declaration.indexOf("=") - 1); // Break to "="\r
-                                    else\r
-                                        declaration = declaration.substring(0, declaration.length() - 2); // Remove ending ";\n" \r
-\r
-                                    name = outputVariable.getName() + "_reference";\r
-                                    declaration = declaration.replace(outputVariable.getName(), name);\r
-                                    declaration += " = " + outputVariable.getName() + " /* Reference value to avoid name conflicts in module instantiation */ ;\n";\r
-                                    references.append(declaration);\r
-                                    break;\r
-                                }\r
-                            }\r
-                        }\r
-\r
-                        declarations.append(", " + reference.getName() + " = " + name);\r
-                    }\r
-                }\r
-            }\r
-        }\r
-        return new Pair<String, String>(declarations.toString(), references.toString());\r
-    }\r
-\r
-    public Configuration getParentConfiguration() {\r
-        return this.parentConfiguration;\r
-    }\r
-\r
-    /**\r
-     * Return the list of the defined redeclarations for this module instance.\r
-     * \r
-     * @return List of the defined redeclarations or an empty list if redeclarations have not been set \r
-     */\r
-    public List<Redeclaration> getRedeclarations() {\r
-        if(redeclarations == null) {\r
-            redeclarations = new ArrayList<Redeclaration>();\r
-        }\r
-        return redeclarations;\r
-    }\r
-\r
-\r
-    /**\r
-     * Get all parameter override elements for this module instance\r
-     * @return parameter overrides\r
-     */\r
-    public String getParameterOverrides() {\r
-        String result = "";\r
-\r
-        if(consistsOf != null) {\r
-            for(Entity e : consistsOf) {\r
-                if(e instanceof ParameterOverride) {\r
-                    ParameterOverride po = (ParameterOverride) e;\r
-                    IndependentVariable var = po.getVariable();\r
-                    if(!Variability.CONTINUOUS.equals(Variability.getVariability(var, false, parentConfiguration))) {\r
-                        if(!result.isEmpty())\r
-                            result += ", ";\r
-\r
-                        result += po.getOverride();\r
-                    }\r
-\r
-                }\r
-            }\r
-        }\r
-\r
-        return result;\r
-    }\r
+       @RelatedValue(Layer0.URIs.HasName)\r
+       private String name;\r
+\r
+       @RelatedElement(Layer0.URIs.PartOf)\r
+       private Configuration parentConfiguration;\r
+\r
+       @RelatedElement(Layer0.URIs.InstanceOf)\r
+       private ModuleType type;\r
+\r
+       @RelatedElements(SysdynResource.URIs.Module_redeclaration)\r
+       private List<Redeclaration> redeclarations;\r
+\r
+       @RelatedElements(Layer0.URIs.ConsistsOf)\r
+       private List<Entity> consistsOf;\r
+\r
+       @Override\r
+       public void accept(IElementVisitorVoid v) {\r
+               v.visit(this);\r
+       }\r
+\r
+       public String getName() {\r
+               return name;\r
+       }\r
+\r
+       public ModuleType getType() {\r
+               return type;\r
+       }\r
+\r
+       /**\r
+        * Returns the declaration of a module with possible redeclared enumerations and parameter assignments\r
+        *\r
+        * <p>\r
+        * Enumeration redeclaration:\r
+        * parameter Integer Enum__size = Enum.size; <br>\r
+        * parameter Integer Enum__elements[:] = Enum.elements; <br>\r
+        * ModuleType ModuleType1(Enum.size = Enum__size, Enum.elements = Enum__elements); <br>\r
+        * \r
+        * <p>\r
+        * Temporary parameter variables are needed to avoid name conflicts when redeclaring an \r
+        * enumeration with the same name.\r
+        * \r
+        * @return Declaration of a module instance\r
+        */\r
+       public String getDeclaration() {\r
+\r
+\r
+               String enumerationRedeclarations = getEnumerationRedeclarations();\r
+               Pair<String, String> inputRedeclarations = getInputRedeclarations();\r
+               String parameterOverrides = getParameterOverrideString();\r
+\r
+               StringBuilder redeclarations = new StringBuilder();\r
+\r
+               if(!enumerationRedeclarations.isEmpty() || !inputRedeclarations.first.isEmpty() || !parameterOverrides.isEmpty()) {\r
+                       redeclarations.append("(");\r
+                       redeclarations.append(enumerationRedeclarations);\r
+\r
+                       String ir = inputRedeclarations.first;\r
+                       if(enumerationRedeclarations.isEmpty() && !inputRedeclarations.first.isEmpty())\r
+                               // remove first ", " if no enumeration redeclarations\r
+                               ir = inputRedeclarations.first.substring(2); \r
+                       redeclarations.append(ir);\r
+\r
+                       if(!parameterOverrides.isEmpty()) {\r
+                               if(redeclarations.length() > 1)\r
+                                       redeclarations.append(", ");\r
+                               redeclarations.append(parameterOverrides);\r
+                       }\r
+\r
+                       redeclarations.append(")");\r
+               }\r
+\r
+               StringBuilder sb = new StringBuilder();\r
+\r
+               // Possible reference variables\r
+               if(inputRedeclarations.second != null && !inputRedeclarations.second.isEmpty()) {\r
+                       sb.append(inputRedeclarations.second);\r
+               }\r
+\r
+               sb.append("    ");\r
+               sb.append(getType().getName());\r
+               sb.append(" ");\r
+               sb.append(getName());\r
+               sb.append(redeclarations.toString()); // possible redeclarations\r
+               sb.append(";\n");\r
+               return sb.toString();\r
+       }\r
+\r
+       /**\r
+        * Get possible enumeration redeclarations.\r
+        * @return enumeration redeclarations or empty string\r
+        */\r
+       private String getEnumerationRedeclarations() {\r
+               StringBuilder redeclarations = new StringBuilder();\r
+               if(!getRedeclarations().isEmpty()) {\r
+\r
+                       Iterator<Redeclaration> i = getRedeclarations().iterator();\r
+                       while(i.hasNext()) {\r
+                               Redeclaration rd = i.next();\r
+                               redeclarations.append(rd.getRedeclaration());\r
+                               if(i.hasNext())\r
+                                       redeclarations.append(",");\r
+                       }\r
+               }\r
+               return redeclarations.toString();\r
+       }\r
+\r
+       /**\r
+        * Get possible input redeclarations\r
+        * @return input redeclarations or empty string\r
+        */\r
+       private Pair<String, String> getInputRedeclarations() {\r
+               StringBuilder declarations = new StringBuilder();\r
+               StringBuilder references = new StringBuilder();\r
+\r
+               for(IElement element : parentConfiguration.getElements()) {\r
+                       if (element instanceof Dependency) {\r
+                               Dependency dependency = (Dependency)element;\r
+                               if(dependency.getHead().equals(this)){\r
+                                       Input reference = (Input)dependency.refersTo();\r
+                                       Variable outputVariable = (Variable)dependency.getTail();\r
+                                       String name = outputVariable.getName();\r
+\r
+                                       Module module = (Module)dependency.getHead();\r
+\r
+                                       if(reference != null && reference.getName() != null) {\r
+                                               if(reference.getVariability() == null || reference.getVariability().isEmpty())\r
+                                                       continue; // Only parameters and constants are redeclared\r
+\r
+                                                       for(IElement e : module.getType().getConfiguration().getElements()) {\r
+                                                               if(e instanceof Variable) {\r
+                                                                       Variable v = (Variable)e;\r
+\r
+                                                                       if(v.getName() != null && outputVariable.getName().equals(v.getName())) {\r
+                                                                               /*\r
+                                                                                *  The target module contains a variable with the same name. Need to\r
+                                                                                *  avoid Module(variable = variable) situations \r
+                                                                                */\r
+                                                                               String declaration;\r
+                                                                               if(outputVariable instanceof Input)\r
+                                                                                       declaration = ((Input)outputVariable).getDeclaration();\r
+                                                                               else\r
+                                                                                       declaration = ((IndependentVariable)outputVariable).getDeclaration();\r
+\r
+                                                                               if(declaration.contains("="))\r
+                                                                                       declaration = declaration.substring(0, declaration.indexOf("=") - 1); // Break to "="\r
+                                                                               else\r
+                                                                                       declaration = declaration.substring(0, declaration.length() - 2); // Remove ending ";\n" \r
+\r
+                                                                               name = outputVariable.getName() + "_reference";\r
+                                                                               declaration = declaration.replace(outputVariable.getName(), name);\r
+                                                                               declaration += " = " + outputVariable.getName() + " /* Reference value to avoid name conflicts in module instantiation */ ;\n";\r
+                                                                               references.append(declaration);\r
+                                                                               break;\r
+                                                                       }\r
+                                                               }\r
+                                                       }\r
+\r
+                                                       declarations.append(", " + reference.getName() + " = " + name);\r
+                                       }\r
+                               }\r
+                       }\r
+               }\r
+               return new Pair<String, String>(declarations.toString(), references.toString());\r
+       }\r
+\r
+       public Configuration getParentConfiguration() {\r
+               return this.parentConfiguration;\r
+       }\r
+\r
+       /**\r
+        * Return the list of the defined redeclarations for this module instance.\r
+        * \r
+        * @return List of the defined redeclarations or an empty list if redeclarations have not been set \r
+        */\r
+       public List<Redeclaration> getRedeclarations() {\r
+               if(redeclarations == null) {\r
+                       redeclarations = new ArrayList<Redeclaration>();\r
+               }\r
+               return redeclarations;\r
+       }\r
+\r
+\r
+       /**\r
+        * Get all parameter override elements for this module instance as a string "param = value, param2 = value2, ..."\r
+        * <p>\r
+        * Only used with game experiments. Other experiments use inits-file.\r
+        * @return parameter overrides\r
+        */\r
+       public String getParameterOverrideString() {\r
+               String result = "";\r
+\r
+               if(RepresentationUtils.isGameExperimentActive()) {\r
+                       for(ParameterOverride po : getParameterOverrides()) {\r
+                               IndependentVariable var = po.getVariable();\r
+                               if(!Variability.CONTINUOUS.equals(Variability.getVariability(var, false, parentConfiguration))) {\r
+                                       if(!result.isEmpty())\r
+                                               result += ", ";\r
+\r
+                                       result += po.getOverride();\r
+                               }\r
+                       }\r
+               }\r
+\r
+               return result;\r
+       }\r
+\r
+\r
+       /**\r
+        * Get all parameter overrides of this module instance\r
+        * @return\r
+        */\r
+       public Set<ParameterOverride> getParameterOverrides() {\r
+               HashSet<ParameterOverride> result = new HashSet<ParameterOverride>();\r
+               if(consistsOf != null) {\r
+                       for(Entity e : consistsOf) {\r
+                               if(e instanceof ParameterOverride) {\r
+                                       result.add( (ParameterOverride) e);\r
+                               }\r
+                       }\r
+               }\r
+               return result; \r
+       }\r
+\r
 \r
 }\r