Generated Code

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

The raw code is available.

/*
   There are a total of 24 entries in the algebraic variable array.
   There are a total of 5 entries in each of the rate and state variable arrays.
   There are a total of 37 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (millisecond).
 * STATES[0] is V in component membrane (millivolt).
 * CONSTANTS[0] is Cm in component membrane (femtoF).
 * ALGEBRAIC[0] is i_K in component K_current (picoA).
 * ALGEBRAIC[8] is i_K_Ca in component K_Ca_current (picoA).
 * ALGEBRAIC[3] is i_K_ATP in component K_ATP_current (picoA).
 * ALGEBRAIC[21] is i_CRAC in component CRAC_current (picoA).
 * ALGEBRAIC[20] is i_Ca in component Ca_current_total (picoA).
 * ALGEBRAIC[10] is i_leak in component leak_current (picoA).
 * CONSTANTS[1] is V_K in component K_current (millivolt).
 * CONSTANTS[2] is g_K in component K_current (picoS).
 * STATES[1] is n in component K_channel_n_gate (dimensionless).
 * ALGEBRAIC[1] is n_infinity in component K_channel_n_gate (dimensionless).
 * ALGEBRAIC[2] is tau_n in component K_channel_n_gate (millisecond).
 * CONSTANTS[3] is Vn in component K_channel_n_gate (millivolt).
 * CONSTANTS[4] is Sn in component K_channel_n_gate (millivolt).
 * CONSTANTS[5] is lambda_n in component K_channel_n_gate (dimensionless).
 * CONSTANTS[6] is g_K_ATP in component K_ATP_current (picoS).
 * ALGEBRAIC[18] is i_Ca_f in component fast_Ca_current (picoA).
 * CONSTANTS[7] is V_Ca in component fast_Ca_current (millivolt).
 * CONSTANTS[8] is g_Ca_f in component fast_Ca_current (picoS).
 * ALGEBRAIC[4] is m_f_infinity in component fast_Ca_channel_m_gate (dimensionless).
 * CONSTANTS[9] is Vm_f in component fast_Ca_channel_m_gate (millivolt).
 * CONSTANTS[10] is Sm_f in component fast_Ca_channel_m_gate (millivolt).
 * ALGEBRAIC[19] is i_Ca_s in component slow_Ca_current (picoA).
 * CONSTANTS[11] is g_Ca_s in component slow_Ca_current (picoS).
 * ALGEBRAIC[5] is m_s_infinity in component slow_Ca_channel_m_gate (dimensionless).
 * STATES[2] is jm in component slow_Ca_channel_j_gate (dimensionless).
 * CONSTANTS[12] is Vm_s in component slow_Ca_channel_m_gate (millivolt).
 * CONSTANTS[13] is Sm_s in component slow_Ca_channel_m_gate (millivolt).
 * ALGEBRAIC[6] is jm_infinity in component slow_Ca_channel_j_gate (dimensionless).
 * CONSTANTS[14] is Vj in component slow_Ca_channel_j_gate (millivolt).
 * ALGEBRAIC[7] is tau_j in component slow_Ca_channel_j_gate (millisecond).
 * CONSTANTS[15] is Sj in component slow_Ca_channel_j_gate (millivolt).
 * CONSTANTS[16] is g_K_Ca in component K_Ca_current (picoS).
 * STATES[3] is Ca_i in component Ca_equations (micromolar).
 * CONSTANTS[17] is kdkca in component K_Ca_current (micromolar).
 * CONSTANTS[18] is g_CRAC in component CRAC_current (picoS).
 * CONSTANTS[19] is V_CRAC in component CRAC_current (millivolt).
 * STATES[4] is Ca_er in component Ca_equations (micromolar).
 * ALGEBRAIC[9] is r_infinity in component CRAC_r_gate (dimensionless).
 * CONSTANTS[20] is Ca_er_bar in component CRAC_r_gate (micromolar).
 * CONSTANTS[21] is sloper in component CRAC_r_gate (micromolar).
 * CONSTANTS[22] is g_leak in component leak_current (picoS).
 * ALGEBRAIC[11] is J_er_p in component ER_parameters (micromolar_per_millisecond).
 * CONSTANTS[23] is IP3 in component ER_parameters (micromolar).
 * CONSTANTS[24] is kerp in component ER_parameters (micromolar).
 * CONSTANTS[25] is verp in component ER_parameters (micromolar_per_millisecond).
 * CONSTANTS[26] is dact in component ER_parameters (micromolar).
 * CONSTANTS[27] is dinh in component ER_parameters (micromolar).
 * CONSTANTS[28] is dip3 in component ER_parameters (micromolar).
 * ALGEBRAIC[12] is a_infinity in component ER_parameters (dimensionless).
 * CONSTANTS[36] is b_infinity in component ER_parameters (dimensionless).
 * ALGEBRAIC[13] is h_infinity in component ER_parameters (dimensionless).
 * ALGEBRAIC[14] is O in component ER_parameters (per_millisecond).
 * ALGEBRAIC[22] is J_er_tot in component Ca_equations (micromolar_per_millisecond).
 * ALGEBRAIC[16] is J_er_IP3 in component Ca_equations (micromolar_per_millisecond).
 * ALGEBRAIC[15] is J_er_leak in component Ca_equations (micromolar_per_millisecond).
 * ALGEBRAIC[23] is J_mem_tot in component Ca_membrane_flux (micromolar_per_millisecond).
 * CONSTANTS[29] is perl in component Ca_equations (per_millisecond).
 * CONSTANTS[30] is lambda_er in component Ca_equations (dimensionless).
 * CONSTANTS[31] is sigma_er in component Ca_equations (dimensionless).
 * CONSTANTS[32] is kmp in component Ca_membrane_flux (micromolar).
 * CONSTANTS[33] is vmp in component Ca_membrane_flux (micromolar).
 * CONSTANTS[34] is gamma in component Ca_membrane_flux (micromolar_per_picoA).
 * ALGEBRAIC[17] is Jmp in component Ca_membrane_flux (micromolar).
 * CONSTANTS[35] is f in component Ca_membrane_flux (per_millisecond).
 * RATES[0] is d/dt V in component membrane (millivolt).
 * RATES[1] is d/dt n in component K_channel_n_gate (dimensionless).
 * RATES[2] is d/dt jm in component slow_Ca_channel_j_gate (dimensionless).
 * RATES[4] is d/dt Ca_er in component Ca_equations (micromolar).
 * RATES[3] is d/dt Ca_i in component Ca_equations (micromolar).
 * There are a total of 0 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = -61;
CONSTANTS[0] = 6158;
CONSTANTS[1] = -70;
CONSTANTS[2] = 3900;
STATES[1] = 0.0005;
CONSTANTS[3] = -15;
CONSTANTS[4] = 6;
CONSTANTS[5] = 1.85;
CONSTANTS[6] = 150;
CONSTANTS[7] = 100;
CONSTANTS[8] = 810;
CONSTANTS[9] = -20;
CONSTANTS[10] = 7.5;
CONSTANTS[11] = 510;
STATES[2] = 0.12;
CONSTANTS[12] = -16;
CONSTANTS[13] = 10;
CONSTANTS[14] = -53;
CONSTANTS[15] = 2;
CONSTANTS[16] = 1200;
STATES[3] = 0.11;
CONSTANTS[17] = 0.55;
CONSTANTS[18] = 75;
CONSTANTS[19] = 0;
STATES[4] = 60;
CONSTANTS[20] = 40;
CONSTANTS[21] = 3;
CONSTANTS[22] = 0;
CONSTANTS[23] = 0;
CONSTANTS[24] = 0.09;
CONSTANTS[25] = 0.24;
CONSTANTS[26] = 0.35;
CONSTANTS[27] = 0.4;
CONSTANTS[28] = 0.2;
CONSTANTS[29] = 0.003;
CONSTANTS[30] = 250;
CONSTANTS[31] = 1;
CONSTANTS[32] = 0.35;
CONSTANTS[33] = 0.08;
CONSTANTS[34] = 0.000003607;
CONSTANTS[35] = 0.01;
CONSTANTS[36] = CONSTANTS[23]/(CONSTANTS[23]+CONSTANTS[28]);
RATES[0] = 0.1001;
RATES[1] = 0.1001;
RATES[2] = 0.1001;
RATES[4] = 0.1001;
RATES[3] = 0.1001;
}
void
computeResiduals(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
                 double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
resid[0] = RATES[0] - - (ALGEBRAIC[20]+ALGEBRAIC[0]+ALGEBRAIC[3]+ALGEBRAIC[8]+ALGEBRAIC[21]+ALGEBRAIC[10])/CONSTANTS[0];
resid[1] = RATES[1] - ( CONSTANTS[5]*(ALGEBRAIC[1] - STATES[1]))/ALGEBRAIC[2];
resid[2] = RATES[2] - (ALGEBRAIC[6] - STATES[2])/ALGEBRAIC[7];
resid[3] = RATES[4] - - ALGEBRAIC[22]/( CONSTANTS[30]*CONSTANTS[31]);
resid[4] = RATES[3] - ALGEBRAIC[22]/CONSTANTS[30]+ALGEBRAIC[23];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
}
void
computeEssentialVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] =  CONSTANTS[2]*STATES[1]*(STATES[0] - CONSTANTS[1]);
ALGEBRAIC[1] = 1.00000/(1.00000+exp((CONSTANTS[3] - STATES[0])/CONSTANTS[4]));
ALGEBRAIC[2] = 9.09000/(1.00000+exp((STATES[0] - CONSTANTS[3])/CONSTANTS[4]));
ALGEBRAIC[3] =  CONSTANTS[6]*(STATES[0] - CONSTANTS[1]);
ALGEBRAIC[6] = 1.00000 - 1.00000/(1.00000+exp((STATES[0] - CONSTANTS[14])/CONSTANTS[15]));
ALGEBRAIC[7] = 50000.0/(exp((STATES[0] - CONSTANTS[14])/4.00000)+exp((CONSTANTS[14] - STATES[0])/4.00000))+1500.00;
ALGEBRAIC[8] =  (( CONSTANTS[16]*pow(STATES[3], 5.00000))/(pow(STATES[3], 5.00000)+pow(CONSTANTS[17], 5.00000)))*(STATES[0] - CONSTANTS[1]);
ALGEBRAIC[10] =  CONSTANTS[22]*(STATES[0] - CONSTANTS[19]);
ALGEBRAIC[4] = 1.00000/(1.00000+exp((CONSTANTS[9] - STATES[0])/CONSTANTS[10]));
ALGEBRAIC[18] =  CONSTANTS[8]*ALGEBRAIC[4]*(STATES[0] - CONSTANTS[7]);
ALGEBRAIC[5] = 1.00000/(1.00000+exp((CONSTANTS[12] - STATES[0])/CONSTANTS[13]));
ALGEBRAIC[19] =  CONSTANTS[11]*ALGEBRAIC[5]*(1.00000 - STATES[2])*(STATES[0] - CONSTANTS[7]);
ALGEBRAIC[20] = ALGEBRAIC[18]+ALGEBRAIC[19];
ALGEBRAIC[9] = 1.00000/(1.00000+exp((STATES[4] - CONSTANTS[20])/CONSTANTS[21]));
ALGEBRAIC[21] =  CONSTANTS[18]*ALGEBRAIC[9]*(STATES[0] - CONSTANTS[19]);
ALGEBRAIC[11] = ( CONSTANTS[25]*pow(STATES[3], 2.00000))/(pow(STATES[3], 2.00000)+pow(CONSTANTS[24], 2.00000));
ALGEBRAIC[12] = 1.00000/(1.00000+CONSTANTS[26]/STATES[3]);
ALGEBRAIC[13] = 1.00000/(1.00000+STATES[3]/CONSTANTS[27]);
ALGEBRAIC[14] =  pow(ALGEBRAIC[12], 3.00000)*pow(CONSTANTS[36], 3.00000)*pow(ALGEBRAIC[13], 3.00000)*1.00000;
ALGEBRAIC[16] =  ALGEBRAIC[14]*(STATES[4] - STATES[3]);
ALGEBRAIC[15] =  CONSTANTS[29]*(STATES[4] - STATES[3]);
ALGEBRAIC[22] = (ALGEBRAIC[15]+ALGEBRAIC[16]) - ALGEBRAIC[11];
ALGEBRAIC[17] = ( CONSTANTS[33]*pow(STATES[3], 2.00000))/(pow(STATES[3], 2.00000)+pow(CONSTANTS[32], 2.00000));
ALGEBRAIC[23] =  - CONSTANTS[35]*( CONSTANTS[34]*ALGEBRAIC[20]+ALGEBRAIC[17]);
}
void
getStateInformation(double* SI)
{
SI[0] = 1.0;
SI[1] = 1.0;
SI[2] = 1.0;
SI[3] = 1.0;
SI[4] = 1.0;
}
void
computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
             double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
}