From: lempinen Date: Fri, 8 Feb 2013 12:50:49 +0000 (+0000) Subject: Enabled parameter overrides for normal experiments. A flattened model is created... X-Git-Tag: simantics-1.10.1~44 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=a0836be8bce9392331d151448c83974e311bffbe;p=simantics%2Fsysdyn.git Enabled parameter overrides for normal experiments. A flattened model is created with OpenModelica 1.9 to find parameters, so also module instance parameters work automatically. (fixes #4060) git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@26743 ac1ea38d-2e2b-0410-8846-a27921b304fc --- diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/modelica/ModelicaWriter.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/modelica/ModelicaWriter.java index 23359334..2ced39d8 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/modelica/ModelicaWriter.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/modelica/ModelicaWriter.java @@ -11,7 +11,6 @@ *******************************************************************************/ package org.simantics.sysdyn.modelica; -import java.io.IOException; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -88,10 +87,7 @@ public class ModelicaWriter { // Insert spreadsheets String version = null; - try { - version = ModelicaManager.getOMCVersion(); - } catch (IOException e) { - } + version = ModelicaManager.getOMCVersion(); if(version != null && version.startsWith("1.9")) { b.insert(spreadsheetlocation, getGlobalSpreadSheets(configurations)); } else { diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Module.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Module.java index d9b329ef..15a8b729 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Module.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Module.java @@ -23,7 +23,6 @@ import org.simantics.objmap.annotations.RelatedElement; import org.simantics.objmap.annotations.RelatedElements; import org.simantics.objmap.annotations.RelatedValue; import org.simantics.sysdyn.SysdynResource; -import org.simantics.sysdyn.representation.utils.RepresentationUtils; import org.simantics.sysdyn.representation.visitors.IElementVisitorVoid; import org.simantics.utils.datastructures.Pair; @@ -226,24 +225,20 @@ public class Module implements IElement { /** * Get all parameter override elements for this module instance as a string "param = value, param2 = value2, ..." - *

- * Only used with game experiments. Other experiments use inits-file. * @return parameter overrides */ public String getParameterOverrideString() { - String result = ""; + String result = ""; - if(RepresentationUtils.isPartOfGameExperiment(this)) { - for(ParameterOverride po : getParameterOverrides()) { - IndependentVariable var = po.getVariable(); - if(!Variability.CONTINUOUS.equals(Variability.getVariability(var, false, parentConfiguration))) { - if(!result.isEmpty()) - result += ", "; + for(ParameterOverride po : getParameterOverrides()) { + IndependentVariable var = po.getVariable(); + if(!Variability.CONTINUOUS.equals(Variability.getVariability(var, false, parentConfiguration))) { + if(!result.isEmpty()) + result += ", "; - result += po.getOverride(); - } - } - } + result += po.getOverride(); + } + } return result; } diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/utils/FormatUtils.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/utils/FormatUtils.java index 0427225a..bb2d136a 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/utils/FormatUtils.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/utils/FormatUtils.java @@ -86,7 +86,7 @@ public class FormatUtils { } else { if(array) refName = "sum(" + refName + ")"; - condition= "if initial() or " + refName + " < 0 or " + + condition= "if " + refName + " < 0 or " + refName + " >= 0 then ("; }