Skip to main content

Posts

Showing posts from August, 2021

Week 10

Progress this Week Last week I had almost finished working on RateRules but I was having some trouble with models where the compartment size was being changed through a RateRule. Species in SBML models can be expressed in terms of their concentrations or their amounts. This is an issue that the SBML reference describes in great detail, so I had taken appropriate care to distinguish between the two while developing the simulator, however, there were still a few issues that caused the error I described above. In our weekly meeting, we spent some time discussing this and the mentors suggested that I try an alternative approach, where the AST nodes will be modified before running the simulator. So, wherever a species occurs in an AST in concentration units, it is changed to (species / compartment). This allows the simulator to substitute amount values while evaluating mathematical expressions and makes integration easier and more accurate. While doing this, I found another error, where I h

Week 9

     Progress this Week The Runge Kutta Fehlberg integrator was completed last week with help from mentors during our weekly meeting. After that, I started working on Rate Rules.  I also modified the data structure I had built earlier and it's a lot more robust now. Earlier, I was using the parsed model directly from the sbml-rs package. That was a problem because the SBML specification allows various ways to set values for quantities like species. For example, it is possible to assign initial amounts/concentrations to species using the initialAmount  or initialConcentration  attributes on <species> tags directly, but it's also possible to assign these values using an initialAssignment . Due to this, while parsing the model, the amount field on a species  struct is an Option<f64>. This creates trouble later while simulating because you have to pattern-match at each step. Hence, this week I created similar structs in the sbml-sim package which process the parsed mode

Week 8

    Progress this Week This week I worked on the Runge Kutta Fehlberg numerical integration algorithm. While the integrator is set up and running, some of the test cases fail due to issues with error estimation.  For example, in model 3 in the core SBML test suite, the simulator calculates the values as follows: $ cargo run ../testsuites/core-semantic/00003/00003-sbml-l3v2.xml 5 50 1e-4 1e-5 5 seconds with 50 steps. t               S1                      S2 0.000000        0.0150000000000000      0.0000000000000000 0.100000        0.0135747032487483      0.0028505935025034 0.200000        0.0122848378861052      0.0054303242277897 0.300000        0.0111175352508572      0.0077649294982856 0.400000        0.0100611494591923      0.0098777010816154 Whereas, the expected values are: time            S1                      S2 0               0.015                   0 0.1             0.01357256127053939     0.002854877458921213 0.2             0.01228096129616973     0.005438077407660545 0