Closed PavelBal closed 6 years ago
Looking at DCI_Info, nether the parameters nor the Species lists have their "isFormula" set to 1 for any of the species/parameters!
This is correct behavior. What happens here:
At the beginning, 2 parameters (concentrations) and 1 species (RHS_Param_formulaInit
) have formulas. Trying to set one of them as variable at the beginning leads to the error/warning you described (The SpeciesInitialValue is defined as Formula
)
However, if you initialize a simulation without setting any parameter/species as variable, all those formulas are replaced by constant values (5+6
trivially, concentrations due to the fact that all molecule amounts and all volumes are const during the simulation). Thus after the initialization there are indeed no more formulas in your model.
I do not get it. How can I then initialize all parameters/species except those with formulas?
In the Matlab-Toolbox you can do it with allNonFormula
This can be done in the same manner in the R-Toolbox (if not implemented yet).
And as far as I see it's also implemented in R
That does not work for species, only for parameters!
>DCI_Info_test <- initSimulation(testXML, whichInitParam = "all")
>DCI_Info_test$InputTab$VariableSpecies$Path
[1] "testSim|Organism|RHS_Param_constantInit" "testSim|Organism|RHS_Param_formulaInit"
attr(,"Name")
[1] "Path"
attr(,"Description")
[1] ""
Initializing all creates two variable species. Initializing "allNonFormula" creates NO variable species, although at least "testSim|Organism|RHS_Param_constantInit" should be there.
DCI_Info_test <- initSimulation(testXML, whichInitParam = "allNonFormula") DCI_Info_test$InputTab$VariableSpecies$Path character(0) attr(,"Name") [1] "Path" attr(,"Description") [1] ""
The ouput is also emtpy for a PBPK-Model exported from PK-Sim, so it is not because of "optimization" or whatever.
Might be a bug in the R-Toolbox. Please create an issue for that.
Initializing your model in Matlab with allNonFormula
sets _RHS_ParamconstantInit species to variable.
Means: if we have an issue here, it's in initSimulation.R
Consider my example from #46 .
The described model is loaded into R and no parameters are initialized:
Now I want to initialized all species that are NOT formulas. For this, I first get all the species (which turn out to be parameters, and I am getting no species at all, but this is another story described in #46 ...), and iterate through the list while getting the property "IsFormula". If the species in not a formula, I initialize its initial value:
Init struct now consists of two parameters (state variables), one of which was defined by a formula:
Now we could think that the formula of "RHS_Param_formulaInit" was optimized to a constant, because it was just "5+6", and everything is fine. Well, it is not, because trying to initialized the model with this init struct leads to an error!
Looking at DCI_Info, nether the parameters nor the Species lists have their "isFormula" set to 1 for any of the species/parameters!