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 16 entries in the algebraic variable array.
   There are a total of 8 entries in each of the rate and state variable arrays.
   There are a total of 37 entries in the constant variable array.
 */
/*
 * VOI is Time in component Environmental (second).
 * CONSTANTS[0] is S in component Parameters (hertz).
 * CONSTANTS[1] is Zeta in component Parameters (dimensionless).
 * CONSTANTS[2] is R0 in component Parameters (mm).
 * CONSTANTS[3] is Cwall in component Parameters (mm_per_mmHg).
 * CONSTANTS[4] is Kne in component Parameters (mmHg_per_mm).
 * CONSTANTS[5] is K1 in component Parameters (mmHg_per_mm).
 * CONSTANTS[6] is K2 in component Parameters (mmHg_per_mm).
 * CONSTANTS[7] is K3 in component Parameters (mmHg_per_mm).
 * CONSTANTS[8] is Bwall in component Parameters (mmHg_s_per_sq_mm).
 * CONSTANTS[9] is B1 in component Parameters (mmHg_s_per_mm).
 * CONSTANTS[10] is B2 in component Parameters (mmHg_s_per_mm).
 * CONSTANTS[11] is B3 in component Parameters (mmHg_s_per_mm).
 * CONSTANTS[12] is Tsmax in component Parameters (AU).
 * CONSTANTS[13] is Tpmax in component Parameters (AU).
 * CONSTANTS[14] is Tsmin in component Parameters (AU).
 * CONSTANTS[15] is Tpmin in component Parameters (AU).
 * CONSTANTS[16] is Gcns in component Parameters (dimensionless).
 * CONSTANTS[17] is Gs in component Parameters (per_Hertz).
 * CONSTANTS[18] is Gp in component Parameters (per_Hertz).
 * CONSTANTS[19] is tau_nor in component Parameters (second).
 * CONSTANTS[20] is tau_ach in component Parameters (second).
 * CONSTANTS[21] is tau_HR_nor in component Parameters (second).
 * CONSTANTS[22] is tau_HR_ach in component Parameters (second).
 * CONSTANTS[23] is HRo in component Parameters (Beats_per_min).
 * CONSTANTS[24] is HRmax in component Parameters (Beats_per_min).
 * CONSTANTS[25] is HRmin in component Parameters (Beats_per_min).
 * CONSTANTS[26] is Beta in component Parameters (dimensionless).
 * CONSTANTS[27] is delta_th in component Parameters (dimensionless).
 * CONSTANTS[28] is q_nor in component Parameters (per_s).
 * CONSTANTS[29] is q_ach in component Parameters (per_s).
 * CONSTANTS[30] is K_nor in component Parameters (AU).
 * CONSTANTS[31] is K_ach in component Parameters (AU).
 * CONSTANTS[32] is Gamma in component Parameters (dimensionless).
 * ALGEBRAIC[13] is alpha_cns in component Nervous_System (hertz).
 * ALGEBRAIC[12] is n in component Nervous_System (hertz).
 * ALGEBRAIC[9] is Delta in component Coupling_Dynamics (dimensionless).
 * CONSTANTS[33] is alpha_s0 in component Nervous_System (hertz).
 * CONSTANTS[34] is alpha_p0 in component Nervous_System (hertz).
 * STATES[0] is A in component Aortic_Wall (mm_sq).
 * ALGEBRAIC[1] is P in component Aortic_Wall (mmHg).
 * ALGEBRAIC[0] is R in component Aortic_Wall (mm).
 * STATES[1] is Eps_1 in component Coupling_Dynamics (dimensionless).
 * STATES[2] is Eps_2 in component Coupling_Dynamics (dimensionless).
 * STATES[3] is Eps_3 in component Coupling_Dynamics (dimensionless).
 * ALGEBRAIC[2] is Eps_wall in component Coupling_Dynamics (dimensionless).
 * ALGEBRAIC[14] is Ts in component PNS_tones (AU).
 * ALGEBRAIC[15] is Tp in component PNS_tones (AU).
 * STATES[4] is c_nor in component Norepinephrine (AU).
 * STATES[5] is C_ach in component Acetylcholine (AU).
 * ALGEBRAIC[3] is delta_HR_ss in component Heart_Response_Nor (Beats_per_min).
 * CONSTANTS[35] is delta_HR_smax in component Heart_Response_Nor (Beats_per_min).
 * STATES[6] is delta_HR_s in component Heart_Response_Nor (Beats_per_min).
 * ALGEBRAIC[4] is delta_HR_ps in component HR_ach (Beats_per_min).
 * CONSTANTS[36] is delta_HR_pmax in component HR_ach (Beats_per_min).
 * ALGEBRAIC[5] is delta_HR_pfast in component HR_ach (Beats_per_min).
 * STATES[7] is delta_HR_pslow in component HR_ach (Beats_per_min).
 * ALGEBRAIC[6] is delta_HR_p in component HR_ach (Beats_per_min).
 * ALGEBRAIC[10] is HR in component HR_Combined (Beats_per_min).
 * ALGEBRAIC[8] is HR_p in component HR_Combined (Beats_per_min).
 * ALGEBRAIC[7] is HR_s in component HR_Combined (Beats_per_min).
 * ALGEBRAIC[11] is Period in component HR_Combined (Sec_per_Beat).
 * RATES[0] is d/dt A in component Aortic_Wall (mm_sq).
 * RATES[1] is d/dt Eps_1 in component Coupling_Dynamics (dimensionless).
 * RATES[2] is d/dt Eps_2 in component Coupling_Dynamics (dimensionless).
 * RATES[3] is d/dt Eps_3 in component Coupling_Dynamics (dimensionless).
 * RATES[4] is d/dt c_nor in component Norepinephrine (AU).
 * RATES[5] is d/dt C_ach in component Acetylcholine (AU).
 * RATES[6] is d/dt delta_HR_s in component Heart_Response_Nor (Beats_per_min).
 * RATES[7] is d/dt delta_HR_pslow in component HR_ach (Beats_per_min).
 * There are a total of 0 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
CONSTANTS[0] = 480;
CONSTANTS[1] = 1;
CONSTANTS[2] = 1.6;
CONSTANTS[3] = 0.006;
CONSTANTS[4] = 1;
CONSTANTS[5] = 1.5;
CONSTANTS[6] = 3.75;
CONSTANTS[7] = 1.05;
CONSTANTS[8] = 1;
CONSTANTS[9] = 1;
CONSTANTS[10] = 10;
CONSTANTS[11] = 206.973;
CONSTANTS[12] = 4.12;
CONSTANTS[13] = 4.994;
CONSTANTS[14] = 0.5;
CONSTANTS[15] = 1.6;
CONSTANTS[16] = 1;
CONSTANTS[17] = 0.178;
CONSTANTS[18] = 0.492;
CONSTANTS[19] = 9.1;
CONSTANTS[20] = 0.2;
CONSTANTS[21] = 2.1;
CONSTANTS[22] = 2.5;
CONSTANTS[23] = 282.648;
CONSTANTS[24] = 483.218;
CONSTANTS[25] = 226.238;
CONSTANTS[26] = 0.175;
CONSTANTS[27] = 0;
CONSTANTS[28] = 0.1099;
CONSTANTS[29] = 5;
CONSTANTS[30] = 1.12;
CONSTANTS[31] = 0.65;
CONSTANTS[32] = 0.75;
CONSTANTS[33] = 58.6;
CONSTANTS[34] = 76.019;
STATES[0] = 15.20531;
STATES[1] = 0.2042;
STATES[2] = 0.183;
STATES[3] = 0.161;
STATES[4] = 1.441;
STATES[5] = 1.0;
STATES[6] = 0;
STATES[7] = 0;
CONSTANTS[35] = CONSTANTS[24] - CONSTANTS[23];
CONSTANTS[36] = CONSTANTS[23] - CONSTANTS[25];
RATES[0] = 0.1;
RATES[1] = 0.1;
RATES[2] = 0.1;
RATES[3] = 0.1;
RATES[4] = 0.1;
RATES[5] = 0.1;
RATES[6] = 0.1;
RATES[7] = 0.1;
}
void
computeResiduals(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
                 double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
resid[0] = RATES[0] - (- ( pow((STATES[0]/ 3.14159265358979), 1.0 / 2) - CONSTANTS[2])/CONSTANTS[3]+ALGEBRAIC[1])/CONSTANTS[8];
resid[1] = RATES[1] - ( CONSTANTS[4]*(ALGEBRAIC[2] - STATES[1]) -  CONSTANTS[5]*(STATES[1] - STATES[2]))/CONSTANTS[9]+RATES[2];
resid[2] = RATES[2] - (( CONSTANTS[5]*(STATES[1] - STATES[2]) -  CONSTANTS[6]*(STATES[2] - STATES[3]))+ CONSTANTS[9]*RATES[1]+ CONSTANTS[10]*RATES[3])/(CONSTANTS[9]+CONSTANTS[10]);
resid[3] = RATES[3] - (( CONSTANTS[6]*(STATES[2] - STATES[3]) -  CONSTANTS[7]*STATES[3])+ CONSTANTS[10]*RATES[2])/(CONSTANTS[10]+CONSTANTS[11]);
resid[4] = RATES[4] - - (STATES[4]/CONSTANTS[19])+ CONSTANTS[28]*ALGEBRAIC[14];
resid[5] = RATES[5] - - (STATES[5]/CONSTANTS[20])+ CONSTANTS[29]*ALGEBRAIC[15];
resid[6] = RATES[6] - (- STATES[6]+ALGEBRAIC[3])/CONSTANTS[21];
resid[7] = RATES[7] - (- STATES[7]+ (1.00000 - CONSTANTS[32])*ALGEBRAIC[4])/CONSTANTS[22];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[5] =  CONSTANTS[32]*ALGEBRAIC[4];
ALGEBRAIC[6] = ALGEBRAIC[5]+STATES[7];
ALGEBRAIC[7] = CONSTANTS[23]+STATES[6];
ALGEBRAIC[8] = CONSTANTS[23] - ALGEBRAIC[6];
ALGEBRAIC[10] = ALGEBRAIC[8]+( (ALGEBRAIC[7] - CONSTANTS[23])*(ALGEBRAIC[8] -  CONSTANTS[26]*CONSTANTS[25]))/(CONSTANTS[23] -  CONSTANTS[26]*CONSTANTS[25]);
ALGEBRAIC[11] = 60.0000/ALGEBRAIC[10];
}
void
computeEssentialVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[1] = 100.000+ 10.0000* sin( 5.00000*VOI);
ALGEBRAIC[0] = pow(STATES[0]/ 3.14159265358979, 0.500000);
ALGEBRAIC[2] = (ALGEBRAIC[0] - CONSTANTS[2])/CONSTANTS[2];
ALGEBRAIC[3] = ( CONSTANTS[35]*pow(STATES[4], 2.00000))/(pow(CONSTANTS[30], 2.00000)+pow(STATES[4], 2.00000));
ALGEBRAIC[4] = ( CONSTANTS[36]*pow(STATES[5], 2.00000))/(pow(CONSTANTS[31], 2.00000)+pow(STATES[5], 2.00000));
ALGEBRAIC[9] = ALGEBRAIC[2] - STATES[1];
ALGEBRAIC[12] =  CONSTANTS[0]*(ALGEBRAIC[9] -  CONSTANTS[1]*CONSTANTS[27]);
ALGEBRAIC[13] =  CONSTANTS[16]*ALGEBRAIC[12];
ALGEBRAIC[14] = CONSTANTS[14]+(CONSTANTS[12] - CONSTANTS[14])/(exp( CONSTANTS[17]*(ALGEBRAIC[13] - CONSTANTS[33]))+1.00000);
ALGEBRAIC[15] = CONSTANTS[15]+(CONSTANTS[13] - CONSTANTS[15])/(exp( - CONSTANTS[18]*(ALGEBRAIC[13] - CONSTANTS[34]))+1.00000);
}
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[7] = 1.0;
}
void
computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
             double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
}
Source
Derived from workspace Bugenhagen 2010 at changeset cac8b4a154b4.
Collaboration
To begin collaborating on this work, please use your git client and issue this command:
License

This work is licensed under a Creative Commons Attribution 3.0 Unported License.