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 2 entries in the algebraic variable array.
   There are a total of 5 entries in each of the rate and state variable arrays.
   There are a total of 35 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (hour).
 * STATES[0] is GH in component GH (ng_ml).
 * CONSTANTS[0] is GHS in component GH (dimensionless).
 * CONSTANTS[1] is k1 in component GH (first_order_rate_constant).
 * CONSTANTS[2] is kr1 in component GH (ng_ml_hr).
 * CONSTANTS[3] is t1 in component GH (pg_ml).
 * CONSTANTS[4] is n1 in component GH (dimensionless).
 * CONSTANTS[5] is n2 in component GH (dimensionless).
 * CONSTANTS[6] is g0 in component GH (dimensionless).
 * CONSTANTS[7] is ng0 in component GH (dimensionless).
 * CONSTANTS[8] is tg0 in component GH (dimensionless).
 * CONSTANTS[9] is t2 in component GH (pg_ml).
 * STATES[1] is SRIF_PeV in component SRIF_PeV (pg_ml).
 * CONSTANTS[33] is F1_GHS in component F (dimensionless).
 * STATES[2] is GHRH in component GHRH (pg_ml).
 * STATES[3] is ghr_GHRH in component ghr_GHRH (pg_ml).
 * CONSTANTS[10] is k4 in component SRIF_PeV (first_order_rate_constant).
 * CONSTANTS[11] is kr4 in component SRIF_PeV (pg_ml_hr).
 * CONSTANTS[12] is t5 in component SRIF_PeV (ng_ml).
 * CONSTANTS[13] is n5 in component SRIF_PeV (dimensionless).
 * CONSTANTS[14] is S_basal in component SRIF_PeV (pg_ml_hr).
 * STATES[4] is SRIF_ArC in component SRIF_ArC (pg_ml).
 * CONSTANTS[15] is k2 in component SRIF_ArC (first_order_rate_constant).
 * CONSTANTS[16] is kr2 in component SRIF_ArC (pg_ml_hr).
 * CONSTANTS[17] is t3 in component SRIF_ArC (pg_ml).
 * CONSTANTS[18] is n3 in component SRIF_ArC (dimensionless).
 * CONSTANTS[19] is k3 in component GHRH (first_order_rate_constant).
 * CONSTANTS[20] is kr3 in component GHRH (pg_ml_hr).
 * CONSTANTS[21] is t4 in component GHRH (pg_ml).
 * CONSTANTS[22] is n4 in component GHRH (dimensionless).
 * CONSTANTS[34] is F2_GHS in component F (dimensionless).
 * CONSTANTS[23] is g1 in component F (dimensionless).
 * CONSTANTS[24] is g2 in component F (dimensionless).
 * CONSTANTS[25] is tg1 in component F (dimensionless).
 * CONSTANTS[26] is tg2 in component F (dimensionless).
 * CONSTANTS[27] is ng1 in component F (dimensionless).
 * CONSTANTS[28] is ng2 in component F (dimensionless).
 * ALGEBRAIC[1] is dghr_GHRH_dt in component ghr_GHRH (pg_ml_hr).
 * ALGEBRAIC[0] is inject in component ghr_GHRH (pg_ml_hr).
 * CONSTANTS[29] is kghr in component ghr_GHRH (first_order_rate_constant).
 * CONSTANTS[30] is C in component ghr_GHRH (pg_ml_hr).
 * CONSTANTS[31] is onset in component ghr_GHRH (hour).
 * CONSTANTS[32] is duration in component ghr_GHRH (hour).
 * RATES[0] is d/dt GH in component GH (ng_ml).
 * RATES[1] is d/dt SRIF_PeV in component SRIF_PeV (pg_ml).
 * RATES[4] is d/dt SRIF_ArC in component SRIF_ArC (pg_ml).
 * RATES[2] is d/dt GHRH in component GHRH (pg_ml).
 * RATES[3] is d/dt ghr_GHRH in component ghr_GHRH (pg_ml).
 * There are a total of 4 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = 0.0;
