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 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[9] is hr in component r (dimensionless).
 * ALGEBRAIC[4] is Ir in component r (flux).
 * ALGEBRAIC[6] 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[8] 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[2] 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[3] 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[5] is hact in component g (dimensionless).
 * CONSTANTS[23] is n2 in component g (dimensionless).
 * CONSTANTS[24] is theta_2 in component g (dimensionless).
 * ALGEBRAIC[1] 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).
 */
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;
}
void
computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
RATES[3] = CONSTANTS[8] -  CONSTANTS[7]*STATES[3];
RATES[6] =  CONSTANTS[5]*(CONSTANTS[25] -  CONSTANTS[19]*STATES[6]);
ALGEBRAIC[2] = 1.00000/(1.00000+exp(- (arbitrary_log( 1.00000*(STATES[1]+STATES[3]), 10) - CONSTANTS[12])/CONSTANTS[13]));
RATES[4] = - ( CONSTANTS[9]*(STATES[0]+CONSTANTS[14])*STATES[4])+ (CONSTANTS[10]+ CONSTANTS[11]*ALGEBRAIC[2])*(1.00000 - STATES[4]);
ALGEBRAIC[3] = 1.00000/(1.00000+exp(- (arbitrary_log( 1.00000*(STATES[1]+STATES[3]), 10) - CONSTANTS[17])/CONSTANTS[18]));
RATES[5] =  CONSTANTS[5]*( (CONSTANTS[15]+ CONSTANTS[16]*(1.00000 - ALGEBRAIC[3]))*( (STATES[0]+CONSTANTS[14])*STATES[4]) -  CONSTANTS[19]*STATES[5]);
ALGEBRAIC[7] = (VOI>0.00000&&VOI<=90.0000 ? 10.0000 : VOI>90.0000&&VOI<=180.000 ? 0.00000 : VOI>180.000&&VOI<=270.000 ? 10.0000 : VOI>270.000&&VOI<=360.000 ? 0.00000 : 0.00000);
RATES[1] = ( ALGEBRAIC[7]*STATES[2] -  CONSTANTS[7]*STATES[1])+CONSTANTS[6];
ALGEBRAIC[1] =  (STATES[5]+STATES[6])*CONSTANTS[26];
ALGEBRAIC[5] = pow(ALGEBRAIC[1], CONSTANTS[23])/(pow(ALGEBRAIC[1], CONSTANTS[23])+pow( CONSTANTS[5]*CONSTANTS[24], CONSTANTS[23]));
RATES[2] =  CONSTANTS[20]*ALGEBRAIC[5]*((CONSTANTS[21] - STATES[2])/CONSTANTS[21]) -  CONSTANTS[22]*ALGEBRAIC[7]*STATES[2];
ALGEBRAIC[0] = 1.00000 - pow(STATES[1], CONSTANTS[1])/(pow(STATES[1], CONSTANTS[1])+pow(CONSTANTS[2], CONSTANTS[1]));
ALGEBRAIC[8] =  (STATES[5]+STATES[6])*CONSTANTS[27];
ALGEBRAIC[9] = 1.00000 - pow(ALGEBRAIC[8], CONSTANTS[3])/(pow(ALGEBRAIC[8], CONSTANTS[3])+pow( CONSTANTS[5]*CONSTANTS[4], CONSTANTS[3]));
ALGEBRAIC[4] = (VOI>=0.00000&&VOI<=90.0000 ? 0.00000 : VOI>=91.0000&&VOI<=92.0000 ? 10.0000 : VOI>=93.0000&&VOI<=113.000 ? 0.00000 : VOI>=114.000&&VOI<=115.000 ? 10.0000 : VOI>=116.000&&VOI<=136.000 ? 0.00000 : VOI>=137.000&&VOI<=138.000 ? 10.0000 : VOI>=139.000&&VOI<=159.000 ? 0.00000 : VOI>=160.000&&VOI<=161.000 ? 10.0000 : VOI>=162.000&&VOI<=252.000 ? 0.00000 : VOI>=253.000&&VOI<=254.000 ? 10.0000 : VOI>=255.000&&VOI<=275.000 ? 0.00000 : VOI>=276.000&&VOI<=277.000 ? 10.0000 : VOI>=278.000&&VOI<=298.000 ? 0.00000 : VOI>=299.000&&VOI<=300.000 ? 10.0000 : VOI>=301.000&&VOI<=321.000 ? 0.00000 : VOI>=322.000&&VOI<=323.000 ? 10.0000 : 0.00000);
ALGEBRAIC[6] = (VOI>=0.00000&&VOI<=5.00000 ? 0.00000 : VOI>=6.00000&&VOI<=7.00000 ? 1000.00 : VOI>=8.00000&&VOI<=12.0000 ? 0.00000 : VOI>=13.0000&&VOI<=14.0000 ? 1000.00 : VOI>=15.0000&&VOI<=21.0000 ? 0.00000 : VOI>=22.0000&&VOI<=23.0000 ? 1000.00 : VOI>=24.0000&&VOI<=204.000 ? 0.00000 : VOI>=205.000&&VOI<=206.000 ? 1000.00 : VOI>=207.000&&VOI<=217.000 ? 0.00000 : VOI>=218.000&&VOI<=219.000 ? 1000.00 : VOI>=220.000&&VOI<=227.000 ? 0.00000 : VOI>=228.000&&VOI<=229.000 ? 1000.00 : VOI>=230.000&&VOI<=310.000 ? 0.00000 : VOI>=311.000&&VOI<=312.000 ? 1000.00 : VOI>=313.000&&VOI<=321.000 ? 0.00000 : VOI>=322.000&&VOI<=323.000 ? 1000.00 : 0.00000);
RATES[0] = ( ALGEBRAIC[0]*ALGEBRAIC[9]*ALGEBRAIC[4] -  CONSTANTS[0]*STATES[0])+ALGEBRAIC[6];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[2] = 1.00000/(1.00000+exp(- (arbitrary_log( 1.00000*(STATES[1]+STATES[3]), 10) - CONSTANTS[12])/CONSTANTS[13]));
ALGEBRAIC[3] = 1.00000/(1.00000+exp(- (arbitrary_log( 1.00000*(STATES[1]+STATES[3]), 10) - CONSTANTS[17])/CONSTANTS[18]));
ALGEBRAIC[7] = (VOI>0.00000&&VOI<=90.0000 ? 10.0000 : VOI>90.0000&&VOI<=180.000 ? 0.00000 : VOI>180.000&&VOI<=270.000 ? 10.0000 : VOI>270.000&&VOI<=360.000 ? 0.00000 : 0.00000);
ALGEBRAIC[1] =  (STATES[5]+STATES[6])*CONSTANTS[26];
ALGEBRAIC[5] = pow(ALGEBRAIC[1], CONSTANTS[23])/(pow(ALGEBRAIC[1], CONSTANTS[23])+pow( CONSTANTS[5]*CONSTANTS[24], CONSTANTS[23]));
ALGEBRAIC[0] = 1.00000 - pow(STATES[1], CONSTANTS[1])/(pow(STATES[1], CONSTANTS[1])+pow(CONSTANTS[2], CONSTANTS[1]));
ALGEBRAIC[8] =  (STATES[5]+STATES[6])*CONSTANTS[27];
ALGEBRAIC[9] = 1.00000 - pow(ALGEBRAIC[8], CONSTANTS[3])/(pow(ALGEBRAIC[8], CONSTANTS[3])+pow( CONSTANTS[5]*CONSTANTS[4], CONSTANTS[3]));
ALGEBRAIC[4] = (VOI>=0.00000&&VOI<=90.0000 ? 0.00000 : VOI>=91.0000&&VOI<=92.0000 ? 10.0000 : VOI>=93.0000&&VOI<=113.000 ? 0.00000 : VOI>=114.000&&VOI<=115.000 ? 10.0000 : VOI>=116.000&&VOI<=136.000 ? 0.00000 : VOI>=137.000&&VOI<=138.000 ? 10.0000 : VOI>=139.000&&VOI<=159.000 ? 0.00000 : VOI>=160.000&&VOI<=161.000 ? 10.0000 : VOI>=162.000&&VOI<=252.000 ? 0.00000 : VOI>=253.000&&VOI<=254.000 ? 10.0000 : VOI>=255.000&&VOI<=275.000 ? 0.00000 : VOI>=276.000&&VOI<=277.000 ? 10.0000 : VOI>=278.000&&VOI<=298.000 ? 0.00000 : VOI>=299.000&&VOI<=300.000 ? 10.0000 : VOI>=301.000&&VOI<=321.000 ? 0.00000 : VOI>=322.000&&VOI<=323.000 ? 10.0000 : 0.00000);
ALGEBRAIC[6] = (VOI>=0.00000&&VOI<=5.00000 ? 0.00000 : VOI>=6.00000&&VOI<=7.00000 ? 1000.00 : VOI>=8.00000&&VOI<=12.0000 ? 0.00000 : VOI>=13.0000&&VOI<=14.0000 ? 1000.00 : VOI>=15.0000&&VOI<=21.0000 ? 0.00000 : VOI>=22.0000&&VOI<=23.0000 ? 1000.00 : VOI>=24.0000&&VOI<=204.000 ? 0.00000 : VOI>=205.000&&VOI<=206.000 ? 1000.00 : VOI>=207.000&&VOI<=217.000 ? 0.00000 : VOI>=218.000&&VOI<=219.000 ? 1000.00 : VOI>=220.000&&VOI<=227.000 ? 0.00000 : VOI>=228.000&&VOI<=229.000 ? 1000.00 : VOI>=230.000&&VOI<=310.000 ? 0.00000 : VOI>=311.000&&VOI<=312.000 ? 1000.00 : VOI>=313.000&&VOI<=321.000 ? 0.00000 : VOI>=322.000&&VOI<=323.000 ? 1000.00 : 0.00000);
}