Generated Code

The following is c code generated by the CellML API from this CellML file. (Back to language selection)

The raw code is available.

/*
   There are a total of 21 entries in the algebraic variable array.
   There are a total of 8 entries in each of the rate and state variable arrays.
   There are a total of 55 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (second).
 * STATES[0] is Vm in component membrane (millivolt).
 * ALGEBRAIC[8] is I_iCa in component membrane (picoampere).
 * ALGEBRAIC[11] is I_iNa in component membrane (picoampere).
 * CONSTANTS[0] is Cm in component membrane (picofarad).
 * ALGEBRAIC[2] is I_Ca in component I_Ca (picoampere).
 * ALGEBRAIC[9] is I_Na in component I_Na (picoampere).
 * ALGEBRAIC[4] is I_NSCC_Ca in component I_NSCC_Ca (picoampere).
 * ALGEBRAIC[7] is I_PM in component I_PM (picoampere).
 * ALGEBRAIC[6] is I_NSCC_Na in component I_NSCC_Na (picoampere).
 * CONSTANTS[1] is gCa in component I_Ca (picosiemens).
 * ALGEBRAIC[0] is ECa in component I_Ca (millivolt).
 * CONSTANTS[2] is T in component model_parameters (kelvin).
 * CONSTANTS[3] is R in component model_parameters (attojoule_per_zeptomole_kelvin).
 * CONSTANTS[4] is F in component model_parameters (femtocoulomb_per_zeptomole).
 * CONSTANTS[5] is CO in component model_parameters (micromolar).
 * STATES[1] is CS1 in component CS1 (micromolar).
 * CONSTANTS[6] is gNSCC_Ca_ in component I_NSCC_Ca (picosiemens).
 * ALGEBRAIC[3] is gNSCC_Ca in component I_NSCC_Ca (picosiemens).
 * CONSTANTS[7] is hNSCC in component model_parameters (dimensionless).
 * CONSTANTS[8] is ENSCC in component model_parameters (millivolt).
 * CONSTANTS[9] is KNSCC in component model_parameters (micromolar).
 * CONSTANTS[10] is gNSCC_Na_ in component I_NSCC_Na (picosiemens).
 * ALGEBRAIC[5] is gNSCC_Na in component I_NSCC_Na (picosiemens).
 * CONSTANTS[11] is gPM in component I_PM (femtoampere).
 * CONSTANTS[12] is KPM in component I_PM (micromolar).
 * CONSTANTS[13] is gNa in component I_Na (femtoampere).
 * CONSTANTS[14] is KNa in component I_Na (micromolar).
 * CONSTANTS[15] is hNa in component I_Na (dimensionless).
 * STATES[2] is NS1 in component NS1 (micromolar).
 * ALGEBRAIC[10] is JSERCA in component JSERCA (flux).
 * CONSTANTS[16] is VSERCA in component JSERCA (first_order_rate_constant).
 * CONSTANTS[17] is A2 in component JSERCA (dimensionless).
 * CONSTANTS[18] is A4 in component JSERCA (per_micromolar).
 * CONSTANTS[19] is A5 in component JSERCA (per_micromolar).
 * CONSTANTS[20] is A6 in component JSERCA (per_micromolar2).
 * STATES[3] is CER in component CER (micromolar).
 * ALGEBRAIC[13] is JMCU in component JMCU (flux).
 * CONSTANTS[21] is VMCU in component JMCU (flux).
 * CONSTANTS[22] is KMCU in component JMCU (micromolar).
 * ALGEBRAIC[12] is epsilon_INH in component JMCU (dimensionless).
 * CONSTANTS[23] is KINH in component JMCU (micromolar).
 * CONSTANTS[24] is hINH in component JMCU (dimensionless).
 * STATES[4] is CS2 in component CS2 (micromolar).
 * STATES[5] is CMT in component CMT (micromolar).
 * ALGEBRAIC[14] is JNCX in component JNCX (flux).
 * CONSTANTS[25] is VNCX in component JNCX (flux).
 * CONSTANTS[26] is KNCX in component JNCX (micromolar).
 * ALGEBRAIC[15] is JS1S2 in component JS1S2 (flux).
 * CONSTANTS[27] is mu_S1S2 in component JS1S2 (first_order_rate_constant).
 * ALGEBRAIC[19] is JIPR in component JIPR (flux).
 * CONSTANTS[28] is kIPR in component JIPR (first_order_rate_constant).
 * CONSTANTS[29] is k_1 in component JIPR (flux).
 * CONSTANTS[30] is k1 in component JIPR (first_order_rate_constant).
 * CONSTANTS[31] is k2 in component JIPR (first_order_rate_constant).
 * CONSTANTS[32] is r2 in component JIPR (first_order_rate_constant).
 * CONSTANTS[33] is r_2 in component JIPR (flux).
 * CONSTANTS[34] is r4 in component JIPR (first_order_rate_constant).
 * CONSTANTS[35] is R1 in component JIPR (micromolar).
 * CONSTANTS[36] is R3 in component JIPR (micromolar).
 * ALGEBRAIC[17] is phi1 in component JIPR (first_order_rate_constant).
 * ALGEBRAIC[18] is phi_1 in component JIPR (flux).
 * ALGEBRAIC[20] is phi2 in component JIPR (first_order_rate_constant).
 * STATES[6] is phi3 in component JIPR (first_order_rate_constant).
 * STATES[7] is H in component JIPR (dimensionless).
 * CONSTANTS[37] is g_beta in component JIPR (first_order_rate_constant).
 * CONSTANTS[38] is h_beta in component JIPR (dimensionless).
 * CONSTANTS[39] is g_alpha in component JIPR (per_second_squared).
 * CONSTANTS[40] is K_beta in component JIPR (micromolar).
 * CONSTANTS[50] is alpha_phi3 in component JIPR (per_second_squared).
 * ALGEBRAIC[1] is beta_phi3 in component JIPR (first_order_rate_constant).
 * CONSTANTS[41] is P in component model_parameters (micromolar).
 * CONSTANTS[49] is lambda_MT_S1 in component CS1 (dimensionless).
 * CONSTANTS[51] is lambda_ER_S1 in component CS1 (dimensionless).
 * CONSTANTS[42] is delta_s in component model_parameters (micromolar_coulomb).
 * CONSTANTS[43] is gamma_S1 in component model_parameters (dimensionless).
 * CONSTANTS[44] is gamma_MT in component model_parameters (dimensionless).
 * CONSTANTS[45] is gamma_ER in component model_parameters (dimensionless).
 * CONSTANTS[52] is lambda_MT_S2 in component CS2 (dimensionless).
 * CONSTANTS[53] is lambda_ER_S2 in component CS2 (dimensionless).
 * CONSTANTS[54] is lambda_S1_S2 in component CS2 (dimensionless).
 * CONSTANTS[46] is gamma_S2 in component model_parameters (dimensionless).
 * ALGEBRAIC[16] is fm in component CMT (dimensionless).
 * CONSTANTS[47] is Km in component CMT (micromolar).
 * CONSTANTS[48] is Bm in component CMT (micromolar).
 * RATES[0] is d/dt Vm in component membrane (millivolt).
 * RATES[7] is d/dt H in component JIPR (dimensionless).
 * RATES[6] is d/dt phi3 in component JIPR (first_order_rate_constant).
 * RATES[1] is d/dt CS1 in component CS1 (micromolar).
 * RATES[4] is d/dt CS2 in component CS2 (micromolar).
 * RATES[3] is d/dt CER in component CER (micromolar).
 * RATES[5] is d/dt CMT in component CMT (micromolar).
 * RATES[2] is d/dt NS1 in component NS1 (micromolar).
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = -70.1;
CONSTANTS[0] = 20.0;
CONSTANTS[1] = 0.01;
CONSTANTS[2] = 310.16;
CONSTANTS[3] = 8.314E-3;
CONSTANTS[4] = 0.09649;
CONSTANTS[5] = 1.8E3;
STATES[1] = 0.120;
CONSTANTS[6] = 0.12;
CONSTANTS[7] = 3.0;
CONSTANTS[8] = 0.0;
CONSTANTS[9] = 0.12;
CONSTANTS[10] = 220.0;
CONSTANTS[11] = 420.0;
CONSTANTS[12] = 1.0;
CONSTANTS[13] = 1.5E4;
CONSTANTS[14] = 1.0E4;
CONSTANTS[15] = 4.0;
STATES[2] = 1.01E4;
CONSTANTS[16] = 1.0E5;
CONSTANTS[17] = 6E-4;
CONSTANTS[18] = 3.57;
CONSTANTS[19] = 2.7E-5;
CONSTANTS[20] = 2.31E-5;
STATES[3] = 203.0;
CONSTANTS[21] = 800.0;
CONSTANTS[22] = 10.0;
CONSTANTS[23] = 10.0;
CONSTANTS[24] = 4.0;
STATES[4] = 0.023;
STATES[5] = 0.220;
CONSTANTS[25] = 0.5;
CONSTANTS[26] = 0.3;
CONSTANTS[27] = 0.04;
CONSTANTS[28] = 2000.0;
CONSTANTS[29] = 6.4;
CONSTANTS[30] = 0.0;
CONSTANTS[31] = 4.0;
CONSTANTS[32] = 200.0;
CONSTANTS[33] = 0.0;
CONSTANTS[34] = 750.0;
CONSTANTS[35] = 36.0;
CONSTANTS[36] = 300.0;
STATES[6] = 0.306;
STATES[7] = 0.787;
CONSTANTS[37] = 300.0;
CONSTANTS[38] = 2.0;
CONSTANTS[39] = 0.02;
CONSTANTS[40] = 2.0;
CONSTANTS[41] = 1.0;
CONSTANTS[42] = 26.0;
CONSTANTS[43] = 100.0;
CONSTANTS[44] = 200.0;
CONSTANTS[45] = 20.0;
CONSTANTS[46] = 1.0;
CONSTANTS[47] = 0.01;
CONSTANTS[48] = 100.0;
CONSTANTS[49] = CONSTANTS[44]/CONSTANTS[43];
CONSTANTS[50] = CONSTANTS[39];
CONSTANTS[51] = CONSTANTS[45]/CONSTANTS[43];
CONSTANTS[52] = CONSTANTS[44]/CONSTANTS[46];
CONSTANTS[53] = CONSTANTS[45]/CONSTANTS[46];
CONSTANTS[54] = CONSTANTS[43]/CONSTANTS[46];
}
void
computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[1] =  CONSTANTS[37]*(pow(STATES[4], CONSTANTS[38])/(pow(CONSTANTS[40], CONSTANTS[38])+pow(STATES[4], CONSTANTS[38])));
RATES[6] = CONSTANTS[50] -  ALGEBRAIC[1]*STATES[6];
ALGEBRAIC[0] =  (( CONSTANTS[3]*CONSTANTS[2])/( 2.00000*CONSTANTS[4]))*log(CONSTANTS[5]/STATES[1]);
ALGEBRAIC[2] =  CONSTANTS[1]*(STATES[0] - ALGEBRAIC[0]);
ALGEBRAIC[3] =  CONSTANTS[6]*(pow(CONSTANTS[9], CONSTANTS[7])/(pow(CONSTANTS[9], CONSTANTS[7])+pow(STATES[1], CONSTANTS[7])));
ALGEBRAIC[4] =  ALGEBRAIC[3]*(STATES[0] - CONSTANTS[8]);
ALGEBRAIC[7] =  CONSTANTS[11]*(pow(STATES[1], 2.00000)/(pow(CONSTANTS[12], 2.00000)+pow(STATES[1], 2.00000)));
ALGEBRAIC[8] = ALGEBRAIC[2]+ALGEBRAIC[4]+ALGEBRAIC[7];
ALGEBRAIC[9] =  CONSTANTS[13]*(pow(STATES[2], CONSTANTS[15])/(pow(CONSTANTS[14], CONSTANTS[15])+pow(STATES[2], CONSTANTS[15])));
ALGEBRAIC[5] =  CONSTANTS[10]*(pow(CONSTANTS[9], CONSTANTS[7])/(pow(CONSTANTS[9], CONSTANTS[7])+pow(STATES[1], CONSTANTS[7])));
ALGEBRAIC[6] =  ALGEBRAIC[5]*(STATES[0] - CONSTANTS[8]);
ALGEBRAIC[11] = ALGEBRAIC[6]+ALGEBRAIC[9];
RATES[0] = - ((ALGEBRAIC[8]+ALGEBRAIC[11])/CONSTANTS[0]);
RATES[2] =  - (CONSTANTS[42]/1.00000)*ALGEBRAIC[11];
ALGEBRAIC[10] = ( CONSTANTS[16]*(STATES[1] -  CONSTANTS[17]*STATES[3]))/(1.00000+ CONSTANTS[18]*STATES[1]+ CONSTANTS[19]*STATES[3]+ CONSTANTS[20]*STATES[1]*STATES[3]);
ALGEBRAIC[14] =  CONSTANTS[25]*(STATES[5]/(STATES[5]+CONSTANTS[26]));
ALGEBRAIC[15] =  CONSTANTS[27]*(STATES[4] - STATES[1]);
RATES[1] = (ALGEBRAIC[15]+ CONSTANTS[49]*ALGEBRAIC[14]) - ( (CONSTANTS[42]/2.00000)*ALGEBRAIC[8]+ CONSTANTS[51]*ALGEBRAIC[10]);
ALGEBRAIC[12] = pow(CONSTANTS[23], CONSTANTS[24])/(pow(CONSTANTS[23], CONSTANTS[24])+pow(STATES[5], CONSTANTS[24]));
ALGEBRAIC[13] =  CONSTANTS[21]*(pow(STATES[4], 2.00000)/(pow(CONSTANTS[22], 2.00000)+pow(STATES[4], 2.00000)))*ALGEBRAIC[12];
ALGEBRAIC[16] = 1.00000/(1.00000+( CONSTANTS[47]*CONSTANTS[48])/pow(CONSTANTS[47]+STATES[5], 2.00000));
RATES[5] =  ALGEBRAIC[16]*(ALGEBRAIC[13] - ALGEBRAIC[14]);
ALGEBRAIC[17] = ( CONSTANTS[30]*CONSTANTS[35]+ CONSTANTS[32]*STATES[4])/(CONSTANTS[35]+STATES[4]);
ALGEBRAIC[18] = ( (CONSTANTS[29]+CONSTANTS[33])*CONSTANTS[36])/(CONSTANTS[36]+STATES[4]);
ALGEBRAIC[20] = ( CONSTANTS[31]*CONSTANTS[36]+ CONSTANTS[34]*STATES[4])/(CONSTANTS[36]+STATES[4]);
RATES[7] =  STATES[6]*(1.00000 - STATES[7]) -  (( CONSTANTS[41]*ALGEBRAIC[17]*ALGEBRAIC[20])/( CONSTANTS[41]*ALGEBRAIC[17]+ALGEBRAIC[18]))*STATES[7];
ALGEBRAIC[19] =  CONSTANTS[28]*pow(( CONSTANTS[41]*ALGEBRAIC[17]*STATES[7])/( CONSTANTS[41]*ALGEBRAIC[17]+ALGEBRAIC[18]), 4.00000)*(STATES[3] - STATES[4]);
RATES[4] =  CONSTANTS[53]*ALGEBRAIC[19] - ( CONSTANTS[54]*ALGEBRAIC[15]+ CONSTANTS[52]*ALGEBRAIC[13]);
RATES[3] = ALGEBRAIC[10] - ALGEBRAIC[19];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[1] =  CONSTANTS[37]*(pow(STATES[4], CONSTANTS[38])/(pow(CONSTANTS[40], CONSTANTS[38])+pow(STATES[4], CONSTANTS[38])));
ALGEBRAIC[0] =  (( CONSTANTS[3]*CONSTANTS[2])/( 2.00000*CONSTANTS[4]))*log(CONSTANTS[5]/STATES[1]);
ALGEBRAIC[2] =  CONSTANTS[1]*(STATES[0] - ALGEBRAIC[0]);
ALGEBRAIC[3] =  CONSTANTS[6]*(pow(CONSTANTS[9], CONSTANTS[7])/(pow(CONSTANTS[9], CONSTANTS[7])+pow(STATES[1], CONSTANTS[7])));
ALGEBRAIC[4] =  ALGEBRAIC[3]*(STATES[0] - CONSTANTS[8]);
ALGEBRAIC[7] =  CONSTANTS[11]*(pow(STATES[1], 2.00000)/(pow(CONSTANTS[12], 2.00000)+pow(STATES[1], 2.00000)));
ALGEBRAIC[8] = ALGEBRAIC[2]+ALGEBRAIC[4]+ALGEBRAIC[7];
ALGEBRAIC[9] =  CONSTANTS[13]*(pow(STATES[2], CONSTANTS[15])/(pow(CONSTANTS[14], CONSTANTS[15])+pow(STATES[2], CONSTANTS[15])));
ALGEBRAIC[5] =  CONSTANTS[10]*(pow(CONSTANTS[9], CONSTANTS[7])/(pow(CONSTANTS[9], CONSTANTS[7])+pow(STATES[1], CONSTANTS[7])));
ALGEBRAIC[6] =  ALGEBRAIC[5]*(STATES[0] - CONSTANTS[8]);
ALGEBRAIC[11] = ALGEBRAIC[6]+ALGEBRAIC[9];
ALGEBRAIC[10] = ( CONSTANTS[16]*(STATES[1] -  CONSTANTS[17]*STATES[3]))/(1.00000+ CONSTANTS[18]*STATES[1]+ CONSTANTS[19]*STATES[3]+ CONSTANTS[20]*STATES[1]*STATES[3]);
ALGEBRAIC[14] =  CONSTANTS[25]*(STATES[5]/(STATES[5]+CONSTANTS[26]));
ALGEBRAIC[15] =  CONSTANTS[27]*(STATES[4] - STATES[1]);
ALGEBRAIC[12] = pow(CONSTANTS[23], CONSTANTS[24])/(pow(CONSTANTS[23], CONSTANTS[24])+pow(STATES[5], CONSTANTS[24]));
ALGEBRAIC[13] =  CONSTANTS[21]*(pow(STATES[4], 2.00000)/(pow(CONSTANTS[22], 2.00000)+pow(STATES[4], 2.00000)))*ALGEBRAIC[12];
ALGEBRAIC[16] = 1.00000/(1.00000+( CONSTANTS[47]*CONSTANTS[48])/pow(CONSTANTS[47]+STATES[5], 2.00000));
ALGEBRAIC[17] = ( CONSTANTS[30]*CONSTANTS[35]+ CONSTANTS[32]*STATES[4])/(CONSTANTS[35]+STATES[4]);
ALGEBRAIC[18] = ( (CONSTANTS[29]+CONSTANTS[33])*CONSTANTS[36])/(CONSTANTS[36]+STATES[4]);
ALGEBRAIC[20] = ( CONSTANTS[31]*CONSTANTS[36]+ CONSTANTS[34]*STATES[4])/(CONSTANTS[36]+STATES[4]);
ALGEBRAIC[19] =  CONSTANTS[28]*pow(( CONSTANTS[41]*ALGEBRAIC[17]*STATES[7])/( CONSTANTS[41]*ALGEBRAIC[17]+ALGEBRAIC[18]), 4.00000)*(STATES[3] - STATES[4]);
}