-
Notifications
You must be signed in to change notification settings - Fork 44
Simulating a Model
Simulating a model that was written in AdvanceSyn Model Specification format is a 2-step process.
As the first step, an executable ODE model must be generated using genODE command. At this point, I will need to know (a) what ODE solver to use, (b) the time step required, (c) length of time to simulate, and (d) upper and lower bounds. For example, if I want to generate an ODE model called bbfMA24.py
from bbfMA24.modelspec
located in models/asm
folder using RK4 solver with 0.1 interval as time step, 3600 time intervals to simulate, bounding all values between 0 and 1000; I will use the following command
python astools.py genODE --modelfile=models/asm/bbfMA24.modelspec --mtype=ASM --solver=RK4 --timestep=0.1 --endtime=3600 --lowerbound=0;0 --upperbound=1000;1000 --odefile=bbfMA24.py
The resulting ODE model bbfMA24.py
will be found in odescript
folder.
For diagnostic purposes, it is common to use printASM, readmodel, and readflux commands to ensure that the model is well-formed.
Once the ODE model is produced, we can simulate the model using runODE command. I can choose different sampling frequencies. For example, if I only want to sample every 20 time steps (given that time step is 0.1 interval, every 20 time steps means sampling at every 2 time intervals), I will use the following command
python astools.py runODE --odefile=bbfMA24.py --sampling=20 --resultfile=result_bbfMA24.csv
Choosing a larger than 1 sampling frequency will reduce the size of the result file, which will be written out into the root folder.
Copyright (c) 2018-2022, AdvanceSyn Pte. Ltd.