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 6 entries in the algebraic variable array.
There are a total of 4 entries in each of the rate and state variable arrays.
There are a total of 22 entries in the constant variable array.
*/
/*
* VOI is time in component environment (minute).
* STATES[0] is m in component m (micromolar).
* CONSTANTS[0] is kM_plus in component m (fourth_order_rate_constant).
* CONSTANTS[1] is kM_minus in component m (first_order_rate_constant).
* CONSTANTS[2] is CaMtotal in component m (micromolar).
* STATES[1] is x in component x (micromolar).
* ALGEBRAIC[0] is dmdt in component m (flux).
* STATES[2] is z in component z (micromolar).
* CONSTANTS[3] is kN_plus in component z (second_order_rate_constant).
* CONSTANTS[4] is kN_minus in component z (first_order_rate_constant).
* CONSTANTS[5] is CaNtotal in component z (micromolar).
* ALGEBRAIC[1] is dzdt in component z (flux).
* STATES[3] is h in component h (dimensionless).
* CONSTANTS[6] is d in component h (first_order_rate_constant).
* CONSTANTS[7] is f in component h (first_order_rate_constant).
* ALGEBRAIC[3] is phi in component phi (dimensionless).
* CONSTANTS[8] is lamda in component model_parameters (dimensionless).
* CONSTANTS[21] is L0 in component model_parameters (dimensionless).
* ALGEBRAIC[2] is y in component model_parameters (dimensionless).
* CONSTANTS[9] is N in component model_parameters (dimensionless).
* ALGEBRAIC[4] is psi in component psi (dimensionless).
* CONSTANTS[10] is Vx in component x (flux).
* CONSTANTS[11] is Kx in component x (micromolar).
* CONSTANTS[12] is V1 in component x (flux).
* CONSTANTS[13] is K1 in component x (micromolar).
* CONSTANTS[14] is V2 in component x (flux).
* CONSTANTS[15] is K2 in component x (micromolar).
* CONSTANTS[16] is V3 in component x (flux).
* CONSTANTS[17] is K3 in component x (micromolar).
* CONSTANTS[18] is kc in component x (dimensionless).
* CONSTANTS[19] is alpha in component x (first_order_rate_constant).
* CONSTANTS[20] is Caex in component x (micromolar).
* ALGEBRAIC[5] is dxdt in component x (flux).
* RATES[0] is d/dt m in component m (micromolar).
* RATES[2] is d/dt z in component z (micromolar).
* RATES[3] is d/dt h in component h (dimensionless).
* RATES[1] is d/dt x in component x (micromolar).
*/
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = 0.0;
CONSTANTS[0] = 500.0;
CONSTANTS[1] = 100.0;
CONSTANTS[2] = 25.0;
STATES[1] = 0.0;
STATES[2] = 1.0E-8;
CONSTANTS[3] = 5.0;
CONSTANTS[4] = 5.0;
CONSTANTS[5] = 25.0;
STATES[3] = 0.0;
CONSTANTS[6] = 0.4;
CONSTANTS[7] = 0.1;
CONSTANTS[8] = 5.0;
CONSTANTS[9] = 13.0;
CONSTANTS[10] = 1000.0;
CONSTANTS[11] = 500.0;
CONSTANTS[12] = 30000.0;
CONSTANTS[13] = 4.3;
CONSTANTS[14] = 100.0;
CONSTANTS[15] = 0.1;
CONSTANTS[16] = 10000.0;
CONSTANTS[17] = 100.0;
CONSTANTS[18] = 10.0;
CONSTANTS[19] = 0.006;
CONSTANTS[20] = 1.0;
CONSTANTS[21] = pow(10.0000, - (CONSTANTS[9]/2.00000));
}
void
computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
RATES[0] = CONSTANTS[0]*(CONSTANTS[2] - STATES[0])*pow(STATES[1], 3.00000) - CONSTANTS[1]*STATES[0];
RATES[2] = CONSTANTS[3]*(CONSTANTS[5] - STATES[2])*STATES[0] - CONSTANTS[4]*STATES[2];
ALGEBRAIC[2] = 1.00000/STATES[2];
ALGEBRAIC[3] = 1.00000/(1.00000+( CONSTANTS[21]*(pow( CONSTANTS[8]*ALGEBRAIC[2], CONSTANTS[9]+1.00000) - 1.00000))/( ( CONSTANTS[8]*ALGEBRAIC[2] - 1.00000)*((ALGEBRAIC[2] - 1.00000)/(pow(ALGEBRAIC[2], CONSTANTS[9]+1.00000) - 1.00000))));
RATES[3] = CONSTANTS[6]*ALGEBRAIC[3]*(1.00000/STATES[2])*(1.00000 - STATES[3]) - CONSTANTS[7]*(1.00000 - ALGEBRAIC[3]*(1.00000/STATES[2]))*STATES[3];
ALGEBRAIC[4] = (1.00000+CONSTANTS[21])/((pow(ALGEBRAIC[2], CONSTANTS[9]+1.00000) - 1.00000)/(ALGEBRAIC[2] - 1.00000)+ CONSTANTS[21]*((pow( CONSTANTS[8]*ALGEBRAIC[2], CONSTANTS[9]+1.00000) - 1.00000)/( CONSTANTS[8]*ALGEBRAIC[2] - 1.00000)));
RATES[1] = ( CONSTANTS[10]*CONSTANTS[20])/(CONSTANTS[11]+CONSTANTS[20]) - ( STATES[3]*ALGEBRAIC[4]*(1.00000/STATES[2])*(( CONSTANTS[12]*STATES[1])/(CONSTANTS[13]+STATES[1]))+ STATES[3]*ALGEBRAIC[4]*(1.00000/STATES[2])*(( CONSTANTS[14]*STATES[1])/(CONSTANTS[15]+STATES[1]))+ (1.00000/(1.00000+ CONSTANTS[18]*STATES[2]))*(( CONSTANTS[16]*STATES[1])/(CONSTANTS[17]+STATES[1]))+ CONSTANTS[19]*STATES[1]);
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[2] = 1.00000/STATES[2];
ALGEBRAIC[3] = 1.00000/(1.00000+( CONSTANTS[21]*(pow( CONSTANTS[8]*ALGEBRAIC[2], CONSTANTS[9]+1.00000) - 1.00000))/( ( CONSTANTS[8]*ALGEBRAIC[2] - 1.00000)*((ALGEBRAIC[2] - 1.00000)/(pow(ALGEBRAIC[2], CONSTANTS[9]+1.00000) - 1.00000))));
ALGEBRAIC[4] = (1.00000+CONSTANTS[21])/((pow(ALGEBRAIC[2], CONSTANTS[9]+1.00000) - 1.00000)/(ALGEBRAIC[2] - 1.00000)+ CONSTANTS[21]*((pow( CONSTANTS[8]*ALGEBRAIC[2], CONSTANTS[9]+1.00000) - 1.00000)/( CONSTANTS[8]*ALGEBRAIC[2] - 1.00000)));
ALGEBRAIC[0] = CONSTANTS[0]*(CONSTANTS[2] - STATES[0])*pow(STATES[1], 3.00000) - CONSTANTS[1]*STATES[0];
ALGEBRAIC[1] = CONSTANTS[3]*(CONSTANTS[5] - STATES[2])*STATES[0] - CONSTANTS[4]*STATES[2];
ALGEBRAIC[5] = ( CONSTANTS[10]*CONSTANTS[20])/(CONSTANTS[11]+CONSTANTS[20]) - ( STATES[3]*ALGEBRAIC[4]*(1.00000/STATES[2])*(( CONSTANTS[12]*STATES[1])/(CONSTANTS[13]+STATES[1]))+ STATES[3]*ALGEBRAIC[4]*(1.00000/STATES[2])*(( CONSTANTS[14]*STATES[1])/(CONSTANTS[15]+STATES[1]))+ (1.00000/(1.00000+ CONSTANTS[18]*STATES[2]))*(( CONSTANTS[16]*STATES[1])/(CONSTANTS[17]+STATES[1]))+ CONSTANTS[19]*STATES[1]);
}
