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 3 entries in the algebraic variable array.
There are a total of 2 entries in each of the rate and state variable arrays.
There are a total of 15 entries in the constant variable array.
*/
/*
* VOI is time in component environment (week).
* ALGEBRAIC[0] is rem_time in component environment (week).
* ALGEBRAIC[2] is Exposure in component environment (mg).
* CONSTANTS[0] is Dose in component environment (mg).
* CONSTANTS[1] is Dose_Int1 in component environment (week).
* CONSTANTS[2] is Dose_Int2 in component environment (week).
* CONSTANTS[3] is Dose_Length in component environment (week).
* CONSTANTS[4] is Cycle_Int in component environment (week).
* CONSTANTS[5] is N_Cycle in component environment (dimensionless).
* CONSTANTS[6] is conversion_factor in component environment (sec_per_week).
* ALGEBRAIC[1] is Effect in component effect_compartment (dimensionless).
* STATES[0] is Ce in component effect_compartment (mg).
* CONSTANTS[7] is E_max in component effect_compartment (dimensionless).
* CONSTANTS[8] is Amt_50 in component effect_compartment (mg).
* CONSTANTS[12] is k_1 in component effect_compartment (per_week).
* CONSTANTS[9] is t_half_eq in component effect_compartment (week).
* STATES[1] is Size in component response_compartment (cm).
* CONSTANTS[10] is Size_0 in component response_compartment (cm).
* CONSTANTS[14] is RateIn in component response_compartment (per_week).
* CONSTANTS[11] is T_Turnover in component response_compartment (cm_week).
* CONSTANTS[13] is k_2 in component response_compartment (per_cm_per_week).
* RATES[0] is d/dt Ce in component effect_compartment (mg).
* RATES[1] is d/dt Size in component response_compartment (cm).
*/
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
CONSTANTS[0] = 5203.84;
CONSTANTS[1] = 0;
CONSTANTS[2] = 1;
CONSTANTS[3] = 0.44359;
CONSTANTS[4] = 3;
CONSTANTS[5] = 6;
CONSTANTS[6] = 604800;
STATES[0] = 0;
CONSTANTS[7] = 1;
CONSTANTS[8] = 10600;
CONSTANTS[9] = 7.67;
STATES[1] = 6.66;
CONSTANTS[10] = 6.66;
CONSTANTS[11] = 21.8;
CONSTANTS[12] = log(2.00000)/CONSTANTS[9];
CONSTANTS[13] = log(2.00000)/CONSTANTS[11];
CONSTANTS[14] = CONSTANTS[10]*CONSTANTS[13];
}
void
computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[1] = 1.00000 - ( CONSTANTS[7]*STATES[0])/(CONSTANTS[8]+STATES[0]);
RATES[1] = ( CONSTANTS[14]*ALGEBRAIC[1] - CONSTANTS[13]*STATES[1])*STATES[1];
ALGEBRAIC[0] = ( (int)( VOI*CONSTANTS[6]) % (int)( CONSTANTS[4]*CONSTANTS[6]))/CONSTANTS[6];
ALGEBRAIC[2] = (VOI< CONSTANTS[4]*CONSTANTS[5]&&CONSTANTS[1]<ALGEBRAIC[0]&&ALGEBRAIC[0]<CONSTANTS[3] ? CONSTANTS[0] : VOI< CONSTANTS[4]*CONSTANTS[5]&&CONSTANTS[2]<ALGEBRAIC[0]&&ALGEBRAIC[0]<CONSTANTS[2]+CONSTANTS[3] ? CONSTANTS[0] : 0.00000);
RATES[0] = ALGEBRAIC[2]/1.00000 - STATES[0]*CONSTANTS[12];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[1] = 1.00000 - ( CONSTANTS[7]*STATES[0])/(CONSTANTS[8]+STATES[0]);
ALGEBRAIC[0] = ( (int)( VOI*CONSTANTS[6]) % (int)( CONSTANTS[4]*CONSTANTS[6]))/CONSTANTS[6];
ALGEBRAIC[2] = (VOI< CONSTANTS[4]*CONSTANTS[5]&&CONSTANTS[1]<ALGEBRAIC[0]&&ALGEBRAIC[0]<CONSTANTS[3] ? CONSTANTS[0] : VOI< CONSTANTS[4]*CONSTANTS[5]&&CONSTANTS[2]<ALGEBRAIC[0]&&ALGEBRAIC[0]<CONSTANTS[2]+CONSTANTS[3] ? CONSTANTS[0] : 0.00000);
}
