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 5 entries in the algebraic variable array.
   There are a total of 3 entries in each of the rate and state variable arrays.
   There are a total of 14 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (second).
 * STATES[0] is V in component membrane (millivolt).
 * CONSTANTS[0] is Cm in component membrane (picoF).
 * ALGEBRAIC[0] is i_s in component calcium_channel (femtoA).
 * ALGEBRAIC[2] is i_K in component potassium_channel (femtoA).
 * ALGEBRAIC[3] is i_K_ACh in component acetyl_choline_activated_potassium_channel (femtoA).
 * ALGEBRAIC[4] is i_j in component coupling_current (femtoA).
 * CONSTANTS[1] is g_s in component calcium_channel (picoS).
 * CONSTANTS[2] is V_s in component calcium_channel (millivolt).
 * CONSTANTS[3] is V_1 in component calcium_channel (millivolt).
 * CONSTANTS[4] is V_2 in component calcium_channel (millivolt).
 * CONSTANTS[5] is g_K in component potassium_channel (picoS).
 * CONSTANTS[6] is V_K in component potassium_channel (millivolt).
 * STATES[1] is w in component potassium_channel_w_gate (dimensionless).
 * CONSTANTS[7] is lambda_w in component potassium_channel_w_gate (per_second).
 * CONSTANTS[8] is V_3 in component potassium_channel_w_gate (millivolt).
 * CONSTANTS[9] is V_4 in component potassium_channel_w_gate (millivolt).
 * STATES[2] is u in component acetyl_choline_activated_potassium_channel_u_gate (dimensionless).
 * CONSTANTS[13] is alpha in component acetyl_choline_activated_potassium_channel_u_gate (per_second).
 * ALGEBRAIC[1] is beta in component acetyl_choline_activated_potassium_channel_u_gate (per_second).
 * CONSTANTS[10] is ACh in component acetyl_choline_activated_potassium_channel_u_gate (molar).
 * CONSTANTS[11] is g_j in component coupling_current (picoS).
 * CONSTANTS[12] is V_B in component coupling_current (millivolt).
 * RATES[0] is d/dt V in component membrane (millivolt).
 * RATES[1] is d/dt w in component potassium_channel_w_gate (dimensionless).
 * RATES[2] is d/dt u in component acetyl_choline_activated_potassium_channel_u_gate (dimensionless).
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = -52.07606;
CONSTANTS[0] = 60;
CONSTANTS[1] = 382.9118;
CONSTANTS[2] = 214.1429;
CONSTANTS[3] = -35.9358;
CONSTANTS[4] = 7.8589;
CONSTANTS[5] = 536.1093;
CONSTANTS[6] = -259.0783;
STATES[1] = 0.0008971;
CONSTANTS[7] = 20.7796;
CONSTANTS[8] = -27.9375;
CONSTANTS[9] = 6.321;
STATES[2] = 0.2344555;
CONSTANTS[10] = 1e-6;
CONSTANTS[11] = 0;
CONSTANTS[12] = -50;
CONSTANTS[13] = 0.0123320/(1.00000+4.20000e-06/CONSTANTS[10]);
}
void
computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
RATES[1] =  CONSTANTS[7]*cosh((STATES[0] - CONSTANTS[8])/( 2.00000*CONSTANTS[9]))*( (1.00000/2.00000)*(1.00000+ tanh((STATES[0] - CONSTANTS[8])/CONSTANTS[9])) - STATES[1]);
ALGEBRAIC[1] =  0.0100000*exp( 0.0133000*(STATES[0]+40.0000));
RATES[2] =  CONSTANTS[13]*(1.00000 - STATES[2]) -  ALGEBRAIC[1]*STATES[2];
ALGEBRAIC[0] =  (1.00000/2.00000)*CONSTANTS[1]*(1.00000+ tanh((STATES[0] - CONSTANTS[3])/CONSTANTS[4]))*(STATES[0] - CONSTANTS[2]);
ALGEBRAIC[2] =  CONSTANTS[5]*STATES[1]*(STATES[0] - CONSTANTS[6]);
ALGEBRAIC[3] =  1.00000*0.270000*STATES[2]*(STATES[0]+90.0000);
ALGEBRAIC[4] =  CONSTANTS[11]*(STATES[0] - CONSTANTS[12]);
RATES[0] = - (ALGEBRAIC[0]+ALGEBRAIC[2]+ALGEBRAIC[3]+ALGEBRAIC[4])/CONSTANTS[0];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[1] =  0.0100000*exp( 0.0133000*(STATES[0]+40.0000));
ALGEBRAIC[0] =  (1.00000/2.00000)*CONSTANTS[1]*(1.00000+ tanh((STATES[0] - CONSTANTS[3])/CONSTANTS[4]))*(STATES[0] - CONSTANTS[2]);
ALGEBRAIC[2] =  CONSTANTS[5]*STATES[1]*(STATES[0] - CONSTANTS[6]);
ALGEBRAIC[3] =  1.00000*0.270000*STATES[2]*(STATES[0]+90.0000);
ALGEBRAIC[4] =  CONSTANTS[11]*(STATES[0] - CONSTANTS[12]);
}