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 1 entries in the algebraic variable array.
   There are a total of 2 entries in each of the rate and state variable arrays.
   There are a total of 34 entries in the constant variable array.
 */
/*
 * VOI is t in component environment (second).
 * CONSTANTS[0] is x in component environment (nanometer).
 * STATES[0] is n in component Crossbridges_attached (dimensionless).
 * STATES[1] is A_c in component Actin_free (dimensionless).
 * CONSTANTS[23] is f in component f (per_second).
 * CONSTANTS[24] is g in component g (per_second).
 * CONSTANTS[1] is h in component Crossbridges_attached (nanometer).
 * CONSTANTS[2] is f_1 in component f (per_second).
 * CONSTANTS[3] is g_1 in component g (per_second).
 * CONSTANTS[4] is g_2 in component g (per_second).
 * ALGEBRAIC[0] is Ca_f in component Ca_sarcoplasm (molar).
 * CONSTANTS[5] is t_d in component Ca_sarcoplasm (second).
 * CONSTANTS[6] is a_1 in component Ca_sarcoplasm (per_second_squared).
 * CONSTANTS[7] is b_1 in component Ca_sarcoplasm (per_second_squared).
 * CONSTANTS[8] is Ca_0 in component Ca_sarcoplasm (molar).
 * CONSTANTS[9] is c_1 in component Actin_free (per_second).
 * CONSTANTS[26] is c_2 in component Actin_free (per_second).
 * CONSTANTS[10] is c_2_0 in component Actin_free (per_second).
 * CONSTANTS[11] is k_i in component Actin_free (dimensionless).
 * CONSTANTS[25] is s_h in component s_h (muscle_length).
 * CONSTANTS[12] is q in component Actin_free (dimensionless).
 * CONSTANTS[13] is AT_0 in component Actin_free (dimensionless).
 * CONSTANTS[32] is F_SE in component Series_Elastic_Element (force).
 * CONSTANTS[14] is alpha_s in component Series_Elastic_Element (force).
 * CONSTANTS[15] is beta_s in component Series_Elastic_Element (muscle_length).
 * CONSTANTS[31] is x_s in component SE_constants (muscle_length).
 * CONSTANTS[16] is x_so in component Series_Elastic_Element (muscle_length).
 * CONSTANTS[30] is X_M_0 in component X_0 (muscle_length).
 * CONSTANTS[17] is L_max in component Series_Elastic_Element (muscle_length).
 * CONSTANTS[28] is F_PE in component Parallel_Elastic_Element (force).
 * CONSTANTS[18] is alpha_p in component Parallel_Elastic_Element (force).
 * CONSTANTS[19] is beta_p in component Parallel_Elastic_Element (muscle_length).
 * CONSTANTS[27] is x_p in component PE_constants (muscle_length).
 * CONSTANTS[20] is x_po in component Parallel_Elastic_Element (muscle_length).
 * CONSTANTS[33] is F_CE in component Contractile_Element (force).
 * CONSTANTS[21] is F_PL in component s_h (force).
 * CONSTANTS[29] is X_S_0 in component X_0 (muscle_length).
 * CONSTANTS[22] is F_PL in component X_0 (force).
 * RATES[0] is d/dt n in component Crossbridges_attached (dimensionless).
 * RATES[1] is d/dt A_c in component Actin_free (dimensionless).
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
CONSTANTS[0] = 10;
STATES[0] = 0;
STATES[1] = 1;
CONSTANTS[1] = 12;
CONSTANTS[2] = 70;
CONSTANTS[3] = 40;
CONSTANTS[4] = 240;
CONSTANTS[5] = 0.3;
CONSTANTS[6] = 200;
CONSTANTS[7] = 5;
CONSTANTS[8] = 0.45e-6;
CONSTANTS[9] = 200e12;
CONSTANTS[10] = 20;
CONSTANTS[11] = 30.9;
CONSTANTS[12] = 1.45;
CONSTANTS[13] = 2;
CONSTANTS[14] = 0.1027;
CONSTANTS[15] = 20;
CONSTANTS[16] = 0.0387;
CONSTANTS[17] = 1;
CONSTANTS[18] = 0.00224;
CONSTANTS[19] = 20;
CONSTANTS[20] = 0.221;
CONSTANTS[21] = 3;
CONSTANTS[22] = 3;
CONSTANTS[23] = (CONSTANTS[0]<0.00000 ? 0.00000 : CONSTANTS[0]>=0.00000&&CONSTANTS[0]<CONSTANTS[1] ? ( CONSTANTS[2]*CONSTANTS[0])/CONSTANTS[1] : 0.00000);
CONSTANTS[24] = (CONSTANTS[0]<0.00000 ? CONSTANTS[4] : CONSTANTS[0]>=0.00000&&CONSTANTS[0]<CONSTANTS[1] ? ( CONSTANTS[3]*CONSTANTS[0])/CONSTANTS[1] : ( CONSTANTS[3]*CONSTANTS[0])/CONSTANTS[1]);
CONSTANTS[25] = CONSTANTS[20] - ( 1.00000*1.00000*arbitrary_log(1.00000+CONSTANTS[21]/CONSTANTS[18], 10))/CONSTANTS[19];
CONSTANTS[26] =  CONSTANTS[10]*exp( CONSTANTS[11]*pow(CONSTANTS[25]/1.00000, CONSTANTS[12]));
CONSTANTS[27] = CONSTANTS[20] - CONSTANTS[25];
CONSTANTS[28] =  CONSTANTS[18]*(exp(( CONSTANTS[19]*CONSTANTS[27])/( 1.00000*1.00000)) - 1.00000);
CONSTANTS[29] = ( 1.00000*1.00000*arbitrary_log(1.00000+CONSTANTS[22]/CONSTANTS[14], 10))/CONSTANTS[15];
CONSTANTS[30] = ((CONSTANTS[29]+CONSTANTS[17]) - CONSTANTS[25]) - CONSTANTS[16];
CONSTANTS[31] = (CONSTANTS[16]+CONSTANTS[25]+CONSTANTS[30]) - CONSTANTS[17];
CONSTANTS[32] =  CONSTANTS[14]*(exp(( CONSTANTS[15]*CONSTANTS[31])/( 1.00000*1.00000)) - 1.00000);
CONSTANTS[33] = CONSTANTS[32] - CONSTANTS[28];
}
void
computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
RATES[0] =  CONSTANTS[23]*(STATES[1] - STATES[0]) -  CONSTANTS[24]*STATES[0];
ALGEBRAIC[0] =  CONSTANTS[8]*fabs(1.00000 - exp( - CONSTANTS[6]*pow(VOI, 2.00000)))*exp( - CONSTANTS[7]*pow(VOI - CONSTANTS[5], 2.00000));
RATES[1] =  CONSTANTS[9]*pow(ALGEBRAIC[0]/1.00000, 2.00000)*(CONSTANTS[13] - STATES[1]) -  CONSTANTS[26]*STATES[1];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] =  CONSTANTS[8]*fabs(1.00000 - exp( - CONSTANTS[6]*pow(VOI, 2.00000)))*exp( - CONSTANTS[7]*pow(VOI - CONSTANTS[5], 2.00000));
}