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 29 entries in the algebraic variable array.
   There are a total of 7 entries in each of the rate and state variable arrays.
   There are a total of 20 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (second).
 * CONSTANTS[0] is C_m in component environment (fF).
 * STATES[0] is q_K_o in component environment (fmol).
 * STATES[1] is q_K_i in component environment (fmol).
 * STATES[2] is q_r0s0_TO in component environment (fmol).
 * STATES[3] is q_r1s0_TO in component environment (fmol).
 * STATES[4] is q_r0s1_TO in component environment (fmol).
 * STATES[5] is q_r1s1_TO in component environment (fmol).
 * STATES[6] is q_mem in component environment (fC).
 * ALGEBRAIC[0] is Vmem in component environment (volt).
 * CONSTANTS[1] is R in component environment (J_per_K_per_mol).
 * CONSTANTS[2] is T in component environment (kelvin).
 * CONSTANTS[3] is F in component environment (C_per_mol).
 * ALGEBRAIC[11] is v_TO in component TO (fmol_per_sec).
 * ALGEBRAIC[28] is I_mem_TO in component TO (fA).
 * CONSTANTS[4] is kappa_TO in component TO_parameters (fmol_per_sec).
 * CONSTANTS[5] is kappa_gTO_1 in component TO_parameters (fmol_per_sec).
 * CONSTANTS[6] is kappa_gTO_2 in component TO_parameters (fmol_per_sec).
 * CONSTANTS[7] is kappa_gTO_3 in component TO_parameters (fmol_per_sec).
 * CONSTANTS[8] is kappa_gTO_4 in component TO_parameters (fmol_per_sec).
 * CONSTANTS[9] is K_K_i in component TO_parameters (per_fmol).
 * CONSTANTS[10] is K_K_o in component TO_parameters (per_fmol).
 * CONSTANTS[11] is K_r0s0_TO in component TO_parameters (per_fmol).
 * CONSTANTS[12] is K_r1s0_TO in component TO_parameters (per_fmol).
 * CONSTANTS[13] is K_r0s1_TO in component TO_parameters (per_fmol).
 * CONSTANTS[14] is K_r1s1_TO in component TO_parameters (per_fmol).
 * CONSTANTS[15] is zK in component TO_parameters (dimensionless).
 * CONSTANTS[16] is z_rTO_f in component TO_parameters (dimensionless).
 * CONSTANTS[17] is z_sTO_f in component TO_parameters (dimensionless).
 * CONSTANTS[18] is z_rTO_r in component TO_parameters (dimensionless).
 * CONSTANTS[19] is z_sTO_r in component TO_parameters (dimensionless).
 * ALGEBRAIC[1] is u_K_i in component TO (J_per_mol).
 * ALGEBRAIC[2] is u_K_o in component TO (J_per_mol).
 * ALGEBRAIC[3] is V_mem in component TO (J_per_C).
 * ALGEBRAIC[8] is Am_TO in component TO (J_per_mol).
 * ALGEBRAIC[9] is Af_TO in component TO (J_per_mol).
 * ALGEBRAIC[10] is Ar_TO in component TO (J_per_mol).
 * ALGEBRAIC[24] is v_r0s0_TO in component TO (fmol_per_sec).
 * ALGEBRAIC[25] is v_r1s0_TO in component TO (fmol_per_sec).
 * ALGEBRAIC[26] is v_r0s1_TO in component TO (fmol_per_sec).
 * ALGEBRAIC[27] is v_r1s1_TO in component TO (fmol_per_sec).
 * ALGEBRAIC[20] is v_gTO_1 in component TO (fmol_per_sec).
 * ALGEBRAIC[21] is v_gTO_3 in component TO (fmol_per_sec).
 * ALGEBRAIC[22] is v_gTO_2 in component TO (fmol_per_sec).
 * ALGEBRAIC[23] is v_gTO_4 in component TO (fmol_per_sec).
 * ALGEBRAIC[4] is mu_r0s0_TO in component TO (J_per_mol).
 * ALGEBRAIC[5] is mu_r1s0_TO in component TO (J_per_mol).
 * ALGEBRAIC[6] is mu_r0s1_TO in component TO (J_per_mol).
 * ALGEBRAIC[7] is mu_r1s1_TO in component TO (J_per_mol).
 * ALGEBRAIC[12] is Af_gTO_1 in component TO (J_per_mol).
 * ALGEBRAIC[13] is Ar_gTO_1 in component TO (J_per_mol).
 * ALGEBRAIC[14] is Af_gTO_3 in component TO (J_per_mol).
 * ALGEBRAIC[15] is Ar_gTO_3 in component TO (J_per_mol).
 * ALGEBRAIC[16] is Af_gTO_2 in component TO (J_per_mol).
 * ALGEBRAIC[17] is Ar_gTO_2 in component TO (J_per_mol).
 * ALGEBRAIC[18] is Af_gTO_4 in component TO (J_per_mol).
 * ALGEBRAIC[19] is Ar_gTO_4 in component TO (J_per_mol).
 * RATES[1] is d/dt q_K_i in component environment (fmol).
 * RATES[0] is d/dt q_K_o in component environment (fmol).
 * RATES[6] is d/dt q_mem in component environment (fC).
 * RATES[2] is d/dt q_r0s0_TO in component environment (fmol).
 * RATES[3] is d/dt q_r1s0_TO in component environment (fmol).
 * RATES[4] is d/dt q_r0s1_TO in component environment (fmol).
 * RATES[5] is d/dt q_r1s1_TO in component environment (fmol).
 * There are a total of 0 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
