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 13 entries in each of the rate and state variable arrays. There are a total of 19 entries in the constant variable array. */ /* * VOI is time in component environment (dimensionless). * STATES[0] is C in component C (dimensionless). * CONSTANTS[0] is gamma in component C (dimensionless). * STATES[3] is Vs in component Vs (dimensionless). * ALGEBRAIC[0] is V1 in component V1 (dimensionless). * STATES[4] is V2 in component V2 (dimensionless). * STATES[5] is Vd in component Vd (dimensionless). * STATES[1] is K in component K (dimensionless). * STATES[2] is RP in component RP (dimensionless). * STATES[6] is V3 in component V3 (dimensionless). * ALGEBRAIC[1] is V4 in component V4 (dimensionless). * STATES[7] is E in component E (dimensionless). * CONSTANTS[1] is sigma in component E (dimensionless). * STATES[8] is RE in component RE (dimensionless). * STATES[9] is KP in component KP (dimensionless). * STATES[10] is KPI in component KPI (dimensionless). * CONSTANTS[2] is thetaI in component KPI (dimensionless). * STATES[11] is I in component I (dimensionless). * CONSTANTS[3] is lambda in component I (dimensionless). * CONSTANTS[4] is thetaE in component RE (dimensionless). * STATES[12] is R in component R (dimensionless). * CONSTANTS[5] is VCs in component Vs (dimensionless). * CONSTANTS[6] is Vsm in component Vs (dimensionless). * CONSTANTS[7] is KsE in component Vs (dimensionless). * CONSTANTS[8] is V1m in component V1 (dimensionless). * CONSTANTS[9] is K1C in component V1 (dimensionless). * CONSTANTS[10] is K1 in component V1 (dimensionless). * CONSTANTS[11] is V2m in component V2 (dimensionless). * CONSTANTS[12] is K2 in component V2 (dimensionless). * CONSTANTS[13] is V3m in component V3 (dimensionless). * CONSTANTS[14] is K3 in component V3 (dimensionless). * CONSTANTS[15] is V4m in component V4 (dimensionless). * CONSTANTS[16] is K4 in component V4 (dimensionless). * CONSTANTS[17] is VdEm in component Vd (dimensionless). * CONSTANTS[18] is KdC in component Vd (dimensionless). * RATES[0] is d/dt C in component C (dimensionless). * RATES[1] is d/dt K in component K (dimensionless). * RATES[2] is d/dt RP in component RP (dimensionless). * There are a total of 0 condition variables. */ void initConsts(double* CONSTANTS, double* RATES, double *STATES) { STATES[0] = 0.38; CONSTANTS[0] = 1.0; STATES[1] = 0.1; STATES[2] = 1.0; CONSTANTS[1] = 10; CONSTANTS[2] = 1.0; CONSTANTS[3] = 1.0; CONSTANTS[4] = 0.01; CONSTANTS[5] = 1.0; CONSTANTS[6] = 1.0; CONSTANTS[7] = 0.1; CONSTANTS[8] = 50.0; CONSTANTS[9] = 0.1; CONSTANTS[10] = 0.0001; CONSTANTS[11] = 40; CONSTANTS[12] = 0.0001; CONSTANTS[13] = 3000; CONSTANTS[14] = 0.0001; CONSTANTS[15] = 3.0; CONSTANTS[16] = 0.0001; CONSTANTS[17] = 1000.0; CONSTANTS[18] = 0.005; STATES[3] = 0.1001; STATES[4] = 0.1001; STATES[5] = 0.1001; STATES[6] = 0.1001; STATES[7] = 0.1001; STATES[8] = 0.1001; STATES[9] = 0.1001; STATES[10] = 0.1001; STATES[11] = 0.1001; STATES[12] = 0.1001; RATES[0] = 0.1001; RATES[1] = 0.1001; RATES[2] = 0.1001; } void computeResiduals(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES, double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS) { resid[0] = RATES[0] - (STATES[3]+ CONSTANTS[0]*STATES[4]) - ( CONSTANTS[0]*ALGEBRAIC[0]+STATES[5]); resid[1] = RATES[1] - STATES[4] - ALGEBRAIC[0]; resid[2] = RATES[2] - STATES[6] - ALGEBRAIC[1]; resid[3] = STATES[7] - 1.00000 - CONSTANTS[1]*STATES[8]; resid[4] = STATES[9] - 1.00000 - (STATES[10]+STATES[1]); resid[5] = STATES[10] - CONSTANTS[2]*STATES[9]*STATES[11]; resid[6] = STATES[11] - 1.00000 - CONSTANTS[3]*STATES[10]; resid[7] = STATES[8] - CONSTANTS[4]*STATES[12]*STATES[7]; resid[8] = STATES[12] - 1.00000 - (STATES[2]+STATES[8]); resid[9] = STATES[3] - CONSTANTS[5]+ CONSTANTS[6]*(STATES[7]/(CONSTANTS[7]+STATES[7])); resid[10] = STATES[4] - CONSTANTS[11]*(STATES[9]/(CONSTANTS[12]+STATES[9])); resid[11] = STATES[6] - CONSTANTS[13]*STATES[9]*(STATES[8]/(CONSTANTS[14]+STATES[8])); resid[12] = STATES[5] - STATES[0]+ CONSTANTS[17]*STATES[7]*(STATES[0]/(CONSTANTS[18]+STATES[0])); } 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] = CONSTANTS[8]*(STATES[0]/(CONSTANTS[9]+STATES[0]))*(STATES[1]/(CONSTANTS[10]+STATES[1])); ALGEBRAIC[1] = CONSTANTS[15]*(STATES[2]/(CONSTANTS[16]+STATES[2])); } void getStateInformation(double* SI) { SI[0] = 1.0; SI[3] = 0.0; SI[4] = 0.0; SI[5] = 0.0; SI[1] = 1.0; SI[2] = 1.0; SI[6] = 0.0; SI[7] = 0.0; SI[8] = 0.0; SI[9] = 0.0; SI[10] = 0.0; SI[11] = 0.0; SI[12] = 0.0; } void computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES, double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS) { }