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 28 entries in the algebraic variable array.
   There are a total of 22 entries in each of the rate and state variable arrays.
   There are a total of 48 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (second).
 * CONSTANTS[0] is q_Cai_init in component environment (fmol).
 * CONSTANTS[1] is q_TRPN_init in component environment (fmol).
 * CONSTANTS[2] is q_Ca_TRPN_init in component environment (fmol).
 * CONSTANTS[3] is q_B_init in component environment (fmol).
 * CONSTANTS[4] is q_U_init in component environment (fmol).
 * CONSTANTS[5] is q_W_init in component environment (fmol).
 * CONSTANTS[6] is q_S_init in component environment (fmol).
 * ALGEBRAIC[0] is q_TRPN in component environment (fmol).
 * ALGEBRAIC[1] is q_Cai in component environment (fmol).
 * ALGEBRAIC[2] is q_Ca_TRPN in component environment (fmol).
 * ALGEBRAIC[3] is q_B in component environment (fmol).
 * ALGEBRAIC[4] is q_U in component environment (fmol).
 * ALGEBRAIC[5] is q_W in component environment (fmol).
 * ALGEBRAIC[6] is q_S in component environment (fmol).
 * STATES[0] is q_TRPN in component crossbridge_TRPN (fmol).
 * STATES[1] is q_Cai in component crossbridge_TRPN (fmol).
 * STATES[2] is q_Ca_TRPN in component crossbridge_TRPN (fmol).
 * STATES[3] is q_B in component crossbridge_TRPN (fmol).
 * STATES[4] is q_U in component crossbridge_TRPN (fmol).
 * STATES[5] is q_W in component crossbridge_TRPN (fmol).
 * STATES[6] is q_S in component crossbridge_TRPN (fmol).
 * STATES[11] is T_total in component crossbridge_TRPN (kPa).
 * STATES[7] is SL in component crossbridge_TRPN (metre).
 * CONSTANTS[7] is kappa_R_TRPNCa in component crossbridge_TRPN_parameters (fmol_per_sec).
 * CONSTANTS[8] is kappa_R_BU in component crossbridge_TRPN_parameters (fmol_per_sec).
 * CONSTANTS[9] is kappa_R_UW in component crossbridge_TRPN_parameters (fmol_per_sec).
 * CONSTANTS[10] is kappa_R_WS in component crossbridge_TRPN_parameters (fmol_per_sec).
 * CONSTANTS[11] is kappa_R_SU in component crossbridge_TRPN_parameters (fmol_per_sec).
 * CONSTANTS[12] is K_TRPN in component crossbridge_TRPN_parameters (per_fmol).
 * CONSTANTS[13] is K_Cai in component crossbridge_TRPN_parameters (per_fmol).
 * CONSTANTS[14] is K_Ca_TRPN in component crossbridge_TRPN_parameters (per_fmol).
 * CONSTANTS[15] is K_B in component crossbridge_TRPN_parameters (per_fmol).
 * CONSTANTS[16] is K_U in component crossbridge_TRPN_parameters (per_fmol).
 * CONSTANTS[17] is K_W in component crossbridge_TRPN_parameters (per_fmol).
 * CONSTANTS[18] is K_S in component crossbridge_TRPN_parameters (per_fmol).
 * CONSTANTS[19] is R in component constants (J_per_K_per_mol).
 * CONSTANTS[20] is T in component constants (kelvin).
 * CONSTANTS[21] is n_Tm in component crossbridge_TRPN (dimensionless).
 * ALGEBRAIC[7] is mu_TRPN in component crossbridge_TRPN (J_per_mol).
 * ALGEBRAIC[8] is mu_Cai in component crossbridge_TRPN (J_per_mol).
 * ALGEBRAIC[9] is mu_Ca_TRPN in component crossbridge_TRPN (J_per_mol).
 * ALGEBRAIC[10] is mu_B in component crossbridge_TRPN (J_per_mol).
 * ALGEBRAIC[11] is mu_U in component crossbridge_TRPN (J_per_mol).
 * ALGEBRAIC[12] is mu_W in component crossbridge_TRPN (J_per_mol).
 * ALGEBRAIC[13] is mu_S in component crossbridge_TRPN (J_per_mol).
 * STATES[12] is v_R_TRPNCa in component crossbridge_TRPN (fmol_per_sec).
 * ALGEBRAIC[14] is v_R_BU in component crossbridge_TRPN (fmol_per_sec).
 * ALGEBRAIC[15] is v_R_UW in component crossbridge_TRPN (fmol_per_sec).
 * ALGEBRAIC[16] is v_R_WS in component crossbridge_TRPN (fmol_per_sec).
 * ALGEBRAIC[17] is v_R_SU in component crossbridge_TRPN (fmol_per_sec).
 * STATES[13] is tension in component crossbridge_TRPN (N_per_mm2).
 * STATES[14] is mu_tension in component crossbridge_TRPN (J_per_mol).
 * CONSTANTS[22] is kf_coeff in component crossbridge_TRPN (dimensionless).
 * CONSTANTS[43] is n in component crossbridge_TRPN (J_per_mol).
 * CONSTANTS[23] is hh in component crossbridge_TRPN (mm2_per_N).
 * CONSTANTS[24] is SL_0 in component crossbridge_TRPN (metre).
 * CONSTANTS[25] is q_MS in component crossbridge_TRPN (fmol).
 * CONSTANTS[26] is r_s in component crossbridge_TRPN (dimensionless).
 * CONSTANTS[27] is r_w in component crossbridge_TRPN (dimensionless).
 * CONSTANTS[28] is A_eff in component crossbridge_TRPN (dimensionless).
 * CONSTANTS[29] is phi in component crossbridge_TRPN (dimensionless).
 * CONSTANTS[30] is k_uw in component crossbridge_TRPN (per_sec).
 * CONSTANTS[31] is k_ws in component crossbridge_TRPN (per_sec).
 * STATES[8] is G_w in component crossbridge_TRPN (metre).
 * STATES[9] is G_s in component crossbridge_TRPN (metre).
 * CONSTANTS[40] is c_w in component crossbridge_TRPN (per_sec).
 * CONSTANTS[41] is c_s in component crossbridge_TRPN (per_sec).
 * CONSTANTS[42] is A_w in component crossbridge_TRPN (dimensionless).
 * CONSTANTS[44] is A_s in component crossbridge_TRPN (dimensionless).
 * ALGEBRAIC[20] is mu_1 in component crossbridge_TRPN (J_per_m).
 * CONSTANTS[45] is mu_2 in component crossbridge_TRPN (J_per_m).
 * ALGEBRAIC[18] is mu_3 in component crossbridge_TRPN (J_per_m).
 * ALGEBRAIC[21] is mu_4 in component crossbridge_TRPN (J_per_m).
 * CONSTANTS[46] is mu_5 in component crossbridge_TRPN (J_per_m).
 * ALGEBRAIC[19] is mu_6 in component crossbridge_TRPN (J_per_m).
 * ALGEBRAIC[25] is v_1 in component crossbridge_TRPN (m_per_s).
 * CONSTANTS[32] is v_2 in component crossbridge_TRPN (m_per_s).
 * ALGEBRAIC[26] is v_4 in component crossbridge_TRPN (m_per_s).
 * CONSTANTS[33] is v_to_mu in component crossbridge_TRPN (Js_per_m2).
 * ALGEBRAIC[27] is T_active in component crossbridge_TRPN (kPa).
 * CONSTANTS[34] is T_ref in component crossbridge_TRPN (kPa).
 * ALGEBRAIC[24] is mu_T_a in component crossbridge_TRPN (kPa).
 * ALGEBRAIC[22] is mu_T_S in component crossbridge_TRPN (kPa).
 * ALGEBRAIC[23] is mu_T_W in component crossbridge_TRPN (kPa).
 * STATES[10] is Cdd in component crossbridge_TRPN (metre).
 * STATES[15] is eta in component crossbridge_TRPN (per_sec).
 * CONSTANTS[35] is eta_l in component crossbridge_TRPN (per_sec).
 * CONSTANTS[36] is eta_s in component crossbridge_TRPN (per_sec).
 * CONSTANTS[37] is k in component crossbridge_TRPN (dimensionless).
 * CONSTANTS[38] is alpha in component crossbridge_TRPN (kPa).
 * STATES[16] is v_Cdd in component crossbridge_TRPN (m_per_s).
 * STATES[17] is mu_d in component crossbridge_TRPN (J_per_m).
 * STATES[18] is mu_k in component crossbridge_TRPN (J_per_m).
 * STATES[19] is mu_f in component crossbridge_TRPN (J_per_m).
 * STATES[20] is mu_T_passive in component crossbridge_TRPN (kPa).
 * STATES[21] is T_passive in component crossbridge_TRPN (kPa).
 * CONSTANTS[39] is F in component constants (C_per_mol).
 * RATES[1] is d/dt q_Cai in component crossbridge_TRPN (fmol).
 * RATES[0] is d/dt q_TRPN in component crossbridge_TRPN (fmol).
 * RATES[2] is d/dt q_Ca_TRPN in component crossbridge_TRPN (fmol).
 * RATES[3] is d/dt q_B in component crossbridge_TRPN (fmol).
 * RATES[4] is d/dt q_U in component crossbridge_TRPN (fmol).
 * RATES[5] is d/dt q_W in component crossbridge_TRPN (fmol).
 * RATES[6] is d/dt q_S in component crossbridge_TRPN (fmol).
 * RATES[8] is d/dt G_w in component crossbridge_TRPN (metre).
 * RATES[7] is d/dt SL in component crossbridge_TRPN (metre).
 * RATES[9] is d/dt G_s in component crossbridge_TRPN (metre).
 * RATES[10] is d/dt Cdd in component crossbridge_TRPN (metre).
 * There are a total of 1 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