CONSTANTS[0] = 1.0e6;
STATES[0] = 0.116325;
STATES[1] = 3.65002;
STATES[2] = 3.1966124E-07;
STATES[3] = 3.1966124E-07;
STATES[4] = 3.1966124E-07;
STATES[5] = 3.1966124E-07;
STATES[6] = -8.5e4;
CONSTANTS[1] = 8.31;
CONSTANTS[2] = 310;
CONSTANTS[3] = 96500;
CONSTANTS[4] = 1.91513;
CONSTANTS[5] = 10.0063;
CONSTANTS[6] = 0.053573;
CONSTANTS[7] = 0.0622138;
CONSTANTS[8] = 0.0155957;
CONSTANTS[9] = 0.0402291;
CONSTANTS[10] = 0.267055;
CONSTANTS[11] = 0.00553253;
CONSTANTS[12] = 0.0220702;
CONSTANTS[13] = 1.03336;
CONSTANTS[14] = 4.12222;
CONSTANTS[15] = 1;
CONSTANTS[16] = 2.28623234372134;
CONSTANTS[17] = -1.51477720975217;
CONSTANTS[18] = -0.131848324558065;
CONSTANTS[19] = 1.75042355789096;
RATES[1] = 0.1001;
RATES[0] = 0.1001;
RATES[6] = 0.1001;
RATES[2] = 0.1001;
RATES[3] = 0.1001;
RATES[4] = 0.1001;
RATES[5] = 0.1001;
}
void
computeResiduals(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
                 double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
resid[0] = RATES[1] - - ALGEBRAIC[11];
resid[1] = RATES[0] - ALGEBRAIC[11];
resid[2] = RATES[6] - ALGEBRAIC[28];
resid[3] = RATES[2] - ALGEBRAIC[24];
resid[4] = RATES[3] - ALGEBRAIC[25];
resid[5] = RATES[4] - ALGEBRAIC[26];
resid[6] = RATES[5] - ALGEBRAIC[27];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] = STATES[6]/CONSTANTS[0];
}
void
computeEssentialVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[3] = STATES[6]/CONSTANTS[0];
ALGEBRAIC[8] =  CONSTANTS[3]*ALGEBRAIC[3];
ALGEBRAIC[1] =  CONSTANTS[1]*CONSTANTS[2]*log( CONSTANTS[9]*STATES[1]);
ALGEBRAIC[7] =  CONSTANTS[1]*CONSTANTS[2]*log( CONSTANTS[14]*STATES[5]);
ALGEBRAIC[9] = ALGEBRAIC[7]+ALGEBRAIC[1]+ALGEBRAIC[8];
ALGEBRAIC[2] =  CONSTANTS[1]*CONSTANTS[2]*log( CONSTANTS[10]*STATES[0]);
ALGEBRAIC[10] = ALGEBRAIC[7]+ALGEBRAIC[2];
ALGEBRAIC[11] = (ALGEBRAIC[8]==0.00000 ?  1.00000*CONSTANTS[4]*(exp(ALGEBRAIC[9]/( CONSTANTS[1]*CONSTANTS[2])) - exp(ALGEBRAIC[10]/( CONSTANTS[1]*CONSTANTS[2]))) :  ((( 1.00000*CONSTANTS[4]*ALGEBRAIC[8])/( CONSTANTS[1]*CONSTANTS[2]))/(exp(ALGEBRAIC[8]/( CONSTANTS[1]*CONSTANTS[2])) - 1.00000))*(exp(ALGEBRAIC[9]/( CONSTANTS[1]*CONSTANTS[2])) - exp(ALGEBRAIC[10]/( CONSTANTS[1]*CONSTANTS[2]))));
ALGEBRAIC[4] =  CONSTANTS[1]*CONSTANTS[2]*log( CONSTANTS[11]*STATES[2]);
ALGEBRAIC[12] = ALGEBRAIC[4]+ CONSTANTS[16]*CONSTANTS[3]*ALGEBRAIC[3];
ALGEBRAIC[5] =  CONSTANTS[1]*CONSTANTS[2]*log( CONSTANTS[12]*STATES[3]);
ALGEBRAIC[13] = ALGEBRAIC[5]+ CONSTANTS[18]*CONSTANTS[3]*ALGEBRAIC[3];
ALGEBRAIC[20] =  CONSTANTS[5]*(exp(ALGEBRAIC[12]/( CONSTANTS[1]*CONSTANTS[2])) - exp(ALGEBRAIC[13]/( CONSTANTS[1]*CONSTANTS[2])));
ALGEBRAIC[14] = ALGEBRAIC[4]+ CONSTANTS[17]*CONSTANTS[3]*ALGEBRAIC[3];
ALGEBRAIC[6] =  CONSTANTS[1]*CONSTANTS[2]*log( CONSTANTS[13]*STATES[4]);
ALGEBRAIC[15] = ALGEBRAIC[6]+ CONSTANTS[19]*CONSTANTS[3]*ALGEBRAIC[3];
ALGEBRAIC[21] =  CONSTANTS[7]*(exp(ALGEBRAIC[14]/( CONSTANTS[1]*CONSTANTS[2])) - exp(ALGEBRAIC[15]/( CONSTANTS[1]*CONSTANTS[2])));
ALGEBRAIC[24] = - ALGEBRAIC[20]+ALGEBRAIC[21];
ALGEBRAIC[18] = ALGEBRAIC[5]+ CONSTANTS[17]*CONSTANTS[3]*ALGEBRAIC[3];
ALGEBRAIC[19] = ALGEBRAIC[7]+ CONSTANTS[19]*CONSTANTS[3]*ALGEBRAIC[3];
ALGEBRAIC[23] =  CONSTANTS[8]*(exp(ALGEBRAIC[18]/( CONSTANTS[1]*CONSTANTS[2])) - exp(ALGEBRAIC[19]/( CONSTANTS[1]*CONSTANTS[2])));
ALGEBRAIC[25] = ALGEBRAIC[20] - ALGEBRAIC[23];
ALGEBRAIC[16] = ALGEBRAIC[6]+ CONSTANTS[16]*CONSTANTS[3]*ALGEBRAIC[3];
ALGEBRAIC[17] = ALGEBRAIC[7]+ CONSTANTS[18]*CONSTANTS[3]*ALGEBRAIC[3];
ALGEBRAIC[22] =  CONSTANTS[6]*(exp(ALGEBRAIC[16]/( CONSTANTS[1]*CONSTANTS[2])) - exp(ALGEBRAIC[17]/( CONSTANTS[1]*CONSTANTS[2])));
ALGEBRAIC[26] = - ALGEBRAIC[22]+ALGEBRAIC[21];
ALGEBRAIC[27] = ALGEBRAIC[22]+ALGEBRAIC[23];
ALGEBRAIC[28] =  CONSTANTS[3]*( - CONSTANTS[15]*ALGEBRAIC[11]+ (ALGEBRAIC[20]+ALGEBRAIC[22])*(CONSTANTS[18] - CONSTANTS[16])+ (ALGEBRAIC[21]+ALGEBRAIC[23])*(CONSTANTS[19] - CONSTANTS[17]));
}
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;
}
void
computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
             double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
}
Source
Derived from workspace TO knowledge page at changeset b3acddc6cb2b.
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.