CONSTANTS[0] = 20.0;
CONSTANTS[1] = 3.0;
CONSTANTS[2] = 600.0;
CONSTANTS[3] = 357.0;
CONSTANTS[4] = 5.0;
CONSTANTS[5] = 2.0;
CONSTANTS[6] = 2.0;
CONSTANTS[7] = 2.9;
CONSTANTS[8] = 200.0;
CONSTANTS[9] = 10.0;
STATES[1] = 0.0;
STATES[2] = 0.0;
STATES[3] = 0.0;
CONSTANTS[10] = 25.0;
CONSTANTS[11] = 20400.0;
CONSTANTS[12] = 10.0;
CONSTANTS[13] = 2.0;
CONSTANTS[14] = 900.0;
STATES[4] = 0.0;
CONSTANTS[15] = 25.0;
CONSTANTS[16] = 2200.0;
CONSTANTS[17] = 400.0;
CONSTANTS[18] = 2.0;
CONSTANTS[19] = 40.0;
CONSTANTS[20] = 63000.0;
CONSTANTS[21] = 28.0;
CONSTANTS[22] = 5.0;
CONSTANTS[23] = 90000.0;
CONSTANTS[24] = 100.0;
CONSTANTS[25] = 390.0;
CONSTANTS[26] = 10000.0;
CONSTANTS[27] = 3.0;
CONSTANTS[28] = 2.0;
CONSTANTS[29] = 15.0;
CONSTANTS[30] = 10000.0;
CONSTANTS[31] = 2.0;
CONSTANTS[32] = 0.2;
CONSTANTS[33] =  CONSTANTS[23]*(pow(CONSTANTS[0]/CONSTANTS[25], CONSTANTS[27])/(1.00000+pow(CONSTANTS[0]/CONSTANTS[25], CONSTANTS[27])));
CONSTANTS[34] =  CONSTANTS[24]*(pow(CONSTANTS[0]/CONSTANTS[26], CONSTANTS[28])/(1.00000+pow(CONSTANTS[0]/CONSTANTS[26], CONSTANTS[28])));
RATES[0] = 0.1001;
RATES[1] = 0.1001;
RATES[4] = 0.1001;
RATES[2] = 0.1001;
RATES[3] = 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[2]*(pow((STATES[2]+STATES[3])/CONSTANTS[3], CONSTANTS[4])/(pow((STATES[2]+STATES[3])/CONSTANTS[3], CONSTANTS[4])+1.00000)+ CONSTANTS[6]*(pow(CONSTANTS[0]/CONSTANTS[8], CONSTANTS[7])/(1.00000+pow(CONSTANTS[0]/CONSTANTS[8], CONSTANTS[7])))+(1.00000+CONSTANTS[33])/(1.00000+pow(STATES[1]/CONSTANTS[9], CONSTANTS[5])+CONSTANTS[33])) -  CONSTANTS[1]*STATES[0];
resid[1] = RATES[1] - - ( CONSTANTS[10]*STATES[1])+ CONSTANTS[11]*(pow(STATES[0]/CONSTANTS[12], CONSTANTS[13])/(pow(STATES[0]/CONSTANTS[12], CONSTANTS[13])+1.00000))+CONSTANTS[14];
resid[2] = RATES[4] -  CONSTANTS[16]*(pow((STATES[2]+STATES[3])/CONSTANTS[17], CONSTANTS[18])/(1.00000+pow((STATES[2]+STATES[3])/CONSTANTS[17], CONSTANTS[18]))) -  CONSTANTS[15]*STATES[4];
resid[3] = RATES[2] - ( CONSTANTS[20]*((1.00000+CONSTANTS[34])/(1.00000+pow((STATES[1]+STATES[4])/CONSTANTS[21], CONSTANTS[22])+CONSTANTS[34]))+ STATES[3]*1.00000) -  CONSTANTS[19]*STATES[2];
resid[4] = RATES[3] - ALGEBRAIC[0] -  CONSTANTS[29]*STATES[3];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[1] = ALGEBRAIC[0] -  CONSTANTS[29]*STATES[3];
}
void
computeEssentialVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] = (CONDVAR[0]<0.00000 ? 0.00000 : CONDVAR[1]>=0.00000&&CONDVAR[2]<=0.00000 ? CONSTANTS[30] : CONDVAR[3]>0.00000 ? 0.00000 : 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;
}
void
computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
             double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
CONDVAR[0] = VOI - CONSTANTS[31];
CONDVAR[1] = VOI - CONSTANTS[31];
CONDVAR[2] = VOI - (CONSTANTS[31]+CONSTANTS[32]);
CONDVAR[3] = VOI - (CONSTANTS[31]+CONSTANTS[32]);
}