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 1 entries in the algebraic variable array.
   There are a total of 20 entries in each of the rate and state variable arrays.
   There are a total of 17 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (second).
 * STATES[0] is Py in component Py (nanomolar).
 * STATES[1] is Zn in component Zn (nanomolar).
 * STATES[2] is Py1 in component Py1 (nanomolar).
 * CONSTANTS[0] is r3 in component model_parameters (third_order_rate_constant).
 * CONSTANTS[1] is r4 in component model_parameters (first_order_rate_constant).
 * STATES[3] is Dw in component Dw (nanomolar).
 * STATES[4] is Qw2 in component Qw2 (nanomolar).
 * CONSTANTS[2] is k_1 in component model_parameters (first_order_rate_constant).
 * CONSTANTS[3] is k1a in component model_parameters (second_order_rate_constant).
 * STATES[5] is Qw1 in component Qw1 (nanomolar).
 * STATES[6] is Rw in component Rw (nanomolar).
 * CONSTANTS[4] is k2 in component model_parameters (second_order_rate_constant).
 * CONSTANTS[5] is k_2 in component model_parameters (first_order_rate_constant).
 * ALGEBRAIC[0] is k3 in component model_parameters (first_order_rate_constant).
 * STATES[7] is Mw in component Mw (nanomolar).
 * STATES[8] is Px in component Px (nanomolar).
 * STATES[9] is Px1 in component Px1 (nanomolar).
 * STATES[10] is Dz in component Dz (nanomolar).
 * STATES[11] is Qz4 in component Qz4 (nanomolar).
 * CONSTANTS[6] is r1 in component model_parameters (second_order_rate_constant).
 * CONSTANTS[7] is r2 in component model_parameters (first_order_rate_constant).
 * CONSTANTS[8] is k1b in component model_parameters (second_order_rate_constant).
 * STATES[12] is Qz2 in component Qz2 (nanomolar).
 * CONSTANTS[9] is k1 in component model_parameters (second_order_rate_constant).
 * STATES[13] is Tp in component Tp (nanomolar).
 * STATES[14] is Tp1 in component Tp1 (nanomolar).
 * CONSTANTS[10] is r5 in component model_parameters (second_order_rate_constant).
 * CONSTANTS[11] is r6 in component model_parameters (first_order_rate_constant).
 * STATES[15] is Qz1 in component Qz1 (nanomolar).
 * STATES[16] is Rz in component Rz (nanomolar).
 * CONSTANTS[12] is k2a in component model_parameters (second_order_rate_constant).
 * STATES[17] is Qz3 in component Qz3 (nanomolar).
 * STATES[18] is Qz5 in component Qz5 (nanomolar).
 * CONSTANTS[13] is k2b in component model_parameters (second_order_rate_constant).
 * CONSTANTS[14] is k2c in component model_parameters (second_order_rate_constant).
 * STATES[19] is Mz in component Mz (nanomolar).
 * CONSTANTS[15] is td0 in component model_parameters (second).
 * CONSTANTS[16] is td in component model_parameters (second).
 * RATES[0] is d/dt Py in component Py (nanomolar).
 * RATES[2] is d/dt Py1 in component Py1 (nanomolar).
 * RATES[3] is d/dt Dw in component Dw (nanomolar).
 * RATES[6] is d/dt Rw in component Rw (nanomolar).
 * RATES[5] is d/dt Qw1 in component Qw1 (nanomolar).
 * RATES[4] is d/dt Qw2 in component Qw2 (nanomolar).
 * RATES[7] is d/dt Mw in component Mw (nanomolar).
 * RATES[8] is d/dt Px in component Px (nanomolar).
 * RATES[9] is d/dt Px1 in component Px1 (nanomolar).
 * RATES[13] is d/dt Tp in component Tp (nanomolar).
 * RATES[14] is d/dt Tp1 in component Tp1 (nanomolar).
 * RATES[1] is d/dt Zn in component Zn (nanomolar).
 * RATES[10] is d/dt Dz in component Dz (nanomolar).
 * RATES[16] is d/dt Rz in component Rz (nanomolar).
 * RATES[15] is d/dt Qz1 in component Qz1 (nanomolar).
 * RATES[12] is d/dt Qz2 in component Qz2 (nanomolar).
 * RATES[17] is d/dt Qz3 in component Qz3 (nanomolar).
 * RATES[11] is d/dt Qz4 in component Qz4 (nanomolar).
 * RATES[18] is d/dt Qz5 in component Qz5 (nanomolar).
 * RATES[19] is d/dt Mz in component Mz (nanomolar).
 * There are a total of 4 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = 25.0;
