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 37 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 144 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (hour).
 * ALGEBRAIC[9] is V_K in component membrane (nanoM).
 * ALGEBRAIC[36] is fr in component membrane (hertz).
 * ALGEBRAIC[7] is v_sPC in component membrane (flux).
 * ALGEBRAIC[22] is Res in component membrane (gigaohm).
 * ALGEBRAIC[19] is V_rest in component membrane (milliV).
 * ALGEBRAIC[21] is V_reset in component membrane (milliV).
 * CONSTANTS[0] is V_theta in component membrane (milliV).
 * CONSTANTS[1] is Cm in component membrane (nanoF).
 * CONSTANTS[2] is R in component membrane (joule_per_mole_kelvin).
 * CONSTANTS[3] is T in component membrane (kelvin).
 * CONSTANTS[4] is T_abs in component membrane (kelvin).
 * CONSTANTS[5] is T_room in component membrane (kelvin).
 * CONSTANTS[6] is F in component membrane (coulomb_per_mole).
 * ALGEBRAIC[14] is alpha in component membrane (dimensionless).
 * ALGEBRAIC[6] is beta in component membrane (dimensionless).
 * ALGEBRAIC[15] is beta_a in component membrane (dimensionless).
 * ALGEBRAIC[16] is c in component membrane (dimensionless).
 * CONSTANTS[7] is P_Ca in component membrane (per_milliM).
 * ALGEBRAIC[0] is P_K in component membrane (per_milliM).
 * CONSTANTS[8] is P_Na in component membrane (per_milliM).
 * CONSTANTS[9] is P_Cl in component membrane (per_milliM).
 * CONSTANTS[10] is v_PK in component membrane (per_milliM).
 * CONSTANTS[11] is npk in component membrane (dimensionless).
 * CONSTANTS[12] is K_PK in component membrane (per_nanoM2).
 * CONSTANTS[13] is V_R in component membrane (gigaohm).
 * CONSTANTS[14] is K_R in component membrane (milliV).
 * CONSTANTS[15] is Ca_ex in component membrane (microM).
 * CONSTANTS[16] is Na_ex in component membrane (milliM).
 * CONSTANTS[17] is K_ex in component membrane (milliM).
 * CONSTANTS[18] is Cl_ex in component membrane (milliM).
 * CONSTANTS[142] is Na_in in component membrane (milliM).
 * CONSTANTS[139] is K_in in component membrane (milliM).
 * CONSTANTS[141] is theta_Na in component membrane (dimensionless).
 * CONSTANTS[138] is theta_K in component membrane (dimensionless).
 * CONSTANTS[19] is E_Na_0 in component membrane (milliV).
 * CONSTANTS[140] is E_Na in component membrane (milliV).
 * CONSTANTS[20] is g_Na in component membrane (nanoS).
 * ALGEBRAIC[1] is E_Ca in component membrane (milliV).
 * ALGEBRAIC[3] is g_Ca in component membrane (nanoS).
 * ALGEBRAIC[2] is g_K in component membrane (nanoS).
 * CONSTANTS[21] is g_K0 in component membrane (nanoS).
 * CONSTANTS[22] is v_gk in component membrane (nanoS).
 * CONSTANTS[23] is K_gk in component membrane (nanoM).
 * ALGEBRAIC[4] is g_KCa in component membrane (nanoS).
 * CONSTANTS[24] is v_KCa in component membrane (nanoS).
 * CONSTANTS[25] is K_KCa in component membrane (per_nanoM).
 * CONSTANTS[26] is nkca in component membrane (dimensionless).
 * ALGEBRAIC[28] is g_L in component membrane (nanoS).
 * CONSTANTS[27] is E_L_0 in component membrane (milliV).
 * CONSTANTS[143] is E_L in component membrane (milliV).
 * CONSTANTS[28] is E_K_0 in component membrane (milliV).
 * CONSTANTS[136] is E_K in component membrane (milliV).
 * ALGEBRAIC[30] is g_ex in component membrane (nanoS).
 * CONSTANTS[29] is E_ex in component membrane (milliV).
 * CONSTANTS[30] is v_ex1 in component membrane (nanoS).
 * CONSTANTS[31] is v_ex2 in component membrane (nanoS).
 * CONSTANTS[32] is K_ex1 in component membrane (picoA_2_5).
 * CONSTANTS[33] is K_ex2 in component membrane (per_microM).
 * CONSTANTS[34] is nex1 in component membrane (dimensionless).
 * CONSTANTS[35] is nex2 in component membrane (dimensionless).
 * CONSTANTS[36] is g_inhib in component membrane (nanoS).
 * ALGEBRAIC[17] is E_inhib in component membrane (milliV).
 * ALGEBRAIC[5] is GABA in component membrane (nanoM).
 * CONSTANTS[37] is GABA0 in component membrane (nanoM).
 * CONSTANTS[38] is v_GABA in component membrane (nanoM).
 * CONSTANTS[39] is K_GABA in component membrane (nanoM).
 * ALGEBRAIC[8] is Cl_in in component membrane (milliM).
 * CONSTANTS[40] is Cl0 in component membrane (milliM).
 * CONSTANTS[41] is v_Cl1 in component membrane (milliM).
 * CONSTANTS[42] is v_Cl2 in component membrane (milliM).
 * CONSTANTS[43] is K_Cl1 in component membrane (nanoM).
 * CONSTANTS[44] is K_Cl2 in component membrane (per_nanoM_0_2).
 * CONSTANTS[45] is nCl in component membrane (dimensionless).
 * ALGEBRAIC[23] is i_Na in component membrane (picoA).
 * ALGEBRAIC[24] is i_Na_abs in component membrane (picoA).
 * ALGEBRAIC[26] is i_Ca in component membrane (picoA).
 * ALGEBRAIC[25] is i_K in component membrane (picoA).
 * ALGEBRAIC[27] is i_KCa in component membrane (picoA).
 * ALGEBRAIC[29] is i_L in component membrane (picoA).
 * ALGEBRAIC[31] is i_ex in component membrane (picoA).
 * ALGEBRAIC[32] is i_inhib in component membrane (picoA).
 * ALGEBRAIC[33] is I_star in component membrane (picoA).
 * ALGEBRAIC[34] is R_star in component membrane (milliohm).
 * ALGEBRAIC[35] is tau_m in component membrane (second).
 * ALGEBRAIC[20] is theta in component membrane (milliV).
 * ALGEBRAIC[18] is psi in component membrane (dimensionless).
 * CONSTANTS[46] is k_q in component membrane (per_kelvin).
 * CONSTANTS[47] is k_MK in component membrane (nanoM).
 * CONSTANTS[48] is V_MK in component membrane (nanoM).
 * CONSTANTS[49] is V_b in component membrane (nanoM).
 * CONSTANTS[50] is k_b in component membrane (dimensionless).
 * CONSTANTS[51] is K_D in component membrane (nanoM).
 * CONSTANTS[52] is v_sP0 in component membrane (flux).
 * CONSTANTS[53] is C_T in component membrane (flux).
 * CONSTANTS[54] is nca in component membrane (dimensionless).
 * CONSTANTS[55] is v_Ca in component membrane (nanoS).
 * CONSTANTS[56] is K_Ca in component membrane (nanoM_2_2).
 * CONSTANTS[57] is K_C in component membrane (nanoM).
 * STATES[0] is Ca_in in component Ca_in (microM).
 * STATES[1] is BC in component BC (nanoM).
 * STATES[2] is MP in component MP (nanoM).
 * STATES[3] is VIP in component VIP (nanoM).
 * STATES[4] is CC in component CC (nanoM).
 * STATES[5] is CB in component CB (nanoM).
 * CONSTANTS[58] is beta_IP3 in component Ca_in (dimensionless).
 * STATES[6] is Ca_store in component Ca_in (nanoM).
 * ALGEBRAIC[11] is v0 in component Ca_in (microM_per_hour).
 * CONSTANTS[137] is v1 in component Ca_in (microM_per_hour).
 * ALGEBRAIC[12] is v2 in component Ca_in (microM_per_hour).
 * ALGEBRAIC[13] is v3 in component Ca_in (microM_per_hour).
 * CONSTANTS[59] is v_kk in component Ca_in (per_microM_per_hour).
 * CONSTANTS[60] is v_v0 in component Ca_in (microM_per_hour).
 * CONSTANTS[61] is kf in component Ca_in (per_hour).
 * ALGEBRAIC[10] is k in component Ca_in (per_microM_per_hour).
 * CONSTANTS[62] is nkk in component Ca_in (dimensionless).
 * CONSTANTS[63] is nv0 in component Ca_in (dimensionless).
 * CONSTANTS[64] is m in component Ca_in (dimensionless).
 * CONSTANTS[65] is n in component Ca_in (dimensionless).
 * CONSTANTS[66] is p in component Ca_in (dimensionless).
 * CONSTANTS[67] is v in component Ca_in (dimensionless).
 * CONSTANTS[68] is K_kk in component Ca_in (nanoM_0_1).
 * CONSTANTS[69] is K_v0 in component Ca_in (nanoM_4_5).
 * CONSTANTS[70] is K_2 in component Ca_in (microM).
 * CONSTANTS[71] is K_R in component Ca_in (microM).
 * CONSTANTS[72] is K_A in component Ca_in (microM).
 * CONSTANTS[73] is v_M1 in component Ca_in (microM_per_hour).
 * CONSTANTS[74] is v_M2 in component Ca_in (microM_per_hour).
 * CONSTANTS[75] is v_M3 in component Ca_in (microM_per_hour).
 * CONSTANTS[76] is v_VIP in component VIP (flux).
 * CONSTANTS[77] is K_VIP in component VIP (hertz_1_9).
 * CONSTANTS[78] is kd_VIP in component VIP (nanoM_0_8_per_hour).
 * CONSTANTS[79] is nd_VIP in component VIP (dimensionless).
 * CONSTANTS[80] is n_VIP in component VIP (dimensionless).
 * CONSTANTS[81] is vmP in component MP (flux).
 * CONSTANTS[82] is kdmp in component MP (first_order_rate_constant).
 * CONSTANTS[83] is KAP in component MP (nanoM).
 * CONSTANTS[84] is KmP in component MP (nanoM).
 * CONSTANTS[85] is n in component model_parameters (dimensionless).
 * STATES[7] is BN in component BN (nanoM).
 * STATES[8] is MC in component MC (nanoM).
 * CONSTANTS[86] is vsC in component MC (flux).
 * CONSTANTS[87] is vmC in component MC (flux).
 * CONSTANTS[88] is kdmc in component MC (first_order_rate_constant).
 * CONSTANTS[89] is KAC in component MC (nanoM).
 * CONSTANTS[90] is KmC in component MC (nanoM).
 * STATES[9] is MB in component MB (nanoM).
 * CONSTANTS[91] is vsB in component MB (flux).
 * CONSTANTS[92] is vmB in component MB (flux).
 * CONSTANTS[93] is kdmb in component MB (first_order_rate_constant).
 * CONSTANTS[94] is KIB in component MB (nanoM).
 * CONSTANTS[95] is KmB in component MB (nanoM).
 * CONSTANTS[96] is m in component model_parameters (dimensionless).
 * STATES[10] is PC in component PC (nanoM).
 * CONSTANTS[97] is ksP in component model_parameters (first_order_rate_constant).
 * CONSTANTS[98] is Kp in component model_parameters (nanoM).
 * CONSTANTS[99] is Kdp in component model_parameters (nanoM).
 * CONSTANTS[100] is k3 in component model_parameters (second_order_rate_constant).
 * CONSTANTS[101] is k4 in component model_parameters (first_order_rate_constant).
 * CONSTANTS[102] is kdn in component model_parameters (first_order_rate_constant).
 * CONSTANTS[103] is V1P in component model_parameters (flux).
 * CONSTANTS[104] is V2P in component model_parameters (flux).
 * STATES[11] is PCP in component PCP (nanoM).
 * STATES[12] is PCC in component PCC (nanoM).
 * CONSTANTS[105] is ksC in component model_parameters (first_order_rate_constant).
 * CONSTANTS[106] is kdnc in component model_parameters (first_order_rate_constant).
 * CONSTANTS[107] is V1C in component model_parameters (flux).
 * CONSTANTS[108] is V2C in component model_parameters (flux).
 * STATES[13] is CCP in component CCP (nanoM).
 * CONSTANTS[109] is vdPC in component model_parameters (flux).
 * CONSTANTS[110] is Kd in component model_parameters (nanoM).
 * CONSTANTS[111] is vdCC in component model_parameters (flux).
 * CONSTANTS[112] is k1 in component model_parameters (first_order_rate_constant).
 * CONSTANTS[113] is k2 in component model_parameters (first_order_rate_constant).
 * CONSTANTS[114] is V1PC in component model_parameters (flux).
 * CONSTANTS[115] is V2PC in component model_parameters (flux).
 * STATES[14] is PCCP in component PCCP (nanoM).
 * STATES[15] is PCN in component PCN (nanoM).
 * CONSTANTS[116] is k7 in component model_parameters (second_order_rate_constant).
 * CONSTANTS[117] is k8 in component model_parameters (first_order_rate_constant).
 * CONSTANTS[118] is V3PC in component model_parameters (flux).
 * CONSTANTS[119] is V4PC in component model_parameters (flux).
 * STATES[16] is PCNP in component PCNP (nanoM).
 * STATES[17] is IN in component IN (nanoM).
 * CONSTANTS[120] is vdPCC in component model_parameters (flux).
 * CONSTANTS[121] is vdPCN in component model_parameters (flux).
 * CONSTANTS[122] is ksB in component model_parameters (first_order_rate_constant).
 * CONSTANTS[123] is k5 in component model_parameters (first_order_rate_constant).
 * CONSTANTS[124] is k6 in component model_parameters (first_order_rate_constant).
 * CONSTANTS[125] is V1B in component model_parameters (flux).
 * CONSTANTS[126] is V2B in component model_parameters (flux).
 * STATES[18] is BCP in component BCP (nanoM).
 * CONSTANTS[127] is vdBC in component model_parameters (flux).
 * CONSTANTS[128] is V3B in component model_parameters (flux).
 * CONSTANTS[129] is V4B in component model_parameters (flux).
 * STATES[19] is BNP in component BNP (nanoM).
 * CONSTANTS[130] is vdBN in component model_parameters (flux).
 * CONSTANTS[131] is vdIN in component model_parameters (flux).
 * CONSTANTS[132] is K1CB in component CB (nanoM).
 * CONSTANTS[133] is K2CB in component CB (nanoM).
 * CONSTANTS[134] is WT in component CB (hour).
 * CONSTANTS[135] is vP in component CB (nanoM).
 * RATES[0] is d/dt Ca_in in component Ca_in (microM).
 * RATES[6] is d/dt Ca_store in component Ca_in (nanoM).
 * RATES[3] is d/dt VIP in component VIP (nanoM).
 * RATES[2] is d/dt MP in component MP (nanoM).
 * RATES[8] is d/dt MC in component MC (nanoM).
 * RATES[9] is d/dt MB in component MB (nanoM).
 * RATES[10] is d/dt PC in component PC (nanoM).
 * RATES[4] is d/dt CC in component CC (nanoM).
 * RATES[11] is d/dt PCP in component PCP (nanoM).
 * RATES[13] is d/dt CCP in component CCP (nanoM).
 * RATES[12] is d/dt PCC in component PCC (nanoM).
 * RATES[15] is d/dt PCN in component PCN (nanoM).
 * RATES[14] is d/dt PCCP in component PCCP (nanoM).
 * RATES[16] is d/dt PCNP in component PCNP (nanoM).
 * RATES[1] is d/dt BC in component BC (nanoM).
 * RATES[18] is d/dt BCP in component BCP (nanoM).
 * RATES[7] is d/dt BN in component BN (nanoM).
 * RATES[19] is d/dt BNP in component BNP (nanoM).
 * RATES[17] is d/dt IN in component IN (nanoM).
 * RATES[5] is d/dt CB in component CB (nanoM).
 * There are a total of 0 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
