First time here? Checkout the FAQ!
x
0 votes
by (550 points)
edited by

Hello,

Has anyone encountered a syntax error using limpet_fe.py when importing a cell model from cellml.org?

I'm interested specifically in the heijman-2011.cellml model (https://models.physiomeproject.org/e/70a). At the later stage of importing a cell model using limpet_fe.py, I get the following errors. 

=============

Syntax error at line 407, token '('

Syntax error at line 416, token '('

Syntax error at line 478, token '('

Syntax error at line 485, token '('

Syntax error at line 547, token '('

Syntax error at line 554, token '('

Error, don't assign to variables marked as differential variables

{Var("p")}

Traceback (most recent call last):

  File "/home/karl/openCARP/physics/limpet/src/python/limpet_fe.py", line 1704, in <module>

    im = IonicModel(open(filename, "r",  encoding="utf-8").read());

  File "/home/karl/openCARP/physics/limpet/src/python/im.py", line 332, in __init__

    self.cleanup()

  File "/home/karl/openCARP/physics/limpet/src/python/im.py", line 653, in cleanup

    assert(0)

AssertionError

=============

Inspecting the .model file at the specified lines and cross-checking with the actual model, it seems that there isn't anything wrong with the syntax (none that I can see, anyway). Below are the lines in question:

=============

407: akap_sig_PKAf_arg = (atan((akap_sig_PKAf_yi/akap_sig_PKAf_yr))/3.0); .units(unitless);

416: akap_sig_PP1f_cav_arg = (atan((akap_sig_PP1f_cav_yi/akap_sig_PP1f_cav_yr))/3.0); .units(unitless);

478: beta_cav_Gs_f_arg = (atan((beta_cav_Gs_f_yi/beta_cav_Gs_f_yr))/3.0); .units(unitless);

485: beta_cav_Gs_f_i = ((beta_cav_Gs_f_mag*sin(beta_cav_Gs_f_arg))*(1.0+beta_cav_Gs_f_x)); .units(mol/m^3);

547: beta_eca_Gs_f_arg = (atan((beta_eca_Gs_f_yi/beta_eca_Gs_f_yr))/3.0); .units(unitless);

554: beta_eca_Gs_f_i = ((beta_eca_Gs_f_mag*sin(beta_eca_Gs_f_arg))*(1.0+beta_eca_Gs_f_x)); .units(mol/m^3);

=============

The other error "Error, don't assign to variables marked as differential variables {Var("p")}". I think the variable p it's pointing to is a critical factor in differential equations. I'm not sure why it shouldn't be included in the differential equation.

819: diff_O1 = (((-(e+p)*O1)+(o*O2))+(t*C15)); .units(unitless/s);

820: diff_O2 = ((p*O1) - (o*O2)); .units(unitless/s);

827: p = (4.0173e-4*exp(((2.0873e-4*V)*FRT))); .units(unitless/s);

=============

I understand from the tutorial that there's no one solution for troubleshooting a wide range of cell models but any help would be appreciated! Thank you! 

Karl

by (550 points)
I found that the trigonometric functions are causing problems building this particular model.

Are there any alternatives I can implement within the .model compatible with this script?
by (550 points)
edited by
atan had to be changed to atan2(y,x). Still trying to figure out how to correct for sin.

Cos seem to work fine for everything else. It also appears in other models. I haven't seen tan and sin on any other model.

Variable p has to be changed to something else other than p. Perhaps a conflict somewhere in the .model file.

1 Answer

0 votes
by (17.5k points)
selected by
 
Best answer

Indeed, arctan, sin and floor were not supported yet. These were added to this branch: https://git.opencarp.org/openCARP/openCARP/-/commits/dynamic_model_improvements

The problem with the variable p is that it's assumed to be a gating variable (because alpha_p and beta_p are given in the irel component) but then an explicit value is set for this variable in the iks_np component. The variable in the iks_np component is a different one but the converter cannot determine this automatically. One of the variables should be renamed.

This issue might also exist for other variables in this very comprehensive model.

by (550 points)
Thank you for the update.

I've gone into the .model file to change the naming of the variable p consistent within the iks_np component.
Welcome to openCARP Q&A. Ask questions and receive answers from other members of the community. For best support, please use appropriate TAGS!
architecture, carputils, documentation, experiments, installation-containers-packages, limpet, slimfem, website, governance
...