CONSTANTS[0] = 6.82e-1;
CONSTANTS[1] = 2.57;
CONSTANTS[2] = 1e-6;
CONSTANTS[3] = 1;
CONSTANTS[4] = 0;
CONSTANTS[5] = 0;
CONSTANTS[6] = 0;
STATES[0] = 1e-16;
STATES[1] = 1e-16;
STATES[2] = 1e-16;
STATES[3] = 1e-16;
STATES[4] = 1e-16;
STATES[5] = 1e-16;
STATES[6] = 1e-16;
STATES[7] = 1e-6;
CONSTANTS[7] = 52.0453;
CONSTANTS[8] = 2.90875;
CONSTANTS[9] = 0.332501;
CONSTANTS[10] = 0.00782356;
CONSTANTS[11] = 140824;
CONSTANTS[12] = 1.27424;
CONSTANTS[13] = 1.27424;
CONSTANTS[14] = 0.11171;
CONSTANTS[15] = 6.06164;
CONSTANTS[16] = 2.27312;
CONSTANTS[17] = 14.8627;
CONSTANTS[18] = 3.71567e-06;
CONSTANTS[19] = 8.31;
CONSTANTS[20] = 310;
CONSTANTS[21] = 1.1;
CONSTANTS[22] = -0.0118;
CONSTANTS[23] = 1;
CONSTANTS[24] = 2e-6;
CONSTANTS[25] = 1e-6;
CONSTANTS[26] = 0.25;
CONSTANTS[27] = 0.5;
CONSTANTS[28] = 25;
CONSTANTS[29] = 2.23;
CONSTANTS[30] = 26;
CONSTANTS[31] = 4;
STATES[8] = 1e-6;
STATES[9] = 1e-6;
CONSTANTS[32] = 0;
CONSTANTS[33] = 1;
CONSTANTS[34] = 40.5;
STATES[10] = 0;
CONSTANTS[35] = 200e3;
CONSTANTS[36] = 200e3;
CONSTANTS[37] = 7;
CONSTANTS[38] = 2.1;
CONSTANTS[39] = 96485;
CONSTANTS[40] = ( CONSTANTS[29]*CONSTANTS[30]*(1.00000 - CONSTANTS[27]))/CONSTANTS[27];
CONSTANTS[41] = ( CONSTANTS[29]*CONSTANTS[31]*(1.00000 - CONSTANTS[26])*CONSTANTS[27])/CONSTANTS[26];
CONSTANTS[42] = ( CONSTANTS[28]*CONSTANTS[26])/( (1.00000 - CONSTANTS[26])*CONSTANTS[27]+CONSTANTS[26]);
CONSTANTS[43] =  CONSTANTS[22]*CONSTANTS[19]*CONSTANTS[20];
CONSTANTS[47] = CONSTANTS[32];
CONSTANTS[44] = CONSTANTS[42];
CONSTANTS[45] =  - CONSTANTS[42]*CONSTANTS[32]*CONSTANTS[33];
CONSTANTS[46] =  - CONSTANTS[44]*CONSTANTS[32]*CONSTANTS[33];
STATES[11] = 0.1001;
STATES[12] = 0.1001;
STATES[13] = 0.1001;
STATES[14] = 0.1001;
STATES[15] = 0.1001;
STATES[16] = 0.1001;
STATES[17] = 0.1001;
STATES[18] = 0.1001;
STATES[19] = 0.1001;
STATES[20] = 0.1001;
STATES[21] = 0.1001;
RATES[1] = 0.1001;
RATES[0] = 0.1001;
RATES[2] = 0.1001;
RATES[3] = 0.1001;
RATES[4] = 0.1001;
RATES[5] = 0.1001;
RATES[6] = 0.1001;
RATES[8] = 0.1001;
RATES[9] = 0.1001;
RATES[10] = 0.1001;
}
void
computeResiduals(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
                 double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
resid[0] = STATES[12] -  CONSTANTS[7]*(exp((ALGEBRAIC[8]+ALGEBRAIC[7])/( CONSTANTS[19]*CONSTANTS[20])) - exp((ALGEBRAIC[9]+STATES[14])/( CONSTANTS[19]*CONSTANTS[20])));
resid[1] = RATES[1] - - STATES[12];
resid[2] = RATES[0] - - STATES[12];
resid[3] = RATES[2] - STATES[12];
resid[4] = RATES[3] - - ALGEBRAIC[14];
resid[5] = RATES[4] - (ALGEBRAIC[14] - ALGEBRAIC[15])+ALGEBRAIC[17];
resid[6] = RATES[5] - ALGEBRAIC[15] - ALGEBRAIC[16];
resid[7] = RATES[6] - ALGEBRAIC[16] - ALGEBRAIC[17];
resid[8] = STATES[13] -  STATES[11]*1000.00;
resid[9] = STATES[14] -  CONSTANTS[23]*CONSTANTS[43]*STATES[13];
resid[10] = RATES[8] - ALGEBRAIC[25];
resid[11] = RATES[9] - ALGEBRAIC[26];
resid[12] = STATES[15] - (CONDVAR[0]>0.00000 ? CONSTANTS[35] : CONSTANTS[36]);
resid[13] = RATES[10] - STATES[16];
resid[14] = STATES[16] - STATES[17]/CONSTANTS[33];
resid[15] = STATES[18] -  (CONSTANTS[37]/STATES[15])*STATES[10]*CONSTANTS[33];
resid[16] = STATES[19] -  (CONSTANTS[37]/STATES[15])*(STATES[7] - CONSTANTS[24])*CONSTANTS[33];
resid[17] = STATES[17] - - STATES[18]+STATES[19];
resid[18] = STATES[20] -  (( CONSTANTS[38]*STATES[15])/CONSTANTS[24])*STATES[16];
resid[19] = STATES[21] - STATES[20];
resid[20] = STATES[11] - ALGEBRAIC[27]+STATES[21];
resid[21] = RATES[7] - CONSTANTS[47];
}
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] = STATES[0]+CONSTANTS[1];
ALGEBRAIC[7] =  CONSTANTS[19]*CONSTANTS[20]*log( CONSTANTS[12]*ALGEBRAIC[0]);
ALGEBRAIC[1] = STATES[1]+CONSTANTS[0];
ALGEBRAIC[8] =  CONSTANTS[19]*CONSTANTS[20]*log( CONSTANTS[13]*ALGEBRAIC[1]);
ALGEBRAIC[2] = STATES[2]+CONSTANTS[2];
ALGEBRAIC[9] =  CONSTANTS[19]*CONSTANTS[20]*log( CONSTANTS[14]*ALGEBRAIC[2]);
ALGEBRAIC[3] = STATES[3]+CONSTANTS[3];
ALGEBRAIC[10] =  CONSTANTS[19]*CONSTANTS[20]*log( CONSTANTS[15]*ALGEBRAIC[3]);
ALGEBRAIC[4] = STATES[4]+CONSTANTS[4];
ALGEBRAIC[11] =  CONSTANTS[19]*CONSTANTS[20]*log( CONSTANTS[16]*ALGEBRAIC[4]);
ALGEBRAIC[14] =  CONSTANTS[8]*(exp((ALGEBRAIC[10]+ CONSTANTS[21]*ALGEBRAIC[9])/( CONSTANTS[19]*CONSTANTS[20])) - exp((ALGEBRAIC[11]+ CONSTANTS[21]*ALGEBRAIC[9])/( CONSTANTS[19]*CONSTANTS[20])));
ALGEBRAIC[5] = STATES[5]+CONSTANTS[5];
ALGEBRAIC[12] =  CONSTANTS[19]*CONSTANTS[20]*log( CONSTANTS[17]*ALGEBRAIC[5]);
ALGEBRAIC[15] =  CONSTANTS[9]*(exp(ALGEBRAIC[11]/( CONSTANTS[19]*CONSTANTS[20])) - exp(ALGEBRAIC[12]/( CONSTANTS[19]*CONSTANTS[20])));
ALGEBRAIC[6] = STATES[6]+CONSTANTS[6];
ALGEBRAIC[13] =  CONSTANTS[19]*CONSTANTS[20]*log( CONSTANTS[18]*ALGEBRAIC[6]);
ALGEBRAIC[16] =  CONSTANTS[10]*(exp(ALGEBRAIC[12]/( CONSTANTS[19]*CONSTANTS[20])) - exp(ALGEBRAIC[13]/( CONSTANTS[19]*CONSTANTS[20])));
ALGEBRAIC[17] =  CONSTANTS[11]*(exp(ALGEBRAIC[13]/( CONSTANTS[19]*CONSTANTS[20])) - exp(ALGEBRAIC[11]/( CONSTANTS[19]*CONSTANTS[20])));
ALGEBRAIC[18] =  CONSTANTS[40]*STATES[8]*CONSTANTS[33];
ALGEBRAIC[20] = - CONSTANTS[45] - ALGEBRAIC[18];
ALGEBRAIC[25] = ALGEBRAIC[20]/CONSTANTS[33];
ALGEBRAIC[19] =  CONSTANTS[41]*STATES[9]*CONSTANTS[33];
ALGEBRAIC[21] = - CONSTANTS[46] - ALGEBRAIC[19];
ALGEBRAIC[26] = ALGEBRAIC[21]/CONSTANTS[33];
ALGEBRAIC[22] =  (CONSTANTS[34]/( CONSTANTS[24]*CONSTANTS[25]*CONSTANTS[26]))*STATES[6]*(STATES[9]+CONSTANTS[24]);
ALGEBRAIC[23] =  (CONSTANTS[34]/( CONSTANTS[24]*CONSTANTS[25]*CONSTANTS[26]))*STATES[5]*STATES[8];
ALGEBRAIC[24] = ALGEBRAIC[22]+ALGEBRAIC[23];
ALGEBRAIC[27] = ALGEBRAIC[24];
}
void
getStateInformation(double* SI)
{
SI[0] = 1.0;
SI[1] = 1.0;
SI[2] = 1.0;
SI[3] = 1.0;
SI[4] = 1.0;
SI[5] = 1.0;
SI[6] = 1.0;
SI[11] = 0.0;
SI[7] = 1.0;
SI[12] = 0.0;
SI[13] = 0.0;
SI[14] = 0.0;
SI[8] = 1.0;
SI[9] = 1.0;
SI[10] = 1.0;
SI[15] = 0.0;
SI[16] = 0.0;
SI[17] = 0.0;
SI[18] = 0.0;
SI[19] = 0.0;
SI[20] = 0.0;
SI[21] = 0.0;
}
void
computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
             double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
CONDVAR[0] = STATES[17] - 0.00000;
}
Source
Derived from workspace BG_crossbridge_TRPN at changeset 1473d84d3eee.
Collaboration
To begin collaborating on this work, please use your git client and issue this command:
License
The terms of use/license for this work is unspecified.