STATES[1] = 10000.0;
STATES[2] = 0.0;
CONSTANTS[0] = 4.41E10;
CONSTANTS[1] = 9E-3;
STATES[3] = 4.0;
STATES[4] = 0.0;
CONSTANTS[2] = 0.9;
CONSTANTS[3] = 1.0;
STATES[5] = 0.0;
STATES[6] = 50.0;
CONSTANTS[4] = 0.02;
CONSTANTS[5] = 0.3;
STATES[7] = 0.0;
STATES[8] = 50.0;
STATES[9] = 0.0;
STATES[10] = 2.0;
STATES[11] = 0.0;
CONSTANTS[6] = 2.73E2;
CONSTANTS[7] = 3.437E-4;
CONSTANTS[8] = 1.253E-2;
STATES[12] = 0.0;
CONSTANTS[9] = 0.025;
STATES[13] = 10000.0;
STATES[14] = 0.0;
CONSTANTS[10] = 3E4;
CONSTANTS[11] = 1.506E-2;
STATES[15] = 0.0;
STATES[16] = 100.0;
CONSTANTS[12] = 0.00005;
STATES[17] = 0.0;
STATES[18] = 0.0;
CONSTANTS[13] = 0.0002;
CONSTANTS[14] = 0.0037;
STATES[19] = 0.0;
CONSTANTS[15] = 1800.0;
CONSTANTS[16] = 2700;
RATES[0] = 0.1001;
RATES[2] = 0.1001;
RATES[3] = 0.1001;
RATES[6] = 0.1001;
RATES[5] = 0.1001;
RATES[4] = 0.1001;
RATES[7] = 0.1001;
RATES[8] = 0.1001;
RATES[9] = 0.1001;
RATES[13] = 0.1001;
RATES[14] = 0.1001;
RATES[1] = 0.1001;
RATES[10] = 0.1001;
RATES[16] = 0.1001;
RATES[15] = 0.1001;
RATES[12] = 0.1001;
RATES[17] = 0.1001;
RATES[11] = 0.1001;
RATES[18] = 0.1001;
RATES[19] = 0.1001;
}
void
computeResiduals(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
                 double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
resid[0] = RATES[0] -  CONSTANTS[1]*STATES[2] -  CONSTANTS[0]*pow(STATES[1], 2.00000)*STATES[0];
resid[1] = RATES[2] - ( CONSTANTS[0]*pow(STATES[1], 2.00000)*STATES[0]+ CONSTANTS[2]*STATES[4]) - ( CONSTANTS[1]*STATES[2]+ CONSTANTS[3]*STATES[3]*STATES[2]);
resid[2] = RATES[3] - ( CONSTANTS[2]*STATES[4]+ ALGEBRAIC[0]*STATES[5]+ CONSTANTS[5]*STATES[5]) - ( CONSTANTS[3]*STATES[3]*STATES[2]+ CONSTANTS[4]*STATES[3]*STATES[6]);
resid[3] = RATES[6] - ( ALGEBRAIC[0]*STATES[5]+ CONSTANTS[5]*STATES[5]) -  CONSTANTS[4]*STATES[3]*STATES[6];
resid[4] = RATES[5] -  CONSTANTS[4]*STATES[3]*STATES[6] - ( ALGEBRAIC[0]*STATES[5]+ CONSTANTS[5]*STATES[5]);
resid[5] = RATES[4] -  CONSTANTS[3]*STATES[3]*STATES[2] -  CONSTANTS[2]*STATES[4];
resid[6] = RATES[7] -  ALGEBRAIC[0]*STATES[5];
resid[7] = RATES[8] - ( CONSTANTS[7]*STATES[9]+ CONSTANTS[2]*STATES[11]) - ( CONSTANTS[6]*STATES[1]*STATES[8]+ CONSTANTS[8]*STATES[10]*STATES[8]);
resid[8] = RATES[9] - ( CONSTANTS[6]*STATES[1]*STATES[8]+ CONSTANTS[2]*STATES[12]) - ( CONSTANTS[7]*STATES[9]+ CONSTANTS[9]*STATES[10]*STATES[9]);
resid[9] = RATES[13] -  CONSTANTS[11]*STATES[14] -  CONSTANTS[10]*STATES[1]*STATES[13];
resid[10] = RATES[14] -  CONSTANTS[10]*STATES[1]*STATES[13] -  CONSTANTS[11]*STATES[14];
resid[11] = RATES[1] - ( CONSTANTS[7]*STATES[9]+ CONSTANTS[11]*STATES[14]) - ( CONSTANTS[6]*STATES[1]*STATES[8]+ CONSTANTS[10]*STATES[1]*STATES[13]);
resid[12] = RATES[10] - ( CONSTANTS[2]*STATES[12]+ ALGEBRAIC[0]*STATES[15]+ CONSTANTS[5]*STATES[15]+ CONSTANTS[2]*STATES[11]) - ( CONSTANTS[8]*STATES[10]*STATES[8]+ CONSTANTS[9]*STATES[10]*STATES[9]+ CONSTANTS[12]*STATES[10]*STATES[16]);
resid[13] = RATES[16] - ( ALGEBRAIC[0]*STATES[15]+ CONSTANTS[5]*STATES[15]+ ALGEBRAIC[0]*STATES[17]+ CONSTANTS[5]*STATES[17]+ ALGEBRAIC[0]*STATES[18]+ CONSTANTS[5]*STATES[18]) - ( CONSTANTS[12]*STATES[10]*STATES[16]+ CONSTANTS[13]*STATES[11]*STATES[16]+ CONSTANTS[14]*STATES[12]*STATES[16]);
resid[14] = RATES[15] -  CONSTANTS[12]*STATES[10]*STATES[16] - ( ALGEBRAIC[0]*STATES[15]+ CONSTANTS[5]*STATES[15]);
resid[15] = RATES[12] - ( CONSTANTS[9]*STATES[10]*STATES[9]+ ALGEBRAIC[0]*STATES[17]+ CONSTANTS[5]*STATES[17]) - ( CONSTANTS[2]*STATES[12]+ CONSTANTS[14]*STATES[12]*STATES[16]);
resid[16] = RATES[17] -  CONSTANTS[14]*STATES[12]*STATES[16] - ( ALGEBRAIC[0]*STATES[17]+ CONSTANTS[5]*STATES[17]);
resid[17] = RATES[11] - ( CONSTANTS[8]*STATES[10]*STATES[8]+ ALGEBRAIC[0]*STATES[18]+ CONSTANTS[5]*STATES[18]) - ( CONSTANTS[2]*STATES[11]+ CONSTANTS[13]*STATES[11]*STATES[16]);
resid[18] = RATES[18] -  CONSTANTS[13]*STATES[11]*STATES[16] - ( ALGEBRAIC[0]*STATES[18]+ CONSTANTS[5]*STATES[18]);
resid[19] = RATES[19] -  ALGEBRAIC[0]*STATES[15]+ ALGEBRAIC[0]*STATES[17]+ ALGEBRAIC[0]*STATES[18];
}
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] = (CONDVAR[0]>=0.00000&&CONDVAR[1]<0.00000 ? 0.00000 : CONDVAR[2]>=0.00000&&CONDVAR[3]<0.00000 ? 0.0110000 : 0.0/0.0);
}
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;
SI[10] = 1.0;
SI[11] = 1.0;
SI[12] = 1.0;
SI[13] = 1.0;
SI[14] = 1.0;
SI[15] = 1.0;
SI[16] = 1.0;
SI[17] = 1.0;
SI[18] = 1.0;
SI[19] = 1.0;
}
void
computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
             double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
CONDVAR[0] = VOI - 0.00000;
CONDVAR[1] = VOI - CONSTANTS[15];
CONDVAR[2] = VOI - CONSTANTS[15];
CONDVAR[3] = VOI - CONSTANTS[16];
}