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 10 entries in the algebraic variable array.
   There are a total of 7 entries in each of the rate and state variable arrays.
   There are a total of 28 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (minute).
 * STATES[0] is r in component r (nanomolar).
 * ALGEBRAIC[0] is ract in component r (dimensionless).
 * ALGEBRAIC[8] is hr in component r (dimensionless).
 * ALGEBRAIC[1] is Ir in component r (flux).
 * ALGEBRAIC[2] is Ir2 in component r (flux).
 * CONSTANTS[0] is k6 in component r (first_order_rate_constant).
 * CONSTANTS[1] is n1 in component r (dimensionless).
 * CONSTANTS[2] is theta_1 in component r (nanomolar).
 * CONSTANTS[3] is n3 in component r (dimensionless).
 * CONSTANTS[4] is theta_3 in component r (dimensionless).
 * STATES[1] is s in component s (nanomolar).
 * ALGEBRAIC[6] is h_delta1 in component model_parameters (dimensionless).
 * CONSTANTS[5] is j1 in component model_parameters (dimensionless).
 * CONSTANTS[6] is Is2 in component s (flux).
 * ALGEBRAIC[7] is Is in component model_parameters (flux).
 * CONSTANTS[7] is k7 in component model_parameters (first_order_rate_constant).
 * STATES[2] is g in component g (dimensionless).
 * STATES[3] is se in component se (nanomolar).
 * CONSTANTS[8] is Ise in component se (flux).
 * STATES[4] is f in component f (dimensionless).
 * CONSTANTS[9] is k1 in component f (second_order_rate_constant).
 * CONSTANTS[10] is k2 in component f (first_order_rate_constant).
 * CONSTANTS[11] is k3 in component f (first_order_rate_constant).
 * ALGEBRAIC[3] is phi_b_s in component f (dimensionless).
 * CONSTANTS[12] is sb in component f (dimensionless).
 * CONSTANTS[13] is delta_b in component f (dimensionless).
 * CONSTANTS[14] is c in component model_parameters (nanomolar).
 * STATES[5] is h in component h (nanomolar).
 * CONSTANTS[15] is k4 in component h (first_order_rate_constant).
 * CONSTANTS[16] is k5 in component h (first_order_rate_constant).
 * ALGEBRAIC[4] is phi_r_s in component h (dimensionless).
 * CONSTANTS[17] is sr in component h (dimensionless).
 * CONSTANTS[18] is delta_r in component h (dimensionless).
 * CONSTANTS[19] is k8 in component model_parameters (first_order_rate_constant).
 * CONSTANTS[20] is g1 in component g (first_order_rate_constant).
 * CONSTANTS[21] is gmax in component g (dimensionless).
 * CONSTANTS[22] is g2 in component g (per_nanomolar).
 * ALGEBRAIC[9] is hact in component g (dimensionless).
 * CONSTANTS[23] is n2 in component g (dimensionless).
 * CONSTANTS[24] is theta_2 in component g (dimensionless).
 * ALGEBRAIC[5] is h_delta in component model_parameters (dimensionless).
 * STATES[6] is hh in component hh (nanomolar).
 * CONSTANTS[25] is Ih in component hh (flux).
 * CONSTANTS[26] is delta in component model_parameters (per_nanomolar).
 * CONSTANTS[27] is delta1 in component model_parameters (per_nanomolar).
 * RATES[0] is d/dt r in component r (nanomolar).
 * RATES[1] is d/dt s in component s (nanomolar).
 * RATES[3] is d/dt se in component se (nanomolar).
 * RATES[4] is d/dt f in component f (dimensionless).
 * RATES[5] is d/dt h in component h (nanomolar).
 * RATES[2] is d/dt g in component g (dimensionless).
 * RATES[6] is d/dt hh in component hh (nanomolar).
 * There are a total of 72 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = 0.0;
