Skip to content

Commit

Permalink
made tolerances strict by 0.1 | add delay property to SpeciesReferenc…
Browse files Browse the repository at this point in the history
…e | passes test cases 1121, 1415, 1419
  • Loading branch information
hemilpanchiwala committed Jun 28, 2020
1 parent 0677654 commit 73ec69f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
Expand Up @@ -48,6 +48,12 @@ public class SpeciesReferenceValue extends ASTNodeValue {
*/
private String id;

/**
* The boolean variable that says whether species reference is constant or
* not
*/
private boolean isConstant;

/**
* @param interpreter
* @param node
Expand All @@ -57,6 +63,7 @@ public class SpeciesReferenceValue extends ASTNodeValue {
public SpeciesReferenceValue(ASTNodeInterpreter interpreter, ASTNode node, SpeciesReference sr, SBMLValueHolder valueHolder) {
super(interpreter, node);
id = sr.getId();
isConstant = sr.isConstant();
this.valueHolder = valueHolder;
}

Expand All @@ -65,6 +72,13 @@ public SpeciesReferenceValue(ASTNodeInterpreter interpreter, ASTNode node, Speci
*/
@Override
protected void computeDoubleValue(double delay) {
doubleValue = valueHolder.getCurrentStoichiometry(id);

if ((delay == 0d) || (isConstant)){
doubleValue = valueHolder.getCurrentStoichiometry(id);
} else {
double valueTime = interpreter.symbolTime() - delay;
doubleValue = valueHolder.computeDelayedValue(valueTime, id, null, null, 0);
}

}
}
Expand Up @@ -49,7 +49,7 @@ public class SBMLTestSuiteRunnerWrapper {
public static final String CONCENTRATION = "concentration";
public static final String ABSOLUTE = "absolute";
public static final String RELATIVE = "relative";
private static final double TOLERANCE_FACTOR = 1E-3;
private static final double TOLERANCE_FACTOR = 1E-4;
private static Logger LOGGER = Logger.getLogger(CompExample.class.getName());

/**
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/org/simulator/sbml/SBMLTestSuiteTest.java
Expand Up @@ -37,7 +37,7 @@ public class SBMLTestSuiteTest {
public static final String RELATIVE = "relative";
private static final Logger logger = LoggerFactory.getLogger(TestUtils.class);
private static final String SBML_TEST_SUITE_PATH = "SBML_TEST_SUITE_PATH";
private static final double TOLERANCE_FACTOR = 1E-3;
private static final double TOLERANCE_FACTOR = 1E-4;
private static final double DELTA = 0.0002d;

public SBMLTestSuiteTest(String path) {
Expand Down

0 comments on commit 73ec69f

Please sign in to comment.