From: lempinen Date: Tue, 16 Feb 2010 13:22:51 +0000 (+0000) Subject: Start and stop times for simulation X-Git-Tag: simantics-1.0~72 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=d67f21a943bf7816ecd8cd95387ef980ba912fe0;p=simantics%2Fsysdyn.git Start and stop times for simulation git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@14151 ac1ea38d-2e2b-0410-8846-a27921b304fc --- diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/SysdynProject.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/SysdynProject.java index d6105422..9cf036a7 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/SysdynProject.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/SysdynProject.java @@ -65,6 +65,8 @@ public class SysdynProject extends AbstractProjectFeature { g.claimValue(model, b.HasName, GraphUtils.findFreshName(g, "Configuration", library)); g.claim(model, b.InstanceOf, sr.Configuration); g.claim(model, b.PartOf, library); + g.claimValue(model, sr.HasStartTime, 0.0); + g.claimValue(model, sr.HasStopTime, 10.0); } catch(Exception e) { errorCallback.run(e); diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/SysdynResource.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/SysdynResource.java index e05b06da..da130921 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/SysdynResource.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/SysdynResource.java @@ -32,6 +32,8 @@ public class SysdynResource { public final Resource HasHead; public final Resource HasInitialEquation; public final Resource HasLookup; + public final Resource HasStartTime; + public final Resource HasStopTime; public final Resource HasTail; public final Resource HasType; public final Resource HasUnit; @@ -65,6 +67,8 @@ public class SysdynResource { public static final String HasHead = "http://www.simantics.org/Sysdyn#HasHead"; public static final String HasInitialEquation = "http://www.simantics.org/Sysdyn#HasInitialEquation"; public static final String HasLookup = "http://www.simantics.org/Sysdyn#HasLookup"; + public static final String HasStartTime = "http://www.simantics.org/Sysdyn#HasStartTime"; + public static final String HasStopTime = "http://www.simantics.org/Sysdyn#HasStopTime"; public static final String HasTail = "http://www.simantics.org/Sysdyn#HasTail"; public static final String HasType = "http://www.simantics.org/Sysdyn#HasType"; public static final String HasUnit = "http://www.simantics.org/Sysdyn#HasUnit"; @@ -108,6 +112,8 @@ public class SysdynResource { HasHead = getResourceOrNull(graph, URIs.HasHead); HasInitialEquation = getResourceOrNull(graph, URIs.HasInitialEquation); HasLookup = getResourceOrNull(graph, URIs.HasLookup); + HasStartTime = getResourceOrNull(graph, URIs.HasStartTime); + HasStopTime = getResourceOrNull(graph, URIs.HasStopTime); HasTail = getResourceOrNull(graph, URIs.HasTail); HasType = getResourceOrNull(graph, URIs.HasType); HasUnit = getResourceOrNull(graph, URIs.HasUnit); diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynModel.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynModel.java index c591b12c..e1eca430 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynModel.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynModel.java @@ -70,7 +70,9 @@ public class SysdynModel implements IMappingListener { result = ModelicaManager.runModelica( configuration.name, - writer.toString()); + writer.toString(), + configuration.startTime, + configuration.stopTime); } catch(Exception e) { e.printStackTrace(); result = null; diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Configuration.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Configuration.java index d2213134..8fef48c3 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Configuration.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Configuration.java @@ -14,6 +14,12 @@ public class Configuration { @RelatedValue("http://www.vtt.fi/Simantics/Layer0/1.0/Relations#HasName") public String name = "Unnamed"; + @RelatedValue("http://www.simantics.org/Sysdyn#HasStartTime") + public Double startTime = 0.0; + + @RelatedValue("http://www.simantics.org/Sysdyn#HasStopTime") + public Double stopTime = 10.0; + @RelatedElements( value = "http://www.vtt.fi/Simantics/Layer0/1.0/Relations#ConsistsOf", composition = true)