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 17 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 25 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (ms).
 * ALGEBRAIC[1] is Ca_i in component intracellular_ion_concentrations (mM).
 * ALGEBRAIC[0] is Ca_b in component intracellular_ion_concentrations (mM).
 * STATES[0] is TRPN in component intracellular_ion_concentrations (mM).
 * CONSTANTS[0] is Ca_TRPN_Max in component troponin (mM).
 * ALGEBRAIC[16] is J_TRPN in component troponin (mM_per_ms).
 * STATES[1] is z in component tropomyosin (dimensionless).
 * ALGEBRAIC[11] is z_max in component tropomyosin (dimensionless).
 * CONSTANTS[1] is k_on in component troponin (per_mM_per_ms).
 * CONSTANTS[2] is k_Ref_off in component troponin (per_ms).
 * CONSTANTS[3] is gamma_trpn in component troponin (dimensionless).
 * CONSTANTS[4] is alpha_0 in component tropomyosin (per_ms).
 * CONSTANTS[5] is alpha_r1 in component tropomyosin (per_ms).
 * CONSTANTS[6] is alpha_r2 in component tropomyosin (per_ms).
 * CONSTANTS[7] is n_Rel in component tropomyosin (dimensionless).
 * CONSTANTS[8] is K_z in component tropomyosin (dimensionless).
 * CONSTANTS[9] is n_Hill in component tropomyosin (dimensionless).
 * CONSTANTS[10] is Ca_50ref in component tropomyosin (mM).
 * CONSTANTS[11] is z_p in component tropomyosin (dimensionless).
 * CONSTANTS[12] is beta_1 in component tropomyosin (dimensionless).
 * ALGEBRAIC[8] is Ca_50 in component tropomyosin (mM).
 * ALGEBRAIC[9] is Ca_TRPN_50 in component tropomyosin (mM).
 * CONSTANTS[22] is K_2 in component tropomyosin (per_ms).
 * CONSTANTS[24] is K_1 in component tropomyosin (per_ms).
 * ALGEBRAIC[10] is alpha_Tm in component tropomyosin (per_ms).
 * ALGEBRAIC[2] is beta_Tm in component tropomyosin (per_ms).
 * CONSTANTS[13] is beta_0 in component filament_overlap (dimensionless).
 * ALGEBRAIC[5] is lambda in component Myofilaments (dimensionless).
 * ALGEBRAIC[15] is k_off in component troponin (per_ms).
 * ALGEBRAIC[14] is Tension in component Cross_Bridges (N_per_mm2).
 * CONSTANTS[14] is T_ref in component length_independent_tension (N_per_mm2).
 * ALGEBRAIC[3] is ExtensionRatio in component Myofilaments (dimensionless).
 * CONSTANTS[23] is dExtensionRatiodt in component Myofilaments (per_ms).
 * ALGEBRAIC[4] is lambda_prev in component Myofilaments (dimensionless).
 * ALGEBRAIC[6] is overlap in component filament_overlap (dimensionless).
 * ALGEBRAIC[12] is T_Base in component length_independent_tension (N_per_mm2).
 * ALGEBRAIC[13] is T_0 in component isometric_tension (N_per_mm2).
 * ALGEBRAIC[7] is Q in component Cross_Bridges (dimensionless).
 * CONSTANTS[15] is a in component Cross_Bridges (dimensionless).
 * STATES[2] is Q_1 in component Cross_Bridges (dimensionless).
 * STATES[3] is Q_2 in component Cross_Bridges (dimensionless).
 * STATES[4] is Q_3 in component Cross_Bridges (dimensionless).
 * CONSTANTS[16] is A_1 in component Cross_Bridges (dimensionless).
 * CONSTANTS[17] is A_2 in component Cross_Bridges (dimensionless).
 * CONSTANTS[18] is A_3 in component Cross_Bridges (dimensionless).
 * CONSTANTS[19] is alpha_1 in component Cross_Bridges (per_ms).
 * CONSTANTS[20] is alpha_2 in component Cross_Bridges (per_ms).
 * CONSTANTS[21] is alpha_3 in component Cross_Bridges (per_ms).
 * RATES[0] is d/dt TRPN in component intracellular_ion_concentrations (mM).
 * RATES[1] is d/dt z in component tropomyosin (dimensionless).
 * RATES[2] is d/dt Q_1 in component Cross_Bridges (dimensionless).
 * RATES[3] is d/dt Q_2 in component Cross_Bridges (dimensionless).
 * RATES[4] is d/dt Q_3 in component Cross_Bridges (dimensionless).
 * There are a total of 15 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = 0.067593139865;
