stoichiometricCoefHash) {
+ super(nodeObject,-1);
+ this.speciesReferenceID = speciesReferenceID;
+ this.stoichiometricCoefHash = stoichiometricCoefHash;
+ }
+
+ /**
+ * Constructor for rules that refer to a species
+ * @param nodeObject
+ * @param index
+ * @param sp
+ * @param compartmentIndex
+ * @param hasZeroSpatialDimensions
+ * @param valueHolder
+ */
+ public AssignmentRuleValue(ASTNodeValue nodeObject, int index,
+ Species sp, int compartmentIndex, boolean hasZeroSpatialDimensions, SBMLValueHolder valueHolder) {
+ super(nodeObject, index, sp, compartmentIndex, hasZeroSpatialDimensions, valueHolder);
+ }
+ /**
+ * Processes the rule and saves the new value of the corresponding variable in the Y vector if changeY is set to true.
+ * @param Y
+ * @param time
+ * @param changeY
+ * @return Has there been a change in the Y vector caused by the rule?
+ */
+ public boolean processRule(double[] Y, double time, boolean changeY) {
+ processAssignmentVariable(time);
+ if(index>=0) {
+ double oldValue=Y[index];
+ if(changeY) {
+ Y[index] = value;
+ }
+ if(oldValue!=value) {
+ return true;
+ }
+ }
+ else if(speciesReferenceID!=null) {
+ Double v=stoichiometricCoefHash.get(speciesReferenceID);
+ stoichiometricCoefHash.put(speciesReferenceID, value);
+
+ if((v!=null) && (v.doubleValue()!=value)) {
+ return true;
+ }
+ }
+ return false;
+
+ }
+
+ /**
+ * Returns the id of the species reference (if present), null otherwise.
+ * @return id
+ */
+ public String getSpeciesReferenceID() {
+ return speciesReferenceID;
+ }
+
}
diff --git a/src/org/simulator/sbml/astnode/CompartmentOrParameterValue.java b/src/org/simulator/sbml/astnode/CompartmentOrParameterValue.java
index 0e7c6559..8d8c8341 100644
--- a/src/org/simulator/sbml/astnode/CompartmentOrParameterValue.java
+++ b/src/org/simulator/sbml/astnode/CompartmentOrParameterValue.java
@@ -5,7 +5,7 @@
* This file is part of Simulation Core Library, a Java-based library
* for efficient numerical simulation of biological models.
*
- * Copyright (C) 2007-2013 jointly by the following organizations:
+ * Copyright (C) 2007-2012 jointly by the following organizations:
* 1. University of Tuebingen, Germany
* 2. Keio University, Japan
* 3. Harvard University, USA
@@ -79,14 +79,8 @@ public CompartmentOrParameterValue(ASTNodeInterpreter interpreter, ASTNode node,
* @see org.simulator.sbml.astnode.ASTNodeValue#computeDoubleValue()
*/
@Override
- protected void computeDoubleValue(double delay) {
- if(delay == 0) {
- doubleValue = valueHolder.getCurrentValueOf(position);
- }
- else {
- double valueTime = interpreter.symbolTime() - delay;
- doubleValue = valueHolder.computeDelayedValue(valueTime, id, null, null, 0);
- }
+ protected void computeDoubleValue() {
+ doubleValue=valueHolder.getCurrentValueOf(position);
}
}
diff --git a/src/org/simulator/sbml/astnode/DivideValue.java b/src/org/simulator/sbml/astnode/DivideValue.java
index 53834d19..02a9310f 100644
--- a/src/org/simulator/sbml/astnode/DivideValue.java
+++ b/src/org/simulator/sbml/astnode/DivideValue.java
@@ -5,7 +5,7 @@
* This file is part of Simulation Core Library, a Java-based library
* for efficient numerical simulation of biological models.
*
- * Copyright (C) 2007-2013 jointly by the following organizations:
+ * Copyright (C) 2007-2012 jointly by the following organizations:
* 1. University of Tuebingen, Germany
* 2. Keio University, Japan
* 3. Harvard University, USA
@@ -46,13 +46,13 @@ public DivideValue(ASTNodeInterpreter interpreter, ASTNode node) {
* (non-Javadoc)
* @see org.simulator.sbml.astnode.ASTNodeValue#computeDoubleValue()
*/
- protected void computeDoubleValue(double delay) {
+ protected void computeDoubleValue() {
if (numChildren != 2) {
throw new SBMLException(MessageFormat.format(
"Fractions must have one numerator and one denominator, here {0,number,integer} elements are given.",
node.getChildCount()));
}
- doubleValue = interpreter.frac(leftChild, rightChild, time, delay);
+ doubleValue = interpreter.frac(leftChild, rightChild, time);
}
}
diff --git a/src/org/simulator/sbml/astnode/FunctionValue.java b/src/org/simulator/sbml/astnode/FunctionValue.java
index 1daca2b6..c1e72674 100644
--- a/src/org/simulator/sbml/astnode/FunctionValue.java
+++ b/src/org/simulator/sbml/astnode/FunctionValue.java
@@ -5,7 +5,7 @@
* This file is part of Simulation Core Library, a Java-based library
* for efficient numerical simulation of biological models.
*
- * Copyright (C) 2007-2013 jointly by the following organizations:
+ * Copyright (C) 2007-2012 jointly by the following organizations:
* 1. University of Tuebingen, Germany
* 2. Keio University, Japan
* 3. Harvard University, USA
@@ -114,7 +114,7 @@ public FunctionValue(ASTNodeInterpreter interpreter,
* @see org.sbml.simulator.math.astnode.ASTNodeObject#computeDoubleValue()
*/
@Override
- protected void computeDoubleValue(double delay) {
+ protected void computeDoubleValue() {
if (math != null) {
doubleValue = interpreter.functionDouble(evaluationBlock, variables, children, numChildren, argumentValues, time);
} else {
diff --git a/src/org/simulator/sbml/astnode/IntegerValue.java b/src/org/simulator/sbml/astnode/IntegerValue.java
index fd4269ce..1381a105 100644
--- a/src/org/simulator/sbml/astnode/IntegerValue.java
+++ b/src/org/simulator/sbml/astnode/IntegerValue.java
@@ -5,7 +5,7 @@
* This file is part of Simulation Core Library, a Java-based library
* for efficient numerical simulation of biological models.
*
- * Copyright (C) 2007-2013 jointly by the following organizations:
+ * Copyright (C) 2007-2012 jointly by the following organizations:
* 1. University of Tuebingen, Germany
* 2. Keio University, Japan
* 3. Harvard University, USA
@@ -43,7 +43,7 @@ public IntegerValue(ASTNodeInterpreter interpreter, ASTNode node) {
* (non-Javadoc)
* @see org.simulator.sbml.astnode.ASTNodeValue#computeDoubleValue()
*/
- protected void computeDoubleValue(double delay) {
+ protected void computeDoubleValue() {
doubleValue = interpreter.compile(real, units);
}
diff --git a/src/org/simulator/sbml/astnode/LocalParameterValue.java b/src/org/simulator/sbml/astnode/LocalParameterValue.java
index 7bfee12a..2fd8264d 100644
--- a/src/org/simulator/sbml/astnode/LocalParameterValue.java
+++ b/src/org/simulator/sbml/astnode/LocalParameterValue.java
@@ -5,7 +5,7 @@
* This file is part of Simulation Core Library, a Java-based library
* for efficient numerical simulation of biological models.
*
- * Copyright (C) 2007-2013 jointly by the following organizations:
+ * Copyright (C) 2007-2012 jointly by the following organizations:
* 1. University of Tuebingen, Germany
* 2. Keio University, Japan
* 3. Harvard University, USA
@@ -58,7 +58,7 @@ public LocalParameterValue(ASTNodeInterpreter interpreter, ASTNode node,
* @see org.simulator.sbml.astnode.ASTNodeValue#compileDouble(double)
*/
@Override
- public double compileDouble(double time, double delay) {
+ public double compileDouble(double time) {
this.time=time;
if(alreadyProcessed == false) {
doubleValue = lp.getValue();
diff --git a/src/org/simulator/sbml/astnode/MinusValue.java b/src/org/simulator/sbml/astnode/MinusValue.java
index 8082bf8b..45d8e51e 100644
--- a/src/org/simulator/sbml/astnode/MinusValue.java
+++ b/src/org/simulator/sbml/astnode/MinusValue.java
@@ -5,7 +5,7 @@
* This file is part of Simulation Core Library, a Java-based library
* for efficient numerical simulation of biological models.
*
- * Copyright (C) 2007-2013 jointly by the following organizations:
+ * Copyright (C) 2007-2012 jointly by the following organizations:
* 1. University of Tuebingen, Germany
* 2. Keio University, Japan
* 3. Harvard University, USA
@@ -43,11 +43,11 @@ public MinusValue(ASTNodeInterpreter interpreter, ASTNode node) {
* (non-Javadoc)
* @see org.simulator.sbml.astnode.ASTNodeValue#computeDoubleValue()
*/
- protected void computeDoubleValue(double delay) {
+ protected void computeDoubleValue() {
if (numChildren == 1) {
- doubleValue = interpreter.uMinus(leftChild, time, delay);
+ doubleValue = interpreter.uMinus(leftChild, time);
} else {
- doubleValue = interpreter.minus(children, numChildren, time, delay);
+ doubleValue = interpreter.minus(children, numChildren, time);
}
}
diff --git a/src/org/simulator/sbml/astnode/NamedValue.java b/src/org/simulator/sbml/astnode/NamedValue.java
index be5848d6..045bd19a 100644
--- a/src/org/simulator/sbml/astnode/NamedValue.java
+++ b/src/org/simulator/sbml/astnode/NamedValue.java
@@ -5,7 +5,7 @@
* This file is part of Simulation Core Library, a Java-based library
* for efficient numerical simulation of biological models.
*
- * Copyright (C) 2007-2013 jointly by the following organizations:
+ * Copyright (C) 2007-2012 jointly by the following organizations:
* 1. University of Tuebingen, Germany
* 2. Keio University, Japan
* 3. Harvard University, USA
@@ -56,7 +56,7 @@ public NamedValue(ASTNodeInterpreter interpreter, ASTNode node, FunctionValue fu
* (non-Javadoc)
* @see org.simulator.sbml.astnode.ASTNodeValue#computeDoubleValue()
*/
- protected void computeDoubleValue(double delay) {
+ protected void computeDoubleValue() {
doubleValue=function.getArgumentValues()[index];
}
diff --git a/src/org/simulator/sbml/astnode/PlusValue.java b/src/org/simulator/sbml/astnode/PlusValue.java
index 50e06da2..c6aef79a 100755
--- a/src/org/simulator/sbml/astnode/PlusValue.java
+++ b/src/org/simulator/sbml/astnode/PlusValue.java
@@ -5,7 +5,7 @@
* This file is part of Simulation Core Library, a Java-based library
* for efficient numerical simulation of biological models.
*
- * Copyright (C) 2007-2013 jointly by the following organizations:
+ * Copyright (C) 2007-2012 jointly by the following organizations:
* 1. University of Tuebingen, Germany
* 2. Keio University, Japan
* 3. Harvard University, USA
@@ -43,8 +43,8 @@ public PlusValue(ASTNodeInterpreter interpreter, ASTNode node) {
* (non-Javadoc)
* @see org.simulator.sbml.astnode.ASTNodeValue#computeDoubleValue()
*/
- protected void computeDoubleValue(double delay) {
- doubleValue = interpreter.plus(children, numChildren, time, delay);
+ protected void computeDoubleValue() {
+ doubleValue = interpreter.plus(children, numChildren, time);
}
}
diff --git a/src/org/simulator/sbml/astnode/PowerValue.java b/src/org/simulator/sbml/astnode/PowerValue.java
index 61201218..0d842a88 100644
--- a/src/org/simulator/sbml/astnode/PowerValue.java
+++ b/src/org/simulator/sbml/astnode/PowerValue.java
@@ -5,7 +5,7 @@
* This file is part of Simulation Core Library, a Java-based library
* for efficient numerical simulation of biological models.
*
- * Copyright (C) 2007-2013 jointly by the following organizations:
+ * Copyright (C) 2007-2012 jointly by the following organizations:
* 1. University of Tuebingen, Germany
* 2. Keio University, Japan
* 3. Harvard University, USA
@@ -43,8 +43,8 @@ public PowerValue(ASTNodeInterpreter interpreter, ASTNode node) {
* (non-Javadoc)
* @see org.simulator.sbml.astnode.ASTNodeValue#computeDoubleValue()
*/
- protected void computeDoubleValue(double delay) {
- doubleValue = interpreter.pow(leftChild, rightChild, time, delay);
+ protected void computeDoubleValue() {
+ doubleValue = interpreter.pow(leftChild, rightChild, time);
}
}
diff --git a/src/org/simulator/sbml/astnode/RateRuleValue.java b/src/org/simulator/sbml/astnode/RateRuleValue.java
index 1e6ccb85..81c899f5 100644
--- a/src/org/simulator/sbml/astnode/RateRuleValue.java
+++ b/src/org/simulator/sbml/astnode/RateRuleValue.java
@@ -5,7 +5,7 @@
* This file is part of Simulation Core Library, a Java-based library
* for efficient numerical simulation of biological models.
*
- * Copyright (C) 2007-2013 jointly by the following organizations:
+ * Copyright (C) 2007-2012 jointly by the following organizations:
* 1. University of Tuebingen, Germany
* 2. Keio University, Japan
* 3. Harvard University, USA
diff --git a/src/org/simulator/sbml/astnode/ReactionValue.java b/src/org/simulator/sbml/astnode/ReactionValue.java
index 402fa40e..9abc6d94 100644
--- a/src/org/simulator/sbml/astnode/ReactionValue.java
+++ b/src/org/simulator/sbml/astnode/ReactionValue.java
@@ -5,7 +5,7 @@
* This file is part of Simulation Core Library, a Java-based library
* for efficient numerical simulation of biological models.
*
- * Copyright (C) 2007-2013 jointly by the following organizations:
+ * Copyright (C) 2007-2012 jointly by the following organizations:
* 1. University of Tuebingen, Germany
* 2. Keio University, Japan
* 3. Harvard University, USA
@@ -65,10 +65,10 @@ public ReactionValue(ASTNodeInterpreter interpreter, ASTNode node,
* (non-Javadoc)
* @see org.simulator.sbml.astnode.ASTNodeValue#computeDoubleValue()
*/
- protected void computeDoubleValue(double delay) {
+ protected void computeDoubleValue() {
doubleValue = Double.NaN;
if (kineticLawUserObject != null) {
- doubleValue = kineticLawUserObject.compileDouble(time, delay);
+ doubleValue = kineticLawUserObject.compileDouble(time);
}
}
diff --git a/src/org/simulator/sbml/astnode/RootFunctionValue.java b/src/org/simulator/sbml/astnode/RootFunctionValue.java
index 254e989d..f454a74f 100644
--- a/src/org/simulator/sbml/astnode/RootFunctionValue.java
+++ b/src/org/simulator/sbml/astnode/RootFunctionValue.java
@@ -5,7 +5,7 @@
* This file is part of Simulation Core Library, a Java-based library
* for efficient numerical simulation of biological models.
*
- * Copyright (C) 2007-2013 jointly by the following organizations:
+ * Copyright (C) 2007-2012 jointly by the following organizations:
* 1. University of Tuebingen, Germany
* 2. Keio University, Japan
* 3. Harvard University, USA
@@ -64,23 +64,23 @@ public RootFunctionValue(ASTNodeInterpreter interpreter, ASTNode node) {
* (non-Javadoc)
* @see org.simulator.sbml.astnode.ASTNodeValue#computeDoubleValue()
*/
- protected void computeDoubleValue(double delay) {
+ protected void computeDoubleValue() {
if (numChildren == 2) {
if (leftChildrenNumeric) {
if (leftDoubleValue == 2) {
- doubleValue = interpreter.sqrt(rightChild, time, delay);
+ doubleValue = interpreter.sqrt(rightChild, time);
} else {
- doubleValue = interpreter.root(leftDoubleValue, rightChild, time, delay);
+ doubleValue = interpreter.root(leftDoubleValue, rightChild, time);
}
} else {
doubleValue = interpreter.root(leftChild,
- rightChild, time, delay);
+ rightChild, time);
}
} else if (numChildren == 1) {
- doubleValue = interpreter.sqrt(rightChild, time, delay);
+ doubleValue = interpreter.sqrt(rightChild, time);
} else {
doubleValue = interpreter.root(leftChild,
- rightChild, time, delay);
+ rightChild, time);
}
}
diff --git a/src/org/simulator/sbml/astnode/RuleValue.java b/src/org/simulator/sbml/astnode/RuleValue.java
index 9796953a..4b571d73 100644
--- a/src/org/simulator/sbml/astnode/RuleValue.java
+++ b/src/org/simulator/sbml/astnode/RuleValue.java
@@ -5,7 +5,7 @@
* This file is part of Simulation Core Library, a Java-based library
* for efficient numerical simulation of biological models.
*
- * Copyright (C) 2007-2013 jointly by the following organizations:
+ * Copyright (C) 2007-2012 jointly by the following organizations:
* 1. University of Tuebingen, Germany
* 2. Keio University, Japan
* 3. Harvard University, USA
@@ -121,7 +121,7 @@ public RuleValue(ASTNodeValue nodeObject, int index,
* @return value the computed value of the variable
*/
protected double processAssignmentVariable(double time) {
- value = nodeObject.compileDouble(time, 0d);
+ value = nodeObject.compileDouble(time);
if(isSpecies && !hasZeroSpatialDimensions) {
double compartmentValue = valueHolder
.getCurrentValueOf(compartmentIndex);
diff --git a/src/org/simulator/sbml/astnode/SpeciesReferenceValue.java b/src/org/simulator/sbml/astnode/SpeciesReferenceValue.java
index 713a1062..61229e59 100644
--- a/src/org/simulator/sbml/astnode/SpeciesReferenceValue.java
+++ b/src/org/simulator/sbml/astnode/SpeciesReferenceValue.java
@@ -5,7 +5,7 @@
* This file is part of Simulation Core Library, a Java-based library
* for efficient numerical simulation of biological models.
*
- * Copyright (C) 2007-2013 jointly by the following organizations:
+ * Copyright (C) 2007-2012 jointly by the following organizations:
* 1. University of Tuebingen, Germany
* 2. Keio University, Japan
* 3. Harvard University, USA
@@ -62,7 +62,7 @@ public SpeciesReferenceValue(ASTNodeInterpreter interpreter,
* (non-Javadoc)
* @see org.simulator.sbml.astnode.ASTNodeValue#computeDoubleValue()
*/
- protected void computeDoubleValue(double delay) {
+ protected void computeDoubleValue() {
doubleValue = valueHolder.getCurrentStoichiometry(id);
}
}
diff --git a/src/org/simulator/sbml/astnode/SpeciesValue.java b/src/org/simulator/sbml/astnode/SpeciesValue.java
index 91d9e5da..423db9d2 100644
--- a/src/org/simulator/sbml/astnode/SpeciesValue.java
+++ b/src/org/simulator/sbml/astnode/SpeciesValue.java
@@ -5,7 +5,7 @@
* This file is part of Simulation Core Library, a Java-based library
* for efficient numerical simulation of biological models.
*
- * Copyright (C) 2007-2013 jointly by the following organizations:
+ * Copyright (C) 2007-2012 jointly by the following organizations:
* 1. University of Tuebingen, Germany
* 2. Keio University, Japan
* 3. Harvard University, USA
@@ -33,56 +33,50 @@
* @since 1.0
*/
public class SpeciesValue extends ASTNodeValue {
- /**
- * The corresponding species
- */
+ /**
+ * The corresponding species
+ */
protected Species s;
-
+
/**
* The id of the species
*/
- protected String id;
-
- /**
- * The value holder that stores the current simulation results
- */
- protected SBMLValueHolder valueHolder;
-
- /**
- * Is the Y value of the species referring to an amount?
- */
- protected boolean isAmount;
-
- /**
- * The hasOnlySubstanceUnits attribute of the species
- */
- protected boolean hasOnlySubstanceUnits;
-
- /**
- * Has the species an initial concentration set?
- */
- protected boolean isSetInitialConcentration;
-
- /**
- * The position of the species value in the Y vector of the value holder
- */
- protected int position;
-
- /**
- * The position of the compartment value of the species in the Y vector of
- * the value holder
- */
- protected int compartmentPosition;
-
- /**
- * Has the compartment of the species no spatial dimensions?
- */
- protected boolean zeroSpatialDimensions;
-
- /**
- * The id of the compartment of the species
- */
- private String compartmentID;
+ protected String id;
+
+ /**
+ * The value holder that stores the current simulation results
+ */
+ protected SBMLValueHolder valueHolder;
+
+ /**
+ * Is the Y value of the species referring to an amount?
+ */
+ protected boolean isAmount;
+
+ /**
+ * The hasOnlySubstanceUnits attribute of the species
+ */
+ protected boolean hasOnlySubstanceUnits;
+
+ /**
+ * Has the species an initial concentration set?
+ */
+ protected boolean isSetInitialConcentration;
+
+ /**
+ * The position of the species value in the Y vector of the value holder
+ */
+ protected int position;
+
+ /**
+ * The position of the compartment value of the species in the Y vector of the value holder
+ */
+ protected int compartmentPosition;
+
+ /**
+ * Has the compartment of the species no spatial dimensions?
+ */
+ protected boolean zeroSpatialDimensions;
/**
*
@@ -92,12 +86,10 @@ public class SpeciesValue extends ASTNodeValue {
* @param valueHolder
* @param position
* @param compartmentPosition
- * @param compartmentID
* @param zeroSpatialDimensions
- * @param isAmount
*/
public SpeciesValue(ASTNodeInterpreter interpreter, ASTNode node,
- Species s, SBMLValueHolder valueHolder, int position, int compartmentPosition, String compartmentID, boolean zeroSpatialDimensions, boolean isAmount) {
+ Species s, SBMLValueHolder valueHolder, int position, int compartmentPosition, boolean zeroSpatialDimensions, boolean isAmount) {
super(interpreter, node);
this.s = s;
this.id = s.getId();
@@ -107,7 +99,6 @@ public SpeciesValue(ASTNodeInterpreter interpreter, ASTNode node,
this.hasOnlySubstanceUnits = s.getHasOnlySubstanceUnits();
this.position = position;
this.compartmentPosition = compartmentPosition;
- this.compartmentID = compartmentID;
this.zeroSpatialDimensions = zeroSpatialDimensions;
}
@@ -116,63 +107,30 @@ public SpeciesValue(ASTNodeInterpreter interpreter, ASTNode node,
* @see org.simulator.sbml.astnode.ASTNodeValue#computeDoubleValue()
*/
@Override
- protected void computeDoubleValue(double delay) {
- if(delay == 0) {
- if (isAmount && !hasOnlySubstanceUnits) {
- double compartmentValue = valueHolder
- .getCurrentValueOf(compartmentPosition);
- if ((compartmentValue == 0d) || zeroSpatialDimensions) {
- doubleValue = valueHolder.getCurrentValueOf(position);
- } else {
- doubleValue = valueHolder.getCurrentValueOf(position)
- / compartmentValue;
-
- }
- } else if (!isAmount && hasOnlySubstanceUnits) {
- double compartmentValue = valueHolder
- .getCurrentValueOf(compartmentPosition);
- if ((compartmentValue == 0d) || zeroSpatialDimensions) {
- doubleValue = valueHolder.getCurrentValueOf(position);
- } else {
- doubleValue = valueHolder.getCurrentValueOf(position)
- * compartmentValue;
- }
- } else {
+ protected void computeDoubleValue() {
+ if (isAmount && !hasOnlySubstanceUnits) {
+ double compartmentValue = valueHolder
+ .getCurrentValueOf(compartmentPosition);
+ if ((compartmentValue == 0d) || zeroSpatialDimensions) {
doubleValue = valueHolder.getCurrentValueOf(position);
+ } else {
+ doubleValue = valueHolder.getCurrentValueOf(position)
+ / compartmentValue;
}
- }
- else {
- double valueTime = interpreter.symbolTime() - delay;
-
-
- if (isAmount && !hasOnlySubstanceUnits) {
- double compartmentValue = valueHolder
- .computeDelayedValue(valueTime, compartmentID, null, null, 0);
- if ((compartmentValue == 0d) || zeroSpatialDimensions) {
- doubleValue = valueHolder.computeDelayedValue(valueTime, id, null, null, 0);
- } else {
- doubleValue = valueHolder.computeDelayedValue(valueTime, id, null, null, 0)
- / compartmentValue;
-
- }
- } else if (!isAmount && hasOnlySubstanceUnits) {
- double compartmentValue = valueHolder
- .computeDelayedValue(valueTime, compartmentID, null, null, 0);
- if ((compartmentValue == 0d) || zeroSpatialDimensions) {
- doubleValue = valueHolder.computeDelayedValue(valueTime, id, null, null, 0);
- } else {
- doubleValue = valueHolder.computeDelayedValue(valueTime, id, null, null, 0)
- * compartmentValue;
- }
+ } else if (!isAmount && hasOnlySubstanceUnits) {
+ double compartmentValue = valueHolder
+ .getCurrentValueOf(compartmentPosition);
+ if ((compartmentValue == 0d) || zeroSpatialDimensions) {
+ doubleValue = valueHolder.getCurrentValueOf(position);
} else {
- doubleValue = valueHolder.computeDelayedValue(valueTime, id, null, null, 0);
-
+ doubleValue = valueHolder.getCurrentValueOf(position)
+ * compartmentValue;
}
- }
-
-
-
+ } else {
+ doubleValue = valueHolder.getCurrentValueOf(position);
+
+ }
}
}
diff --git a/src/org/simulator/sbml/astnode/StoichiometryValue.java b/src/org/simulator/sbml/astnode/StoichiometryValue.java
index bd2f0b92..1e9b49de 100644
--- a/src/org/simulator/sbml/astnode/StoichiometryValue.java
+++ b/src/org/simulator/sbml/astnode/StoichiometryValue.java
@@ -5,7 +5,7 @@
* This file is part of Simulation Core Library, a Java-based library
* for efficient numerical simulation of biological models.
*
- * Copyright (C) 2007-2013 jointly by the following organizations:
+ * Copyright (C) 2007-2012 jointly by the following organizations:
* 1. University of Tuebingen, Germany
* 2. Keio University, Japan
* 3. Harvard University, USA
@@ -136,7 +136,7 @@ private void computeStoichiometricValue() {
stoichiometrySet=true;
} else {
if (isSetStoichiometryMath) {
- stoichiometry = stoichiometryMathValue.compileDouble(time, 0d);
+ stoichiometry = stoichiometryMathValue.compileDouble(time);
stoichiometrySet=true;
} else if ((!sr.isSetStoichiometry()) && (sr.getLevel() >= 3)) {
stoichiometry = 1d;
diff --git a/src/org/simulator/sbml/astnode/TimesValue.java b/src/org/simulator/sbml/astnode/TimesValue.java
index 75c70180..4102e297 100644
--- a/src/org/simulator/sbml/astnode/TimesValue.java
+++ b/src/org/simulator/sbml/astnode/TimesValue.java
@@ -5,7 +5,7 @@
* This file is part of Simulation Core Library, a Java-based library
* for efficient numerical simulation of biological models.
*
- * Copyright (C) 2007-2013 jointly by the following organizations:
+ * Copyright (C) 2007-2012 jointly by the following organizations:
* 1. University of Tuebingen, Germany
* 2. Keio University, Japan
* 3. Harvard University, USA
@@ -44,8 +44,8 @@ public TimesValue(ASTNodeInterpreter interpreter, ASTNode node) {
* (non-Javadoc)
* @see org.simulator.sbml.astnode.ASTNodeValue#computeDoubleValue()
*/
- protected void computeDoubleValue(double delay) {
- doubleValue = interpreter.times(children, numChildren, time, delay);
+ protected void computeDoubleValue() {
+ doubleValue = interpreter.times(children, numChildren, time);
}
}
diff --git a/src/org/simulator/sbml/astnode/package-info.java b/src/org/simulator/sbml/astnode/package-info.java
index cda3ecbf..a4dbf030 100644
--- a/src/org/simulator/sbml/astnode/package-info.java
+++ b/src/org/simulator/sbml/astnode/package-info.java
@@ -5,7 +5,7 @@
* This file is part of Simulation Core Library, a Java-based library
* for efficient numerical simulation of biological models.
*
- * Copyright (C) 2007-2013 jointly by the following organizations:
+ * Copyright (C) 2007-2012 jointly by the following organizations:
* 1. University of Tuebingen, Germany
* 2. Keio University, Japan
* 3. Harvard University, USA
diff --git a/src/org/simulator/sbml/package-info.java b/src/org/simulator/sbml/package-info.java
index 3b4ec401..d20ed168 100755
--- a/src/org/simulator/sbml/package-info.java
+++ b/src/org/simulator/sbml/package-info.java
@@ -5,7 +5,7 @@
* This file is part of Simulation Core Library, a Java-based library
* for efficient numerical simulation of biological models.
*
- * Copyright (C) 2007-2013 jointly by the following organizations:
+ * Copyright (C) 2007-2012 jointly by the following organizations:
* 1. University of Tuebingen, Germany
* 2. Keio University, Japan
* 3. Harvard University, USA
diff --git a/src/org/simulator/sedml/ExecutionException.java b/src/org/simulator/sedml/ExecutionException.java
index 9aa83d59..ab6c1200 100644
--- a/src/org/simulator/sedml/ExecutionException.java
+++ b/src/org/simulator/sedml/ExecutionException.java
@@ -5,7 +5,7 @@
* This file is part of Simulation Core Library, a Java-based library
* for efficient numerical simulation of biological models.
*
- * Copyright (C) 2007-2013 jointly by the following organizations:
+ * Copyright (C) 2007-2012 jointly by the following organizations:
* 1. University of Tuebingen, Germany
* 2. Keio University, Japan
* 3. Harvard University, USA
diff --git a/src/org/simulator/sedml/MultTableSEDMLWrapper.java b/src/org/simulator/sedml/MultTableSEDMLWrapper.java
index 1870182c..c87d8ba6 100644
--- a/src/org/simulator/sedml/MultTableSEDMLWrapper.java
+++ b/src/org/simulator/sedml/MultTableSEDMLWrapper.java
@@ -5,7 +5,7 @@
* This file is part of Simulation Core Library, a Java-based library
* for efficient numerical simulation of biological models.
*
- * Copyright (C) 2007-2013 jointly by the following organizations:
+ * Copyright (C) 2007-2012 jointly by the following organizations:
* 1. University of Tuebingen, Germany
* 2. Keio University, Japan
* 3. Harvard University, USA
diff --git a/src/org/simulator/sedml/SEDMLExecutor.java b/src/org/simulator/sedml/SEDMLExecutor.java
index a899947e..ccafe670 100644
--- a/src/org/simulator/sedml/SEDMLExecutor.java
+++ b/src/org/simulator/sedml/SEDMLExecutor.java
@@ -5,7 +5,7 @@
* This file is part of Simulation Core Library, a Java-based library
* for efficient numerical simulation of biological models.
*
- * Copyright (C) 2007-2013 jointly by the following organizations:
+ * Copyright (C) 2007-2012 jointly by the following organizations:
* 1. University of Tuebingen, Germany
* 2. Keio University, Japan
* 3. Harvard University, USA
diff --git a/src/org/simulator/sedml/SEDMLWriter.java b/src/org/simulator/sedml/SEDMLWriter.java
index 4c5b0fed..dc843d33 100644
--- a/src/org/simulator/sedml/SEDMLWriter.java
+++ b/src/org/simulator/sedml/SEDMLWriter.java
@@ -5,7 +5,7 @@
* This file is part of Simulation Core Library, a Java-based library
* for efficient numerical simulation of biological models.
*
- * Copyright (C) 2007-2013 jointly by the following organizations:
+ * Copyright (C) 2007-2012 jointly by the following organizations:
* 1. University of Tuebingen, Germany
* 2. Keio University, Japan
* 3. Harvard University, USA
diff --git a/src/org/simulator/sedml/SedMLSBMLSimulatorExecutor.java b/src/org/simulator/sedml/SedMLSBMLSimulatorExecutor.java
index 9c311870..f0e77fca 100644
--- a/src/org/simulator/sedml/SedMLSBMLSimulatorExecutor.java
+++ b/src/org/simulator/sedml/SedMLSBMLSimulatorExecutor.java
@@ -5,7 +5,7 @@
* This file is part of Simulation Core Library, a Java-based library
* for efficient numerical simulation of biological models.
*
- * Copyright (C) 2007-2013 jointly by the following organizations:
+ * Copyright (C) 2007-2012 jointly by the following organizations:
* 1. University of Tuebingen, Germany
* 2. Keio University, Japan
* 3. Harvard University, USA
diff --git a/src/org/simulator/sedml/package-info.java b/src/org/simulator/sedml/package-info.java
index f2c86c7d..fd3af90b 100755
--- a/src/org/simulator/sedml/package-info.java
+++ b/src/org/simulator/sedml/package-info.java
@@ -5,7 +5,7 @@
* This file is part of Simulation Core Library, a Java-based library
* for efficient numerical simulation of biological models.
*
- * Copyright (C) 2007-2013 jointly by the following organizations:
+ * Copyright (C) 2007-2012 jointly by the following organizations:
* 1. University of Tuebingen, Germany
* 2. Keio University, Japan
* 3. Harvard University, USA
@@ -31,8 +31,6 @@
*
* Classes for storing and interpreting an SBML model. The most important
* class is SBMLinterpreter that can return the current vector of
- * derivatives to the solver.
- *
- * @author Richard Adams
+ * derivatives to the solver.
*/
package org.simulator.sedml;
diff --git a/src/overview.html b/src/overview.html
index 534ce9a4..85ec2175 100644
--- a/src/overview.html
+++ b/src/overview.html
@@ -133,7 +133,7 @@
Using SED-ML for simulation
- SEDMLDocument doc = Libsedml.readDocument(f);
+ SEDMLDocument doc = Libsedml.readDocument(f);
SedML sedml = doc.getSBMLModel();
Output wanted = sedml.getOutputs().get(0);
SedMLSBMLSimulatorExecutor exe = new SedMLSBMLSimulatorExecutor(sedml, wanted);
diff --git a/test/org/simulator/SBMLTestSuiteRunner.java b/test/org/simulator/SBMLTestSuiteRunner.java
index 2db3317e..d7d58cfd 100644
--- a/test/org/simulator/SBMLTestSuiteRunner.java
+++ b/test/org/simulator/SBMLTestSuiteRunner.java
@@ -5,7 +5,7 @@
* This file is part of Simulation Core Library, a Java-based library
* for efficient numerical simulation of biological models.
*
- * Copyright (C) 2007-2013 jointly by the following organizations:
+ * Copyright (C) 2007-2012 jointly by the following organizations:
* 1. University of Tuebingen, Germany
* 2. Keio University, Japan
* 3. Harvard University, USA
@@ -371,7 +371,7 @@ public static void testRosenbrockSolver(String file, int from, int to)
int errors = 0;
int nModels = 0;
int correctSimulations = 0;
- RosenbrockSolver solver = new RosenbrockSolver();
+ AbstractDESSolver solver = new RosenbrockSolver();
int[] numberOfModels = new int[6];
double[] runningTimes = new double[6];
for (int i = 0; i != 6; i++) {
@@ -379,37 +379,9 @@ public static void testRosenbrockSolver(String file, int from, int to)
runningTimes[i] = 0d;
}
- List modelsWithStrongerTolerance = new LinkedList();
- modelsWithStrongerTolerance.add(863);
- modelsWithStrongerTolerance.add(882);
- modelsWithStrongerTolerance.add(893);
- modelsWithStrongerTolerance.add(994);
- modelsWithStrongerTolerance.add(1109);
- modelsWithStrongerTolerance.add(1121);
-
- List modelsWithStrongestTolerance = new LinkedList();
- modelsWithStrongestTolerance.add(872);
- modelsWithStrongestTolerance.add(987);
- modelsWithStrongestTolerance.add(1052);
-
for (int modelnr = from; modelnr <= to; modelnr++) {
- if((modelnr>=1124) && (modelnr<=1183)) {
- continue;
- }
System.out.println("model " + modelnr);
- solver.reset();
- if(modelsWithStrongestTolerance.contains(modelnr)) {
- solver.setAbsTol(1E-14);
- solver.setRelTol(1E-12);
- }
- else if (modelsWithStrongerTolerance.contains(modelnr)){
- solver.setAbsTol(1E-12);
- solver.setRelTol(1E-8);
- }
- else {
- solver.setAbsTol(1E-12);
- solver.setRelTol(1E-6);
- }
+
StringBuilder modelFile = new StringBuilder();
modelFile.append(modelnr);
while (modelFile.length() < 5)
diff --git a/test/org/simulator/SBMLTestSuiteWrapper.java b/test/org/simulator/SBMLTestSuiteWrapper.java
index bcca8149..10358d46 100644
--- a/test/org/simulator/SBMLTestSuiteWrapper.java
+++ b/test/org/simulator/SBMLTestSuiteWrapper.java
@@ -5,7 +5,7 @@
* This file is part of Simulation Core Library, a Java-based library
* for efficient numerical simulation of biological models.
*
- * Copyright (C) 2007-2013 jointly by the following organizations:
+ * Copyright (C) 2007-2012 jointly by the following organizations:
* 1. University of Tuebingen, Germany
* 2. Keio University, Japan
* 3. Harvard University, USA
@@ -30,8 +30,6 @@
import java.io.IOException;
import java.net.URISyntaxException;
import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.logging.Logger;
@@ -41,6 +39,7 @@
import org.sbml.jsbml.validator.ModelOverdeterminedException;
import org.sbml.jsbml.xml.stax.SBMLReader;
import org.simulator.io.CSVImporter;
+import org.simulator.math.odes.AbstractDESSolver;
import org.simulator.math.odes.MultiTable;
import org.simulator.math.odes.RosenbrockSolver;
@@ -66,38 +65,9 @@ public class SBMLTestSuiteWrapper {
public static void testRosenbrockSolver(String path, int modelnr, String outputPath, int level, int version)
throws FileNotFoundException, IOException, URISyntaxException {
String sbmlfile, csvfile, configfile;
- if((modelnr>=1124) && (modelnr<=1183)) {
- return;
- }
-
- RosenbrockSolver solver = new RosenbrockSolver();
-
- List modelsWithStrongerTolerance = new LinkedList();
- modelsWithStrongerTolerance.add(863);
- modelsWithStrongerTolerance.add(882);
- modelsWithStrongerTolerance.add(893);
- modelsWithStrongerTolerance.add(994);
- modelsWithStrongerTolerance.add(1109);
- modelsWithStrongerTolerance.add(1121);
-
- List modelsWithStrongestTolerance = new LinkedList();
- modelsWithStrongestTolerance.add(872);
- modelsWithStrongestTolerance.add(987);
- modelsWithStrongestTolerance.add(1052);
-
- if(modelsWithStrongestTolerance.contains(modelnr)) {
- solver.setAbsTol(1E-14);
- solver.setRelTol(1E-12);
- }
- else if (modelsWithStrongerTolerance.contains(modelnr)){
- solver.setAbsTol(1E-12);
- solver.setRelTol(1E-8);
- }
- else {
- solver.setAbsTol(1E-12);
- solver.setRelTol(1E-6);
- }
-
+ AbstractDESSolver solver = new RosenbrockSolver();
+
+
StringBuilder fileBuilder = new StringBuilder();
fileBuilder.append(modelnr);
while (fileBuilder.length() < 5)
@@ -105,7 +75,7 @@ else if (modelsWithStrongerTolerance.contains(modelnr)){
String folder = fileBuilder.toString();
fileBuilder.append('/');
fileBuilder.append(folder);
- fileBuilder.insert(0, path + "/");
+ fileBuilder.insert(0, path);
String modelFile = fileBuilder.toString();
csvfile = modelFile + "-results.csv";
configfile = modelFile + "-settings.txt";
@@ -113,6 +83,7 @@ else if (modelsWithStrongerTolerance.contains(modelnr)){
Properties props = new Properties();
props.load(new BufferedReader(new FileReader(configfile)));
double duration = Double.valueOf(props.getProperty("duration"));
+ double start = Double.valueOf(props.getProperty("start"));
int steps = Integer.valueOf(props.getProperty("steps"));
Map amountHash = new HashMap();
@@ -169,11 +140,11 @@ else if (modelsWithStrongerTolerance.contains(modelnr)){
solution = null;
}
if(solution != null) {
- writeMultiTableToFile(outputPath+"/" + folder + ".csv", variables, solution);
+ writeMultiTableToFile(path+"/" + folder + ".csv", variables, solution);
}
}
else {
- logger.warning("The model "+ modelnr + " does not exist");
+ logger.warning("The model does not exist");
}
}
@@ -207,7 +178,6 @@ private static void writeMultiTableToFile(String outputFile, String[] variables,
}
}
}
- writer.newLine();
writer.close();
}
@@ -220,14 +190,7 @@ private static void writeMultiTableToFile(String outputFile, String[] variables,
* @throws URISyntaxException
*/
public static void main(String[] args) throws NumberFormatException, FileNotFoundException, IOException, URISyntaxException {
- int begin = Integer.valueOf(args[1]);
- int end = begin;
- if(args.length > 5) {
- end = Integer.valueOf(args[5]);
- }
- for(int modelnr = begin; modelnr<=end; modelnr++) {
- testRosenbrockSolver(args[0], modelnr, args[2], Integer.valueOf(args[3]), Integer.valueOf(args[4]));
- }
+ testRosenbrockSolver(args[0], Integer.valueOf(args[1]), args[2], Integer.valueOf(args[3]), Integer.valueOf(args[4]));
}
}
diff --git a/test/org/simulator/SimulatorTest.java b/test/org/simulator/SimulatorTest.java
index 88687395..81e68264 100644
--- a/test/org/simulator/SimulatorTest.java
+++ b/test/org/simulator/SimulatorTest.java
@@ -5,7 +5,7 @@
* This file is part of Simulation Core Library, a Java-based library
* for efficient numerical simulation of biological models.
*
- * Copyright (C) 2007-2013 jointly by the following organizations:
+ * Copyright (C) 2007-2012 jointly by the following organizations:
* 1. University of Tuebingen, Germany
* 2. Keio University, Japan
* 3. Harvard University, USA
diff --git a/test/org/simulator/TestBiomodels.java b/test/org/simulator/TestBiomodels.java
index 5f806bd8..373c5ee6 100644
--- a/test/org/simulator/TestBiomodels.java
+++ b/test/org/simulator/TestBiomodels.java
@@ -5,7 +5,7 @@
* This file is part of Simulation Core Library, a Java-based library
* for efficient numerical simulation of biological models.
*
- * Copyright (C) 2007-2013 jointly by the following organizations:
+ * Copyright (C) 2007-2012 jointly by the following organizations:
* 1. University of Tuebingen, Germany
* 2. Keio University, Japan
* 3. Harvard University, USA
@@ -27,9 +27,11 @@
import java.net.URISyntaxException;
import java.util.logging.Logger;
+import org.apache.commons.math.ode.DerivativeException;
import org.sbml.jsbml.Model;
+import org.sbml.jsbml.validator.ModelOverdeterminedException;
import org.sbml.jsbml.xml.stax.SBMLReader;
-import org.simulator.math.odes.AdaptiveStepsizeIntegrator;
+import org.simulator.math.odes.AbstractDESSolver;
import org.simulator.math.odes.RosenbrockSolver;
import org.simulator.sbml.SBMLinterpreter;
@@ -55,9 +57,7 @@ public static void testBiomodels(String file, int from, int to)
throws FileNotFoundException, IOException {
int errors = 0;
int nModels = 0;
- AdaptiveStepsizeIntegrator solver = new RosenbrockSolver();
- solver.setAbsTol(1E-12);
- solver.setRelTol(1E-6);
+ AbstractDESSolver solver = new RosenbrockSolver();
for (int modelnr = from; modelnr <= to; modelnr++) {
System.out.println("Biomodel " + modelnr);
@@ -84,7 +84,7 @@ public static void testBiomodels(String file, int from, int to)
if ((solver != null) && (interpreter != null)) {
solver.setStepSize(0.1);
-
+
// solve
solver.solve(interpreter,
interpreter.getInitialValues(), 0, 10);
@@ -94,10 +94,14 @@ public static void testBiomodels(String file, int from, int to)
errors++;
}
}
- } catch (Exception e) {
+ } catch (DerivativeException e) {
logger.warning("Exception in Biomodel " + modelnr);
errors++;
- }
+ } catch (ModelOverdeterminedException e) {
+ logger.warning("OverdeterminationException in Biomodel "
+ + modelnr);
+ errors++;
+ }
}
nModels++;
}
diff --git a/test/org/simulator/sedml/SEDMLExecutorTest.java b/test/org/simulator/sedml/SEDMLExecutorTest.java
index 1f89b678..6b5b7738 100644
--- a/test/org/simulator/sedml/SEDMLExecutorTest.java
+++ b/test/org/simulator/sedml/SEDMLExecutorTest.java
@@ -5,7 +5,7 @@
* This file is part of Simulation Core Library, a Java-based library
* for efficient numerical simulation of biological models.
*
- * Copyright (C) 2007-2013 jointly by the following organizations:
+ * Copyright (C) 2007-2012 jointly by the following organizations:
* 1. University of Tuebingen, Germany
* 2. Keio University, Japan
* 3. Harvard University, USA
diff --git a/test/org/simulator/sedml/SEDMLWriterTest.java b/test/org/simulator/sedml/SEDMLWriterTest.java
index 3ace2dec..5ba76c7f 100644
--- a/test/org/simulator/sedml/SEDMLWriterTest.java
+++ b/test/org/simulator/sedml/SEDMLWriterTest.java
@@ -5,7 +5,7 @@
* This file is part of Simulation Core Library, a Java-based library
* for efficient numerical simulation of biological models.
*
- * Copyright (C) 2007-2013 jointly by the following organizations:
+ * Copyright (C) 2007-2012 jointly by the following organizations:
* 1. University of Tuebingen, Germany
* 2. Keio University, Japan
* 3. Harvard University, USA