sys-bio / roadrunner

libRoadRunner: A high-performance SBML simulator
http://libroadrunner.org/
Other
39 stars 24 forks source link

Default steps not used when passing variableStep=False to simulate #277

Closed 0u812 closed 8 years ago

0u812 commented 8 years ago

The model below only produces one output row when variableStep=False is passed to simulate but the number of steps is not specified.

from __future__ import print_function, division

import tellurium as te
import roadrunner
from roadrunner import SelectionRecord
print(roadrunner.__version__)

# Model definition via antimony.
# The model contains an Event triggered at t=2 [s].
r = te.loada("""
    model event_time()
    // Reactions
    J0: $PP_S -> 2 S3; K1 * PP_S;

    // Species initializations:
    var species S3;
    var species S4;
    S3 = 0.5;
    PP_S = 0.0;
    S4 := 2*S3;

    // Rule for S1
    K1 = 0.5;

    // Additional events for triggering re-integration
    E1: at(time>=2):  S3=5;
    end
""")

r.selections = ['time'] + r.model.getBoundarySpeciesIds() + r.model.getFloatingSpeciesIds() + r.model.getReactionIds()
print(r.selections)

absTol = 1E-6 * min(r.model.getCompartmentVolumes())
relTol = 1E-6

s = r.simulate(0, 7, absolute=absTol, relative=relTol, variableStep=False, stiff=False, plot=True)
print(r)
print(s)
0u812 commented 8 years ago

I've removed the ability to pass variableStep to the simulate method. It should only be specified via the solver API.