Generator: `computeComputedConstants()` may not generate some dependencies in the right place
Closed this issue · 7 comments
Hi team,
I tried to solve the attached models using the Python package Scipy ode solver
GLUT1_BG.zip.
I had to call compute computed constants(variables) twice in my initialization code, otherwise, some variables/constants are nan.
For many other models, I only needed to call compute computed constants(variables) once.
It would be great if the team could provide some guidance on how to initialize and solve the system (generated Python), in particular the call orders of the compute_variables(), compute_rates(),compute_computed_constants(), etc.
Thanks.
Weiwei.
Hi @WeiweiAi, I haven't checked your model, but to fully initialise a model, you need to call all the methods, i.e.
- For an ODE/DAE model:
initialise_variables(states, rates, variables)
compute_computed_constants(variables)
compute_rates(voi, states, rates, variables)
compute_variables(voi, states, rates, variables)
- For an algebraic/NLA model:
initialise_variables(variables)
compute_computed_constants(variables)
compute_variables(variables)
Hi @agarny, thanks for the instructions. For the model that I attached here, I need to repeat "compute_computed_constants(variables)" one more time.
Ok, I guess I will need to have a proper look at your model then.
FWIW, I can indeed confirm the issue and I can see where, in the Python code, it's doing that. Now, I need to understand why b
, which is needed by K_1
, doesn't get computed before K_1
...
If I manually put the calculation for b
before K_1
then, as expected, everything is fine.
FTR, the analyser reports that K_1
has rightly a dependency on K_3
, K_6
, a
, and... b
. So, the issue is somewhere else...