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 3 entries in the algebraic variable array.
   There are a total of 10 entries in each of the rate and state variable arrays.
   There are a total of 40 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (hour).
 * CONSTANTS[0] is v_sP in component nucleus (nanomolar_hour).
 * CONSTANTS[1] is v_mP in component nucleus (nanomolar_hour).
 * CONSTANTS[2] is K_IP in component nucleus (nanomolar).
 * CONSTANTS[3] is K_mP in component nucleus (nanomolar).
 * CONSTANTS[4] is v_sT in component nucleus (nanomolar_hour).
 * CONSTANTS[5] is v_mT in component nucleus (nanomolar_hour).
 * CONSTANTS[6] is K_IT in component nucleus (nanomolar).
 * CONSTANTS[7] is K_mT in component nucleus (nanomolar).
 * CONSTANTS[8] is k_d in component cytosol (per_hour).
 * CONSTANTS[9] is n in component nucleus (dimensionless).
 * CONSTANTS[10] is k_1 in component cytosol (per_hour).
 * CONSTANTS[11] is k_2 in component cytosol (per_hour).
 * CONSTANTS[12] is k_dN in component nucleus (per_hour).
 * STATES[0] is C in component cytosol (nanomolar).
 * STATES[1] is M_P in component nucleus (nanomolar).
 * STATES[2] is M_T in component nucleus (nanomolar).
 * STATES[3] is C_N in component nucleus (nanomolar).
 * CONSTANTS[13] is k_3 in component cytosol (per_nanomolar_hour).
 * CONSTANTS[14] is k_4 in component cytosol (per_hour).
 * CONSTANTS[15] is k_dC in component cytosol (per_hour).
 * STATES[4] is P_0 in component PER (nanomolar).
 * STATES[5] is P_1 in component PER (nanomolar).
 * STATES[6] is P_2 in component PER (nanomolar).
 * STATES[7] is T_0 in component TIM (nanomolar).
 * STATES[8] is T_1 in component TIM (nanomolar).
 * STATES[9] is T_2 in component TIM (nanomolar).
 * CONSTANTS[16] is V_1P in component PER (nanomolar_hour).
 * CONSTANTS[17] is V_2P in component PER (nanomolar_hour).
 * CONSTANTS[18] is V_3P in component PER (nanomolar_hour).
 * CONSTANTS[19] is V_4P in component PER (nanomolar_hour).
 * CONSTANTS[20] is K_1P in component PER (nanomolar).
 * CONSTANTS[21] is K_2P in component PER (nanomolar).
 * CONSTANTS[22] is K_3P in component PER (nanomolar).
 * CONSTANTS[23] is K_4P in component PER (nanomolar).
 * CONSTANTS[24] is K_dP in component PER (nanomolar).
 * CONSTANTS[25] is v_dP in component PER (nanomolar_hour).
 * CONSTANTS[26] is k_sP in component PER (per_hour).
 * CONSTANTS[27] is V_1T in component TIM (nanomolar_hour).
 * CONSTANTS[28] is V_2T in component TIM (nanomolar_hour).
 * CONSTANTS[29] is V_3T in component TIM (nanomolar_hour).
 * CONSTANTS[30] is V_4T in component TIM (nanomolar_hour).
 * CONSTANTS[31] is K_1T in component TIM (nanomolar).
 * CONSTANTS[32] is K_2T in component TIM (nanomolar).
 * CONSTANTS[33] is K_3T in component TIM (nanomolar).
 * CONSTANTS[34] is K_4T in component TIM (nanomolar).
 * CONSTANTS[35] is K_dT in component TIM (nanomolar).
 * ALGEBRAIC[0] is v_dT in component LD_cycle (nanomolar_hour).
 * CONSTANTS[36] is k_sT in component TIM (per_hour).
 * CONSTANTS[37] is PI in component LD_cycle (dimensionless).
 * CONSTANTS[38] is v_dT_dark in component LD_cycle (nanomolar_hour).
 * CONSTANTS[39] is v_dT_light in component LD_cycle (nanomolar_hour).
 * ALGEBRAIC[1] is P_t in component PER_total (nanomolar).
 * ALGEBRAIC[2] is T_t in component TIM_total (nanomolar).
 * RATES[1] is d/dt M_P in component nucleus (nanomolar).
 * RATES[2] is d/dt M_T in component nucleus (nanomolar).
 * RATES[3] is d/dt C_N in component nucleus (nanomolar).
 * RATES[0] is d/dt C in component cytosol (nanomolar).
 * RATES[4] is d/dt P_0 in component PER (nanomolar).
 * RATES[5] is d/dt P_1 in component PER (nanomolar).
 * RATES[6] is d/dt P_2 in component PER (nanomolar).
 * RATES[7] is d/dt T_0 in component TIM (nanomolar).
 * RATES[8] is d/dt T_1 in component TIM (nanomolar).
 * RATES[9] is d/dt T_2 in component TIM (nanomolar).
 * There are a total of 1 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
