|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.simulator.sbml.SBMLinterpreter
public class SBMLinterpreter
This DifferentialEquationSystem takes a model in SBML format and maps it to a
data structure that is understood by the AbstractDESSolver
.
Therefore, this class implements all necessary functions expected by SBML.
Field Summary | |
---|---|
protected org.sbml.jsbml.Reaction |
currentReaction
This field is necessary to also consider local parameters of the current reaction because it is not possible to access these parameters from the model. |
protected double[] |
initialValues
An array, which stores all computed initial values of the model. |
protected java.util.List<java.lang.Double>[] |
listOfContraintsViolations
An array, which stores for each constraint the list of times, in which the constraint was violated during the simulation. |
protected org.sbml.jsbml.Model |
model
The model to be simulated. |
protected java.util.Map<java.lang.String,java.lang.Double> |
stoichiometricCoefHash
This Map saves the current stoichiometric coefficients for those
SpeciesReference objects that are a target to an Assignment
. |
static java.lang.String |
TEMP_VALUE
Key to memorize user objects in ASTNode |
protected double[] |
v
An array of the velocities of each reaction within the model system. |
protected double[] |
Y
An array of the current concentration of each species within the model system. |
Constructor Summary | |
---|---|
SBMLinterpreter(org.sbml.jsbml.Model model)
This constructs a new DESystem for the given SBML Model . |
Method Summary | |
---|---|
double |
computeDelayedValue(double time,
java.lang.String id)
|
void |
computeDerivatives(double time,
double[] Y,
double[] changeRate)
|
boolean |
containsEventsOrRules()
|
boolean |
containsFastProcesses()
|
java.lang.String[] |
getAdditionalValueIds()
This provides the column/row identifiers of all intermediate results: one identifier per result. |
double[] |
getAdditionalValues(double t,
double[] Y)
Computes and/or delivers the intermediate results at the given time and for the given results from the previous time step. |
double |
getCurrentCompartmentSize(java.lang.String id)
Returns the size of the compartment with the given id. |
double |
getCurrentCompartmentValueOf(java.lang.String speciesId)
Checks if the given symbol id refers to a Species and returns the
value of its Compartment or 1d otherwise |
double |
getCurrentParameterValue(java.lang.String id)
Returns the value of the parameter with the given id. |
double |
getCurrentSpeciesValue(java.lang.String id)
Returns the value of the species with the given id. |
double |
getCurrentStoichiometry(java.lang.String id)
Returns the value of the stoichiometry of the species reference with the given id. |
double |
getCurrentTime()
Returns the timepoint where the simulation is currently situated |
double |
getCurrentValueOf(int position)
Returns the current value of the Y vector at the given position. |
double |
getCurrentValueOf(java.lang.String id)
Returns the current value of the SBase with the given id. |
int |
getDimension()
|
int |
getEventCount()
Counts the number of events in this system. |
java.lang.String[] |
getIdentifiers()
Delivers an array of String s that describe the content of each
dimension of the resulting array of this DESystem . |
double[] |
getInitialValues()
Returns the initial values of the model to be simulated. |
org.sbml.jsbml.Model |
getModel()
Returns the model that is used by this object. |
EventInProcess |
getNextEventAssignments(double t,
double previousTime,
double[] Y)
Returns a list with event assignments for the events triggered either by the time t or by the concentrations of the species stored in Y. |
boolean |
getNoDerivatives()
|
int |
getNumAdditionalValues()
Gives the number of intermediate results that are computed by this class. |
int |
getNumPositiveValues()
|
int |
getParameterCount()
This method tells you the complete number of parameters within the model. |
int |
getPositionOfParameters()
|
int |
getRuleCount()
Counts the number of rules to be evaluated in each time point. |
void |
init()
This method initializes the differential equation system for simulation. |
void |
init(boolean refreshTree)
This method initializes the differential equation system for simulation. |
void |
init(boolean renewTree,
double defaultSpeciesValue,
double defaultParameterValue,
double defaultCompartmentValue)
This method initializes the differential equation system for simulation. |
boolean |
processAssignmentRules(double t,
double[] Y)
|
void |
processInitialAssignments(double time,
double[] Y)
Processes the initial assignments |
boolean |
processRules(double time,
double[] changeRate,
double[] Y,
boolean initialCalculations)
Processes the rules |
protected void |
processVelocities(double[] changeRate,
double time)
This method computes the multiplication of the stoichiometric matrix of the given model system with the reaction velocities vector passed to this method. |
void |
registerDelayValueHolder(DelayValueHolder dvh)
|
void |
setFastProcessComputation(boolean isProcessing)
|
void |
setParameters(double[] params)
This method allows us to set the parameters of the model to the specified values in the given array. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String TEMP_VALUE
ASTNode
protected org.sbml.jsbml.Reaction currentReaction
protected double[] initialValues
protected java.util.List<java.lang.Double>[] listOfContraintsViolations
protected org.sbml.jsbml.Model model
protected double[] v
protected java.util.Map<java.lang.String,java.lang.Double> stoichiometricCoefHash
Map
saves the current stoichiometric coefficients for those
SpeciesReference
objects that are a target to an Assignment
.
protected double[] Y
Constructor Detail |
---|
public SBMLinterpreter(org.sbml.jsbml.Model model) throws org.sbml.jsbml.validator.ModelOverdeterminedException, org.sbml.jsbml.SBMLException
This constructs a new DESystem
for the given SBML Model
.
Note that only a maximum of Integer.MAX_VALUE
Species
can
be simulated. If the model contains more Species
, this class is not
applicable.
Note that currently, units are not considered.
model
-
org.sbml.jsbml.validator.ModelOverdeterminedException
org.sbml.jsbml.SBMLException
Method Detail |
---|
public boolean containsFastProcesses()
containsFastProcesses
in interface FastProcessDESystem
public java.lang.String[] getAdditionalValueIds()
RichDESystem
String
array must equal the length of the array returned by
RichDESystem.getAdditionalValues(double, double[])
.
getAdditionalValueIds
in interface RichDESystem
public double[] getAdditionalValues(double t, double[] Y) throws org.apache.commons.math.ode.DerivativeException
RichDESystem
getAdditionalValues
in interface RichDESystem
t
- The time point for which intermediate results are to be
computed.Y
- The result vector from the previous time step.
#getValue(double, double[], double[])
) to avoid unnecessary
re-computation. Implementing classes should store interesting
intermediate results to be accessible in case time and Y are the
same values than those just used for the actual computation.
org.apache.commons.math.ode.DerivativeException
- If the system cannot be solved for the given configuration or
no intermediate results can be computed in this step.public double getCurrentCompartmentValueOf(java.lang.String speciesId)
Species
and returns the
value of its Compartment
or 1d otherwise
getCurrentCompartmentValueOf
in interface ValueHolder
speciesId
- val
-
public double getCurrentCompartmentSize(java.lang.String id)
ValueHolder
getCurrentCompartmentSize
in interface ValueHolder
public double getCurrentParameterValue(java.lang.String id)
ValueHolder
getCurrentParameterValue
in interface ValueHolder
public double getCurrentSpeciesValue(java.lang.String id)
ValueHolder
getCurrentSpeciesValue
in interface ValueHolder
public double getCurrentStoichiometry(java.lang.String id)
ValueHolder
getCurrentStoichiometry
in interface ValueHolder
public int getDimension()
getDimension
in interface org.apache.commons.math.ode.FirstOrderDifferentialEquations
public EventInProcess getNextEventAssignments(double t, double previousTime, double[] Y) throws org.apache.commons.math.ode.DerivativeException
EventDESystem
getNextEventAssignments
in interface EventDESystem
t
- The current simulation time.Y
- The current change of the system.
org.apache.commons.math.ode.DerivativeException
public java.lang.String[] getIdentifiers()
DESystem
String
s that describe the content of each
dimension of the resulting array of this DESystem
.
getIdentifiers
in interface DESystem
String
s which has the same length than the
number given by #getDESystemDimension()
. Each
String
describes the content of the given dimension.public double[] getInitialValues()
public org.sbml.jsbml.Model getModel()
public int getNumAdditionalValues()
RichDESystem
RichDESystem.getAdditionalValueIds()
and
RichDESystem.getAdditionalValues(double, double[])
.
getNumAdditionalValues
in interface RichDESystem
public int getEventCount()
EventDESystem
getEventCount
in interface EventDESystem
public int getParameterCount()
int
value, whereas the SBML model may
contain int
values.public int getRuleCount()
EventDESystem
getRuleCount
in interface EventDESystem
public int getPositionOfParameters()
public double getCurrentTime()
getCurrentTime
in interface ValueHolder
public void computeDerivatives(double time, double[] Y, double[] changeRate) throws org.apache.commons.math.ode.DerivativeException
computeDerivatives
in interface org.apache.commons.math.ode.FirstOrderDifferentialEquations
org.apache.commons.math.ode.DerivativeException
public double getCurrentValueOf(java.lang.String id)
ValueHolder
getCurrentValueOf
in interface ValueHolder
public void init() throws org.sbml.jsbml.validator.ModelOverdeterminedException, org.sbml.jsbml.SBMLException
This method initializes the differential equation system for simulation. In
more detail: the initial amounts or concentration will be assigned to every
Species
or InitialAssignment
s if any are executed.
To save computation time the results of this method should be stored in an array. Hence this method must only be called once. However, if the SBML model to be simulated contains initial assignments, this can lead to wrong simulation results because initial assignments may depend on current parameter values.
org.sbml.jsbml.validator.ModelOverdeterminedException
org.sbml.jsbml.SBMLException
public void init(boolean refreshTree) throws org.sbml.jsbml.validator.ModelOverdeterminedException, org.sbml.jsbml.SBMLException
refreshTree
-
org.sbml.jsbml.validator.ModelOverdeterminedException
org.sbml.jsbml.SBMLException
public void init(boolean renewTree, double defaultSpeciesValue, double defaultParameterValue, double defaultCompartmentValue) throws org.sbml.jsbml.validator.ModelOverdeterminedException, org.sbml.jsbml.SBMLException
renewTree
- defaultSpeciesValue
- defaultParameterValue
- defaultCompartmentValue
-
org.sbml.jsbml.validator.ModelOverdeterminedException
org.sbml.jsbml.SBMLException
public boolean processAssignmentRules(double t, double[] Y) throws org.apache.commons.math.ode.DerivativeException
processAssignmentRules
in interface EventDESystem
t
- The current simulation time.Y
- The current change of the system.
org.apache.commons.math.ode.DerivativeException
public void processInitialAssignments(double time, double[] Y) throws org.sbml.jsbml.SBMLException
the
- ASTNode timethe
- Y vector
org.sbml.jsbml.SBMLException
public boolean processRules(double time, double[] changeRate, double[] Y, boolean initialCalculations) throws org.sbml.jsbml.SBMLException
the
- current timethe
- changeRate vectorthe
- Y vector
org.sbml.jsbml.SBMLException
protected void processVelocities(double[] changeRate, double time) throws org.sbml.jsbml.SBMLException
velocities
- An array of reaction velocities at the current time.Y
-
org.sbml.jsbml.SBMLException
public void setFastProcessComputation(boolean isProcessing)
setFastProcessComputation
in interface FastProcessDESystem
public void setParameters(double[] params)
params
- An array of parameter values to be set for this model. If the number
of given parameters does not match the number of model parameters,
an exception will be thrown.public boolean containsEventsOrRules()
containsEventsOrRules
in interface DESystem
public double getCurrentValueOf(int position)
ValueHolder
getCurrentValueOf
in interface ValueHolder
public int getNumPositiveValues()
getNumPositiveValues
in interface DESystem
public void registerDelayValueHolder(DelayValueHolder dvh)
registerDelayValueHolder
in interface DelayedDESystem
public double computeDelayedValue(double time, java.lang.String id) throws org.apache.commons.math.ode.DerivativeException
computeDelayedValue
in interface DelayValueHolder
org.apache.commons.math.ode.DerivativeException
public boolean getNoDerivatives()
getNoDerivatives
in interface EventDESystem
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |