Dear Kazutaka,
If so, in this example initial conditions are the ones defined in the model m1 and they are not modified. If you run the script (especially the command sbioloadproject('AntibacterialPKPD.sbproj', 'm1') ), the model will be loaded. Then, if you type in the Command window of MATLAB:
you will see the list of state variables and their initial conditions. Species Growing in compartment [Bacterial Growth Model] is set to 1e7 molecule/milliliter (=CFU/ml) which corresponds to the severe infection case.
If you want to simulate different conditions, you could use one of the following methods:
- Modify the value in the model itself: After line 62 of the script where the model is loaded, you could add the following lines:
specObj = sbioselect(m1,'Type','Species','Name','Growing');
specObj.InitialAmount = 1e4;
If you are using the SimBiology App, you can open the Model Browser and edit the values there. The drawback of this method is that the value of Growing is changed in the model itself. So, you will need to remember this to make sure you are simulating the right initial conditions.
2. Use a variant: Variants are constructs that store alternate values of model parameters and initial conditions and are applied at simulation time. Using variant gives you a lot of flexibility and might be easier to keep track of the parameter values and initial conditions used for simulation. Typically, you would create variants in the SimBiology App with one of the following methods:
a. drag and drop the variant icon into the list of model components in the Model Browser.
b. or open the list of Variants from the 'Open' menu in the 'Model' tab
But you could also define them programmatically:
variant = addvariant(m1, 'Moderate infection');
addcontent(variant, {'species', 'Growing', 'InitialAmount', 1e4});
In this example, you could then use this variant as baseline of the SimFunction:
simfunc = createSimFunction(m1,params,observables,tempdose,variant,'UseParallel',true);
3. Define this initial value as input of the SimFunction: In the previous methods, the new initial condition will be used for all simulations. But if you wish to be able to change the initial condition for every simulation, it might be better to define the initial amount of the species Growing as input of the SimFunction. SimFunctions are function-like interface to execute SimBiology models with a predefined list of inputs (initial conditions or parameter values) and a predefined list of outputs (e.g. timecourse of some state variables). To implement it you will need to modify line 221 to define the species initial amount as input: params = {'Central', 'k12', 'k21', 'CL', 'k1', 'k2', 'Kmax', 'KC50','[Bacterial Growth Model].Growing'};
Then, you would need to add the new values of Growing in phi (the matrix containing all values to use for simulation). For instance, if you want to use the same values for all simulations:
iniInfection = 1e4;
phi = cell(1,nDoseGrps);
for i = 1:nDoseGrps
phi{i} = [Central(:,i),k12(:,i),k21(:,i), ...
CL(:,i), k1(:,i), k2(:,i), ...
Kmax(:,i), KC50(:,i), iniInfection];
end
But again, this method will be more useful if the the value of Growing differs for the different simulations.
This turned out to be a long answer but I hope it gives you a good overview on how to change initial conditions.
Best regards,
Jérémy