CONSTANTS[0] = 0.8;
CONSTANTS[1] = 0.8;
CONSTANTS[2] = 1;
CONSTANTS[3] = 0.2;
CONSTANTS[4] = 1;
CONSTANTS[5] = 0.7;
CONSTANTS[6] = 1;
CONSTANTS[7] = 0.2;
CONSTANTS[8] = 0.01;
CONSTANTS[9] = 4;
CONSTANTS[10] = 1.2;
CONSTANTS[11] = 0.2;
CONSTANTS[12] = 0.01;
STATES[0] = 0.1790;
STATES[1] = 0.09107;
STATES[2] = 1.427;
STATES[3] = 1.203;
CONSTANTS[13] = 1.2;
CONSTANTS[14] = 0.6;
CONSTANTS[15] = 0.01;
STATES[4] = 0.02324;
STATES[5] = 0.02210;
STATES[6] = 0.01251;
STATES[7] = 0.5420;
STATES[8] = 0.8000;
STATES[9] = 4.733;
CONSTANTS[16] = 8;
CONSTANTS[17] = 1;
CONSTANTS[18] = 8;
CONSTANTS[19] = 1;
CONSTANTS[20] = 2;
CONSTANTS[21] = 2;
CONSTANTS[22] = 2;
CONSTANTS[23] = 2;
CONSTANTS[24] = 0.2;
CONSTANTS[25] = 2;
CONSTANTS[26] = 0.9;
CONSTANTS[27] = 8;
CONSTANTS[28] = 1;
CONSTANTS[29] = 8;
CONSTANTS[30] = 1;
CONSTANTS[31] = 2;
CONSTANTS[32] = 2;
CONSTANTS[33] = 2;
CONSTANTS[34] = 2;
CONSTANTS[35] = 0.2;
CONSTANTS[36] = 0.9;
CONSTANTS[37] = 3.141592653589793;
CONSTANTS[38] = 2;
CONSTANTS[39] = 4;
RATES[1] = 0.1;
RATES[2] = 0.1;
RATES[3] = 0.1;
RATES[0] = 0.1;
RATES[4] = 0.1;
RATES[5] = 0.1;
RATES[6] = 0.1;
RATES[7] = 0.1;
RATES[8] = 0.1;
RATES[9] = 0.1;
}
void
computeResiduals(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
                 double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
resid[0] = RATES[1] -  CONSTANTS[0]*pow(CONSTANTS[2], CONSTANTS[9])/(pow(CONSTANTS[2], CONSTANTS[9])+pow(STATES[3], CONSTANTS[9])) -  CONSTANTS[1]*STATES[1]/(CONSTANTS[3]+STATES[1]) -  CONSTANTS[8]*STATES[1];
resid[1] = RATES[2] -  CONSTANTS[4]*pow(CONSTANTS[6], CONSTANTS[9])/(pow(CONSTANTS[6], CONSTANTS[9])+pow(STATES[3], CONSTANTS[9])) -  CONSTANTS[5]*STATES[2]/(CONSTANTS[7]+STATES[2]) -  CONSTANTS[8]*STATES[2];
resid[2] = RATES[3] -  CONSTANTS[10]*STATES[0] -  CONSTANTS[11]*STATES[3] -  CONSTANTS[12]*STATES[3];
resid[3] = RATES[0] -  CONSTANTS[13]*STATES[6]*STATES[9] -  CONSTANTS[14]*STATES[0] -  CONSTANTS[10]*STATES[0]+ CONSTANTS[11]*STATES[3] -  CONSTANTS[15]*STATES[0];
resid[4] = RATES[4] -  CONSTANTS[26]*STATES[1] -  CONSTANTS[16]*STATES[4]/(CONSTANTS[20]+STATES[4])+ CONSTANTS[17]*STATES[5]/(CONSTANTS[21]+STATES[5]) -  CONSTANTS[8]*STATES[4];
resid[5] = RATES[5] -  CONSTANTS[16]*STATES[4]/(CONSTANTS[20]+STATES[4]) -  CONSTANTS[17]*STATES[5]/(CONSTANTS[21]+STATES[5]) -  CONSTANTS[18]*STATES[5]/(CONSTANTS[22]+STATES[5])+ CONSTANTS[19]*STATES[6]/(CONSTANTS[23]+STATES[6]) -  CONSTANTS[8]*STATES[5];
resid[6] = RATES[6] -  CONSTANTS[18]*STATES[5]/(CONSTANTS[22]+STATES[5]) -  CONSTANTS[19]*STATES[6]/(CONSTANTS[23]+STATES[6]) -  CONSTANTS[13]*STATES[6]*STATES[9]+ CONSTANTS[14]*STATES[0] -  CONSTANTS[25]*STATES[6]/(CONSTANTS[24]+STATES[6]) -  CONSTANTS[8]*STATES[6];
resid[7] = RATES[7] -  CONSTANTS[36]*STATES[2] -  CONSTANTS[27]*STATES[7]/(CONSTANTS[31]+STATES[7])+ CONSTANTS[28]*STATES[8]/(CONSTANTS[32]+STATES[8]) -  CONSTANTS[8]*STATES[7];
resid[8] = RATES[8] -  CONSTANTS[27]*STATES[7]/(CONSTANTS[31]+STATES[7]) -  CONSTANTS[28]*STATES[8]/(CONSTANTS[32]+STATES[8]) -  CONSTANTS[29]*STATES[8]/(CONSTANTS[33]+STATES[8])+ CONSTANTS[30]*STATES[9]/(CONSTANTS[34]+STATES[9]) -  CONSTANTS[8]*STATES[8];
resid[9] = RATES[9] -  CONSTANTS[29]*STATES[8]/(CONSTANTS[33]+STATES[8]) -  CONSTANTS[30]*STATES[9]/(CONSTANTS[34]+STATES[9]) -  CONSTANTS[13]*STATES[6]*STATES[9]+ CONSTANTS[14]*STATES[0] -  ALGEBRAIC[0]*STATES[9]/(CONSTANTS[35]+STATES[9]) -  CONSTANTS[8]*STATES[9];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[1] = STATES[4]+STATES[5]+STATES[6]+STATES[0]+STATES[3];
ALGEBRAIC[2] = STATES[7]+STATES[8]+STATES[9]+STATES[0]+STATES[3];
}
void
computeEssentialVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] = (CONDVAR[0]<=0.00000 ? CONSTANTS[38] : CONSTANTS[39]);
}
void
getStateInformation(double* SI)
{
SI[0] = 1.0;
SI[1] = 1.0;
SI[2] = 1.0;
SI[3] = 1.0;
SI[4] = 1.0;
SI[5] = 1.0;
SI[6] = 1.0;
SI[7] = 1.0;
SI[8] = 1.0;
SI[9] = 1.0;
}
void
computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
             double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
CONDVAR[0] =  sin( CONSTANTS[37]*VOI/12.0000) - 0.00000;
}