CONSTANTS[0] = 20.0;
CONSTANTS[1] = 5.0;
CONSTANTS[2] = 8.314;
CONSTANTS[3] = 37;
CONSTANTS[4] = 273.15;
CONSTANTS[5] = 22;
CONSTANTS[6] = 96485;
CONSTANTS[7] = 0.05;
CONSTANTS[8] = 0.036;
CONSTANTS[9] = 0.3;
CONSTANTS[10] = 1.9;
CONSTANTS[11] = -2.0;
CONSTANTS[12] = 1.0;
CONSTANTS[13] = 0.41;
CONSTANTS[14] = 34.0;
CONSTANTS[15] = 5.0;
CONSTANTS[16] = 145.0;
CONSTANTS[17] = 1.0;
CONSTANTS[18] = 114.5;
CONSTANTS[19] = 45.0;
CONSTANTS[20] = 36.0;
CONSTANTS[21] = 9.7;
CONSTANTS[22] = 10.0;
CONSTANTS[23] = 10.0;
CONSTANTS[24] = 3.0;
CONSTANTS[25] = 0.16;
CONSTANTS[26] = -1.0;
CONSTANTS[27] = -29.0;
CONSTANTS[28] = -97.0;
CONSTANTS[29] = 0.0;
CONSTANTS[30] = 105.0;
CONSTANTS[31] = 4.4;
CONSTANTS[32] = 574050000.0;
CONSTANTS[33] = 1.0;
CONSTANTS[34] = 2.5;
CONSTANTS[35] = -1.0;
CONSTANTS[36] = 12.3;
CONSTANTS[37] = 0.2;
CONSTANTS[38] = 19.0;
CONSTANTS[39] = 3.0;
CONSTANTS[40] = 1.0;
CONSTANTS[41] = 15.5;
CONSTANTS[42] = 19.0;
CONSTANTS[43] = 4.0;
CONSTANTS[44] = 1.0;
CONSTANTS[45] = -0.2;
CONSTANTS[46] = 8.75e-5;
CONSTANTS[47] = 2.9;
CONSTANTS[48] = 5.0;
CONSTANTS[49] = 2.0;
CONSTANTS[50] = 2.0;
CONSTANTS[51] = 0.08;
CONSTANTS[52] = 1.0;
CONSTANTS[53] = 1.6;
CONSTANTS[54] = 2.2;
CONSTANTS[55] = 12.3;
CONSTANTS[56] = 22.0;
CONSTANTS[57] = 0.15;
STATES[0] = 0.1;
STATES[1] = 2.41;
STATES[2] = 2.8;
STATES[3] = 0.0;
STATES[4] = 12.0;
STATES[5] = 0.12;
CONSTANTS[58] = 0.5;
STATES[6] = 0.1;
CONSTANTS[59] = 3.3;
CONSTANTS[60] = 0.09;
CONSTANTS[61] = 0.001;
CONSTANTS[62] = 0.1;
CONSTANTS[63] = 4.5;
CONSTANTS[64] = 6.0;
CONSTANTS[65] = 2.2;
CONSTANTS[66] = 4.2;
CONSTANTS[67] = 2.0;
CONSTANTS[68] = 0.02;
CONSTANTS[69] = 4.5;
CONSTANTS[70] = 5.0;
CONSTANTS[71] = 3.0;
CONSTANTS[72] = 0.67;
CONSTANTS[73] = 0.0003;
CONSTANTS[74] = 149.5;
CONSTANTS[75] = 400.0;
CONSTANTS[76] = 0.5;
CONSTANTS[77] = 15.0;
CONSTANTS[78] = 0.5;
CONSTANTS[79] = 0.2;
CONSTANTS[80] = 1.9;
CONSTANTS[81] = 1.1;
CONSTANTS[82] = 0.01;
CONSTANTS[83] = 0.6;
CONSTANTS[84] = 0.31;
CONSTANTS[85] = 4.0;
STATES[7] = 1.94;
STATES[8] = 2.0;
CONSTANTS[86] = 1.1;
CONSTANTS[87] = 1.0;
CONSTANTS[88] = 0.01;
CONSTANTS[89] = 0.6;
CONSTANTS[90] = 0.4;
STATES[9] = 7.94;
CONSTANTS[91] = 1.0;
CONSTANTS[92] = 0.8;
CONSTANTS[93] = 0.01;
CONSTANTS[94] = 2.2;
CONSTANTS[95] = 0.4;
CONSTANTS[96] = 2.0;
STATES[10] = 0.4;
CONSTANTS[97] = 0.6;
CONSTANTS[98] = 0.1;
CONSTANTS[99] = 0.1;
CONSTANTS[100] = 0.4;
CONSTANTS[101] = 0.2;
CONSTANTS[102] = 0.01;
CONSTANTS[103] = 0.4;
CONSTANTS[104] = 0.3;
STATES[11] = 0.13;
STATES[12] = 1.26;
CONSTANTS[105] = 1.6;
CONSTANTS[106] = 0.12;
CONSTANTS[107] = 0.6;
CONSTANTS[108] = 0.1;
STATES[13] = 9.0;
CONSTANTS[109] = 0.7;
CONSTANTS[110] = 0.3;
CONSTANTS[111] = 0.7;
CONSTANTS[112] = 0.45;
CONSTANTS[113] = 0.2;
CONSTANTS[114] = 0.4;
CONSTANTS[115] = 0.1;
STATES[14] = 0.2;
STATES[15] = 0.16;
CONSTANTS[116] = 0.5;
CONSTANTS[117] = 0.1;
CONSTANTS[118] = 0.4;
CONSTANTS[119] = 0.1;
STATES[16] = 0.091;
STATES[17] = 0.05;
CONSTANTS[120] = 0.7;
CONSTANTS[121] = 0.7;
CONSTANTS[122] = 0.12;
CONSTANTS[123] = 0.4;
CONSTANTS[124] = 0.2;
CONSTANTS[125] = 0.5;
CONSTANTS[126] = 0.1;
STATES[18] = 0.48;
CONSTANTS[127] = 0.5;
CONSTANTS[128] = 0.5;
CONSTANTS[129] = 0.2;
STATES[19] = 0.32;
CONSTANTS[130] = 0.6;
CONSTANTS[131] = 0.8;
CONSTANTS[132] = 0.01;
CONSTANTS[133] = 0.01;
CONSTANTS[134] = 1.0;
CONSTANTS[135] = 1.0;
CONSTANTS[136] = ( CONSTANTS[28]*(CONSTANTS[3]+CONSTANTS[4]))/(CONSTANTS[5]+CONSTANTS[4]);
CONSTANTS[137] =  CONSTANTS[73]*CONSTANTS[58];
CONSTANTS[138] = exp(CONSTANTS[136]/( CONSTANTS[46]*(CONSTANTS[3]+CONSTANTS[4])*1000.00));
CONSTANTS[139] = CONSTANTS[17]/CONSTANTS[138];
CONSTANTS[140] = ( CONSTANTS[19]*(CONSTANTS[3]+CONSTANTS[4]))/(CONSTANTS[5]+CONSTANTS[4]);
CONSTANTS[141] = exp(CONSTANTS[140]/( CONSTANTS[46]*(CONSTANTS[3]+CONSTANTS[4])*1000.00));
CONSTANTS[142] = CONSTANTS[16]/CONSTANTS[141];
CONSTANTS[143] = ( CONSTANTS[27]*(CONSTANTS[3]+CONSTANTS[4]))/(CONSTANTS[5]+CONSTANTS[4]);
RATES[0] = 0.1001;
RATES[6] = 0.1001;
RATES[3] = 0.1001;
RATES[2] = 0.1001;
RATES[8] = 0.1001;
RATES[9] = 0.1001;
RATES[10] = 0.1001;
RATES[4] = 0.1001;
RATES[11] = 0.1001;
RATES[13] = 0.1001;
RATES[12] = 0.1001;
RATES[15] = 0.1001;
RATES[14] = 0.1001;
RATES[16] = 0.1001;
RATES[1] = 0.1001;
RATES[18] = 0.1001;
RATES[7] = 0.1001;
RATES[19] = 0.1001;
RATES[17] = 0.1001;
RATES[5] = 0.1001;
}
void
computeResiduals(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
                 double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
resid[0] = RATES[0] - (ALGEBRAIC[11]+CONSTANTS[137]+ALGEBRAIC[13]+ CONSTANTS[61]*STATES[6]) - (ALGEBRAIC[12]+ ALGEBRAIC[10]*pow(STATES[0], CONSTANTS[67]));
resid[1] = RATES[6] - ALGEBRAIC[12] - (ALGEBRAIC[13]+ CONSTANTS[61]*STATES[6]);
resid[2] = RATES[3] -  CONSTANTS[76]*(pow(ALGEBRAIC[36], CONSTANTS[80])/(CONSTANTS[77]+pow(ALGEBRAIC[36], CONSTANTS[80]))) -  CONSTANTS[78]*pow(STATES[3], CONSTANTS[79]);
resid[3] = RATES[2] -  ALGEBRAIC[7]*(pow(STATES[7], CONSTANTS[85])/(pow(CONSTANTS[83], CONSTANTS[85])+pow(STATES[7], CONSTANTS[85]))) - ( CONSTANTS[81]*(STATES[2]/(CONSTANTS[84]+STATES[2]))+ CONSTANTS[82]*STATES[2]);
resid[4] = RATES[8] -  CONSTANTS[86]*(pow(STATES[7], CONSTANTS[85])/(pow(CONSTANTS[89], CONSTANTS[85])+pow(STATES[7], CONSTANTS[85]))) - ( CONSTANTS[87]*(STATES[8]/(CONSTANTS[90]+STATES[8]))+ CONSTANTS[88]*STATES[8]);
resid[5] = RATES[9] -  CONSTANTS[91]*(pow(CONSTANTS[94], CONSTANTS[96])/(pow(CONSTANTS[94], CONSTANTS[96])+pow(STATES[7], CONSTANTS[96]))) - ( CONSTANTS[92]*(STATES[9]/(CONSTANTS[95]+STATES[9]))+ CONSTANTS[93]*STATES[9]);
resid[6] = RATES[10] - ( CONSTANTS[97]*STATES[2]+ CONSTANTS[104]*(STATES[11]/(CONSTANTS[99]+STATES[11]))+ CONSTANTS[101]*STATES[12]) - ( CONSTANTS[103]*(STATES[10]/(CONSTANTS[98]+STATES[10]))+ CONSTANTS[100]*STATES[10]*STATES[4]+ CONSTANTS[102]*STATES[10]);
resid[7] = RATES[4] - ( CONSTANTS[105]*STATES[8]+ CONSTANTS[108]*(STATES[13]/(CONSTANTS[99]+STATES[13]))+ CONSTANTS[101]*STATES[12]) - ( CONSTANTS[107]*(STATES[4]/(CONSTANTS[98]+STATES[4]))+ CONSTANTS[100]*STATES[10]*STATES[4]+ CONSTANTS[106]*STATES[4]);
resid[8] = RATES[11] -  CONSTANTS[103]*(STATES[10]/(CONSTANTS[98]+STATES[10])) - ( CONSTANTS[104]*(STATES[11]/(CONSTANTS[99]+STATES[11]))+ CONSTANTS[109]*(STATES[11]/(CONSTANTS[110]+STATES[11]))+ CONSTANTS[102]*STATES[11]);
resid[9] = RATES[13] -  CONSTANTS[107]*(STATES[4]/(CONSTANTS[98]+STATES[4])) - ( CONSTANTS[108]*(STATES[13]/(CONSTANTS[99]+STATES[13]))+ CONSTANTS[111]*(STATES[13]/(CONSTANTS[110]+STATES[13]))+ CONSTANTS[102]*STATES[13]);
resid[10] = RATES[12] - ( CONSTANTS[115]*(STATES[14]/(CONSTANTS[99]+STATES[14]))+ CONSTANTS[100]*STATES[10]*STATES[4]+ CONSTANTS[113]*STATES[15]) - ( CONSTANTS[114]*(STATES[12]/(CONSTANTS[98]+STATES[12]))+ CONSTANTS[101]*STATES[12]+ CONSTANTS[112]*STATES[12]+ CONSTANTS[102]*STATES[12]);
resid[11] = RATES[15] - ( CONSTANTS[119]*(STATES[16]/(CONSTANTS[99]+STATES[16]))+ CONSTANTS[112]*STATES[12]+ CONSTANTS[117]*STATES[17]) - ( CONSTANTS[118]*(STATES[15]/(CONSTANTS[98]+STATES[15]))+ CONSTANTS[113]*STATES[15]+ CONSTANTS[116]*STATES[7]*STATES[15]+ CONSTANTS[102]*STATES[15]);
resid[12] = RATES[14] -  CONSTANTS[114]*(STATES[12]/(CONSTANTS[98]+STATES[12])) - ( CONSTANTS[115]*(STATES[14]/(CONSTANTS[99]+STATES[14]))+ CONSTANTS[120]*(STATES[14]/(CONSTANTS[110]+STATES[14]))+ CONSTANTS[102]*STATES[14]);
resid[13] = RATES[16] -  CONSTANTS[118]*(STATES[15]/(CONSTANTS[98]+STATES[15])) - ( CONSTANTS[119]*(STATES[16]/(CONSTANTS[99]+STATES[16]))+ CONSTANTS[121]*(STATES[16]/(CONSTANTS[110]+STATES[16]))+ CONSTANTS[102]*STATES[16]);
resid[14] = RATES[1] - ( CONSTANTS[126]*(STATES[18]/(CONSTANTS[99]+STATES[18]))+ CONSTANTS[124]*STATES[7]+ CONSTANTS[122]*STATES[9]) - ( CONSTANTS[125]*(STATES[1]/(CONSTANTS[98]+STATES[1]))+ CONSTANTS[123]*STATES[1]+ CONSTANTS[102]*STATES[1]);
resid[15] = RATES[18] -  CONSTANTS[125]*(STATES[1]/(CONSTANTS[98]+STATES[1])) - ( CONSTANTS[126]*(STATES[18]/(CONSTANTS[99]+STATES[18]))+ CONSTANTS[127]*(STATES[18]/(CONSTANTS[110]+STATES[18]))+ CONSTANTS[102]*STATES[18]);
resid[16] = RATES[7] - ( CONSTANTS[129]*(STATES[19]/(CONSTANTS[99]+STATES[19]))+ CONSTANTS[123]*STATES[1]+ CONSTANTS[117]*STATES[17]) - ( CONSTANTS[128]*(STATES[7]/(CONSTANTS[98]+STATES[7]))+ CONSTANTS[124]*STATES[7]+ CONSTANTS[116]*STATES[7]*STATES[15]+ CONSTANTS[102]*STATES[7]);
resid[17] = RATES[19] -  CONSTANTS[128]*(STATES[7]/(CONSTANTS[98]+STATES[7])) - ( CONSTANTS[129]*(STATES[19]/(CONSTANTS[99]+STATES[19]))+ CONSTANTS[130]*(STATES[19]/(CONSTANTS[110]+STATES[19]))+ CONSTANTS[102]*STATES[19]);
resid[18] = RATES[17] -  CONSTANTS[116]*STATES[7]*STATES[15] - ( CONSTANTS[117]*STATES[17]+ CONSTANTS[131]*(STATES[17]/(CONSTANTS[110]+STATES[17]))+ CONSTANTS[102]*STATES[17]);
resid[19] = RATES[5] - (( ALGEBRAIC[9]*(1.00000 - STATES[5]))/((CONSTANTS[132]+1.00000) - STATES[5]) - ( CONSTANTS[135]*STATES[5])/(CONSTANTS[133]+STATES[5]))/CONSTANTS[134];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[25] =  ALGEBRAIC[2]*(ALGEBRAIC[19] - CONSTANTS[136]);
ALGEBRAIC[26] =  ALGEBRAIC[3]*(ALGEBRAIC[19] - ALGEBRAIC[1]);
ALGEBRAIC[27] =  ALGEBRAIC[4]*(ALGEBRAIC[19] - CONSTANTS[136]);
ALGEBRAIC[29] =  ALGEBRAIC[28]*(ALGEBRAIC[19] - CONSTANTS[143]);
ALGEBRAIC[31] =  ALGEBRAIC[30]*(ALGEBRAIC[19] - CONSTANTS[29]);
ALGEBRAIC[32] =  CONSTANTS[36]*(ALGEBRAIC[19] - ALGEBRAIC[17]);
}
void
computeEssentialVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[7] = CONSTANTS[52]+( CONSTANTS[53]*STATES[5])/(CONSTANTS[57]+STATES[5]);
ALGEBRAIC[6] = STATES[3]/(STATES[3]+CONSTANTS[51]);
ALGEBRAIC[9] = ( CONSTANTS[48]*STATES[0])/(CONSTANTS[47]+STATES[0])+( CONSTANTS[49]*ALGEBRAIC[6])/(CONSTANTS[50]+ALGEBRAIC[6]);
ALGEBRAIC[10] =  CONSTANTS[59]*(pow(STATES[4], CONSTANTS[62])/(CONSTANTS[68]+pow(STATES[4], CONSTANTS[62])));
ALGEBRAIC[11] =  CONSTANTS[60]*(pow(STATES[1], CONSTANTS[63])/(CONSTANTS[69]+pow(STATES[1], CONSTANTS[63])));
ALGEBRAIC[12] =  CONSTANTS[74]*(pow(STATES[0], CONSTANTS[65])/(pow(CONSTANTS[70], CONSTANTS[65])+pow(STATES[0], CONSTANTS[65])));
ALGEBRAIC[13] =  CONSTANTS[75]*(pow(STATES[6], CONSTANTS[64])/(pow(CONSTANTS[71], CONSTANTS[64])+pow(STATES[6], CONSTANTS[64])))*(pow(STATES[0], CONSTANTS[66])/(pow(CONSTANTS[72], CONSTANTS[66])+pow(STATES[0], CONSTANTS[66])));
ALGEBRAIC[0] =  CONSTANTS[10]*(pow(STATES[1], CONSTANTS[11])/(CONSTANTS[12]+pow(STATES[1], CONSTANTS[11])));
ALGEBRAIC[14] =  4.00000*CONSTANTS[7]*STATES[0]*0.00100000+ ALGEBRAIC[0]*CONSTANTS[139]+ CONSTANTS[8]*CONSTANTS[142]+ CONSTANTS[9]*CONSTANTS[18];
ALGEBRAIC[5] = CONSTANTS[37]+( CONSTANTS[38]*STATES[3])/(CONSTANTS[39]+STATES[3]);
ALGEBRAIC[8] = CONSTANTS[40]+ CONSTANTS[41]*(STATES[2]/(CONSTANTS[43]+STATES[2]))+ CONSTANTS[42]*(pow(ALGEBRAIC[5], CONSTANTS[45])/(CONSTANTS[44]+pow(ALGEBRAIC[5], CONSTANTS[45])));
ALGEBRAIC[15] = ( ALGEBRAIC[0]*CONSTANTS[139]+ CONSTANTS[8]*CONSTANTS[142]+ CONSTANTS[9]*CONSTANTS[18]) - ( ALGEBRAIC[0]*CONSTANTS[17]+ CONSTANTS[8]*CONSTANTS[16]+ CONSTANTS[9]*ALGEBRAIC[8]);
ALGEBRAIC[16] = - ( ALGEBRAIC[0]*CONSTANTS[17]+ 4.00000*CONSTANTS[7]*CONSTANTS[15]*0.00100000+ CONSTANTS[8]*CONSTANTS[16]+ CONSTANTS[9]*ALGEBRAIC[8]);
ALGEBRAIC[18] = ( pow((pow(ALGEBRAIC[15], 2.00000) -  4.00000*ALGEBRAIC[14]*ALGEBRAIC[16]), 1.0 / 2) - ALGEBRAIC[15])/( 2.00000*ALGEBRAIC[14]);
ALGEBRAIC[19] =  (( CONSTANTS[2]*(CONSTANTS[3]+CONSTANTS[4]))/CONSTANTS[6])*log(ALGEBRAIC[18])*1000.00;
ALGEBRAIC[21] = ALGEBRAIC[19]+4.00000;
ALGEBRAIC[1] =  (( CONSTANTS[46]*(CONSTANTS[3]+CONSTANTS[4]))/2.00000)*log(CONSTANTS[15]/STATES[0])*1000.00;
ALGEBRAIC[3] =  CONSTANTS[55]*(pow(STATES[2], CONSTANTS[54])/(CONSTANTS[56]+pow(STATES[2], CONSTANTS[54])));
ALGEBRAIC[2] = CONSTANTS[21]+ CONSTANTS[22]*(STATES[2]/(CONSTANTS[23]+STATES[2]));
ALGEBRAIC[4] =  CONSTANTS[24]*(pow(STATES[4], CONSTANTS[26])/(CONSTANTS[25]+pow(STATES[4], CONSTANTS[26])));
ALGEBRAIC[22] =  CONSTANTS[13]*(ALGEBRAIC[19]/(CONSTANTS[14]+ALGEBRAIC[19]));
ALGEBRAIC[28] = 1.00000/ALGEBRAIC[22];
ALGEBRAIC[23] =  CONSTANTS[20]*(ALGEBRAIC[19] - CONSTANTS[140]);
ALGEBRAIC[24] =  pow(pow(ALGEBRAIC[23], 2.00000), 1.0 / 2);
ALGEBRAIC[30] =  CONSTANTS[30]*(pow(ALGEBRAIC[24], CONSTANTS[34])/(CONSTANTS[32]+pow(ALGEBRAIC[24], CONSTANTS[34])))+ CONSTANTS[31]*(pow(STATES[0], CONSTANTS[35])/(CONSTANTS[33]+pow(STATES[0], CONSTANTS[35])));
ALGEBRAIC[17] =  - CONSTANTS[46]*(CONSTANTS[3]+CONSTANTS[4])*log(CONSTANTS[18]/ALGEBRAIC[8])*1000.00;
ALGEBRAIC[33] = ( CONSTANTS[20]*CONSTANTS[140]+ ALGEBRAIC[3]*ALGEBRAIC[1]+ ALGEBRAIC[2]*CONSTANTS[136]+ ALGEBRAIC[28]*CONSTANTS[143]+ ALGEBRAIC[4]*CONSTANTS[136]) - ( CONSTANTS[36]*ALGEBRAIC[17]+ ALGEBRAIC[30]*CONSTANTS[29]);
ALGEBRAIC[34] = 1.00000/((CONSTANTS[20]+ALGEBRAIC[2]+ALGEBRAIC[28]+ALGEBRAIC[3]+ALGEBRAIC[4]) - (CONSTANTS[36]+ALGEBRAIC[30]));
ALGEBRAIC[35] =  CONSTANTS[1]*ALGEBRAIC[34];
ALGEBRAIC[20] = ALGEBRAIC[19]+CONSTANTS[0];
ALGEBRAIC[36] = -1.00000/( ALGEBRAIC[35]*log((ALGEBRAIC[20] -  ALGEBRAIC[34]*ALGEBRAIC[33])/(ALGEBRAIC[21] -  ALGEBRAIC[34]*ALGEBRAIC[33])));
}
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)
{
}