Total time of SBML run between each MCS

13 days ago by
If I have an SBML file being updated every MCS, where 1MCS = 6 min and I have a step size of 0.2 in my CC3D code, how can I be sure that the final state given out by SBML at the end of 6 min is the same as running the SBML model in COPASI for 6 minutes with the same step size. Currently, the numbers do not match. OR am I wrong in assuming that time in CC3D translates as a same time in COPASI.

To be more clear, I have 1 MCS = 6 min. I update the state of the cell every MCS. Does  that mean the total time for SBML model is 6 min with the same step size , 0.2 = 1.2 min ? So should the states at the end of 6 min for COPASI match the state of the cell given out by CompuCell at the end of MCS ?
Community: CompuCell3D

1 Answer

13 days ago by
Is the difference a little or a lot?

How have you set the time step for the SBML in the CC3D code and what is the time step specified in the SBML?

A well done SBML file should include a time unit such as second or hour.

<unitDefinition id="time" name="minute">

When you load the SBML in CC3D you specify the time step for the SBML in the units the SBML file has.

If you are using 1 MCS = 6 minutes in CC3D, and you are updating the SBML every MCS, and the time unit in the SBML is minutes, then when you load the SBML you need to tell it _stepSize=6;

self.addFreeFloatingSBML(_modelFile=modelFile1,_modelName='modNAME',_stepSize=6) ​

However, if you want time steps of 6 minutes but the SBML file time unit is hour then you’ll need;

self.addFreeFloatingSBML(_modelFile=modelFile1,_modelName='modNAME', _stepSize=0.1)

Every time you step the SBML with self.timestepSBML() the SBML will move forward in time by _stepSize*<whatever the SBML files internal time unit is>

You can also call the SBML more or less often than every MCS and adjust the setting to account for that. Often in a CC3D model the time scale represented by the spin flips is much faster than you need to run the SBML. So, you might only update the SBML every 10 MCS and you set the "_stepSize” to match that.

In your case though, if 1 MCS is 6 minutes then the SBML time scale is probably faster than the spin flip time scale and updating only once every 6 minutes might not be enough.

If you are sure of your time units and stepping, then the next possibility is that the time is off between CC3D and the SBML. It is possible that the time is off by one time step. I've played around with the SBML simple demo SBMLSolver (C:\CompuCell3D\Demos\SBMLSolverExamples folder) and it looks to me like that is the case; CC3D is one time step ahead of the SBML.

I changed the step size to 6 in CC3D code since my time unit is in minutes. You are right, the concentration that I am getting after 1 MCS (6 min) is actually exactly equal to the concentration after 12 min in COPASI.

In that case, If I am right should I have my step size in cc3D code as 3 so as to give out concentrations every six minutes(in real time)
written 13 days ago by Mahua Roy  
If you change the the time step to 3 you'll be scaling all time by 50%. I think the problem is a constant offset of 1 MCS between the two. So if 3 doesn't work try something like;

if mcs > 1:
   <time step the SBML> # skips the first sbml time step

or, to shift one time step the other way;
if mcs == 1;
   <time step the SBML>  # an extra time step at startup
<time step the SBML>
written 13 days ago by James Sluka  
Yes, skipping the first step works. Thank you.
written 12 days ago by Mahua Roy  
Please login to add an answer/comment or follow this question.

Similar posts:
Search »