CONSTANTS[0] = 70e-3;
STATES[1] = 0.014417937837;
CONSTANTS[1] = 100;
CONSTANTS[2] = 0.2;
CONSTANTS[3] = 2;
CONSTANTS[4] = 8e-3;
CONSTANTS[5] = 2e-3;
CONSTANTS[6] = 1.75e-3;
CONSTANTS[7] = 3;
CONSTANTS[8] = 0.15;
CONSTANTS[9] = 3;
CONSTANTS[10] = 1.05e-3;
CONSTANTS[11] = 0.85;
CONSTANTS[12] = -4;
CONSTANTS[13] = 4.9;
CONSTANTS[14] = 56.2;
CONSTANTS[15] = 0.35;
STATES[2] = 0;
STATES[3] = 0;
STATES[4] = 0;
CONSTANTS[16] = -29;
CONSTANTS[17] = 138;
CONSTANTS[18] = 129;
CONSTANTS[19] = 0.03;
CONSTANTS[20] = 0.13;
CONSTANTS[21] = 0.625;
CONSTANTS[22] =  (( CONSTANTS[6]*pow(CONSTANTS[11], CONSTANTS[7]))/(pow(CONSTANTS[11], CONSTANTS[7])+pow(CONSTANTS[8], CONSTANTS[7])))*(1.00000 - ( CONSTANTS[7]*pow(CONSTANTS[8], CONSTANTS[7]))/(pow(CONSTANTS[11], CONSTANTS[7])+pow(CONSTANTS[8], CONSTANTS[7])));
CONSTANTS[23] = 0.00000;
CONSTANTS[24] = ( CONSTANTS[6]*pow(CONSTANTS[11], CONSTANTS[7] - 1.00000)*CONSTANTS[7]*pow(CONSTANTS[8], CONSTANTS[7]))/pow(pow(CONSTANTS[11], CONSTANTS[7])+pow(CONSTANTS[8], CONSTANTS[7]), 2.00000);
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] - ALGEBRAIC[16];
resid[1] = RATES[1] -  ALGEBRAIC[10]*(1.00000 - STATES[1]) -  ALGEBRAIC[2]*STATES[1];
resid[2] = RATES[2] -  CONSTANTS[16]*CONSTANTS[23] -  CONSTANTS[19]*STATES[2];
resid[3] = RATES[3] -  CONSTANTS[17]*CONSTANTS[23] -  CONSTANTS[20]*STATES[3];
resid[4] = RATES[4] -  CONSTANTS[18]*CONSTANTS[23] -  CONSTANTS[21]*STATES[4];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[4] = ALGEBRAIC[3];
}
void
computeEssentialVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[2] = CONSTANTS[5]+( CONSTANTS[6]*pow(STATES[1], CONSTANTS[7] - 1.00000))/(pow(STATES[1], CONSTANTS[7])+pow(CONSTANTS[8], CONSTANTS[7]));
ALGEBRAIC[0] = CONSTANTS[0] - STATES[0];
ALGEBRAIC[3] = (CONDVAR[10]>0.00000 ? 1.00000 : 1.00000);
ALGEBRAIC[5] = (CONDVAR[11]>0.00000&&CONDVAR[12]<=0.00000 ? ALGEBRAIC[3] : CONDVAR[13]>0.00000 ? 1.15000 : 0.800000);
ALGEBRAIC[8] =  CONSTANTS[10]*(1.00000+ CONSTANTS[12]*(ALGEBRAIC[5] - 1.00000));
ALGEBRAIC[9] = ( ALGEBRAIC[8]*CONSTANTS[0])/(ALGEBRAIC[8]+ (CONSTANTS[2]/CONSTANTS[1])*(1.00000 - ( (1.00000+ CONSTANTS[13]*(ALGEBRAIC[5] - 1.00000))*0.500000)/CONSTANTS[3]));
ALGEBRAIC[10] =  CONSTANTS[4]*pow(ALGEBRAIC[0]/ALGEBRAIC[9], CONSTANTS[9]);
ALGEBRAIC[1] = (CONDVAR[0]<0.00000 ?  1000.00*1.84330e-07 : CONDVAR[1]>=0.00000&&CONDVAR[2]<0.00000 ?  1000.00*((( 1.05500*pow(VOI/1000.00, 3.00000) -  0.0350700*pow(VOI/1000.00, 2.00000))+( 0.000399200*VOI)/1000.00) - 1.35600e-06) : CONDVAR[3]>=0.00000&&CONDVAR[4]<0.00000 ?  1000.00*((( 0.0140000*pow(VOI/1000.00, 3.00000) -  0.00255500*pow(VOI/1000.00, 2.00000))+( 0.000149400*VOI)/1000.00) - 1.42800e-06) : CONDVAR[5]>=0.00000&&CONDVAR[6]<0.00000 ?  1000.00*((( 1.73900e-05*pow(VOI/1000.00, 3.00000) -  3.20900e-06*pow(VOI/1000.00, 2.00000)) - ( 5.68900e-06*VOI)/1000.00)+1.71900e-06) : CONDVAR[7]>=0.00000&&CONDVAR[8]<0.00000 ?  1000.00*(((( 0.000132100*pow(VOI/1000.00, 4.00000) -  0.000219700*pow(VOI/1000.00, 3.00000))+ 0.000137400*pow(VOI/1000.00, 2.00000)) - ( 3.89500e-05*VOI)/1000.00)+4.44100e-06) :  1000.00*1.21480e-07);
ALGEBRAIC[6] = 1.00000+ CONSTANTS[13]*(ALGEBRAIC[5] - 1.00000);
ALGEBRAIC[11] = (CONSTANTS[4]/pow(ALGEBRAIC[9]/CONSTANTS[0], CONSTANTS[9]) - CONSTANTS[22])/(CONSTANTS[5]+CONSTANTS[24]+CONSTANTS[4]/pow(ALGEBRAIC[9]/CONSTANTS[0], CONSTANTS[9]));
ALGEBRAIC[12] = ( CONSTANTS[14]*STATES[1])/ALGEBRAIC[11];
ALGEBRAIC[13] =  ALGEBRAIC[12]*ALGEBRAIC[6];
ALGEBRAIC[7] = STATES[2]+STATES[3]+STATES[4];
ALGEBRAIC[14] = (CONDVAR[14]<0.00000 ? ( ALGEBRAIC[13]*( CONSTANTS[15]*ALGEBRAIC[7]+1.00000))/(1.00000 - ALGEBRAIC[7]) : ( ALGEBRAIC[13]*(1.00000+ (CONSTANTS[15]+2.00000)*ALGEBRAIC[7]))/(1.00000+ALGEBRAIC[7]));
ALGEBRAIC[15] = (CONDVAR[9]>0.00000 ?  CONSTANTS[2]*(1.00000 - ALGEBRAIC[14]/( CONSTANTS[3]*CONSTANTS[14])) :  CONSTANTS[2]*0.100000);
ALGEBRAIC[16] =  (CONSTANTS[0] - STATES[0])*ALGEBRAIC[15] -  ALGEBRAIC[1]*STATES[0]*CONSTANTS[1];
}
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 - 1.00000;
CONDVAR[1] = VOI - 10.0000;
CONDVAR[2] = VOI - 15.0000;
CONDVAR[3] = VOI - 15.0000;
CONDVAR[4] = VOI - 55.0000;
CONDVAR[5] = VOI - 55.0000;
CONDVAR[6] = VOI - 250.000;
CONDVAR[7] = VOI - 250.000;
CONDVAR[8] = VOI - 490.000;
CONDVAR[9] = (1.00000 - ALGEBRAIC[14]/( CONSTANTS[3]*CONSTANTS[14])) - 0.100000;
CONDVAR[10] = VOI - 1000.00;
CONDVAR[11] = ALGEBRAIC[3] - 0.800000;
CONDVAR[12] = ALGEBRAIC[3] - 1.15000;
CONDVAR[13] = ALGEBRAIC[3] - 1.15000;
CONDVAR[14] = ALGEBRAIC[7] - 0.00000;
}