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 20 entries in the constant variable array.
 */
/*
 * VOI is t in component environment (second).
 * CONSTANTS[0] is D_Ca in component parameters (second).
 * CONSTANTS[1] is k_1 in component parameters (per_second).
 * CONSTANTS[2] is k_2 in component parameters (per_second).
 * CONSTANTS[3] is f in component parameters (per_second).
 * CONSTANTS[4] is g in component parameters (per_second).
 * CONSTANTS[5] is Ca_max in component parameters (dimensionless).
 * CONSTANTS[6] is Total_Tn in component parameters (dimensionless).
 * CONSTANTS[7] is Total_CB in component parameters (dimensionless).
 * ALGEBRAIC[0] is Ca_t in component Ca_t (dimensionless).
 * STATES[0] is TnCa in component TnCa (dimensionless).
 * STATES[1] is CB_on in component CB_on (dimensionless).
 * STATES[2] is CumCB_on in component CumCB (dimensionless).
 * STATES[3] is CumCB_off in component CumCB (dimensionless).
 * ALGEBRAIC[1] is F in component force_development (force).
 * STATES[4] is FTI in component force_development (force_second).
 * CONSTANTS[15] is FLA in component force_development (energy).
 * CONSTANTS[8] is phi in component force_development (force).
 * CONSTANTS[9] is s in component force_development (dimensionless).
 * CONSTANTS[10] is L in component force_development (meter).
 * CONSTANTS[11] is L_0 in component force_development (meter).
 * CONSTANTS[12] is F_max in component force_development (force).
 * CONSTANTS[17] is ATP in component ATP (dimensionless).
 * CONSTANTS[18] is ATP_energy in component ATP (energy).
 * CONSTANTS[13] is epsilon in component ATP (energy).
 * CONSTANTS[14] is CumCB_on_end in component ATP (dimensionless).
 * CONSTANTS[19] is Efficiency in component equations_main (dimensionless).
 * CONSTANTS[16] is Economy in component equations_main (second_per_meter).
 * RATES[0] is d/dt TnCa in component TnCa (dimensionless).
 * RATES[1] is d/dt CB_on in component CB_on (dimensionless).
 * RATES[2] is d/dt CumCB_on in component CumCB (dimensionless).
 * RATES[3] is d/dt CumCB_off in component CumCB (dimensionless).
 * RATES[4] is d/dt FTI in component force_development (force_second).
 * There are a total of 4 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
CONSTANTS[0] = 0.1;
CONSTANTS[1] = 40;
CONSTANTS[2] = 20;
CONSTANTS[3] = 10;
CONSTANTS[4] = 10;
CONSTANTS[5] = 1;
CONSTANTS[6] = 1;
CONSTANTS[7] = 1;
STATES[0] = 0;
STATES[1] = 0;
STATES[2] = 0;
STATES[3] = 0;
STATES[4] = 0;
CONSTANTS[8] = 1;
CONSTANTS[9] = 1;
CONSTANTS[10] = 1;
CONSTANTS[11] = 0;
CONSTANTS[12] = 0.228;
CONSTANTS[13] = 1;
CONSTANTS[14] = 1;
CONSTANTS[15] =  CONSTANTS[12]*CONSTANTS[9]*(CONSTANTS[10] - CONSTANTS[11]);
CONSTANTS[16] =  (CONSTANTS[8]/CONSTANTS[13])*(1.00000/CONSTANTS[4]);
CONSTANTS[17] = CONSTANTS[14];
CONSTANTS[18] =  CONSTANTS[17]*CONSTANTS[13];
CONSTANTS[19] = CONSTANTS[15]/CONSTANTS[18];
RATES[0] = 0.1001;
RATES[1] = 0.1001;
RATES[2] = 0.1001;
RATES[3] = 0.1001;
RATES[4] = 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[1]*ALGEBRAIC[0]*(CONSTANTS[6] - STATES[0]) -  CONSTANTS[2]*STATES[0];
resid[1] = RATES[1] -  CONSTANTS[3]*STATES[0]*(CONSTANTS[7] - STATES[1]) -  CONSTANTS[4]*STATES[1];
resid[2] = RATES[2] -  CONSTANTS[3]*STATES[0]*(CONSTANTS[7] - STATES[1]);
resid[3] = RATES[3] -  CONSTANTS[4]*STATES[1];
resid[4] = RATES[4] - ALGEBRAIC[1];
}
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] = (CONDVAR[0]>=0.00000&&CONDVAR[1]<0.00000 ? ( CONSTANTS[5]*(1.00000+ sin((  3.14159265358979*(VOI/CONSTANTS[0] - 0.150000))/0.300000)))/2.00000 : CONDVAR[2]>=0.00000&&CONDVAR[3]<0.00000 ? ( CONSTANTS[5]*(1.00000 -  sin((  3.14159265358979*(VOI/CONSTANTS[0] - 0.650000))/0.700000)))/2.00000 : 0.00000);
ALGEBRAIC[1] =  STATES[1]*CONSTANTS[8];
}
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 - 0.00000;
CONDVAR[1] = VOI -  0.300000*CONSTANTS[0];
CONDVAR[2] = VOI -  0.300000*CONSTANTS[0];
CONDVAR[3] = VOI - CONSTANTS[0];
}