CONSTANTS[0] = 5.0;
CONSTANTS[1] = 4.0;
CONSTANTS[2] = 1.0;
CONSTANTS[3] = 5.0;
CONSTANTS[4] = 30.0;
STATES[1] = 0.0;
CONSTANTS[5] = 10;
CONSTANTS[6] = 50.0;
CONSTANTS[7] = 5.0;
STATES[2] = 2.0;
STATES[3] = 0.0;
CONSTANTS[8] = 10.0;
STATES[4] = 0.3;
CONSTANTS[9] = 0.1;
CONSTANTS[10] = 0.002;
CONSTANTS[11] = 0.018;
CONSTANTS[12] = 0.029;
CONSTANTS[13] = 0.3;
CONSTANTS[14] = 0.01;
STATES[5] = 0.0;
CONSTANTS[15] = 0.5;
CONSTANTS[16] = 71.0;
CONSTANTS[17] = -0.56;
CONSTANTS[18] = 0.2;
CONSTANTS[19] = 0.07;
CONSTANTS[20] = 1.0;
CONSTANTS[21] = 5.0;
CONSTANTS[22] = 0.008;
CONSTANTS[23] = 2.0;
CONSTANTS[24] = 30.0;
STATES[6] = 0.0;
CONSTANTS[25] = 50.0;
CONSTANTS[26] = 60.0;
CONSTANTS[27] = 15.0;
RATES[0] = 0.1001;
RATES[1] = 0.1001;
RATES[3] = 0.1001;
RATES[4] = 0.1001;
RATES[5] = 0.1001;
RATES[2] = 0.1001;
RATES[6] = 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[0]*ALGEBRAIC[8]*ALGEBRAIC[1] -  CONSTANTS[0]*STATES[0])+ALGEBRAIC[2];
resid[1] = RATES[1] - ( ALGEBRAIC[7]*STATES[2] -  CONSTANTS[7]*STATES[1])+CONSTANTS[6];
resid[2] = RATES[3] - CONSTANTS[8] -  CONSTANTS[7]*STATES[3];
resid[3] = RATES[4] - - ( CONSTANTS[9]*(STATES[0]+CONSTANTS[14])*STATES[4])+ (CONSTANTS[10]+ CONSTANTS[11]*ALGEBRAIC[3])*(1.00000 - STATES[4]);
resid[4] = RATES[5] -  CONSTANTS[5]*( (CONSTANTS[15]+ CONSTANTS[16]*(1.00000 - ALGEBRAIC[4]))*( (STATES[0]+CONSTANTS[14])*STATES[4]) -  CONSTANTS[19]*STATES[5]);
resid[5] = RATES[2] -  CONSTANTS[20]*ALGEBRAIC[9]*((CONSTANTS[21] - STATES[2])/CONSTANTS[21]) -  CONSTANTS[22]*ALGEBRAIC[7]*STATES[2];
resid[6] = RATES[6] -  CONSTANTS[5]*(CONSTANTS[25] -  CONSTANTS[19]*STATES[6]);
}
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] = 1.00000 - pow(STATES[1], CONSTANTS[1])/(pow(STATES[1], CONSTANTS[1])+pow(CONSTANTS[2], CONSTANTS[1]));
ALGEBRAIC[1] = (CONDVAR[0]>=0.00000&&CONDVAR[1]<=0.00000 ? 0.00000 : CONDVAR[2]>=0.00000&&CONDVAR[3]<=0.00000 ? 10.0000 : CONDVAR[4]>=0.00000&&CONDVAR[5]<=0.00000 ? 0.00000 : CONDVAR[6]>=0.00000&&CONDVAR[7]<=0.00000 ? 10.0000 : CONDVAR[8]>=0.00000&&CONDVAR[9]<=0.00000 ? 0.00000 : CONDVAR[10]>=0.00000&&CONDVAR[11]<=0.00000 ? 10.0000 : CONDVAR[12]>=0.00000&&CONDVAR[13]<=0.00000 ? 0.00000 : CONDVAR[14]>=0.00000&&CONDVAR[15]<=0.00000 ? 10.0000 : CONDVAR[16]>=0.00000&&CONDVAR[17]<=0.00000 ? 0.00000 : CONDVAR[18]>=0.00000&&CONDVAR[19]<=0.00000 ? 10.0000 : CONDVAR[20]>=0.00000&&CONDVAR[21]<=0.00000 ? 0.00000 : CONDVAR[22]>=0.00000&&CONDVAR[23]<=0.00000 ? 10.0000 : CONDVAR[24]>=0.00000&&CONDVAR[25]<=0.00000 ? 0.00000 : CONDVAR[26]>=0.00000&&CONDVAR[27]<=0.00000 ? 10.0000 : CONDVAR[28]>=0.00000&&CONDVAR[29]<=0.00000 ? 0.00000 : CONDVAR[30]>=0.00000&&CONDVAR[31]<=0.00000 ? 10.0000 : 0.00000);
ALGEBRAIC[2] = (CONDVAR[32]>=0.00000&&CONDVAR[33]<=0.00000 ? 0.00000 : CONDVAR[34]>=0.00000&&CONDVAR[35]<=0.00000 ? 1000.00 : CONDVAR[36]>=0.00000&&CONDVAR[37]<=0.00000 ? 0.00000 : CONDVAR[38]>=0.00000&&CONDVAR[39]<=0.00000 ? 1000.00 : CONDVAR[40]>=0.00000&&CONDVAR[41]<=0.00000 ? 0.00000 : CONDVAR[42]>=0.00000&&CONDVAR[43]<=0.00000 ? 1000.00 : CONDVAR[44]>=0.00000&&CONDVAR[45]<=0.00000 ? 0.00000 : CONDVAR[46]>=0.00000&&CONDVAR[47]<=0.00000 ? 1000.00 : CONDVAR[48]>=0.00000&&CONDVAR[49]<=0.00000 ? 0.00000 : CONDVAR[50]>=0.00000&&CONDVAR[51]<=0.00000 ? 1000.00 : CONDVAR[52]>=0.00000&&CONDVAR[53]<=0.00000 ? 0.00000 : CONDVAR[54]>=0.00000&&CONDVAR[55]<=0.00000 ? 1000.00 : CONDVAR[56]>=0.00000&&CONDVAR[57]<=0.00000 ? 0.00000 : CONDVAR[58]>=0.00000&&CONDVAR[59]<=0.00000 ? 1000.00 : CONDVAR[60]>=0.00000&&CONDVAR[61]<=0.00000 ? 0.00000 : CONDVAR[62]>=0.00000&&CONDVAR[63]<=0.00000 ? 1000.00 : 0.00000);
ALGEBRAIC[3] = 1.00000/(1.00000+exp(- (arbitrary_log( 1.00000*(STATES[1]+STATES[3]), 10) - CONSTANTS[12])/CONSTANTS[13]));
ALGEBRAIC[4] = 1.00000/(1.00000+exp(- (arbitrary_log( 1.00000*(STATES[1]+STATES[3]), 10) - CONSTANTS[17])/CONSTANTS[18]));
ALGEBRAIC[7] = (CONDVAR[64]>0.00000&&CONDVAR[65]<=0.00000 ? 10.0000 : CONDVAR[66]>0.00000&&CONDVAR[67]<=0.00000 ? 0.00000 : CONDVAR[68]>0.00000&&CONDVAR[69]<=0.00000 ? 10.0000 : CONDVAR[70]>0.00000&&CONDVAR[71]<=0.00000 ? 0.00000 : 0.00000);
ALGEBRAIC[6] =  (STATES[5]+STATES[6])*CONSTANTS[27];
ALGEBRAIC[8] = 1.00000 - pow(ALGEBRAIC[6], CONSTANTS[3])/(pow(ALGEBRAIC[6], CONSTANTS[3])+pow( CONSTANTS[5]*CONSTANTS[4], CONSTANTS[3]));
ALGEBRAIC[5] =  (STATES[5]+STATES[6])*CONSTANTS[26];
ALGEBRAIC[9] = pow(ALGEBRAIC[5], CONSTANTS[23])/(pow(ALGEBRAIC[5], CONSTANTS[23])+pow( CONSTANTS[5]*CONSTANTS[24], CONSTANTS[23]));
}
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;
}
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 - 90.0000;
CONDVAR[2] = VOI - 91.0000;
CONDVAR[3] = VOI - 92.0000;
CONDVAR[4] = VOI - 93.0000;
CONDVAR[5] = VOI - 113.000;
CONDVAR[6] = VOI - 114.000;
CONDVAR[7] = VOI - 115.000;
CONDVAR[8] = VOI - 116.000;
CONDVAR[9] = VOI - 136.000;
CONDVAR[10] = VOI - 137.000;
CONDVAR[11] = VOI - 138.000;
CONDVAR[12] = VOI - 139.000;
CONDVAR[13] = VOI - 159.000;
CONDVAR[14] = VOI - 160.000;
CONDVAR[15] = VOI - 161.000;
CONDVAR[16] = VOI - 162.000;
CONDVAR[17] = VOI - 252.000;
CONDVAR[18] = VOI - 253.000;
CONDVAR[19] = VOI - 254.000;
CONDVAR[20] = VOI - 255.000;
CONDVAR[21] = VOI - 275.000;
CONDVAR[22] = VOI - 276.000;
CONDVAR[23] = VOI - 277.000;
CONDVAR[24] = VOI - 278.000;
CONDVAR[25] = VOI - 298.000;
CONDVAR[26] = VOI - 299.000;
CONDVAR[27] = VOI - 300.000;
CONDVAR[28] = VOI - 301.000;
CONDVAR[29] = VOI - 321.000;
CONDVAR[30] = VOI - 322.000;
CONDVAR[31] = VOI - 323.000;
CONDVAR[32] = VOI - 0.00000;
CONDVAR[33] = VOI - 5.00000;
CONDVAR[34] = VOI - 6.00000;
CONDVAR[35] = VOI - 7.00000;
CONDVAR[36] = VOI - 8.00000;
CONDVAR[37] = VOI - 12.0000;
CONDVAR[38] = VOI - 13.0000;
CONDVAR[39] = VOI - 14.0000;
CONDVAR[40] = VOI - 15.0000;
CONDVAR[41] = VOI - 21.0000;
CONDVAR[42] = VOI - 22.0000;
CONDVAR[43] = VOI - 23.0000;
CONDVAR[44] = VOI - 24.0000;
CONDVAR[45] = VOI - 204.000;
CONDVAR[46] = VOI - 205.000;
CONDVAR[47] = VOI - 206.000;
CONDVAR[48] = VOI - 207.000;
CONDVAR[49] = VOI - 217.000;
CONDVAR[50] = VOI - 218.000;
CONDVAR[51] = VOI - 219.000;
CONDVAR[52] = VOI - 220.000;
CONDVAR[53] = VOI - 227.000;
CONDVAR[54] = VOI - 228.000;
CONDVAR[55] = VOI - 229.000;
CONDVAR[56] = VOI - 230.000;
CONDVAR[57] = VOI - 310.000;
CONDVAR[58] = VOI - 311.000;
CONDVAR[59] = VOI - 312.000;
CONDVAR[60] = VOI - 313.000;
CONDVAR[61] = VOI - 321.000;
CONDVAR[62] = VOI - 322.000;
CONDVAR[63] = VOI - 323.000;
CONDVAR[64] = VOI - 0.00000;
CONDVAR[65] = VOI - 90.0000;
CONDVAR[66] = VOI - 90.0000;
CONDVAR[67] = VOI - 180.000;
CONDVAR[68] = VOI - 180.000;
CONDVAR[69] = VOI - 270.000;
CONDVAR[70] = VOI - 270.000;
CONDVAR[71] = VOI - 360.000;
}