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 7 entries in the algebraic variable array.
There are a total of 2 entries in each of the rate and state variable arrays.
There are a total of 2 entries in the constant variable array.
*/
/*
* ALGEBRAIC[0] is V in component environment (millivolt).
* VOI is t in component environment (millisec).
* STATES[0] is m in component sodium_channel_m_gate (dimensionless).
* STATES[1] is h in component sodium_channel_h_gate (dimensionless).
* CONSTANTS[0] is g_Na in component sodium_channel (milliS_per_cm2).
* CONSTANTS[1] is E_Na in component sodium_channel (millivolt).
* ALGEBRAIC[1] is Na_conductance in component sodium_channel (milliS_per_cm2).
* ALGEBRAIC[2] is i_Na in component sodium_channel (microA_per_cm2).
* ALGEBRAIC[3] is alpha_m in component sodium_channel_m_gate (per_millisec).
* ALGEBRAIC[4] is beta_m in component sodium_channel_m_gate (per_millisec).
* ALGEBRAIC[5] is alpha_h in component sodium_channel_h_gate (per_millisec).
* ALGEBRAIC[6] is beta_h in component sodium_channel_h_gate (per_millisec).
* RATES[0] is d/dt m in component sodium_channel_m_gate (dimensionless).
* RATES[1] is d/dt h in component sodium_channel_h_gate (dimensionless).
* There are a total of 2 condition variables.
*/
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = 0.05;
STATES[1] = 0.6;
CONSTANTS[0] = 120;
CONSTANTS[1] = 35;
RATES[0] = 0.1001;
RATES[1] = 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[3]*(1.00000 - STATES[0]) - ALGEBRAIC[4]*STATES[0];
resid[1] = RATES[1] - ALGEBRAIC[5]*(1.00000 - STATES[1]) - ALGEBRAIC[6]*STATES[1];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[1] = CONSTANTS[0]*pow(STATES[0], 3.00000)*STATES[1];
ALGEBRAIC[2] = ALGEBRAIC[1]*(ALGEBRAIC[0] - CONSTANTS[1]);
}
void
computeEssentialVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] = (CONDVAR[0]>0.00000&&CONDVAR[1]<0.00000 ? 0.00000 : - 85.0000);
ALGEBRAIC[3] = ( - 0.100000*(ALGEBRAIC[0]+50.0000))/(exp(- (ALGEBRAIC[0]+50.0000)/10.0000) - 1.00000);
ALGEBRAIC[4] = 4.00000*exp(- (ALGEBRAIC[0]+75.0000)/18.0000);
ALGEBRAIC[5] = 0.0700000*exp(- (ALGEBRAIC[0]+75.0000)/20.0000);
ALGEBRAIC[6] = 1.00000/(exp(- (ALGEBRAIC[0]+45.0000)/10.0000)+1.00000);
}
void
getStateInformation(double* SI)
{
SI[0] = 1.0;
SI[1] = 1.0;
}
void
computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
CONDVAR[0] = VOI - 5.00000;
CONDVAR[1] = VOI - 15.0000;
}
