Generated Code

The following is matlab code generated by the CellML API from this CellML file. (Back to language selection)

The raw code is available.

function [VOI, STATES, ALGEBRAIC, CONSTANTS] = mainFunction()
    % This is the "main function".  In Matlab, things work best if you rename this function to match the filename.
   [VOI, STATES, ALGEBRAIC, CONSTANTS] = solveModel();
end

function [algebraicVariableCount] = getAlgebraicVariableCount() 
    % Used later when setting a global variable with the number of algebraic variables.
    % Note: This is not the "main method".  
    algebraicVariableCount =200;
end
% There are a total of 49 entries in each of the rate and state variable arrays.
% There are a total of 206 entries in the constant variable array.
%

function [VOI, STATES, ALGEBRAIC, CONSTANTS] = solveModel()
    % Create ALGEBRAIC of correct size
    global algebraicVariableCount;  algebraicVariableCount = getAlgebraicVariableCount();
    % Initialise constants and state variables
    [INIT_STATES, CONSTANTS] = initConsts;

    % Set timespan to solve over 
    tspan = [0, 10];

    % Set numerical accuracy options for ODE solver
    options = odeset('RelTol', 1e-06, 'AbsTol', 1e-06, 'MaxStep', 1);

    % Solve model with ODE solver
    [VOI, STATES] = ode15s(@(VOI, STATES)computeRates(VOI, STATES, CONSTANTS), tspan, INIT_STATES, options);

    % Compute algebraic variables
    [RATES, ALGEBRAIC] = computeRates(VOI, STATES, CONSTANTS);
    ALGEBRAIC = computeAlgebraic(ALGEBRAIC, CONSTANTS, STATES, VOI);

    % Plot state variables against variable of integration
    [LEGEND_STATES, LEGEND_ALGEBRAIC, LEGEND_VOI, LEGEND_CONSTANTS] = createLegends();
    figure();
    plot(VOI, STATES);
    xlabel(LEGEND_VOI);
    l = legend(LEGEND_STATES);
    set(l,'Interpreter','none');
end

function [LEGEND_STATES, LEGEND_ALGEBRAIC, LEGEND_VOI, LEGEND_CONSTANTS] = createLegends()
    LEGEND_STATES = ''; LEGEND_ALGEBRAIC = ''; LEGEND_VOI = ''; LEGEND_CONSTANTS = '';
    LEGEND_VOI = strpad('time in component environment (millisecond)');
    LEGEND_CONSTANTS(:,1) = strpad('celltype in component environment (dimensionless)');
    LEGEND_CONSTANTS(:,2) = strpad('nao in component extracellular (millimolar)');
    LEGEND_CONSTANTS(:,3) = strpad('cao in component extracellular (millimolar)');
    LEGEND_CONSTANTS(:,4) = strpad('ko in component extracellular (millimolar)');
    LEGEND_CONSTANTS(:,5) = strpad('R in component physical_constants (joule_per_kilomole_kelvin)');
    LEGEND_CONSTANTS(:,6) = strpad('T in component physical_constants (kelvin)');
    LEGEND_CONSTANTS(:,7) = strpad('F in component physical_constants (coulomb_per_mole)');
    LEGEND_CONSTANTS(:,8) = strpad('zna in component physical_constants (dimensionless)');
    LEGEND_CONSTANTS(:,9) = strpad('zca in component physical_constants (dimensionless)');
    LEGEND_CONSTANTS(:,10) = strpad('zk in component physical_constants (dimensionless)');
    LEGEND_CONSTANTS(:,11) = strpad('L in component cell_geometry (centimeter)');
    LEGEND_CONSTANTS(:,12) = strpad('rad in component cell_geometry (centimeter)');
    LEGEND_CONSTANTS(:,163) = strpad('vcell in component cell_geometry (microliter)');
    LEGEND_CONSTANTS(:,178) = strpad('Ageo in component cell_geometry (centimeter_squared)');
    LEGEND_CONSTANTS(:,184) = strpad('Acap in component cell_geometry (centimeter_squared)');
    LEGEND_CONSTANTS(:,185) = strpad('vmyo in component cell_geometry (microliter)');
    LEGEND_CONSTANTS(:,186) = strpad('vnsr in component cell_geometry (microliter)');
    LEGEND_CONSTANTS(:,187) = strpad('vjsr in component cell_geometry (microliter)');
    LEGEND_CONSTANTS(:,188) = strpad('vss in component cell_geometry (microliter)');
    LEGEND_STATES(:,1) = strpad('v in component membrane (millivolt)');
    LEGEND_ALGEBRAIC(:,13) = strpad('vfrt in component membrane (dimensionless)');
    LEGEND_CONSTANTS(:,170) = strpad('ffrt in component membrane (coulomb_per_mole_millivolt)');
    LEGEND_CONSTANTS(:,150) = strpad('frt in component membrane (per_millivolt)');
    LEGEND_ALGEBRAIC(:,59) = strpad('INa in component INa (microA_per_microF)');
    LEGEND_ALGEBRAIC(:,61) = strpad('INaL in component INaL (microA_per_microF)');
    LEGEND_ALGEBRAIC(:,67) = strpad('Ito in component Ito (microA_per_microF)');
    LEGEND_ALGEBRAIC(:,84) = strpad('ICaL in component ICaL (microA_per_microF)');
    LEGEND_ALGEBRAIC(:,85) = strpad('ICaNa in component ICaL (microA_per_microF)');
    LEGEND_ALGEBRAIC(:,88) = strpad('ICaK in component ICaL (microA_per_microF)');
    LEGEND_ALGEBRAIC(:,91) = strpad('IKr in component IKr (microA_per_microF)');
    LEGEND_ALGEBRAIC(:,97) = strpad('IKs in component IKs (microA_per_microF)');
    LEGEND_ALGEBRAIC(:,99) = strpad('IK1 in component IK1 (microA_per_microF)');
    LEGEND_ALGEBRAIC(:,131) = strpad('INaCa_i in component INaCa_i (microA_per_microF)');
    LEGEND_ALGEBRAIC(:,161) = strpad('INaCa_ss in component INaCa_i (microA_per_microF)');
    LEGEND_ALGEBRAIC(:,180) = strpad('INaK in component INaK (microA_per_microF)');
    LEGEND_ALGEBRAIC(:,186) = strpad('INab in component INab (microA_per_microF)');
    LEGEND_ALGEBRAIC(:,182) = strpad('IKb in component IKb (microA_per_microF)');
    LEGEND_ALGEBRAIC(:,191) = strpad('IpCa in component IpCa (microA_per_microF)');
    LEGEND_ALGEBRAIC(:,190) = strpad('ICab in component ICab (microA_per_microF)');
    LEGEND_ALGEBRAIC(:,1) = strpad('Istim in component membrane (microA_per_microF)');
    LEGEND_CONSTANTS(:,13) = strpad('i_Stim_Start in component membrane (millisecond)');
    LEGEND_CONSTANTS(:,14) = strpad('i_Stim_End in component membrane (millisecond)');
    LEGEND_CONSTANTS(:,15) = strpad('i_Stim_Amplitude in component membrane (microA_per_microF)');
    LEGEND_CONSTANTS(:,16) = strpad('i_Stim_Period in component membrane (millisecond)');
    LEGEND_CONSTANTS(:,17) = strpad('i_Stim_PulseDuration in component membrane (millisecond)');
    LEGEND_CONSTANTS(:,18) = strpad('KmCaMK in component CaMK (millimolar)');
    LEGEND_CONSTANTS(:,19) = strpad('aCaMK in component CaMK (per_millimolar_per_millisecond)');
    LEGEND_CONSTANTS(:,20) = strpad('bCaMK in component CaMK (per_millisecond)');
    LEGEND_CONSTANTS(:,21) = strpad('CaMKo in component CaMK (dimensionless)');
    LEGEND_CONSTANTS(:,22) = strpad('KmCaM in component CaMK (millimolar)');
    LEGEND_ALGEBRAIC(:,37) = strpad('CaMKb in component CaMK (millimolar)');
    LEGEND_ALGEBRAIC(:,43) = strpad('CaMKa in component CaMK (millimolar)');
    LEGEND_STATES(:,2) = strpad('CaMKt in component CaMK (millimolar)');
    LEGEND_STATES(:,3) = strpad('cass in component intracellular_ions (millimolar)');
    LEGEND_CONSTANTS(:,23) = strpad('cmdnmax_b in component intracellular_ions (millimolar)');
    LEGEND_CONSTANTS(:,151) = strpad('cmdnmax in component intracellular_ions (millimolar)');
    LEGEND_CONSTANTS(:,24) = strpad('kmcmdn in component intracellular_ions (millimolar)');
    LEGEND_CONSTANTS(:,25) = strpad('trpnmax in component intracellular_ions (millimolar)');
    LEGEND_CONSTANTS(:,26) = strpad('kmtrpn in component intracellular_ions (millimolar)');
    LEGEND_CONSTANTS(:,27) = strpad('BSRmax in component intracellular_ions (millimolar)');
    LEGEND_CONSTANTS(:,28) = strpad('KmBSR in component intracellular_ions (millimolar)');
    LEGEND_CONSTANTS(:,29) = strpad('BSLmax in component intracellular_ions (millimolar)');
    LEGEND_CONSTANTS(:,30) = strpad('KmBSL in component intracellular_ions (millimolar)');
    LEGEND_CONSTANTS(:,31) = strpad('csqnmax in component intracellular_ions (millimolar)');
    LEGEND_CONSTANTS(:,32) = strpad('kmcsqn in component intracellular_ions (millimolar)');
    LEGEND_STATES(:,4) = strpad('nai in component intracellular_ions (millimolar)');
    LEGEND_STATES(:,5) = strpad('nass in component intracellular_ions (millimolar)');
    LEGEND_STATES(:,6) = strpad('ki in component intracellular_ions (millimolar)');
    LEGEND_STATES(:,7) = strpad('kss in component intracellular_ions (millimolar)');
    LEGEND_STATES(:,8) = strpad('cansr in component intracellular_ions (millimolar)');
    LEGEND_STATES(:,9) = strpad('cajsr in component intracellular_ions (millimolar)');
    LEGEND_STATES(:,10) = strpad('cai in component intracellular_ions (millimolar)');
    LEGEND_ALGEBRAIC(:,188) = strpad('JdiffNa in component diff (millimolar_per_millisecond)');
    LEGEND_ALGEBRAIC(:,192) = strpad('Jdiff in component diff (millimolar_per_millisecond)');
    LEGEND_ALGEBRAIC(:,199) = strpad('Jup in component SERCA (millimolar_per_millisecond)');
    LEGEND_ALGEBRAIC(:,184) = strpad('JdiffK in component diff (millimolar_per_millisecond)');
    LEGEND_ALGEBRAIC(:,194) = strpad('Jrel in component ryr (millimolar_per_millisecond)');
    LEGEND_ALGEBRAIC(:,200) = strpad('Jtr in component trans_flux (millimolar_per_millisecond)');
    LEGEND_ALGEBRAIC(:,45) = strpad('Bcai in component intracellular_ions (dimensionless)');
    LEGEND_ALGEBRAIC(:,49) = strpad('Bcajsr in component intracellular_ions (dimensionless)');
    LEGEND_ALGEBRAIC(:,47) = strpad('Bcass in component intracellular_ions (dimensionless)');
    LEGEND_CONSTANTS(:,33) = strpad('cm in component intracellular_ions (microF_per_centimeter_squared)');
    LEGEND_CONSTANTS(:,34) = strpad('PKNa in component reversal_potentials (dimensionless)');
    LEGEND_ALGEBRAIC(:,51) = strpad('ENa in component reversal_potentials (millivolt)');
    LEGEND_ALGEBRAIC(:,54) = strpad('EK in component reversal_potentials (millivolt)');
    LEGEND_ALGEBRAIC(:,55) = strpad('EKs in component reversal_potentials (millivolt)');
    LEGEND_ALGEBRAIC(:,2) = strpad('mss in component INa (dimensionless)');
    LEGEND_ALGEBRAIC(:,14) = strpad('tm in component INa (millisecond)');
    LEGEND_CONSTANTS(:,35) = strpad('mssV1 in component INa (millivolt)');
    LEGEND_CONSTANTS(:,36) = strpad('mssV2 in component INa (millivolt)');
    LEGEND_CONSTANTS(:,37) = strpad('mtV1 in component INa (millivolt)');
    LEGEND_CONSTANTS(:,38) = strpad('mtV2 in component INa (millivolt)');
    LEGEND_CONSTANTS(:,39) = strpad('mtD1 in component INa (dimensionless)');
    LEGEND_CONSTANTS(:,40) = strpad('mtD2 in component INa (dimensionless)');
    LEGEND_CONSTANTS(:,41) = strpad('mtV3 in component INa (millivolt)');
    LEGEND_CONSTANTS(:,42) = strpad('mtV4 in component INa (millivolt)');
    LEGEND_STATES(:,11) = strpad('m in component INa (dimensionless)');
    LEGEND_ALGEBRAIC(:,3) = strpad('hss in component INa (dimensionless)');
    LEGEND_ALGEBRAIC(:,15) = strpad('thf in component INa (millisecond)');
    LEGEND_ALGEBRAIC(:,16) = strpad('ths in component INa (millisecond)');
    LEGEND_CONSTANTS(:,43) = strpad('hssV1 in component INa (millivolt)');
    LEGEND_CONSTANTS(:,44) = strpad('hssV2 in component INa (millivolt)');
    LEGEND_CONSTANTS(:,152) = strpad('Ahs in component INa (dimensionless)');
    LEGEND_CONSTANTS(:,45) = strpad('Ahf in component INa (dimensionless)');
    LEGEND_STATES(:,12) = strpad('hf in component INa (dimensionless)');
    LEGEND_STATES(:,13) = strpad('hs in component INa (dimensionless)');
    LEGEND_ALGEBRAIC(:,56) = strpad('h in component INa (dimensionless)');
    LEGEND_CONSTANTS(:,46) = strpad('GNa in component INa (milliS_per_microF)');
    LEGEND_CONSTANTS(:,47) = strpad('shift_INa_inact in component INa (millivolt)');
    LEGEND_ALGEBRAIC(:,17) = strpad('jss in component INa (dimensionless)');
    LEGEND_ALGEBRAIC(:,28) = strpad('tj in component INa (millisecond)');
    LEGEND_STATES(:,14) = strpad('j in component INa (dimensionless)');
    LEGEND_ALGEBRAIC(:,29) = strpad('hssp in component INa (dimensionless)');
    LEGEND_ALGEBRAIC(:,38) = strpad('thsp in component INa (millisecond)');
    LEGEND_STATES(:,15) = strpad('hsp in component INa (dimensionless)');
    LEGEND_ALGEBRAIC(:,57) = strpad('hp in component INa (dimensionless)');
    LEGEND_ALGEBRAIC(:,39) = strpad('tjp in component INa (millisecond)');
    LEGEND_STATES(:,16) = strpad('jp in component INa (dimensionless)');
    LEGEND_ALGEBRAIC(:,58) = strpad('fINap in component INa (dimensionless)');
    LEGEND_ALGEBRAIC(:,30) = strpad('mLss in component INaL (dimensionless)');
    LEGEND_ALGEBRAIC(:,40) = strpad('tmL in component INaL (millisecond)');
    LEGEND_STATES(:,17) = strpad('mL in component INaL (dimensionless)');
    LEGEND_CONSTANTS(:,48) = strpad('thL in component INaL (millisecond)');
    LEGEND_ALGEBRAIC(:,4) = strpad('hLss in component INaL (dimensionless)');
    LEGEND_STATES(:,18) = strpad('hL in component INaL (dimensionless)');
    LEGEND_ALGEBRAIC(:,5) = strpad('hLssp in component INaL (dimensionless)');
    LEGEND_CONSTANTS(:,153) = strpad('thLp in component INaL (millisecond)');
    LEGEND_STATES(:,19) = strpad('hLp in component INaL (dimensionless)');
    LEGEND_CONSTANTS(:,49) = strpad('GNaL_b in component INaL (milliS_per_microF)');
    LEGEND_CONSTANTS(:,154) = strpad('GNaL in component INaL (milliS_per_microF)');
    LEGEND_ALGEBRAIC(:,60) = strpad('fINaLp in component INaL (dimensionless)');
    LEGEND_CONSTANTS(:,50) = strpad('Gto_b in component Ito (milliS_per_microF)');
    LEGEND_ALGEBRAIC(:,6) = strpad('ass in component Ito (dimensionless)');
    LEGEND_ALGEBRAIC(:,18) = strpad('ta in component Ito (millisecond)');
    LEGEND_STATES(:,20) = strpad('a in component Ito (dimensionless)');
    LEGEND_ALGEBRAIC(:,7) = strpad('iss in component Ito (dimensionless)');
    LEGEND_ALGEBRAIC(:,19) = strpad('delta_epi in component Ito (dimensionless)');
    LEGEND_ALGEBRAIC(:,31) = strpad('tiF_b in component Ito (millisecond)');
    LEGEND_ALGEBRAIC(:,41) = strpad('tiS_b in component Ito (millisecond)');
    LEGEND_ALGEBRAIC(:,44) = strpad('tiF in component Ito (millisecond)');
    LEGEND_ALGEBRAIC(:,46) = strpad('tiS in component Ito (millisecond)');
    LEGEND_ALGEBRAIC(:,62) = strpad('AiF in component Ito (dimensionless)');
    LEGEND_ALGEBRAIC(:,63) = strpad('AiS in component Ito (dimensionless)');
    LEGEND_STATES(:,21) = strpad('iF in component Ito (dimensionless)');
    LEGEND_STATES(:,22) = strpad('iS in component Ito (dimensionless)');
    LEGEND_ALGEBRAIC(:,64) = strpad('i in component Ito (dimensionless)');
    LEGEND_ALGEBRAIC(:,32) = strpad('assp in component Ito (dimensionless)');
    LEGEND_STATES(:,23) = strpad('ap in component Ito (dimensionless)');
    LEGEND_ALGEBRAIC(:,48) = strpad('dti_develop in component Ito (dimensionless)');
    LEGEND_ALGEBRAIC(:,50) = strpad('dti_recover in component Ito (dimensionless)');
    LEGEND_ALGEBRAIC(:,52) = strpad('tiFp in component Ito (millisecond)');
    LEGEND_ALGEBRAIC(:,53) = strpad('tiSp in component Ito (millisecond)');
    LEGEND_STATES(:,24) = strpad('iFp in component Ito (dimensionless)');
    LEGEND_STATES(:,25) = strpad('iSp in component Ito (dimensionless)');
    LEGEND_ALGEBRAIC(:,65) = strpad('ip in component Ito (dimensionless)');
    LEGEND_CONSTANTS(:,155) = strpad('Gto in component Ito (milliS_per_microF)');
    LEGEND_ALGEBRAIC(:,66) = strpad('fItop in component Ito (dimensionless)');
    LEGEND_CONSTANTS(:,51) = strpad('Kmn in component ICaL (millimolar)');
    LEGEND_CONSTANTS(:,52) = strpad('k2n in component ICaL (per_millisecond)');
    LEGEND_CONSTANTS(:,53) = strpad('PCa_b in component ICaL (dimensionless)');
    LEGEND_ALGEBRAIC(:,8) = strpad('dss in component ICaL (dimensionless)');
    LEGEND_STATES(:,26) = strpad('d in component ICaL (dimensionless)');
    LEGEND_ALGEBRAIC(:,9) = strpad('fss in component ICaL (dimensionless)');
    LEGEND_CONSTANTS(:,156) = strpad('Aff in component ICaL (dimensionless)');
    LEGEND_CONSTANTS(:,171) = strpad('Afs in component ICaL (dimensionless)');
    LEGEND_STATES(:,27) = strpad('ff in component ICaL (dimensionless)');
    LEGEND_STATES(:,28) = strpad('fs in component ICaL (dimensionless)');
    LEGEND_ALGEBRAIC(:,68) = strpad('f in component ICaL (dimensionless)');
    LEGEND_ALGEBRAIC(:,20) = strpad('fcass in component ICaL (dimensionless)');
    LEGEND_ALGEBRAIC(:,69) = strpad('Afcaf in component ICaL (dimensionless)');
    LEGEND_ALGEBRAIC(:,70) = strpad('Afcas in component ICaL (dimensionless)');
    LEGEND_STATES(:,29) = strpad('fcaf in component ICaL (dimensionless)');
    LEGEND_STATES(:,30) = strpad('fcas in component ICaL (dimensionless)');
    LEGEND_ALGEBRAIC(:,71) = strpad('fca in component ICaL (dimensionless)');
    LEGEND_STATES(:,31) = strpad('jca in component ICaL (dimensionless)');
    LEGEND_STATES(:,32) = strpad('ffp in component ICaL (dimensionless)');
    LEGEND_ALGEBRAIC(:,72) = strpad('fp in component ICaL (dimensionless)');
    LEGEND_STATES(:,33) = strpad('fcafp in component ICaL (dimensionless)');
    LEGEND_ALGEBRAIC(:,73) = strpad('fcap in component ICaL (dimensionless)');
    LEGEND_ALGEBRAIC(:,10) = strpad('km2n in component ICaL (per_millisecond)');
    LEGEND_ALGEBRAIC(:,21) = strpad('anca in component ICaL (dimensionless)');
    LEGEND_STATES(:,34) = strpad('nca in component ICaL (dimensionless)');
    LEGEND_ALGEBRAIC(:,76) = strpad('PhiCaL in component ICaL (dimensionless)');
    LEGEND_ALGEBRAIC(:,79) = strpad('PhiCaNa in component ICaL (dimensionless)');
    LEGEND_ALGEBRAIC(:,82) = strpad('PhiCaK in component ICaL (dimensionless)');
    LEGEND_CONSTANTS(:,157) = strpad('PCa in component ICaL (dimensionless)');
    LEGEND_CONSTANTS(:,172) = strpad('PCap in component ICaL (dimensionless)');
    LEGEND_CONSTANTS(:,173) = strpad('PCaNa in component ICaL (dimensionless)');
    LEGEND_CONSTANTS(:,174) = strpad('PCaK in component ICaL (dimensionless)');
    LEGEND_CONSTANTS(:,182) = strpad('PCaNap in component ICaL (dimensionless)');
    LEGEND_CONSTANTS(:,183) = strpad('PCaKp in component ICaL (dimensionless)');
    LEGEND_ALGEBRAIC(:,83) = strpad('fICaLp in component ICaL (dimensionless)');
    LEGEND_ALGEBRAIC(:,22) = strpad('td in component ICaL (millisecond)');
    LEGEND_ALGEBRAIC(:,23) = strpad('tff in component ICaL (millisecond)');
    LEGEND_ALGEBRAIC(:,24) = strpad('tfs in component ICaL (millisecond)');
    LEGEND_ALGEBRAIC(:,33) = strpad('tfcaf in component ICaL (millisecond)');
    LEGEND_ALGEBRAIC(:,34) = strpad('tfcas in component ICaL (millisecond)');
    LEGEND_CONSTANTS(:,158) = strpad('tjca in component ICaL (millisecond)');
    LEGEND_ALGEBRAIC(:,35) = strpad('tffp in component ICaL (millisecond)');
    LEGEND_ALGEBRAIC(:,42) = strpad('tfcafp in component ICaL (millisecond)');
    LEGEND_CONSTANTS(:,159) = strpad('v0 in component ICaL (millivolt)');
    LEGEND_ALGEBRAIC(:,74) = strpad('A_1 in component ICaL (dimensionless)');
    LEGEND_CONSTANTS(:,175) = strpad('B_1 in component ICaL (per_millivolt)');
    LEGEND_ALGEBRAIC(:,75) = strpad('U_1 in component ICaL (dimensionless)');
    LEGEND_ALGEBRAIC(:,77) = strpad('A_2 in component ICaL (dimensionless)');
    LEGEND_CONSTANTS(:,176) = strpad('B_2 in component ICaL (per_millivolt)');
    LEGEND_ALGEBRAIC(:,78) = strpad('U_2 in component ICaL (dimensionless)');
    LEGEND_ALGEBRAIC(:,80) = strpad('A_3 in component ICaL (dimensionless)');
    LEGEND_CONSTANTS(:,177) = strpad('B_3 in component ICaL (per_millivolt)');
    LEGEND_ALGEBRAIC(:,81) = strpad('U_3 in component ICaL (dimensionless)');
    LEGEND_CONSTANTS(:,54) = strpad('GKr_b in component IKr (milliS_per_microF)');
    LEGEND_STATES(:,35) = strpad('IC1 in component IKr (dimensionless)');
    LEGEND_STATES(:,36) = strpad('IC2 in component IKr (dimensionless)');
    LEGEND_STATES(:,37) = strpad('C1 in component IKr (dimensionless)');
    LEGEND_STATES(:,38) = strpad('C2 in component IKr (dimensionless)');
    LEGEND_STATES(:,39) = strpad('O in component IKr (dimensionless)');
    LEGEND_STATES(:,40) = strpad('IO in component IKr (dimensionless)');
    LEGEND_STATES(:,41) = strpad('IObound in component IKr (dimensionless)');
    LEGEND_STATES(:,42) = strpad('Obound in component IKr (dimensionless)');
    LEGEND_STATES(:,43) = strpad('Cbound in component IKr (dimensionless)');
    LEGEND_STATES(:,44) = strpad('D in component IKr (dimensionless)');
    LEGEND_CONSTANTS(:,160) = strpad('GKr in component IKr (milliS_per_microF)');
    LEGEND_CONSTANTS(:,55) = strpad('A1 in component IKr (per_millisecond)');
    LEGEND_CONSTANTS(:,56) = strpad('B1 in component IKr (per_millivolt)');
    LEGEND_CONSTANTS(:,57) = strpad('q1 in component IKr (dimensionless)');
    LEGEND_CONSTANTS(:,58) = strpad('A2 in component IKr (per_millisecond)');
    LEGEND_CONSTANTS(:,59) = strpad('B2 in component IKr (per_millivolt)');
    LEGEND_CONSTANTS(:,60) = strpad('q2 in component IKr (dimensionless)');
    LEGEND_CONSTANTS(:,61) = strpad('A3 in component IKr (per_millisecond)');
    LEGEND_CONSTANTS(:,62) = strpad('B3 in component IKr (per_millivolt)');
    LEGEND_CONSTANTS(:,63) = strpad('q3 in component IKr (dimensionless)');
    LEGEND_CONSTANTS(:,64) = strpad('A4 in component IKr (per_millisecond)');
    LEGEND_CONSTANTS(:,65) = strpad('B4 in component IKr (per_millivolt)');
    LEGEND_CONSTANTS(:,66) = strpad('q4 in component IKr (dimensionless)');
    LEGEND_CONSTANTS(:,67) = strpad('A11 in component IKr (per_millisecond)');
    LEGEND_CONSTANTS(:,68) = strpad('B11 in component IKr (per_millivolt)');
    LEGEND_CONSTANTS(:,69) = strpad('q11 in component IKr (dimensionless)');
    LEGEND_CONSTANTS(:,70) = strpad('A21 in component IKr (per_millisecond)');
    LEGEND_CONSTANTS(:,71) = strpad('B21 in component IKr (per_millivolt)');
    LEGEND_CONSTANTS(:,72) = strpad('q21 in component IKr (dimensionless)');
    LEGEND_CONSTANTS(:,73) = strpad('A31 in component IKr (per_millisecond)');
    LEGEND_CONSTANTS(:,74) = strpad('B31 in component IKr (per_millivolt)');
    LEGEND_CONSTANTS(:,75) = strpad('q31 in component IKr (dimensionless)');
    LEGEND_CONSTANTS(:,76) = strpad('A41 in component IKr (per_millisecond)');
    LEGEND_CONSTANTS(:,77) = strpad('B41 in component IKr (per_millivolt)');
    LEGEND_CONSTANTS(:,78) = strpad('q41 in component IKr (dimensionless)');
    LEGEND_CONSTANTS(:,79) = strpad('A51 in component IKr (per_millisecond)');
    LEGEND_CONSTANTS(:,80) = strpad('B51 in component IKr (per_millivolt)');
    LEGEND_CONSTANTS(:,81) = strpad('q51 in component IKr (dimensionless)');
    LEGEND_CONSTANTS(:,82) = strpad('A52 in component IKr (per_millisecond)');
    LEGEND_CONSTANTS(:,83) = strpad('B52 in component IKr (per_millivolt)');
    LEGEND_CONSTANTS(:,84) = strpad('q52 in component IKr (dimensionless)');
    LEGEND_CONSTANTS(:,85) = strpad('A53 in component IKr (per_millisecond)');
    LEGEND_CONSTANTS(:,86) = strpad('B53 in component IKr (per_millivolt)');
    LEGEND_CONSTANTS(:,87) = strpad('q53 in component IKr (dimensionless)');
    LEGEND_CONSTANTS(:,88) = strpad('A61 in component IKr (per_millisecond)');
    LEGEND_CONSTANTS(:,89) = strpad('B61 in component IKr (per_millivolt)');
    LEGEND_CONSTANTS(:,90) = strpad('q61 in component IKr (dimensionless)');
    LEGEND_CONSTANTS(:,91) = strpad('A62 in component IKr (per_millisecond)');
    LEGEND_CONSTANTS(:,92) = strpad('B62 in component IKr (per_millivolt)');
    LEGEND_CONSTANTS(:,93) = strpad('q62 in component IKr (dimensionless)');
    LEGEND_CONSTANTS(:,94) = strpad('A63 in component IKr (per_millisecond)');
    LEGEND_CONSTANTS(:,95) = strpad('B63 in component IKr (per_millivolt)');
    LEGEND_CONSTANTS(:,96) = strpad('q63 in component IKr (dimensionless)');
    LEGEND_CONSTANTS(:,97) = strpad('Kmax in component IKr (dimensionless)');
    LEGEND_CONSTANTS(:,98) = strpad('Ku in component IKr (per_millisecond)');
    LEGEND_CONSTANTS(:,99) = strpad('n in component IKr (dimensionless)');
    LEGEND_CONSTANTS(:,100) = strpad('halfmax in component IKr (dimensionless)');
    LEGEND_CONSTANTS(:,101) = strpad('Kt in component IKr (per_millisecond)');
    LEGEND_CONSTANTS(:,102) = strpad('Vhalf in component IKr (millivolt)');
    LEGEND_CONSTANTS(:,103) = strpad('Temp in component IKr (dimensionless)');
    LEGEND_CONSTANTS(:,104) = strpad('GKs_b in component IKs (milliS_per_microF)');
    LEGEND_CONSTANTS(:,161) = strpad('GKs in component IKs (milliS_per_microF)');
    LEGEND_ALGEBRAIC(:,11) = strpad('xs1ss in component IKs (dimensionless)');
    LEGEND_ALGEBRAIC(:,25) = strpad('xs2ss in component IKs (dimensionless)');
    LEGEND_ALGEBRAIC(:,26) = strpad('txs1 in component IKs (millisecond)');
    LEGEND_CONSTANTS(:,105) = strpad('txs1_max in component IKs (millisecond)');
    LEGEND_STATES(:,45) = strpad('xs1 in component IKs (dimensionless)');
    LEGEND_STATES(:,46) = strpad('xs2 in component IKs (dimensionless)');
    LEGEND_ALGEBRAIC(:,94) = strpad('KsCa in component IKs (dimensionless)');
    LEGEND_ALGEBRAIC(:,36) = strpad('txs2 in component IKs (millisecond)');
    LEGEND_CONSTANTS(:,162) = strpad('GK1 in component IK1 (milliS_per_microF)');
    LEGEND_CONSTANTS(:,106) = strpad('GK1_b in component IK1 (milliS_per_microF)');
    LEGEND_ALGEBRAIC(:,12) = strpad('xk1ss in component IK1 (dimensionless)');
    LEGEND_ALGEBRAIC(:,27) = strpad('txk1 in component IK1 (millisecond)');
    LEGEND_STATES(:,47) = strpad('xk1 in component IK1 (dimensionless)');
    LEGEND_ALGEBRAIC(:,98) = strpad('rk1 in component IK1 (millisecond)');
    LEGEND_CONSTANTS(:,107) = strpad('kna1 in component INaCa_i (per_millisecond)');
    LEGEND_CONSTANTS(:,108) = strpad('kna2 in component INaCa_i (per_millisecond)');
    LEGEND_CONSTANTS(:,109) = strpad('kna3 in component INaCa_i (per_millisecond)');
    LEGEND_CONSTANTS(:,110) = strpad('kasymm in component INaCa_i (dimensionless)');
    LEGEND_CONSTANTS(:,111) = strpad('wna in component INaCa_i (dimensionless)');
    LEGEND_CONSTANTS(:,112) = strpad('wca in component INaCa_i (dimensionless)');
    LEGEND_CONSTANTS(:,113) = strpad('wnaca in component INaCa_i (dimensionless)');
    LEGEND_CONSTANTS(:,114) = strpad('kcaon in component INaCa_i (per_millisecond)');
    LEGEND_CONSTANTS(:,115) = strpad('kcaoff in component INaCa_i (per_millisecond)');
    LEGEND_CONSTANTS(:,116) = strpad('qna in component INaCa_i (dimensionless)');
    LEGEND_CONSTANTS(:,117) = strpad('qca in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,101) = strpad('hna in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,100) = strpad('hca in component INaCa_i (dimensionless)');
    LEGEND_CONSTANTS(:,118) = strpad('KmCaAct in component INaCa_i (millimolar)');
    LEGEND_CONSTANTS(:,119) = strpad('Gncx_b in component INaCa_i (milliS_per_microF)');
    LEGEND_CONSTANTS(:,195) = strpad('Gncx in component INaCa_i (milliS_per_microF)');
    LEGEND_ALGEBRAIC(:,102) = strpad('h1_i in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,103) = strpad('h2_i in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,104) = strpad('h3_i in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,105) = strpad('h4_i in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,106) = strpad('h5_i in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,107) = strpad('h6_i in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,108) = strpad('h7_i in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,109) = strpad('h8_i in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,110) = strpad('h9_i in component INaCa_i (dimensionless)');
    LEGEND_CONSTANTS(:,189) = strpad('h10_i in component INaCa_i (dimensionless)');
    LEGEND_CONSTANTS(:,190) = strpad('h11_i in component INaCa_i (dimensionless)');
    LEGEND_CONSTANTS(:,191) = strpad('h12_i in component INaCa_i (dimensionless)');
    LEGEND_CONSTANTS(:,192) = strpad('k1_i in component INaCa_i (dimensionless)');
    LEGEND_CONSTANTS(:,193) = strpad('k2_i in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,111) = strpad('k3p_i in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,112) = strpad('k3pp_i in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,113) = strpad('k3_i in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,116) = strpad('k4_i in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,114) = strpad('k4p_i in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,115) = strpad('k4pp_i in component INaCa_i (dimensionless)');
    LEGEND_CONSTANTS(:,194) = strpad('k5_i in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,117) = strpad('k6_i in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,118) = strpad('k7_i in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,119) = strpad('k8_i in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,120) = strpad('x1_i in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,121) = strpad('x2_i in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,122) = strpad('x3_i in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,123) = strpad('x4_i in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,124) = strpad('E1_i in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,125) = strpad('E2_i in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,126) = strpad('E3_i in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,127) = strpad('E4_i in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,128) = strpad('allo_i in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,129) = strpad('JncxNa_i in component INaCa_i (millimolar_per_millisecond)');
    LEGEND_ALGEBRAIC(:,130) = strpad('JncxCa_i in component INaCa_i (millimolar_per_millisecond)');
    LEGEND_ALGEBRAIC(:,132) = strpad('h1_ss in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,133) = strpad('h2_ss in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,134) = strpad('h3_ss in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,135) = strpad('h4_ss in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,136) = strpad('h5_ss in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,137) = strpad('h6_ss in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,138) = strpad('h7_ss in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,139) = strpad('h8_ss in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,140) = strpad('h9_ss in component INaCa_i (dimensionless)');
    LEGEND_CONSTANTS(:,196) = strpad('h10_ss in component INaCa_i (dimensionless)');
    LEGEND_CONSTANTS(:,197) = strpad('h11_ss in component INaCa_i (dimensionless)');
    LEGEND_CONSTANTS(:,198) = strpad('h12_ss in component INaCa_i (dimensionless)');
    LEGEND_CONSTANTS(:,199) = strpad('k1_ss in component INaCa_i (dimensionless)');
    LEGEND_CONSTANTS(:,200) = strpad('k2_ss in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,141) = strpad('k3p_ss in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,142) = strpad('k3pp_ss in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,143) = strpad('k3_ss in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,146) = strpad('k4_ss in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,144) = strpad('k4p_ss in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,145) = strpad('k4pp_ss in component INaCa_i (dimensionless)');
    LEGEND_CONSTANTS(:,201) = strpad('k5_ss in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,147) = strpad('k6_ss in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,148) = strpad('k7_ss in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,149) = strpad('k8_ss in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,150) = strpad('x1_ss in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,151) = strpad('x2_ss in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,152) = strpad('x3_ss in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,153) = strpad('x4_ss in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,154) = strpad('E1_ss in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,155) = strpad('E2_ss in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,156) = strpad('E3_ss in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,157) = strpad('E4_ss in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,158) = strpad('allo_ss in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,159) = strpad('JncxNa_ss in component INaCa_i (millimolar_per_millisecond)');
    LEGEND_ALGEBRAIC(:,160) = strpad('JncxCa_ss in component INaCa_i (millimolar_per_millisecond)');
    LEGEND_CONSTANTS(:,120) = strpad('k1p in component INaK (per_millisecond)');
    LEGEND_CONSTANTS(:,121) = strpad('k1m in component INaK (per_millisecond)');
    LEGEND_CONSTANTS(:,122) = strpad('k2p in component INaK (per_millisecond)');
    LEGEND_CONSTANTS(:,123) = strpad('k2m in component INaK (per_millisecond)');
    LEGEND_CONSTANTS(:,124) = strpad('k3p in component INaK (per_millisecond)');
    LEGEND_CONSTANTS(:,125) = strpad('k3m in component INaK (per_millisecond)');
    LEGEND_CONSTANTS(:,126) = strpad('k4p in component INaK (per_millisecond)');
    LEGEND_CONSTANTS(:,127) = strpad('k4m in component INaK (per_millisecond)');
    LEGEND_CONSTANTS(:,128) = strpad('Knai0 in component INaK (millimolar)');
    LEGEND_CONSTANTS(:,129) = strpad('Knao0 in component INaK (millimolar)');
    LEGEND_CONSTANTS(:,130) = strpad('delta in component INaK (millivolt)');
    LEGEND_CONSTANTS(:,131) = strpad('Kki in component INaK (per_millisecond)');
    LEGEND_CONSTANTS(:,132) = strpad('Kko in component INaK (per_millisecond)');
    LEGEND_CONSTANTS(:,133) = strpad('MgADP in component INaK (millimolar)');
    LEGEND_CONSTANTS(:,134) = strpad('MgATP in component INaK (millimolar)');
    LEGEND_CONSTANTS(:,135) = strpad('Kmgatp in component INaK (millimolar)');
    LEGEND_CONSTANTS(:,136) = strpad('H in component INaK (millimolar)');
    LEGEND_CONSTANTS(:,137) = strpad('eP in component INaK (dimensionless)');
    LEGEND_CONSTANTS(:,138) = strpad('Khp in component INaK (millimolar)');
    LEGEND_CONSTANTS(:,139) = strpad('Knap in component INaK (millimolar)');
    LEGEND_CONSTANTS(:,140) = strpad('Kxkur in component INaK (millimolar)');
    LEGEND_CONSTANTS(:,141) = strpad('Pnak_b in component INaK (milliS_per_microF)');
    LEGEND_CONSTANTS(:,205) = strpad('Pnak in component INaK (milliS_per_microF)');
    LEGEND_ALGEBRAIC(:,162) = strpad('Knai in component INaK (millimolar)');
    LEGEND_ALGEBRAIC(:,163) = strpad('Knao in component INaK (millimolar)');
    LEGEND_ALGEBRAIC(:,164) = strpad('P in component INaK (dimensionless)');
    LEGEND_ALGEBRAIC(:,165) = strpad('a1 in component INaK (dimensionless)');
    LEGEND_CONSTANTS(:,202) = strpad('b1 in component INaK (dimensionless)');
    LEGEND_CONSTANTS(:,203) = strpad('a2 in component INaK (dimensionless)');
    LEGEND_ALGEBRAIC(:,166) = strpad('b2 in component INaK (dimensionless)');
    LEGEND_ALGEBRAIC(:,167) = strpad('a3 in component INaK (dimensionless)');
    LEGEND_ALGEBRAIC(:,168) = strpad('b3 in component INaK (dimensionless)');
    LEGEND_CONSTANTS(:,204) = strpad('a4 in component INaK (dimensionless)');
    LEGEND_ALGEBRAIC(:,169) = strpad('b4 in component INaK (dimensionless)');
    LEGEND_ALGEBRAIC(:,170) = strpad('x1 in component INaK (dimensionless)');
    LEGEND_ALGEBRAIC(:,171) = strpad('x2 in component INaK (dimensionless)');
    LEGEND_ALGEBRAIC(:,172) = strpad('x3 in component INaK (dimensionless)');
    LEGEND_ALGEBRAIC(:,173) = strpad('x4 in component INaK (dimensionless)');
    LEGEND_ALGEBRAIC(:,174) = strpad('E1 in component INaK (dimensionless)');
    LEGEND_ALGEBRAIC(:,175) = strpad('E2 in component INaK (dimensionless)');
    LEGEND_ALGEBRAIC(:,176) = strpad('E3 in component INaK (dimensionless)');
    LEGEND_ALGEBRAIC(:,177) = strpad('E4 in component INaK (dimensionless)');
    LEGEND_ALGEBRAIC(:,178) = strpad('JnakNa in component INaK (millimolar_per_millisecond)');
    LEGEND_ALGEBRAIC(:,179) = strpad('JnakK in component INaK (millimolar_per_millisecond)');
    LEGEND_ALGEBRAIC(:,181) = strpad('xkb in component IKb (dimensionless)');
    LEGEND_CONSTANTS(:,142) = strpad('GKb_b in component IKb (milliS_per_microF)');
    LEGEND_CONSTANTS(:,164) = strpad('GKb in component IKb (milliS_per_microF)');
    LEGEND_CONSTANTS(:,143) = strpad('PNab in component INab (milliS_per_microF)');
    LEGEND_ALGEBRAIC(:,183) = strpad('A in component INab (microA_per_microF)');
    LEGEND_CONSTANTS(:,179) = strpad('B in component INab (per_millivolt)');
    LEGEND_CONSTANTS(:,165) = strpad('v0 in component INab (millivolt)');
    LEGEND_ALGEBRAIC(:,185) = strpad('U in component INab (dimensionless)');
    LEGEND_CONSTANTS(:,144) = strpad('PCab in component ICab (milliS_per_microF)');
    LEGEND_ALGEBRAIC(:,187) = strpad('A in component ICab (microA_per_microF)');
    LEGEND_CONSTANTS(:,180) = strpad('B in component ICab (per_millivolt)');
    LEGEND_CONSTANTS(:,166) = strpad('v0 in component ICab (millivolt)');
    LEGEND_ALGEBRAIC(:,189) = strpad('U in component ICab (dimensionless)');
    LEGEND_CONSTANTS(:,145) = strpad('GpCa in component IpCa (milliS_per_microF)');
    LEGEND_CONSTANTS(:,146) = strpad('KmCap in component IpCa (millimolar)');
    LEGEND_CONSTANTS(:,147) = strpad('bt in component ryr (millisecond)');
    LEGEND_CONSTANTS(:,167) = strpad('a_rel in component ryr (millisecond)');
    LEGEND_ALGEBRAIC(:,89) = strpad('Jrel_inf in component ryr (dimensionless)');
    LEGEND_ALGEBRAIC(:,95) = strpad('tau_rel in component ryr (millisecond)');
    LEGEND_ALGEBRAIC(:,90) = strpad('Jrel_infp in component ryr (dimensionless)');
    LEGEND_ALGEBRAIC(:,87) = strpad('Jrel_temp in component ryr (dimensionless)');
    LEGEND_ALGEBRAIC(:,96) = strpad('tau_relp in component ryr (millisecond)');
    LEGEND_STATES(:,48) = strpad('Jrelnp in component ryr (dimensionless)');
    LEGEND_STATES(:,49) = strpad('Jrelp in component ryr (dimensionless)');
    LEGEND_CONSTANTS(:,168) = strpad('btp in component ryr (millisecond)');
    LEGEND_CONSTANTS(:,181) = strpad('a_relp in component ryr (millisecond)');
    LEGEND_ALGEBRAIC(:,86) = strpad('Jrel_inf_temp in component ryr (dimensionless)');
    LEGEND_ALGEBRAIC(:,193) = strpad('fJrelp in component ryr (dimensionless)');
    LEGEND_CONSTANTS(:,148) = strpad('Jrel_scaling_factor in component ryr (dimensionless)');
    LEGEND_ALGEBRAIC(:,92) = strpad('tau_rel_temp in component ryr (millisecond)');
    LEGEND_ALGEBRAIC(:,93) = strpad('tau_relp_temp in component ryr (millisecond)');
    LEGEND_CONSTANTS(:,169) = strpad('upScale in component SERCA (dimensionless)');
    LEGEND_ALGEBRAIC(:,195) = strpad('Jupnp in component SERCA (millimolar_per_millisecond)');
    LEGEND_ALGEBRAIC(:,196) = strpad('Jupp in component SERCA (millimolar_per_millisecond)');
    LEGEND_ALGEBRAIC(:,197) = strpad('fJupp in component SERCA (dimensionless)');
    LEGEND_ALGEBRAIC(:,198) = strpad('Jleak in component SERCA (millimolar_per_millisecond)');
    LEGEND_CONSTANTS(:,149) = strpad('Jup_b in component SERCA (dimensionless)');
    LEGEND_RATES(:,1) = strpad('d/dt v in component membrane (millivolt)');
    LEGEND_RATES(:,2) = strpad('d/dt CaMKt in component CaMK (millimolar)');
    LEGEND_RATES(:,4) = strpad('d/dt nai in component intracellular_ions (millimolar)');
    LEGEND_RATES(:,5) = strpad('d/dt nass in component intracellular_ions (millimolar)');
    LEGEND_RATES(:,6) = strpad('d/dt ki in component intracellular_ions (millimolar)');
    LEGEND_RATES(:,7) = strpad('d/dt kss in component intracellular_ions (millimolar)');
    LEGEND_RATES(:,10) = strpad('d/dt cai in component intracellular_ions (millimolar)');
    LEGEND_RATES(:,3) = strpad('d/dt cass in component intracellular_ions (millimolar)');
    LEGEND_RATES(:,8) = strpad('d/dt cansr in component intracellular_ions (millimolar)');
    LEGEND_RATES(:,9) = strpad('d/dt cajsr in component intracellular_ions (millimolar)');
    LEGEND_RATES(:,11) = strpad('d/dt m in component INa (dimensionless)');
    LEGEND_RATES(:,12) = strpad('d/dt hf in component INa (dimensionless)');
    LEGEND_RATES(:,13) = strpad('d/dt hs in component INa (dimensionless)');
    LEGEND_RATES(:,14) = strpad('d/dt j in component INa (dimensionless)');
    LEGEND_RATES(:,15) = strpad('d/dt hsp in component INa (dimensionless)');
    LEGEND_RATES(:,16) = strpad('d/dt jp in component INa (dimensionless)');
    LEGEND_RATES(:,17) = strpad('d/dt mL in component INaL (dimensionless)');
    LEGEND_RATES(:,18) = strpad('d/dt hL in component INaL (dimensionless)');
    LEGEND_RATES(:,19) = strpad('d/dt hLp in component INaL (dimensionless)');
    LEGEND_RATES(:,20) = strpad('d/dt a in component Ito (dimensionless)');
    LEGEND_RATES(:,21) = strpad('d/dt iF in component Ito (dimensionless)');
    LEGEND_RATES(:,22) = strpad('d/dt iS in component Ito (dimensionless)');
    LEGEND_RATES(:,23) = strpad('d/dt ap in component Ito (dimensionless)');
    LEGEND_RATES(:,24) = strpad('d/dt iFp in component Ito (dimensionless)');
    LEGEND_RATES(:,25) = strpad('d/dt iSp in component Ito (dimensionless)');
    LEGEND_RATES(:,26) = strpad('d/dt d in component ICaL (dimensionless)');
    LEGEND_RATES(:,27) = strpad('d/dt ff in component ICaL (dimensionless)');
    LEGEND_RATES(:,28) = strpad('d/dt fs in component ICaL (dimensionless)');
    LEGEND_RATES(:,29) = strpad('d/dt fcaf in component ICaL (dimensionless)');
    LEGEND_RATES(:,30) = strpad('d/dt fcas in component ICaL (dimensionless)');
    LEGEND_RATES(:,31) = strpad('d/dt jca in component ICaL (dimensionless)');
    LEGEND_RATES(:,32) = strpad('d/dt ffp in component ICaL (dimensionless)');
    LEGEND_RATES(:,33) = strpad('d/dt fcafp in component ICaL (dimensionless)');
    LEGEND_RATES(:,34) = strpad('d/dt nca in component ICaL (dimensionless)');
    LEGEND_RATES(:,35) = strpad('d/dt IC1 in component IKr (dimensionless)');
    LEGEND_RATES(:,36) = strpad('d/dt IC2 in component IKr (dimensionless)');
    LEGEND_RATES(:,37) = strpad('d/dt C1 in component IKr (dimensionless)');
    LEGEND_RATES(:,38) = strpad('d/dt C2 in component IKr (dimensionless)');
    LEGEND_RATES(:,39) = strpad('d/dt O in component IKr (dimensionless)');
    LEGEND_RATES(:,40) = strpad('d/dt IO in component IKr (dimensionless)');
    LEGEND_RATES(:,41) = strpad('d/dt IObound in component IKr (dimensionless)');
    LEGEND_RATES(:,42) = strpad('d/dt Obound in component IKr (dimensionless)');
    LEGEND_RATES(:,43) = strpad('d/dt Cbound in component IKr (dimensionless)');
    LEGEND_RATES(:,44) = strpad('d/dt D in component IKr (dimensionless)');
    LEGEND_RATES(:,45) = strpad('d/dt xs1 in component IKs (dimensionless)');
    LEGEND_RATES(:,46) = strpad('d/dt xs2 in component IKs (dimensionless)');
    LEGEND_RATES(:,47) = strpad('d/dt xk1 in component IK1 (dimensionless)');
    LEGEND_RATES(:,48) = strpad('d/dt Jrelnp in component ryr (dimensionless)');
    LEGEND_RATES(:,49) = strpad('d/dt Jrelp in component ryr (dimensionless)');
    LEGEND_STATES  = LEGEND_STATES';
    LEGEND_ALGEBRAIC = LEGEND_ALGEBRAIC';
    LEGEND_RATES = LEGEND_RATES';
    LEGEND_CONSTANTS = LEGEND_CONSTANTS';
end

function [STATES, CONSTANTS] = initConsts()
    VOI = 0; CONSTANTS = []; STATES = []; ALGEBRAIC = [];
    CONSTANTS(:,1) = 0;
    CONSTANTS(:,2) = 140;
    CONSTANTS(:,3) = 1.8;
    CONSTANTS(:,4) = 5.4;
    CONSTANTS(:,5) = 8314;
    CONSTANTS(:,6) = 310;
    CONSTANTS(:,7) = 96485;
    CONSTANTS(:,8) = 1;
    CONSTANTS(:,9) = 2;
    CONSTANTS(:,10) = 1;
    CONSTANTS(:,11) = 0.01;
    CONSTANTS(:,12) = 0.0011;
    STATES(:,1) = -88.00190465;
    CONSTANTS(:,13) = 10;
    CONSTANTS(:,14) = 100000000000000000;
    CONSTANTS(:,15) = -80;
    CONSTANTS(:,16) = 1000;
    CONSTANTS(:,17) = 0.5;
    CONSTANTS(:,18) = 0.15;
    CONSTANTS(:,19) = 0.05;
    CONSTANTS(:,20) = 0.00068;
    CONSTANTS(:,21) = 0.05;
    CONSTANTS(:,22) = 0.0015;
    STATES(:,2) = 0.0125840447;
    STATES(:,3) = 8.49e-05;
    CONSTANTS(:,23) = 0.05;
    CONSTANTS(:,24) = 0.00238;
    CONSTANTS(:,25) = 0.07;
    CONSTANTS(:,26) = 0.0005;
    CONSTANTS(:,27) = 0.047;
    CONSTANTS(:,28) = 0.00087;
    CONSTANTS(:,29) = 1.124;
    CONSTANTS(:,30) = 0.0087;
    CONSTANTS(:,31) = 10;
    CONSTANTS(:,32) = 0.8;
    STATES(:,4) = 7.268004498;
    STATES(:,5) = 7.268089977;
    STATES(:,6) = 144.6555918;
    STATES(:,7) = 144.6555651;
    STATES(:,8) = 1.619574538;
    STATES(:,9) = 1.571234014;
    STATES(:,10) = 8.6e-05;
    CONSTANTS(:,33) = 1;
    CONSTANTS(:,34) = 0.01833;
    CONSTANTS(:,35) = 39.57;
    CONSTANTS(:,36) = 9.871;
    CONSTANTS(:,37) = 11.64;
    CONSTANTS(:,38) = 34.77;
    CONSTANTS(:,39) = 6.765;
    CONSTANTS(:,40) = 8.552;
    CONSTANTS(:,41) = 77.42;
    CONSTANTS(:,42) = 5.955;
    STATES(:,11) = 0.007344121102;
    CONSTANTS(:,43) = 82.9;
    CONSTANTS(:,44) = 6.086;
    CONSTANTS(:,45) = 0.99;
    STATES(:,12) = 0.6981071913;
    STATES(:,13) = 0.6980895801;
    CONSTANTS(:,46) = 75;
    CONSTANTS(:,47) = 0;
    STATES(:,14) = 0.6979908432;
    STATES(:,15) = 0.4549485525;
    STATES(:,16) = 0.6979245865;
    STATES(:,17) = 0.0001882617273;
    CONSTANTS(:,48) = 200;
    STATES(:,18) = 0.5008548855;
    STATES(:,19) = 0.2693065357;
    CONSTANTS(:,49) = 0.019957499999999975;
    CONSTANTS(:,50) = 0.02;
    STATES(:,20) = 0.001001097687;
    STATES(:,21) = 0.9995541745;
    STATES(:,22) = 0.5865061736;
    STATES(:,23) = 0.0005100862934;
    STATES(:,24) = 0.9995541823;
    STATES(:,25) = 0.6393399482;
    CONSTANTS(:,51) = 0.002;
    CONSTANTS(:,52) = 1000;
    CONSTANTS(:,53) = 0.0001007;
    STATES(:,26) = 2.34e-9;
    STATES(:,27) = 0.9999999909;
    STATES(:,28) = 0.9102412777;
    STATES(:,29) = 0.9999999909;
    STATES(:,30) = 0.9998046777;
    STATES(:,31) = 0.9999738312;
    STATES(:,32) = 0.9999999909;
    STATES(:,33) = 0.9999999909;
    STATES(:,34) = 0.002749414044;
    CONSTANTS(:,54) = 0.04658545454545456;
    STATES(:,35) = 0.999637;
    STATES(:,36) = 6.83208e-05;
    STATES(:,37) = 1.80145e-08;
    STATES(:,38) = 8.26619e-05;
    STATES(:,39) = 0.00015551;
    STATES(:,40) = 5.67623e-05;
    STATES(:,41) = 0;
    STATES(:,42) = 0;
    STATES(:,43) = 0;
    STATES(:,44) = 0;
    CONSTANTS(:,55) = 0.0264;
    CONSTANTS(:,56) = 4.631E-05;
    CONSTANTS(:,57) = 4.843;
    CONSTANTS(:,58) = 4.986E-06;
    CONSTANTS(:,59) = -0.004226;
    CONSTANTS(:,60) = 4.23;
    CONSTANTS(:,61) = 0.001214;
    CONSTANTS(:,62) = 0.008516;
    CONSTANTS(:,63) = 4.962;
    CONSTANTS(:,64) = 1.854E-05;
    CONSTANTS(:,65) = -0.04641;
    CONSTANTS(:,66) = 3.769;
    CONSTANTS(:,67) = 0.0007868;
    CONSTANTS(:,68) = 1.535E-08;
    CONSTANTS(:,69) = 4.942;
    CONSTANTS(:,70) = 5.455E-06;
    CONSTANTS(:,71) = -0.1688;
    CONSTANTS(:,72) = 4.156;
    CONSTANTS(:,73) = 0.005509;
    CONSTANTS(:,74) = 7.771E-09;
    CONSTANTS(:,75) = 4.22;
    CONSTANTS(:,76) = 0.001416;
    CONSTANTS(:,77) = -0.02877;
    CONSTANTS(:,78) = 1.459;
    CONSTANTS(:,79) = 0.4492;
    CONSTANTS(:,80) = 0.008595;
    CONSTANTS(:,81) = 5;
    CONSTANTS(:,82) = 0.3181;
    CONSTANTS(:,83) = 3.613E-08;
    CONSTANTS(:,84) = 4.663;
    CONSTANTS(:,85) = 0.149;
    CONSTANTS(:,86) = 0.004668;
    CONSTANTS(:,87) = 2.412;
    CONSTANTS(:,88) = 0.01241;
    CONSTANTS(:,89) = 0.1725;
    CONSTANTS(:,90) = 5.568;
    CONSTANTS(:,91) = 0.3226;
    CONSTANTS(:,92) = -0.0006575;
    CONSTANTS(:,93) = 5;
    CONSTANTS(:,94) = 0.008978;
    CONSTANTS(:,95) = -0.02215;
    CONSTANTS(:,96) = 5.682;
    CONSTANTS(:,97) = 0;
    CONSTANTS(:,98) = 0;
    CONSTANTS(:,99) = 1;
    CONSTANTS(:,100) = 1;
    CONSTANTS(:,101) = 0;
    CONSTANTS(:,102) = 1;
    CONSTANTS(:,103) = 37;
    CONSTANTS(:,104) = 0.006358000000000001;
    CONSTANTS(:,105) = 817.3;
    STATES(:,45) = 0.2707758025;
    STATES(:,46) = 0.0001928503426;
    CONSTANTS(:,106) = 0.3239783999999998;
    STATES(:,47) = 0.9967597594;
    CONSTANTS(:,107) = 15;
    CONSTANTS(:,108) = 5;
    CONSTANTS(:,109) = 88.12;
    CONSTANTS(:,110) = 12.5;
    CONSTANTS(:,111) = 6e4;
    CONSTANTS(:,112) = 6e4;
    CONSTANTS(:,113) = 5e3;
    CONSTANTS(:,114) = 1.5e6;
    CONSTANTS(:,115) = 5e3;
    CONSTANTS(:,116) = 0.5224;
    CONSTANTS(:,117) = 0.167;
    CONSTANTS(:,118) = 150e-6;
    CONSTANTS(:,119) = 0.0008;
    CONSTANTS(:,120) = 949.5;
    CONSTANTS(:,121) = 182.4;
    CONSTANTS(:,122) = 687.2;
    CONSTANTS(:,123) = 39.4;
    CONSTANTS(:,124) = 1899;
    CONSTANTS(:,125) = 79300;
    CONSTANTS(:,126) = 639;
    CONSTANTS(:,127) = 40;
    CONSTANTS(:,128) = 9.073;
    CONSTANTS(:,129) = 27.78;
    CONSTANTS(:,130) = -0.155;
    CONSTANTS(:,131) = 0.5;
    CONSTANTS(:,132) = 0.3582;
    CONSTANTS(:,133) = 0.05;
    CONSTANTS(:,134) = 9.8;
    CONSTANTS(:,135) = 1.698e-7;
    CONSTANTS(:,136) = 1e-7;
    CONSTANTS(:,137) = 4.2;
    CONSTANTS(:,138) = 1.698e-7;
    CONSTANTS(:,139) = 224;
    CONSTANTS(:,140) = 292;
    CONSTANTS(:,141) = 30;
    CONSTANTS(:,142) = 0.003;
    CONSTANTS(:,143) = 3.75e-10;
    CONSTANTS(:,144) = 2.5e-8;
    CONSTANTS(:,145) = 0.0005;
    CONSTANTS(:,146) = 0.0005;
    CONSTANTS(:,147) = 4.75;
    STATES(:,48) = 2.5e-7;
    STATES(:,49) = 3.12e-7;
    CONSTANTS(:,148) = 1.0;
    CONSTANTS(:,149) = 1.0;
    CONSTANTS(:,150) = CONSTANTS(:,7)./( CONSTANTS(:,5).*CONSTANTS(:,6));
    CONSTANTS(:,151) = piecewise({CONSTANTS(:,1)==1.00000,  CONSTANTS(:,23).*1.30000 }, CONSTANTS(:,23));
    CONSTANTS(:,152) = 1.00000 - CONSTANTS(:,45);
    CONSTANTS(:,153) =  3.00000.*CONSTANTS(:,48);
    CONSTANTS(:,154) = piecewise({CONSTANTS(:,1)==1.00000,  CONSTANTS(:,49).*0.600000 }, CONSTANTS(:,49));
    CONSTANTS(:,155) = piecewise({CONSTANTS(:,1)==1.00000,  CONSTANTS(:,50).*4.00000 , CONSTANTS(:,1)==2.00000,  CONSTANTS(:,50).*4.00000 }, CONSTANTS(:,50));
    CONSTANTS(:,156) = 0.600000;
    CONSTANTS(:,157) = piecewise({CONSTANTS(:,1)==1.00000,  CONSTANTS(:,53).*1.20000 , CONSTANTS(:,1)==2.00000,  CONSTANTS(:,53).*2.50000 }, CONSTANTS(:,53));
    CONSTANTS(:,158) = 75.0000;
    CONSTANTS(:,159) = 0.00000;
    CONSTANTS(:,160) = piecewise({CONSTANTS(:,1)==1.00000,  CONSTANTS(:,54).*1.30000 , CONSTANTS(:,1)==2.00000,  CONSTANTS(:,54).*0.800000 }, CONSTANTS(:,54));
    CONSTANTS(:,161) = piecewise({CONSTANTS(:,1)==1.00000,  CONSTANTS(:,104).*1.40000 }, CONSTANTS(:,104));
    CONSTANTS(:,162) = piecewise({CONSTANTS(:,1)==1.00000,  CONSTANTS(:,106).*1.20000 , CONSTANTS(:,1)==2.00000,  CONSTANTS(:,106).*1.30000 }, CONSTANTS(:,106));
    CONSTANTS(:,163) =  1000.00.*3.14000.*CONSTANTS(:,12).*CONSTANTS(:,12).*CONSTANTS(:,11);
    CONSTANTS(:,164) = piecewise({CONSTANTS(:,1)==1.00000,  CONSTANTS(:,142).*0.600000 }, CONSTANTS(:,142));
    CONSTANTS(:,165) = 0.00000;
    CONSTANTS(:,166) = 0.00000;
    CONSTANTS(:,167) =  0.500000.*CONSTANTS(:,147);
    CONSTANTS(:,168) =  1.25000.*CONSTANTS(:,147);
    CONSTANTS(:,169) = piecewise({CONSTANTS(:,1)==1.00000, 1.30000 }, 1.00000);
    CONSTANTS(:,205) = 0.00000;
    CONSTANTS(:,170) =  CONSTANTS(:,7).*CONSTANTS(:,150);
    CONSTANTS(:,171) = 1.00000 - CONSTANTS(:,156);
    CONSTANTS(:,172) =  1.10000.*CONSTANTS(:,157);
    CONSTANTS(:,173) =  0.00125000.*CONSTANTS(:,157);
    CONSTANTS(:,174) =  0.000357400.*CONSTANTS(:,157);
    CONSTANTS(:,175) =  2.00000.*CONSTANTS(:,150);
    CONSTANTS(:,176) = CONSTANTS(:,150);
    CONSTANTS(:,177) = CONSTANTS(:,150);
    CONSTANTS(:,178) =  2.00000.*3.14000.*CONSTANTS(:,12).*CONSTANTS(:,12)+ 2.00000.*3.14000.*CONSTANTS(:,12).*CONSTANTS(:,11);
    CONSTANTS(:,179) = CONSTANTS(:,150);
    CONSTANTS(:,180) =  2.00000.*CONSTANTS(:,150);
    CONSTANTS(:,181) =  0.500000.*CONSTANTS(:,168);
    CONSTANTS(:,182) =  0.00125000.*CONSTANTS(:,172);
    CONSTANTS(:,183) =  0.000357400.*CONSTANTS(:,172);
    CONSTANTS(:,184) =  2.00000.*CONSTANTS(:,178);
    CONSTANTS(:,185) =  0.680000.*CONSTANTS(:,163);
    CONSTANTS(:,186) =  0.0552000.*CONSTANTS(:,163);
    CONSTANTS(:,187) =  0.00480000.*CONSTANTS(:,163);
    CONSTANTS(:,188) =  0.0200000.*CONSTANTS(:,163);
    CONSTANTS(:,189) = CONSTANTS(:,110)+1.00000+ (CONSTANTS(:,2)./CONSTANTS(:,107)).*(1.00000+CONSTANTS(:,2)./CONSTANTS(:,108));
    CONSTANTS(:,190) = ( CONSTANTS(:,2).*CONSTANTS(:,2))./( CONSTANTS(:,189).*CONSTANTS(:,107).*CONSTANTS(:,108));
    CONSTANTS(:,191) = 1.00000./CONSTANTS(:,189);
    CONSTANTS(:,192) =  CONSTANTS(:,191).*CONSTANTS(:,3).*CONSTANTS(:,114);
    CONSTANTS(:,193) = CONSTANTS(:,115);
    CONSTANTS(:,194) = CONSTANTS(:,115);
    CONSTANTS(:,195) = piecewise({CONSTANTS(:,1)==1.00000,  CONSTANTS(:,119).*1.10000 , CONSTANTS(:,1)==2.00000,  CONSTANTS(:,119).*1.40000 }, CONSTANTS(:,119));
    CONSTANTS(:,196) = CONSTANTS(:,110)+1.00000+ (CONSTANTS(:,2)./CONSTANTS(:,107)).*(1.00000+CONSTANTS(:,2)./CONSTANTS(:,108));
    CONSTANTS(:,197) = ( CONSTANTS(:,2).*CONSTANTS(:,2))./( CONSTANTS(:,196).*CONSTANTS(:,107).*CONSTANTS(:,108));
    CONSTANTS(:,198) = 1.00000./CONSTANTS(:,196);
    CONSTANTS(:,199) =  CONSTANTS(:,198).*CONSTANTS(:,3).*CONSTANTS(:,114);
    CONSTANTS(:,200) = CONSTANTS(:,115);
    CONSTANTS(:,201) = CONSTANTS(:,115);
    CONSTANTS(:,202) =  CONSTANTS(:,121).*CONSTANTS(:,133);
    CONSTANTS(:,203) = CONSTANTS(:,122);
    CONSTANTS(:,204) = (( CONSTANTS(:,126).*CONSTANTS(:,134))./CONSTANTS(:,135))./(1.00000+CONSTANTS(:,134)./CONSTANTS(:,135));
    CONSTANTS(:,205) = piecewise({CONSTANTS(:,1)==1.00000,  CONSTANTS(:,141).*0.900000 , CONSTANTS(:,1)==2.00000,  CONSTANTS(:,141).*0.700000 }, CONSTANTS(:,141));
    if (isempty(STATES)), warning('Initial values for states not set');, end
end

function [RATES, ALGEBRAIC] = computeRates(VOI, STATES, CONSTANTS)
    global algebraicVariableCount;
    statesSize = size(STATES);
    statesColumnCount = statesSize(2);
    if ( statesColumnCount == 1)
        STATES = STATES';
        ALGEBRAIC = zeros(1, algebraicVariableCount);
        utilOnes = 1;
    else
        statesRowCount = statesSize(1);
        ALGEBRAIC = zeros(statesRowCount, algebraicVariableCount);
        RATES = zeros(statesRowCount, statesColumnCount);
        utilOnes = ones(statesRowCount, 1);
    end
    RATES(:,44) = CONSTANTS(:,205);
    RATES(:,35) = ( - ( CONSTANTS(:,67).*exp( CONSTANTS(:,68).*STATES(:,1)).*STATES(:,35).*exp(( (CONSTANTS(:,103) - 20.0000).*log(CONSTANTS(:,69)))./10.0000) -  CONSTANTS(:,70).*exp( CONSTANTS(:,71).*STATES(:,1)).*STATES(:,36).*exp(( (CONSTANTS(:,103) - 20.0000).*log(CONSTANTS(:,72)))./10.0000))+ CONSTANTS(:,79).*exp( CONSTANTS(:,80).*STATES(:,1)).*STATES(:,37).*exp(( (CONSTANTS(:,103) - 20.0000).*log(CONSTANTS(:,81)))./10.0000)) -  CONSTANTS(:,88).*exp( CONSTANTS(:,89).*STATES(:,1)).*STATES(:,35).*exp(( (CONSTANTS(:,103) - 20.0000).*log(CONSTANTS(:,90)))./10.0000);
    RATES(:,36) = ((( CONSTANTS(:,67).*exp( CONSTANTS(:,68).*STATES(:,1)).*STATES(:,35).*exp(( (CONSTANTS(:,103) - 20.0000).*log(CONSTANTS(:,69)))./10.0000) -  CONSTANTS(:,70).*exp( CONSTANTS(:,71).*STATES(:,1)).*STATES(:,36).*exp(( (CONSTANTS(:,103) - 20.0000).*log(CONSTANTS(:,72)))./10.0000)) - ( CONSTANTS(:,61).*exp( CONSTANTS(:,62).*STATES(:,1)).*STATES(:,36).*exp(( (CONSTANTS(:,103) - 20.0000).*log(CONSTANTS(:,63)))./10.0000) -  CONSTANTS(:,64).*exp( CONSTANTS(:,65).*STATES(:,1)).*STATES(:,40).*exp(( (CONSTANTS(:,103) - 20.0000).*log(CONSTANTS(:,66)))./10.0000)))+ CONSTANTS(:,82).*exp( CONSTANTS(:,83).*STATES(:,1)).*STATES(:,38).*exp(( (CONSTANTS(:,103) - 20.0000).*log(CONSTANTS(:,84)))./10.0000)) -  CONSTANTS(:,91).*exp( CONSTANTS(:,92).*STATES(:,1)).*STATES(:,36).*exp(( (CONSTANTS(:,103) - 20.0000).*log(CONSTANTS(:,93)))./10.0000);
    RATES(:,37) =  - ( CONSTANTS(:,55).*exp( CONSTANTS(:,56).*STATES(:,1)).*STATES(:,37).*exp(( (CONSTANTS(:,103) - 20.0000).*log(CONSTANTS(:,57)))./10.0000) -  CONSTANTS(:,58).*exp( CONSTANTS(:,59).*STATES(:,1)).*STATES(:,38).*exp(( (CONSTANTS(:,103) - 20.0000).*log(CONSTANTS(:,60)))./10.0000)) - ( CONSTANTS(:,79).*exp( CONSTANTS(:,80).*STATES(:,1)).*STATES(:,37).*exp(( (CONSTANTS(:,103) - 20.0000).*log(CONSTANTS(:,81)))./10.0000) -  CONSTANTS(:,88).*exp( CONSTANTS(:,89).*STATES(:,1)).*STATES(:,35).*exp(( (CONSTANTS(:,103) - 20.0000).*log(CONSTANTS(:,90)))./10.0000));
    RATES(:,38) = (( CONSTANTS(:,55).*exp( CONSTANTS(:,56).*STATES(:,1)).*STATES(:,37).*exp(( (CONSTANTS(:,103) - 20.0000).*log(CONSTANTS(:,57)))./10.0000) -  CONSTANTS(:,58).*exp( CONSTANTS(:,59).*STATES(:,1)).*STATES(:,38).*exp(( (CONSTANTS(:,103) - 20.0000).*log(CONSTANTS(:,60)))./10.0000)) - ( CONSTANTS(:,73).*exp( CONSTANTS(:,74).*STATES(:,1)).*STATES(:,38).*exp(( (CONSTANTS(:,103) - 20.0000).*log(CONSTANTS(:,75)))./10.0000) -  CONSTANTS(:,76).*exp( CONSTANTS(:,77).*STATES(:,1)).*STATES(:,39).*exp(( (CONSTANTS(:,103) - 20.0000).*log(CONSTANTS(:,78)))./10.0000))) - ( CONSTANTS(:,82).*exp( CONSTANTS(:,83).*STATES(:,1)).*STATES(:,38).*exp(( (CONSTANTS(:,103) - 20.0000).*log(CONSTANTS(:,84)))./10.0000) -  CONSTANTS(:,91).*exp( CONSTANTS(:,92).*STATES(:,1)).*STATES(:,36).*exp(( (CONSTANTS(:,103) - 20.0000).*log(CONSTANTS(:,93)))./10.0000));
    RATES(:,39) = (( CONSTANTS(:,73).*exp( CONSTANTS(:,74).*STATES(:,1)).*STATES(:,38).*exp(( (CONSTANTS(:,103) - 20.0000).*log(CONSTANTS(:,75)))./10.0000) -  CONSTANTS(:,76).*exp( CONSTANTS(:,77).*STATES(:,1)).*STATES(:,39).*exp(( (CONSTANTS(:,103) - 20.0000).*log(CONSTANTS(:,78)))./10.0000)) - ( CONSTANTS(:,85).*exp( CONSTANTS(:,86).*STATES(:,1)).*STATES(:,39).*exp(( (CONSTANTS(:,103) - 20.0000).*log(CONSTANTS(:,87)))./10.0000) -  CONSTANTS(:,94).*exp( CONSTANTS(:,95).*STATES(:,1)).*STATES(:,40).*exp(( (CONSTANTS(:,103) - 20.0000).*log(CONSTANTS(:,96)))./10.0000))) - ( (( CONSTANTS(:,97).*CONSTANTS(:,98).*exp( CONSTANTS(:,99).*log(STATES(:,44))))./(exp( CONSTANTS(:,99).*log(STATES(:,44)))+CONSTANTS(:,100))).*STATES(:,39) -  CONSTANTS(:,98).*STATES(:,42));
    RATES(:,40) = ((( CONSTANTS(:,61).*exp( CONSTANTS(:,62).*STATES(:,1)).*STATES(:,36).*exp(( (CONSTANTS(:,103) - 20.0000).*log(CONSTANTS(:,63)))./10.0000) -  CONSTANTS(:,64).*exp( CONSTANTS(:,65).*STATES(:,1)).*STATES(:,40).*exp(( (CONSTANTS(:,103) - 20.0000).*log(CONSTANTS(:,66)))./10.0000))+ CONSTANTS(:,85).*exp( CONSTANTS(:,86).*STATES(:,1)).*STATES(:,39).*exp(( (CONSTANTS(:,103) - 20.0000).*log(CONSTANTS(:,87)))./10.0000)) -  CONSTANTS(:,94).*exp( CONSTANTS(:,95).*STATES(:,1)).*STATES(:,40).*exp(( (CONSTANTS(:,103) - 20.0000).*log(CONSTANTS(:,96)))./10.0000)) - ( (( CONSTANTS(:,97).*CONSTANTS(:,98).*exp( CONSTANTS(:,99).*log(STATES(:,44))))./(exp( CONSTANTS(:,99).*log(STATES(:,44)))+CONSTANTS(:,100))).*STATES(:,40) -  (( CONSTANTS(:,98).*CONSTANTS(:,85).*exp( CONSTANTS(:,86).*STATES(:,1)).*exp(( (CONSTANTS(:,103) - 20.0000).*log(CONSTANTS(:,87)))./10.0000))./( CONSTANTS(:,94).*exp( CONSTANTS(:,95).*STATES(:,1)).*exp(( (CONSTANTS(:,103) - 20.0000).*log(CONSTANTS(:,96)))./10.0000))).*STATES(:,41));
    RATES(:,41) = (( (( CONSTANTS(:,97).*CONSTANTS(:,98).*exp( CONSTANTS(:,99).*log(STATES(:,44))))./(exp( CONSTANTS(:,99).*log(STATES(:,44)))+CONSTANTS(:,100))).*STATES(:,40) -  (( CONSTANTS(:,98).*CONSTANTS(:,85).*exp( CONSTANTS(:,86).*STATES(:,1)).*exp(( (CONSTANTS(:,103) - 20.0000).*log(CONSTANTS(:,87)))./10.0000))./( CONSTANTS(:,94).*exp( CONSTANTS(:,95).*STATES(:,1)).*exp(( (CONSTANTS(:,103) - 20.0000).*log(CONSTANTS(:,96)))./10.0000))).*STATES(:,41))+ (CONSTANTS(:,101)./(1.00000+exp( - (STATES(:,1) - CONSTANTS(:,102))./6.78900))).*STATES(:,43)) -  CONSTANTS(:,101).*STATES(:,41);
    RATES(:,42) = (( (( CONSTANTS(:,97).*CONSTANTS(:,98).*exp( CONSTANTS(:,99).*log(STATES(:,44))))./(exp( CONSTANTS(:,99).*log(STATES(:,44)))+CONSTANTS(:,100))).*STATES(:,39) -  CONSTANTS(:,98).*STATES(:,42))+ (CONSTANTS(:,101)./(1.00000+exp( - (STATES(:,1) - CONSTANTS(:,102))./6.78900))).*STATES(:,43)) -  CONSTANTS(:,101).*STATES(:,42);
    RATES(:,43) =  - ( (CONSTANTS(:,101)./(1.00000+exp( - (STATES(:,1) - CONSTANTS(:,102))./6.78900))).*STATES(:,43) -  CONSTANTS(:,101).*STATES(:,42)) - ( (CONSTANTS(:,101)./(1.00000+exp( - (STATES(:,1) - CONSTANTS(:,102))./6.78900))).*STATES(:,43) -  CONSTANTS(:,101).*STATES(:,41));
    ALGEBRAIC(:,4) = 1.00000./(1.00000+exp((STATES(:,1)+87.6100)./7.48800));
    RATES(:,18) = (ALGEBRAIC(:,4) - STATES(:,18))./CONSTANTS(:,48);
    ALGEBRAIC(:,5) = 1.00000./(1.00000+exp((STATES(:,1)+93.8100)./7.48800));
    RATES(:,19) = (ALGEBRAIC(:,5) - STATES(:,19))./CONSTANTS(:,153);
    ALGEBRAIC(:,2) = 1.00000./(1.00000+exp( - (STATES(:,1)+CONSTANTS(:,35))./CONSTANTS(:,36)));
    ALGEBRAIC(:,14) = 1.00000./( CONSTANTS(:,39).*exp((STATES(:,1)+CONSTANTS(:,37))./CONSTANTS(:,38))+ CONSTANTS(:,40).*exp( - (STATES(:,1)+CONSTANTS(:,41))./CONSTANTS(:,42)));
    RATES(:,11) = (ALGEBRAIC(:,2) - STATES(:,11))./ALGEBRAIC(:,14);
    ALGEBRAIC(:,3) = 1.00000./(1.00000+exp(((STATES(:,1)+CONSTANTS(:,43)) - CONSTANTS(:,47))./CONSTANTS(:,44)));
    ALGEBRAIC(:,15) = 1.00000./( 1.43200e-05.*exp( - ((STATES(:,1)+1.19600) - CONSTANTS(:,47))./6.28500)+ 6.14900.*exp(((STATES(:,1)+0.509600) - CONSTANTS(:,47))./20.2700));
    RATES(:,12) = (ALGEBRAIC(:,3) - STATES(:,12))./ALGEBRAIC(:,15);
    ALGEBRAIC(:,16) = 1.00000./( 0.00979400.*exp( - ((STATES(:,1)+17.9500) - CONSTANTS(:,47))./28.0500)+ 0.334300.*exp(((STATES(:,1)+5.73000) - CONSTANTS(:,47))./56.6600));
    RATES(:,13) = (ALGEBRAIC(:,3) - STATES(:,13))./ALGEBRAIC(:,16);
    ALGEBRAIC(:,6) = 1.00000./(1.00000+exp( - (STATES(:,1) - 14.3400)./14.8200));
    ALGEBRAIC(:,18) = 1.05150./(1.00000./( 1.20890.*(1.00000+exp( - (STATES(:,1) - 18.4099)./29.3814)))+3.50000./(1.00000+exp((STATES(:,1)+100.000)./29.3814)));
    RATES(:,20) = (ALGEBRAIC(:,6) - STATES(:,20))./ALGEBRAIC(:,18);
    ALGEBRAIC(:,8) = 1.00000./(1.00000+exp( - (STATES(:,1)+3.94000)./4.23000));
    ALGEBRAIC(:,22) = 0.600000+1.00000./(exp(  - 0.0500000.*(STATES(:,1)+6.00000))+exp( 0.0900000.*(STATES(:,1)+14.0000)));
    RATES(:,26) = (ALGEBRAIC(:,8) - STATES(:,26))./ALGEBRAIC(:,22);
    ALGEBRAIC(:,9) = 1.00000./(1.00000+exp((STATES(:,1)+19.5800)./3.69600));
    ALGEBRAIC(:,23) = 7.00000+1.00000./( 0.00450000.*exp( - (STATES(:,1)+20.0000)./10.0000)+ 0.00450000.*exp((STATES(:,1)+20.0000)./10.0000));
    RATES(:,27) = (ALGEBRAIC(:,9) - STATES(:,27))./ALGEBRAIC(:,23);
    ALGEBRAIC(:,24) = 1000.00+1.00000./( 3.50000e-05.*exp( - (STATES(:,1)+5.00000)./4.00000)+ 3.50000e-05.*exp((STATES(:,1)+5.00000)./6.00000));
    RATES(:,28) = (ALGEBRAIC(:,9) - STATES(:,28))./ALGEBRAIC(:,24);
    ALGEBRAIC(:,20) = ALGEBRAIC(:,9);
    RATES(:,31) = (ALGEBRAIC(:,20) - STATES(:,31))./CONSTANTS(:,158);
    ALGEBRAIC(:,10) =  STATES(:,31).*1.00000;
    ALGEBRAIC(:,21) = 1.00000./(CONSTANTS(:,52)./ALGEBRAIC(:,10)+power(1.00000+CONSTANTS(:,51)./STATES(:,3), 4.00000));
    RATES(:,34) =  ALGEBRAIC(:,21).*CONSTANTS(:,52) -  STATES(:,34).*ALGEBRAIC(:,10);
    ALGEBRAIC(:,11) = 1.00000./(1.00000+exp( - (STATES(:,1)+11.6000)./8.93200));
    ALGEBRAIC(:,26) = CONSTANTS(:,105)+1.00000./( 0.000232600.*exp((STATES(:,1)+48.2800)./17.8000)+ 0.00129200.*exp( - (STATES(:,1)+210.000)./230.000));
    RATES(:,45) = (ALGEBRAIC(:,11) - STATES(:,45))./ALGEBRAIC(:,26);
    ALGEBRAIC(:,12) = 1.00000./(1.00000+exp( - (STATES(:,1)+ 2.55380.*CONSTANTS(:,4)+144.590)./( 1.56920.*CONSTANTS(:,4)+3.81150)));
    ALGEBRAIC(:,27) = 122.200./(exp( - (STATES(:,1)+127.200)./20.3600)+exp((STATES(:,1)+236.800)./69.3300));
    RATES(:,47) = (ALGEBRAIC(:,12) - STATES(:,47))./ALGEBRAIC(:,27);
    ALGEBRAIC(:,37) = ( CONSTANTS(:,21).*(1.00000 - STATES(:,2)))./(1.00000+CONSTANTS(:,22)./STATES(:,3));
    RATES(:,2) =  CONSTANTS(:,19).*ALGEBRAIC(:,37).*(ALGEBRAIC(:,37)+STATES(:,2)) -  CONSTANTS(:,20).*STATES(:,2);
    ALGEBRAIC(:,17) = ALGEBRAIC(:,3);
    ALGEBRAIC(:,28) = 2.03800+1.00000./( 0.0213600.*exp( - ((STATES(:,1)+100.600) - CONSTANTS(:,47))./8.28100)+ 0.305200.*exp(((STATES(:,1)+0.994100) - CONSTANTS(:,47))./38.4500));
    RATES(:,14) = (ALGEBRAIC(:,17) - STATES(:,14))./ALGEBRAIC(:,28);
    ALGEBRAIC(:,32) = 1.00000./(1.00000+exp( - (STATES(:,1) - 24.3400)./14.8200));
    RATES(:,23) = (ALGEBRAIC(:,32) - STATES(:,23))./ALGEBRAIC(:,18);
    ALGEBRAIC(:,33) = 7.00000+1.00000./( 0.0400000.*exp( - (STATES(:,1) - 4.00000)./7.00000)+ 0.0400000.*exp((STATES(:,1) - 4.00000)./7.00000));
    RATES(:,29) = (ALGEBRAIC(:,20) - STATES(:,29))./ALGEBRAIC(:,33);
    ALGEBRAIC(:,34) = 100.000+1.00000./( 0.000120000.*exp( - STATES(:,1)./3.00000)+ 0.000120000.*exp(STATES(:,1)./7.00000));
    RATES(:,30) = (ALGEBRAIC(:,20) - STATES(:,30))./ALGEBRAIC(:,34);
    ALGEBRAIC(:,35) =  2.50000.*ALGEBRAIC(:,23);
    RATES(:,32) = (ALGEBRAIC(:,9) - STATES(:,32))./ALGEBRAIC(:,35);
    ALGEBRAIC(:,25) = ALGEBRAIC(:,11);
    ALGEBRAIC(:,36) = 1.00000./( 0.0100000.*exp((STATES(:,1) - 50.0000)./20.0000)+ 0.0193000.*exp( - (STATES(:,1)+66.5400)./31.0000));
    RATES(:,46) = (ALGEBRAIC(:,25) - STATES(:,46))./ALGEBRAIC(:,36);
    ALGEBRAIC(:,29) = 1.00000./(1.00000+exp(((STATES(:,1)+89.1000) - CONSTANTS(:,47))./6.08600));
    ALGEBRAIC(:,38) =  3.00000.*ALGEBRAIC(:,16);
    RATES(:,15) = (ALGEBRAIC(:,29) - STATES(:,15))./ALGEBRAIC(:,38);
    ALGEBRAIC(:,39) =  1.46000.*ALGEBRAIC(:,28);
    RATES(:,16) = (ALGEBRAIC(:,17) - STATES(:,16))./ALGEBRAIC(:,39);
    ALGEBRAIC(:,30) = 1.00000./(1.00000+exp( - (STATES(:,1)+42.8500)./5.26400));
    ALGEBRAIC(:,40) = ALGEBRAIC(:,14);
    RATES(:,17) = (ALGEBRAIC(:,30) - STATES(:,17))./ALGEBRAIC(:,40);
    ALGEBRAIC(:,42) =  2.50000.*ALGEBRAIC(:,33);
    RATES(:,33) = (ALGEBRAIC(:,20) - STATES(:,33))./ALGEBRAIC(:,42);
    ALGEBRAIC(:,7) = 1.00000./(1.00000+exp((STATES(:,1)+43.9400)./5.71100));
    ALGEBRAIC(:,19) = piecewise({CONSTANTS(:,1)==1.00000, 1.00000 - 0.950000./(1.00000+exp((STATES(:,1)+70.0000)./5.00000)) }, 1.00000);
    ALGEBRAIC(:,31) = 4.56200+1.00000./( 0.393300.*exp( - (STATES(:,1)+100.000)./100.000)+ 0.0800400.*exp((STATES(:,1)+50.0000)./16.5900));
    ALGEBRAIC(:,44) =  ALGEBRAIC(:,31).*ALGEBRAIC(:,19);
    RATES(:,21) = (ALGEBRAIC(:,7) - STATES(:,21))./ALGEBRAIC(:,44);
    ALGEBRAIC(:,41) = 23.6200+1.00000./( 0.00141600.*exp( - (STATES(:,1)+96.5200)./59.0500)+ 1.78000e-08.*exp((STATES(:,1)+114.100)./8.07900));
    ALGEBRAIC(:,46) =  ALGEBRAIC(:,41).*ALGEBRAIC(:,19);
    RATES(:,22) = (ALGEBRAIC(:,7) - STATES(:,22))./ALGEBRAIC(:,46);
    ALGEBRAIC(:,48) = 1.35400+0.000100000./(exp((STATES(:,1) - 167.400)./15.8900)+exp( - (STATES(:,1) - 12.2300)./0.215400));
    ALGEBRAIC(:,50) = 1.00000 - 0.500000./(1.00000+exp((STATES(:,1)+70.0000)./20.0000));
    ALGEBRAIC(:,52) =  ALGEBRAIC(:,48).*ALGEBRAIC(:,50).*ALGEBRAIC(:,44);
    RATES(:,24) = (ALGEBRAIC(:,7) - STATES(:,24))./ALGEBRAIC(:,52);
    ALGEBRAIC(:,53) =  ALGEBRAIC(:,48).*ALGEBRAIC(:,50).*ALGEBRAIC(:,46);
    RATES(:,25) = (ALGEBRAIC(:,7) - STATES(:,25))./ALGEBRAIC(:,53);
    ALGEBRAIC(:,68) =  CONSTANTS(:,156).*STATES(:,27)+ CONSTANTS(:,171).*STATES(:,28);
    ALGEBRAIC(:,69) = 0.300000+0.600000./(1.00000+exp((STATES(:,1) - 10.0000)./10.0000));
    ALGEBRAIC(:,70) = 1.00000 - ALGEBRAIC(:,69);
    ALGEBRAIC(:,71) =  ALGEBRAIC(:,69).*STATES(:,29)+ ALGEBRAIC(:,70).*STATES(:,30);
    ALGEBRAIC(:,72) =  CONSTANTS(:,156).*STATES(:,32)+ CONSTANTS(:,171).*STATES(:,28);
    ALGEBRAIC(:,73) =  ALGEBRAIC(:,69).*STATES(:,33)+ ALGEBRAIC(:,70).*STATES(:,30);
    ALGEBRAIC(:,13) =  STATES(:,1).*CONSTANTS(:,150);
    ALGEBRAIC(:,74) = ( 4.00000.*CONSTANTS(:,170).*( STATES(:,3).*exp( 2.00000.*ALGEBRAIC(:,13)) -  0.341000.*CONSTANTS(:,3)))./CONSTANTS(:,175);
    ALGEBRAIC(:,75) =  CONSTANTS(:,175).*(STATES(:,1) - CONSTANTS(:,159));
    ALGEBRAIC(:,76) = piecewise({ - 1.00000e-07<=ALGEBRAIC(:,75)&ALGEBRAIC(:,75)<=1.00000e-07,  ALGEBRAIC(:,74).*(1.00000 -  0.500000.*ALGEBRAIC(:,75)) }, ( ALGEBRAIC(:,74).*ALGEBRAIC(:,75))./(exp(ALGEBRAIC(:,75)) - 1.00000));
    ALGEBRAIC(:,43) = ALGEBRAIC(:,37)+STATES(:,2);
    ALGEBRAIC(:,83) = 1.00000./(1.00000+CONSTANTS(:,18)./ALGEBRAIC(:,43));
    ALGEBRAIC(:,84) =  (1.00000 - ALGEBRAIC(:,83)).*CONSTANTS(:,157).*ALGEBRAIC(:,76).*STATES(:,26).*( ALGEBRAIC(:,68).*(1.00000 - STATES(:,34))+ STATES(:,31).*ALGEBRAIC(:,71).*STATES(:,34))+ ALGEBRAIC(:,83).*CONSTANTS(:,172).*ALGEBRAIC(:,76).*STATES(:,26).*( ALGEBRAIC(:,72).*(1.00000 - STATES(:,34))+ STATES(:,31).*ALGEBRAIC(:,73).*STATES(:,34));
    ALGEBRAIC(:,86) = ( CONSTANTS(:,167).* - ALGEBRAIC(:,84))./(1.00000+ 1.00000.*power(1.50000./STATES(:,9), 8.00000));
    ALGEBRAIC(:,89) = piecewise({CONSTANTS(:,1)==2.00000,  ALGEBRAIC(:,86).*1.70000 }, ALGEBRAIC(:,86));
    ALGEBRAIC(:,92) = CONSTANTS(:,147)./(1.00000+0.0123000./STATES(:,9));
    ALGEBRAIC(:,95) = piecewise({ALGEBRAIC(:,92)<0.00100000, 0.00100000 }, ALGEBRAIC(:,92));
    RATES(:,48) = (ALGEBRAIC(:,89) - STATES(:,48))./ALGEBRAIC(:,95);
    ALGEBRAIC(:,87) = ( CONSTANTS(:,181).* - ALGEBRAIC(:,84))./(1.00000+power(1.50000./STATES(:,9), 8.00000));
    ALGEBRAIC(:,90) = piecewise({CONSTANTS(:,1)==2.00000,  ALGEBRAIC(:,87).*1.70000 }, ALGEBRAIC(:,87));
    ALGEBRAIC(:,93) = CONSTANTS(:,168)./(1.00000+0.0123000./STATES(:,9));
    ALGEBRAIC(:,96) = piecewise({ALGEBRAIC(:,93)<0.00100000, 0.00100000 }, ALGEBRAIC(:,93));
    RATES(:,49) = (ALGEBRAIC(:,90) - STATES(:,49))./ALGEBRAIC(:,96);
    ALGEBRAIC(:,54) =  (( CONSTANTS(:,5).*CONSTANTS(:,6))./CONSTANTS(:,7)).*log(CONSTANTS(:,4)./STATES(:,6));
    ALGEBRAIC(:,62) = 1.00000./(1.00000+exp((STATES(:,1) - 213.600)./151.200));
    ALGEBRAIC(:,63) = 1.00000 - ALGEBRAIC(:,62);
    ALGEBRAIC(:,64) =  ALGEBRAIC(:,62).*STATES(:,21)+ ALGEBRAIC(:,63).*STATES(:,22);
    ALGEBRAIC(:,65) =  ALGEBRAIC(:,62).*STATES(:,24)+ ALGEBRAIC(:,63).*STATES(:,25);
    ALGEBRAIC(:,66) = 1.00000./(1.00000+CONSTANTS(:,18)./ALGEBRAIC(:,43));
    ALGEBRAIC(:,67) =  CONSTANTS(:,155).*(STATES(:,1) - ALGEBRAIC(:,54)).*( (1.00000 - ALGEBRAIC(:,66)).*STATES(:,20).*ALGEBRAIC(:,64)+ ALGEBRAIC(:,66).*STATES(:,23).*ALGEBRAIC(:,65));
    ALGEBRAIC(:,91) =  CONSTANTS(:,160).*power((CONSTANTS(:,4)./5.40000), 1.0 ./ 2).*STATES(:,39).*(STATES(:,1) - ALGEBRAIC(:,54));
    ALGEBRAIC(:,55) =  (( CONSTANTS(:,5).*CONSTANTS(:,6))./CONSTANTS(:,7)).*log((CONSTANTS(:,4)+ CONSTANTS(:,34).*CONSTANTS(:,2))./(STATES(:,6)+ CONSTANTS(:,34).*STATES(:,4)));
    ALGEBRAIC(:,94) = 1.00000+0.600000./(1.00000+power(3.80000e-05./STATES(:,10), 1.40000));
    ALGEBRAIC(:,97) =  CONSTANTS(:,161).*ALGEBRAIC(:,94).*STATES(:,45).*STATES(:,46).*(STATES(:,1) - ALGEBRAIC(:,55));
    ALGEBRAIC(:,98) = 1.00000./(1.00000+exp(((STATES(:,1)+105.800) -  2.60000.*CONSTANTS(:,4))./9.49300));
    ALGEBRAIC(:,99) =  CONSTANTS(:,162).*power(CONSTANTS(:,4), 1.0 ./ 2).*ALGEBRAIC(:,98).*STATES(:,47).*(STATES(:,1) - ALGEBRAIC(:,54));
    ALGEBRAIC(:,163) =  CONSTANTS(:,129).*exp(( (1.00000 - CONSTANTS(:,130)).*STATES(:,1).*CONSTANTS(:,7))./( 3.00000.*CONSTANTS(:,5).*CONSTANTS(:,6)));
    ALGEBRAIC(:,167) = ( CONSTANTS(:,124).*power(CONSTANTS(:,4)./CONSTANTS(:,132), 2.00000))./((power(1.00000+CONSTANTS(:,2)./ALGEBRAIC(:,163), 3.00000)+power(1.00000+CONSTANTS(:,4)./CONSTANTS(:,132), 2.00000)) - 1.00000);
    ALGEBRAIC(:,164) = CONSTANTS(:,137)./(1.00000+CONSTANTS(:,136)./CONSTANTS(:,138)+STATES(:,4)./CONSTANTS(:,139)+STATES(:,6)./CONSTANTS(:,140));
    ALGEBRAIC(:,168) = ( CONSTANTS(:,125).*ALGEBRAIC(:,164).*CONSTANTS(:,136))./(1.00000+CONSTANTS(:,134)./CONSTANTS(:,135));
    ALGEBRAIC(:,162) =  CONSTANTS(:,128).*exp(( CONSTANTS(:,130).*STATES(:,1).*CONSTANTS(:,7))./( 3.00000.*CONSTANTS(:,5).*CONSTANTS(:,6)));
    ALGEBRAIC(:,165) = ( CONSTANTS(:,120).*power(STATES(:,4)./ALGEBRAIC(:,162), 3.00000))./((power(1.00000+STATES(:,4)./ALGEBRAIC(:,162), 3.00000)+power(1.00000+STATES(:,6)./CONSTANTS(:,131), 2.00000)) - 1.00000);
    ALGEBRAIC(:,166) = ( CONSTANTS(:,123).*power(CONSTANTS(:,2)./ALGEBRAIC(:,163), 3.00000))./((power(1.00000+CONSTANTS(:,2)./ALGEBRAIC(:,163), 3.00000)+power(1.00000+CONSTANTS(:,4)./CONSTANTS(:,132), 2.00000)) - 1.00000);
    ALGEBRAIC(:,169) = ( CONSTANTS(:,127).*power(STATES(:,6)./CONSTANTS(:,131), 2.00000))./((power(1.00000+STATES(:,4)./ALGEBRAIC(:,162), 3.00000)+power(1.00000+STATES(:,6)./CONSTANTS(:,131), 2.00000)) - 1.00000);
    ALGEBRAIC(:,170) =  CONSTANTS(:,204).*ALGEBRAIC(:,165).*CONSTANTS(:,203)+ ALGEBRAIC(:,166).*ALGEBRAIC(:,169).*ALGEBRAIC(:,168)+ CONSTANTS(:,203).*ALGEBRAIC(:,169).*ALGEBRAIC(:,168)+ ALGEBRAIC(:,168).*ALGEBRAIC(:,165).*CONSTANTS(:,203);
    ALGEBRAIC(:,171) =  ALGEBRAIC(:,166).*CONSTANTS(:,202).*ALGEBRAIC(:,169)+ ALGEBRAIC(:,165).*CONSTANTS(:,203).*ALGEBRAIC(:,167)+ ALGEBRAIC(:,167).*CONSTANTS(:,202).*ALGEBRAIC(:,169)+ CONSTANTS(:,203).*ALGEBRAIC(:,167).*ALGEBRAIC(:,169);
    ALGEBRAIC(:,172) =  CONSTANTS(:,203).*ALGEBRAIC(:,167).*CONSTANTS(:,204)+ ALGEBRAIC(:,168).*ALGEBRAIC(:,166).*CONSTANTS(:,202)+ ALGEBRAIC(:,166).*CONSTANTS(:,202).*CONSTANTS(:,204)+ ALGEBRAIC(:,167).*CONSTANTS(:,204).*CONSTANTS(:,202);
    ALGEBRAIC(:,173) =  ALGEBRAIC(:,169).*ALGEBRAIC(:,168).*ALGEBRAIC(:,166)+ ALGEBRAIC(:,167).*CONSTANTS(:,204).*ALGEBRAIC(:,165)+ ALGEBRAIC(:,166).*CONSTANTS(:,204).*ALGEBRAIC(:,165)+ ALGEBRAIC(:,168).*ALGEBRAIC(:,166).*ALGEBRAIC(:,165);
    ALGEBRAIC(:,174) = ALGEBRAIC(:,170)./(ALGEBRAIC(:,170)+ALGEBRAIC(:,171)+ALGEBRAIC(:,172)+ALGEBRAIC(:,173));
    ALGEBRAIC(:,175) = ALGEBRAIC(:,171)./(ALGEBRAIC(:,170)+ALGEBRAIC(:,171)+ALGEBRAIC(:,172)+ALGEBRAIC(:,173));
    ALGEBRAIC(:,178) =  3.00000.*( ALGEBRAIC(:,174).*ALGEBRAIC(:,167) -  ALGEBRAIC(:,175).*ALGEBRAIC(:,168));
    ALGEBRAIC(:,176) = ALGEBRAIC(:,172)./(ALGEBRAIC(:,170)+ALGEBRAIC(:,171)+ALGEBRAIC(:,172)+ALGEBRAIC(:,173));
    ALGEBRAIC(:,177) = ALGEBRAIC(:,173)./(ALGEBRAIC(:,170)+ALGEBRAIC(:,171)+ALGEBRAIC(:,172)+ALGEBRAIC(:,173));
    ALGEBRAIC(:,179) =  2.00000.*( ALGEBRAIC(:,177).*CONSTANTS(:,202) -  ALGEBRAIC(:,176).*ALGEBRAIC(:,165));
    ALGEBRAIC(:,180) =  CONSTANTS(:,205).*( CONSTANTS(:,8).*ALGEBRAIC(:,178)+ CONSTANTS(:,10).*ALGEBRAIC(:,179));
    ALGEBRAIC(:,181) = 1.00000./(1.00000+exp( - (STATES(:,1) - 14.4800)./18.3400));
    ALGEBRAIC(:,182) =  CONSTANTS(:,164).*ALGEBRAIC(:,181).*(STATES(:,1) - ALGEBRAIC(:,54));
    ALGEBRAIC(:,1) = piecewise({VOI>=CONSTANTS(:,13)&VOI<=CONSTANTS(:,14)&(VOI - CONSTANTS(:,13)) -  floor((VOI - CONSTANTS(:,13))./CONSTANTS(:,16)).*CONSTANTS(:,16)<=CONSTANTS(:,17), CONSTANTS(:,15) }, 0.00000);
    ALGEBRAIC(:,184) = (STATES(:,7) - STATES(:,6))./2.00000;
    RATES(:,6) = (  - ((ALGEBRAIC(:,67)+ALGEBRAIC(:,91)+ALGEBRAIC(:,97)+ALGEBRAIC(:,99)+ALGEBRAIC(:,182)+ALGEBRAIC(:,1)) -  2.00000.*ALGEBRAIC(:,180)).*CONSTANTS(:,33).*CONSTANTS(:,184))./( CONSTANTS(:,7).*CONSTANTS(:,185))+( ALGEBRAIC(:,184).*CONSTANTS(:,188))./CONSTANTS(:,185);
    ALGEBRAIC(:,80) = ( 0.750000.*CONSTANTS(:,170).*( STATES(:,7).*exp(ALGEBRAIC(:,13)) - CONSTANTS(:,4)))./CONSTANTS(:,177);
    ALGEBRAIC(:,81) =  CONSTANTS(:,177).*(STATES(:,1) - CONSTANTS(:,159));
    ALGEBRAIC(:,82) = piecewise({ - 1.00000e-07<=ALGEBRAIC(:,81)&ALGEBRAIC(:,81)<=1.00000e-07,  ALGEBRAIC(:,80).*(1.00000 -  0.500000.*ALGEBRAIC(:,81)) }, ( ALGEBRAIC(:,80).*ALGEBRAIC(:,81))./(exp(ALGEBRAIC(:,81)) - 1.00000));
    ALGEBRAIC(:,88) =  (1.00000 - ALGEBRAIC(:,83)).*CONSTANTS(:,174).*ALGEBRAIC(:,82).*STATES(:,26).*( ALGEBRAIC(:,68).*(1.00000 - STATES(:,34))+ STATES(:,31).*ALGEBRAIC(:,71).*STATES(:,34))+ ALGEBRAIC(:,83).*CONSTANTS(:,183).*ALGEBRAIC(:,82).*STATES(:,26).*( ALGEBRAIC(:,72).*(1.00000 - STATES(:,34))+ STATES(:,31).*ALGEBRAIC(:,73).*STATES(:,34));
    RATES(:,7) = (  - ALGEBRAIC(:,88).*CONSTANTS(:,33).*CONSTANTS(:,184))./( CONSTANTS(:,7).*CONSTANTS(:,188)) - ALGEBRAIC(:,184);
    ALGEBRAIC(:,51) =  (( CONSTANTS(:,5).*CONSTANTS(:,6))./CONSTANTS(:,7)).*log(CONSTANTS(:,2)./STATES(:,4));
    ALGEBRAIC(:,56) =  CONSTANTS(:,45).*STATES(:,12)+ CONSTANTS(:,152).*STATES(:,13);
    ALGEBRAIC(:,57) =  CONSTANTS(:,45).*STATES(:,12)+ CONSTANTS(:,152).*STATES(:,15);
    ALGEBRAIC(:,58) = 1.00000./(1.00000+CONSTANTS(:,18)./ALGEBRAIC(:,43));
    ALGEBRAIC(:,59) =  CONSTANTS(:,46).*(STATES(:,1) - ALGEBRAIC(:,51)).*power(STATES(:,11), 3.00000).*( (1.00000 - ALGEBRAIC(:,58)).*ALGEBRAIC(:,56).*STATES(:,14)+ ALGEBRAIC(:,58).*ALGEBRAIC(:,57).*STATES(:,16));
    ALGEBRAIC(:,60) = 1.00000./(1.00000+CONSTANTS(:,18)./ALGEBRAIC(:,43));
    ALGEBRAIC(:,61) =  CONSTANTS(:,154).*(STATES(:,1) - ALGEBRAIC(:,51)).*STATES(:,17).*( (1.00000 - ALGEBRAIC(:,60)).*STATES(:,18)+ ALGEBRAIC(:,60).*STATES(:,19));
    ALGEBRAIC(:,128) = 1.00000./(1.00000+power(CONSTANTS(:,118)./STATES(:,10), 2.00000));
    ALGEBRAIC(:,101) = exp(( CONSTANTS(:,116).*STATES(:,1).*CONSTANTS(:,7))./( CONSTANTS(:,5).*CONSTANTS(:,6)));
    ALGEBRAIC(:,108) = 1.00000+ (CONSTANTS(:,2)./CONSTANTS(:,109)).*(1.00000+1.00000./ALGEBRAIC(:,101));
    ALGEBRAIC(:,109) = CONSTANTS(:,2)./( CONSTANTS(:,109).*ALGEBRAIC(:,101).*ALGEBRAIC(:,108));
    ALGEBRAIC(:,112) =  ALGEBRAIC(:,109).*CONSTANTS(:,113);
    ALGEBRAIC(:,102) = 1.00000+ (STATES(:,4)./CONSTANTS(:,109)).*(1.00000+ALGEBRAIC(:,101));
    ALGEBRAIC(:,103) = ( STATES(:,4).*ALGEBRAIC(:,101))./( CONSTANTS(:,109).*ALGEBRAIC(:,102));
    ALGEBRAIC(:,115) =  ALGEBRAIC(:,103).*CONSTANTS(:,113);
    ALGEBRAIC(:,105) = 1.00000+ (STATES(:,4)./CONSTANTS(:,107)).*(1.00000+STATES(:,4)./CONSTANTS(:,108));
    ALGEBRAIC(:,106) = ( STATES(:,4).*STATES(:,4))./( ALGEBRAIC(:,105).*CONSTANTS(:,107).*CONSTANTS(:,108));
    ALGEBRAIC(:,118) =  ALGEBRAIC(:,106).*ALGEBRAIC(:,103).*CONSTANTS(:,111);
    ALGEBRAIC(:,119) =  ALGEBRAIC(:,109).*CONSTANTS(:,190).*CONSTANTS(:,111);
    ALGEBRAIC(:,110) = 1.00000./ALGEBRAIC(:,108);
    ALGEBRAIC(:,111) =  ALGEBRAIC(:,110).*CONSTANTS(:,112);
    ALGEBRAIC(:,113) = ALGEBRAIC(:,111)+ALGEBRAIC(:,112);
    ALGEBRAIC(:,100) = exp(( CONSTANTS(:,117).*STATES(:,1).*CONSTANTS(:,7))./( CONSTANTS(:,5).*CONSTANTS(:,6)));
    ALGEBRAIC(:,104) = 1.00000./ALGEBRAIC(:,102);
    ALGEBRAIC(:,114) = ( ALGEBRAIC(:,104).*CONSTANTS(:,112))./ALGEBRAIC(:,100);
    ALGEBRAIC(:,116) = ALGEBRAIC(:,114)+ALGEBRAIC(:,115);
    ALGEBRAIC(:,107) = 1.00000./ALGEBRAIC(:,105);
    ALGEBRAIC(:,117) =  ALGEBRAIC(:,107).*STATES(:,10).*CONSTANTS(:,114);
    ALGEBRAIC(:,120) =  CONSTANTS(:,193).*ALGEBRAIC(:,116).*(ALGEBRAIC(:,118)+ALGEBRAIC(:,117))+ CONSTANTS(:,194).*ALGEBRAIC(:,118).*(CONSTANTS(:,193)+ALGEBRAIC(:,113));
    ALGEBRAIC(:,121) =  CONSTANTS(:,192).*ALGEBRAIC(:,118).*(ALGEBRAIC(:,116)+CONSTANTS(:,194))+ ALGEBRAIC(:,116).*ALGEBRAIC(:,117).*(CONSTANTS(:,192)+ALGEBRAIC(:,119));
    ALGEBRAIC(:,122) =  CONSTANTS(:,192).*ALGEBRAIC(:,113).*(ALGEBRAIC(:,118)+ALGEBRAIC(:,117))+ ALGEBRAIC(:,119).*ALGEBRAIC(:,117).*(CONSTANTS(:,193)+ALGEBRAIC(:,113));
    ALGEBRAIC(:,123) =  CONSTANTS(:,193).*ALGEBRAIC(:,119).*(ALGEBRAIC(:,116)+CONSTANTS(:,194))+ ALGEBRAIC(:,113).*CONSTANTS(:,194).*(CONSTANTS(:,192)+ALGEBRAIC(:,119));
    ALGEBRAIC(:,124) = ALGEBRAIC(:,120)./(ALGEBRAIC(:,120)+ALGEBRAIC(:,121)+ALGEBRAIC(:,122)+ALGEBRAIC(:,123));
    ALGEBRAIC(:,125) = ALGEBRAIC(:,121)./(ALGEBRAIC(:,120)+ALGEBRAIC(:,121)+ALGEBRAIC(:,122)+ALGEBRAIC(:,123));
    ALGEBRAIC(:,126) = ALGEBRAIC(:,122)./(ALGEBRAIC(:,120)+ALGEBRAIC(:,121)+ALGEBRAIC(:,122)+ALGEBRAIC(:,123));
    ALGEBRAIC(:,127) = ALGEBRAIC(:,123)./(ALGEBRAIC(:,120)+ALGEBRAIC(:,121)+ALGEBRAIC(:,122)+ALGEBRAIC(:,123));
    ALGEBRAIC(:,129) = ( 3.00000.*( ALGEBRAIC(:,127).*ALGEBRAIC(:,118) -  ALGEBRAIC(:,124).*ALGEBRAIC(:,119))+ ALGEBRAIC(:,126).*ALGEBRAIC(:,115)) -  ALGEBRAIC(:,125).*ALGEBRAIC(:,112);
    ALGEBRAIC(:,130) =  ALGEBRAIC(:,125).*CONSTANTS(:,193) -  ALGEBRAIC(:,124).*CONSTANTS(:,192);
    ALGEBRAIC(:,131) =  0.800000.*CONSTANTS(:,195).*ALGEBRAIC(:,128).*( CONSTANTS(:,8).*ALGEBRAIC(:,129)+ CONSTANTS(:,9).*ALGEBRAIC(:,130));
    ALGEBRAIC(:,183) = ( CONSTANTS(:,143).*CONSTANTS(:,170).*( STATES(:,4).*exp(ALGEBRAIC(:,13)) - CONSTANTS(:,2)))./CONSTANTS(:,179);
    ALGEBRAIC(:,185) =  CONSTANTS(:,179).*(STATES(:,1) - CONSTANTS(:,165));
    ALGEBRAIC(:,186) = piecewise({ - 1.00000e-07<=ALGEBRAIC(:,185)&ALGEBRAIC(:,185)<=1.00000e-07,  ALGEBRAIC(:,183).*(1.00000 -  0.500000.*ALGEBRAIC(:,185)) }, ( ALGEBRAIC(:,183).*ALGEBRAIC(:,185))./(exp(ALGEBRAIC(:,185)) - 1.00000));
    ALGEBRAIC(:,188) = (STATES(:,5) - STATES(:,4))./2.00000;
    RATES(:,4) = (  - (ALGEBRAIC(:,59)+ALGEBRAIC(:,61)+ 3.00000.*ALGEBRAIC(:,131)+ 3.00000.*ALGEBRAIC(:,180)+ALGEBRAIC(:,186)).*CONSTANTS(:,184).*CONSTANTS(:,33))./( CONSTANTS(:,7).*CONSTANTS(:,185))+( ALGEBRAIC(:,188).*CONSTANTS(:,188))./CONSTANTS(:,185);
    ALGEBRAIC(:,77) = ( 0.750000.*CONSTANTS(:,170).*( STATES(:,5).*exp(ALGEBRAIC(:,13)) - CONSTANTS(:,2)))./CONSTANTS(:,176);
    ALGEBRAIC(:,78) =  CONSTANTS(:,176).*(STATES(:,1) - CONSTANTS(:,159));
    ALGEBRAIC(:,79) = piecewise({ - 1.00000e-07<=ALGEBRAIC(:,78)&ALGEBRAIC(:,78)<=1.00000e-07,  ALGEBRAIC(:,77).*(1.00000 -  0.500000.*ALGEBRAIC(:,78)) }, ( ALGEBRAIC(:,77).*ALGEBRAIC(:,78))./(exp(ALGEBRAIC(:,78)) - 1.00000));
    ALGEBRAIC(:,85) =  (1.00000 - ALGEBRAIC(:,83)).*CONSTANTS(:,173).*ALGEBRAIC(:,79).*STATES(:,26).*( ALGEBRAIC(:,68).*(1.00000 - STATES(:,34))+ STATES(:,31).*ALGEBRAIC(:,71).*STATES(:,34))+ ALGEBRAIC(:,83).*CONSTANTS(:,182).*ALGEBRAIC(:,79).*STATES(:,26).*( ALGEBRAIC(:,72).*(1.00000 - STATES(:,34))+ STATES(:,31).*ALGEBRAIC(:,73).*STATES(:,34));
    ALGEBRAIC(:,158) = 1.00000./(1.00000+power(CONSTANTS(:,118)./STATES(:,3), 2.00000));
    ALGEBRAIC(:,138) = 1.00000+ (CONSTANTS(:,2)./CONSTANTS(:,109)).*(1.00000+1.00000./ALGEBRAIC(:,101));
    ALGEBRAIC(:,139) = CONSTANTS(:,2)./( CONSTANTS(:,109).*ALGEBRAIC(:,101).*ALGEBRAIC(:,138));
    ALGEBRAIC(:,142) =  ALGEBRAIC(:,139).*CONSTANTS(:,113);
    ALGEBRAIC(:,132) = 1.00000+ (STATES(:,5)./CONSTANTS(:,109)).*(1.00000+ALGEBRAIC(:,101));
    ALGEBRAIC(:,133) = ( STATES(:,5).*ALGEBRAIC(:,101))./( CONSTANTS(:,109).*ALGEBRAIC(:,132));
    ALGEBRAIC(:,145) =  ALGEBRAIC(:,133).*CONSTANTS(:,113);
    ALGEBRAIC(:,135) = 1.00000+ (STATES(:,5)./CONSTANTS(:,107)).*(1.00000+STATES(:,5)./CONSTANTS(:,108));
    ALGEBRAIC(:,136) = ( STATES(:,5).*STATES(:,5))./( ALGEBRAIC(:,135).*CONSTANTS(:,107).*CONSTANTS(:,108));
    ALGEBRAIC(:,148) =  ALGEBRAIC(:,136).*ALGEBRAIC(:,133).*CONSTANTS(:,111);
    ALGEBRAIC(:,149) =  ALGEBRAIC(:,139).*CONSTANTS(:,197).*CONSTANTS(:,111);
    ALGEBRAIC(:,140) = 1.00000./ALGEBRAIC(:,138);
    ALGEBRAIC(:,141) =  ALGEBRAIC(:,140).*CONSTANTS(:,112);
    ALGEBRAIC(:,143) = ALGEBRAIC(:,141)+ALGEBRAIC(:,142);
    ALGEBRAIC(:,134) = 1.00000./ALGEBRAIC(:,132);
    ALGEBRAIC(:,144) = ( ALGEBRAIC(:,134).*CONSTANTS(:,112))./ALGEBRAIC(:,100);
    ALGEBRAIC(:,146) = ALGEBRAIC(:,144)+ALGEBRAIC(:,145);
    ALGEBRAIC(:,137) = 1.00000./ALGEBRAIC(:,135);
    ALGEBRAIC(:,147) =  ALGEBRAIC(:,137).*STATES(:,3).*CONSTANTS(:,114);
    ALGEBRAIC(:,150) =  CONSTANTS(:,200).*ALGEBRAIC(:,146).*(ALGEBRAIC(:,148)+ALGEBRAIC(:,147))+ CONSTANTS(:,201).*ALGEBRAIC(:,148).*(CONSTANTS(:,200)+ALGEBRAIC(:,143));
    ALGEBRAIC(:,151) =  CONSTANTS(:,199).*ALGEBRAIC(:,148).*(ALGEBRAIC(:,146)+CONSTANTS(:,201))+ ALGEBRAIC(:,146).*ALGEBRAIC(:,147).*(CONSTANTS(:,199)+ALGEBRAIC(:,149));
    ALGEBRAIC(:,152) =  CONSTANTS(:,199).*ALGEBRAIC(:,143).*(ALGEBRAIC(:,148)+ALGEBRAIC(:,147))+ ALGEBRAIC(:,149).*ALGEBRAIC(:,147).*(CONSTANTS(:,200)+ALGEBRAIC(:,143));
    ALGEBRAIC(:,153) =  CONSTANTS(:,200).*ALGEBRAIC(:,149).*(ALGEBRAIC(:,146)+CONSTANTS(:,201))+ ALGEBRAIC(:,143).*CONSTANTS(:,201).*(CONSTANTS(:,199)+ALGEBRAIC(:,149));
    ALGEBRAIC(:,154) = ALGEBRAIC(:,150)./(ALGEBRAIC(:,150)+ALGEBRAIC(:,151)+ALGEBRAIC(:,152)+ALGEBRAIC(:,153));
    ALGEBRAIC(:,155) = ALGEBRAIC(:,151)./(ALGEBRAIC(:,150)+ALGEBRAIC(:,151)+ALGEBRAIC(:,152)+ALGEBRAIC(:,153));
    ALGEBRAIC(:,156) = ALGEBRAIC(:,152)./(ALGEBRAIC(:,150)+ALGEBRAIC(:,151)+ALGEBRAIC(:,152)+ALGEBRAIC(:,153));
    ALGEBRAIC(:,157) = ALGEBRAIC(:,153)./(ALGEBRAIC(:,150)+ALGEBRAIC(:,151)+ALGEBRAIC(:,152)+ALGEBRAIC(:,153));
    ALGEBRAIC(:,159) = ( 3.00000.*( ALGEBRAIC(:,157).*ALGEBRAIC(:,148) -  ALGEBRAIC(:,154).*ALGEBRAIC(:,149))+ ALGEBRAIC(:,156).*ALGEBRAIC(:,145)) -  ALGEBRAIC(:,155).*ALGEBRAIC(:,142);
    ALGEBRAIC(:,160) =  ALGEBRAIC(:,155).*CONSTANTS(:,200) -  ALGEBRAIC(:,154).*CONSTANTS(:,199);
    ALGEBRAIC(:,161) =  0.200000.*CONSTANTS(:,195).*ALGEBRAIC(:,158).*( CONSTANTS(:,8).*ALGEBRAIC(:,159)+ CONSTANTS(:,9).*ALGEBRAIC(:,160));
    RATES(:,5) = (  - (ALGEBRAIC(:,85)+ 3.00000.*ALGEBRAIC(:,161)).*CONSTANTS(:,33).*CONSTANTS(:,184))./( CONSTANTS(:,7).*CONSTANTS(:,188)) - ALGEBRAIC(:,188);
    ALGEBRAIC(:,191) = ( CONSTANTS(:,145).*STATES(:,10))./(CONSTANTS(:,146)+STATES(:,10));
    ALGEBRAIC(:,187) = ( CONSTANTS(:,144).*4.00000.*CONSTANTS(:,170).*( STATES(:,10).*exp( 2.00000.*ALGEBRAIC(:,13)) -  0.341000.*CONSTANTS(:,3)))./CONSTANTS(:,180);
    ALGEBRAIC(:,189) =  CONSTANTS(:,180).*(STATES(:,1) - CONSTANTS(:,166));
    ALGEBRAIC(:,190) = piecewise({ - 1.00000e-07<=ALGEBRAIC(:,189)&ALGEBRAIC(:,189)<=1.00000e-07,  ALGEBRAIC(:,187).*(1.00000 -  0.500000.*ALGEBRAIC(:,189)) }, ( ALGEBRAIC(:,187).*ALGEBRAIC(:,189))./(exp(ALGEBRAIC(:,189)) - 1.00000));
    RATES(:,1) =  - (ALGEBRAIC(:,59)+ALGEBRAIC(:,61)+ALGEBRAIC(:,67)+ALGEBRAIC(:,84)+ALGEBRAIC(:,85)+ALGEBRAIC(:,88)+ALGEBRAIC(:,91)+ALGEBRAIC(:,97)+ALGEBRAIC(:,99)+ALGEBRAIC(:,131)+ALGEBRAIC(:,161)+ALGEBRAIC(:,180)+ALGEBRAIC(:,186)+ALGEBRAIC(:,182)+ALGEBRAIC(:,191)+ALGEBRAIC(:,190)+ALGEBRAIC(:,1));
    ALGEBRAIC(:,192) = (STATES(:,3) - STATES(:,10))./0.200000;
    ALGEBRAIC(:,193) = 1.00000./(1.00000+CONSTANTS(:,18)./ALGEBRAIC(:,43));
    ALGEBRAIC(:,194) =  CONSTANTS(:,148).*( (1.00000 - ALGEBRAIC(:,193)).*STATES(:,48)+ ALGEBRAIC(:,193).*STATES(:,49));
    ALGEBRAIC(:,47) = 1.00000./(1.00000+( CONSTANTS(:,27).*CONSTANTS(:,28))./power(CONSTANTS(:,28)+STATES(:,3), 2.00000)+( CONSTANTS(:,29).*CONSTANTS(:,30))./power(CONSTANTS(:,30)+STATES(:,3), 2.00000));
    RATES(:,3) =  ALGEBRAIC(:,47).*(((  - (ALGEBRAIC(:,84) -  2.00000.*ALGEBRAIC(:,161)).*CONSTANTS(:,33).*CONSTANTS(:,184))./( 2.00000.*CONSTANTS(:,7).*CONSTANTS(:,188))+( ALGEBRAIC(:,194).*CONSTANTS(:,187))./CONSTANTS(:,188)) - ALGEBRAIC(:,192));
    ALGEBRAIC(:,195) = ( CONSTANTS(:,169).*0.00437500.*STATES(:,10))./(STATES(:,10)+0.000920000);
    ALGEBRAIC(:,196) = ( CONSTANTS(:,169).*2.75000.*0.00437500.*STATES(:,10))./((STATES(:,10)+0.000920000) - 0.000170000);
    ALGEBRAIC(:,197) = 1.00000./(1.00000+CONSTANTS(:,18)./ALGEBRAIC(:,43));
    ALGEBRAIC(:,198) = ( 0.00393750.*STATES(:,8))./15.0000;
    ALGEBRAIC(:,199) =  CONSTANTS(:,149).*(( (1.00000 - ALGEBRAIC(:,197)).*ALGEBRAIC(:,195)+ ALGEBRAIC(:,197).*ALGEBRAIC(:,196)) - ALGEBRAIC(:,198));
    ALGEBRAIC(:,45) = 1.00000./(1.00000+( CONSTANTS(:,151).*CONSTANTS(:,24))./power(CONSTANTS(:,24)+STATES(:,10), 2.00000)+( CONSTANTS(:,25).*CONSTANTS(:,26))./power(CONSTANTS(:,26)+STATES(:,10), 2.00000));
    RATES(:,10) =  ALGEBRAIC(:,45).*(((  - ((ALGEBRAIC(:,191)+ALGEBRAIC(:,190)) -  2.00000.*ALGEBRAIC(:,131)).*CONSTANTS(:,33).*CONSTANTS(:,184))./( 2.00000.*CONSTANTS(:,7).*CONSTANTS(:,185)) - ( ALGEBRAIC(:,199).*CONSTANTS(:,186))./CONSTANTS(:,185))+( ALGEBRAIC(:,192).*CONSTANTS(:,188))./CONSTANTS(:,185));
    ALGEBRAIC(:,200) = (STATES(:,8) - STATES(:,9))./100.000;
    RATES(:,8) = ALGEBRAIC(:,199) - ( ALGEBRAIC(:,200).*CONSTANTS(:,187))./CONSTANTS(:,186);
    ALGEBRAIC(:,49) = 1.00000./(1.00000+( CONSTANTS(:,31).*CONSTANTS(:,32))./power(CONSTANTS(:,32)+STATES(:,9), 2.00000));
    RATES(:,9) =  ALGEBRAIC(:,49).*(ALGEBRAIC(:,200) - ALGEBRAIC(:,194));
   RATES = RATES';
end

% Calculate algebraic variables
function ALGEBRAIC = computeAlgebraic(ALGEBRAIC, CONSTANTS, STATES, VOI)
    statesSize = size(STATES);
    statesColumnCount = statesSize(2);
    if ( statesColumnCount == 1)
        STATES = STATES';
        utilOnes = 1;
    else
        statesRowCount = statesSize(1);
        utilOnes = ones(statesRowCount, 1);
    end
    ALGEBRAIC(:,4) = 1.00000./(1.00000+exp((STATES(:,1)+87.6100)./7.48800));
    ALGEBRAIC(:,5) = 1.00000./(1.00000+exp((STATES(:,1)+93.8100)./7.48800));
    ALGEBRAIC(:,2) = 1.00000./(1.00000+exp( - (STATES(:,1)+CONSTANTS(:,35))./CONSTANTS(:,36)));
    ALGEBRAIC(:,14) = 1.00000./( CONSTANTS(:,39).*exp((STATES(:,1)+CONSTANTS(:,37))./CONSTANTS(:,38))+ CONSTANTS(:,40).*exp( - (STATES(:,1)+CONSTANTS(:,41))./CONSTANTS(:,42)));
    ALGEBRAIC(:,3) = 1.00000./(1.00000+exp(((STATES(:,1)+CONSTANTS(:,43)) - CONSTANTS(:,47))./CONSTANTS(:,44)));
    ALGEBRAIC(:,15) = 1.00000./( 1.43200e-05.*exp( - ((STATES(:,1)+1.19600) - CONSTANTS(:,47))./6.28500)+ 6.14900.*exp(((STATES(:,1)+0.509600) - CONSTANTS(:,47))./20.2700));
    ALGEBRAIC(:,16) = 1.00000./( 0.00979400.*exp( - ((STATES(:,1)+17.9500) - CONSTANTS(:,47))./28.0500)+ 0.334300.*exp(((STATES(:,1)+5.73000) - CONSTANTS(:,47))./56.6600));
    ALGEBRAIC(:,6) = 1.00000./(1.00000+exp( - (STATES(:,1) - 14.3400)./14.8200));
    ALGEBRAIC(:,18) = 1.05150./(1.00000./( 1.20890.*(1.00000+exp( - (STATES(:,1) - 18.4099)./29.3814)))+3.50000./(1.00000+exp((STATES(:,1)+100.000)./29.3814)));
    ALGEBRAIC(:,8) = 1.00000./(1.00000+exp( - (STATES(:,1)+3.94000)./4.23000));
    ALGEBRAIC(:,22) = 0.600000+1.00000./(exp(  - 0.0500000.*(STATES(:,1)+6.00000))+exp( 0.0900000.*(STATES(:,1)+14.0000)));
    ALGEBRAIC(:,9) = 1.00000./(1.00000+exp((STATES(:,1)+19.5800)./3.69600));
    ALGEBRAIC(:,23) = 7.00000+1.00000./( 0.00450000.*exp( - (STATES(:,1)+20.0000)./10.0000)+ 0.00450000.*exp((STATES(:,1)+20.0000)./10.0000));
    ALGEBRAIC(:,24) = 1000.00+1.00000./( 3.50000e-05.*exp( - (STATES(:,1)+5.00000)./4.00000)+ 3.50000e-05.*exp((STATES(:,1)+5.00000)./6.00000));
    ALGEBRAIC(:,20) = ALGEBRAIC(:,9);
    ALGEBRAIC(:,10) =  STATES(:,31).*1.00000;
    ALGEBRAIC(:,21) = 1.00000./(CONSTANTS(:,52)./ALGEBRAIC(:,10)+power(1.00000+CONSTANTS(:,51)./STATES(:,3), 4.00000));
    ALGEBRAIC(:,11) = 1.00000./(1.00000+exp( - (STATES(:,1)+11.6000)./8.93200));
    ALGEBRAIC(:,26) = CONSTANTS(:,105)+1.00000./( 0.000232600.*exp((STATES(:,1)+48.2800)./17.8000)+ 0.00129200.*exp( - (STATES(:,1)+210.000)./230.000));
    ALGEBRAIC(:,12) = 1.00000./(1.00000+exp( - (STATES(:,1)+ 2.55380.*CONSTANTS(:,4)+144.590)./( 1.56920.*CONSTANTS(:,4)+3.81150)));
    ALGEBRAIC(:,27) = 122.200./(exp( - (STATES(:,1)+127.200)./20.3600)+exp((STATES(:,1)+236.800)./69.3300));
    ALGEBRAIC(:,37) = ( CONSTANTS(:,21).*(1.00000 - STATES(:,2)))./(1.00000+CONSTANTS(:,22)./STATES(:,3));
    ALGEBRAIC(:,17) = ALGEBRAIC(:,3);
    ALGEBRAIC(:,28) = 2.03800+1.00000./( 0.0213600.*exp( - ((STATES(:,1)+100.600) - CONSTANTS(:,47))./8.28100)+ 0.305200.*exp(((STATES(:,1)+0.994100) - CONSTANTS(:,47))./38.4500));
    ALGEBRAIC(:,32) = 1.00000./(1.00000+exp( - (STATES(:,1) - 24.3400)./14.8200));
    ALGEBRAIC(:,33) = 7.00000+1.00000./( 0.0400000.*exp( - (STATES(:,1) - 4.00000)./7.00000)+ 0.0400000.*exp((STATES(:,1) - 4.00000)./7.00000));
    ALGEBRAIC(:,34) = 100.000+1.00000./( 0.000120000.*exp( - STATES(:,1)./3.00000)+ 0.000120000.*exp(STATES(:,1)./7.00000));
    ALGEBRAIC(:,35) =  2.50000.*ALGEBRAIC(:,23);
    ALGEBRAIC(:,25) = ALGEBRAIC(:,11);
    ALGEBRAIC(:,36) = 1.00000./( 0.0100000.*exp((STATES(:,1) - 50.0000)./20.0000)+ 0.0193000.*exp( - (STATES(:,1)+66.5400)./31.0000));
    ALGEBRAIC(:,29) = 1.00000./(1.00000+exp(((STATES(:,1)+89.1000) - CONSTANTS(:,47))./6.08600));
    ALGEBRAIC(:,38) =  3.00000.*ALGEBRAIC(:,16);
    ALGEBRAIC(:,39) =  1.46000.*ALGEBRAIC(:,28);
    ALGEBRAIC(:,30) = 1.00000./(1.00000+exp( - (STATES(:,1)+42.8500)./5.26400));
    ALGEBRAIC(:,40) = ALGEBRAIC(:,14);
    ALGEBRAIC(:,42) =  2.50000.*ALGEBRAIC(:,33);
    ALGEBRAIC(:,7) = 1.00000./(1.00000+exp((STATES(:,1)+43.9400)./5.71100));
    ALGEBRAIC(:,19) = piecewise({CONSTANTS(:,1)==1.00000, 1.00000 - 0.950000./(1.00000+exp((STATES(:,1)+70.0000)./5.00000)) }, 1.00000);
    ALGEBRAIC(:,31) = 4.56200+1.00000./( 0.393300.*exp( - (STATES(:,1)+100.000)./100.000)+ 0.0800400.*exp((STATES(:,1)+50.0000)./16.5900));
    ALGEBRAIC(:,44) =  ALGEBRAIC(:,31).*ALGEBRAIC(:,19);
    ALGEBRAIC(:,41) = 23.6200+1.00000./( 0.00141600.*exp( - (STATES(:,1)+96.5200)./59.0500)+ 1.78000e-08.*exp((STATES(:,1)+114.100)./8.07900));
    ALGEBRAIC(:,46) =  ALGEBRAIC(:,41).*ALGEBRAIC(:,19);
    ALGEBRAIC(:,48) = 1.35400+0.000100000./(exp((STATES(:,1) - 167.400)./15.8900)+exp( - (STATES(:,1) - 12.2300)./0.215400));
    ALGEBRAIC(:,50) = 1.00000 - 0.500000./(1.00000+exp((STATES(:,1)+70.0000)./20.0000));
    ALGEBRAIC(:,52) =  ALGEBRAIC(:,48).*ALGEBRAIC(:,50).*ALGEBRAIC(:,44);
    ALGEBRAIC(:,53) =  ALGEBRAIC(:,48).*ALGEBRAIC(:,50).*ALGEBRAIC(:,46);
    ALGEBRAIC(:,68) =  CONSTANTS(:,156).*STATES(:,27)+ CONSTANTS(:,171).*STATES(:,28);
    ALGEBRAIC(:,69) = 0.300000+0.600000./(1.00000+exp((STATES(:,1) - 10.0000)./10.0000));
    ALGEBRAIC(:,70) = 1.00000 - ALGEBRAIC(:,69);
    ALGEBRAIC(:,71) =  ALGEBRAIC(:,69).*STATES(:,29)+ ALGEBRAIC(:,70).*STATES(:,30);
    ALGEBRAIC(:,72) =  CONSTANTS(:,156).*STATES(:,32)+ CONSTANTS(:,171).*STATES(:,28);
    ALGEBRAIC(:,73) =  ALGEBRAIC(:,69).*STATES(:,33)+ ALGEBRAIC(:,70).*STATES(:,30);
    ALGEBRAIC(:,13) =  STATES(:,1).*CONSTANTS(:,150);
    ALGEBRAIC(:,74) = ( 4.00000.*CONSTANTS(:,170).*( STATES(:,3).*exp( 2.00000.*ALGEBRAIC(:,13)) -  0.341000.*CONSTANTS(:,3)))./CONSTANTS(:,175);
    ALGEBRAIC(:,75) =  CONSTANTS(:,175).*(STATES(:,1) - CONSTANTS(:,159));
    ALGEBRAIC(:,76) = piecewise({ - 1.00000e-07<=ALGEBRAIC(:,75)&ALGEBRAIC(:,75)<=1.00000e-07,  ALGEBRAIC(:,74).*(1.00000 -  0.500000.*ALGEBRAIC(:,75)) }, ( ALGEBRAIC(:,74).*ALGEBRAIC(:,75))./(exp(ALGEBRAIC(:,75)) - 1.00000));
    ALGEBRAIC(:,43) = ALGEBRAIC(:,37)+STATES(:,2);
    ALGEBRAIC(:,83) = 1.00000./(1.00000+CONSTANTS(:,18)./ALGEBRAIC(:,43));
    ALGEBRAIC(:,84) =  (1.00000 - ALGEBRAIC(:,83)).*CONSTANTS(:,157).*ALGEBRAIC(:,76).*STATES(:,26).*( ALGEBRAIC(:,68).*(1.00000 - STATES(:,34))+ STATES(:,31).*ALGEBRAIC(:,71).*STATES(:,34))+ ALGEBRAIC(:,83).*CONSTANTS(:,172).*ALGEBRAIC(:,76).*STATES(:,26).*( ALGEBRAIC(:,72).*(1.00000 - STATES(:,34))+ STATES(:,31).*ALGEBRAIC(:,73).*STATES(:,34));
    ALGEBRAIC(:,86) = ( CONSTANTS(:,167).* - ALGEBRAIC(:,84))./(1.00000+ 1.00000.*power(1.50000./STATES(:,9), 8.00000));
    ALGEBRAIC(:,89) = piecewise({CONSTANTS(:,1)==2.00000,  ALGEBRAIC(:,86).*1.70000 }, ALGEBRAIC(:,86));
    ALGEBRAIC(:,92) = CONSTANTS(:,147)./(1.00000+0.0123000./STATES(:,9));
    ALGEBRAIC(:,95) = piecewise({ALGEBRAIC(:,92)<0.00100000, 0.00100000 }, ALGEBRAIC(:,92));
    ALGEBRAIC(:,87) = ( CONSTANTS(:,181).* - ALGEBRAIC(:,84))./(1.00000+power(1.50000./STATES(:,9), 8.00000));
    ALGEBRAIC(:,90) = piecewise({CONSTANTS(:,1)==2.00000,  ALGEBRAIC(:,87).*1.70000 }, ALGEBRAIC(:,87));
    ALGEBRAIC(:,93) = CONSTANTS(:,168)./(1.00000+0.0123000./STATES(:,9));
    ALGEBRAIC(:,96) = piecewise({ALGEBRAIC(:,93)<0.00100000, 0.00100000 }, ALGEBRAIC(:,93));
    ALGEBRAIC(:,54) =  (( CONSTANTS(:,5).*CONSTANTS(:,6))./CONSTANTS(:,7)).*log(CONSTANTS(:,4)./STATES(:,6));
    ALGEBRAIC(:,62) = 1.00000./(1.00000+exp((STATES(:,1) - 213.600)./151.200));
    ALGEBRAIC(:,63) = 1.00000 - ALGEBRAIC(:,62);
    ALGEBRAIC(:,64) =  ALGEBRAIC(:,62).*STATES(:,21)+ ALGEBRAIC(:,63).*STATES(:,22);
    ALGEBRAIC(:,65) =  ALGEBRAIC(:,62).*STATES(:,24)+ ALGEBRAIC(:,63).*STATES(:,25);
    ALGEBRAIC(:,66) = 1.00000./(1.00000+CONSTANTS(:,18)./ALGEBRAIC(:,43));
    ALGEBRAIC(:,67) =  CONSTANTS(:,155).*(STATES(:,1) - ALGEBRAIC(:,54)).*( (1.00000 - ALGEBRAIC(:,66)).*STATES(:,20).*ALGEBRAIC(:,64)+ ALGEBRAIC(:,66).*STATES(:,23).*ALGEBRAIC(:,65));
    ALGEBRAIC(:,91) =  CONSTANTS(:,160).*power((CONSTANTS(:,4)./5.40000), 1.0 ./ 2).*STATES(:,39).*(STATES(:,1) - ALGEBRAIC(:,54));
    ALGEBRAIC(:,55) =  (( CONSTANTS(:,5).*CONSTANTS(:,6))./CONSTANTS(:,7)).*log((CONSTANTS(:,4)+ CONSTANTS(:,34).*CONSTANTS(:,2))./(STATES(:,6)+ CONSTANTS(:,34).*STATES(:,4)));
    ALGEBRAIC(:,94) = 1.00000+0.600000./(1.00000+power(3.80000e-05./STATES(:,10), 1.40000));
    ALGEBRAIC(:,97) =  CONSTANTS(:,161).*ALGEBRAIC(:,94).*STATES(:,45).*STATES(:,46).*(STATES(:,1) - ALGEBRAIC(:,55));
    ALGEBRAIC(:,98) = 1.00000./(1.00000+exp(((STATES(:,1)+105.800) -  2.60000.*CONSTANTS(:,4))./9.49300));
    ALGEBRAIC(:,99) =  CONSTANTS(:,162).*power(CONSTANTS(:,4), 1.0 ./ 2).*ALGEBRAIC(:,98).*STATES(:,47).*(STATES(:,1) - ALGEBRAIC(:,54));
    ALGEBRAIC(:,163) =  CONSTANTS(:,129).*exp(( (1.00000 - CONSTANTS(:,130)).*STATES(:,1).*CONSTANTS(:,7))./( 3.00000.*CONSTANTS(:,5).*CONSTANTS(:,6)));
    ALGEBRAIC(:,167) = ( CONSTANTS(:,124).*power(CONSTANTS(:,4)./CONSTANTS(:,132), 2.00000))./((power(1.00000+CONSTANTS(:,2)./ALGEBRAIC(:,163), 3.00000)+power(1.00000+CONSTANTS(:,4)./CONSTANTS(:,132), 2.00000)) - 1.00000);
    ALGEBRAIC(:,164) = CONSTANTS(:,137)./(1.00000+CONSTANTS(:,136)./CONSTANTS(:,138)+STATES(:,4)./CONSTANTS(:,139)+STATES(:,6)./CONSTANTS(:,140));
    ALGEBRAIC(:,168) = ( CONSTANTS(:,125).*ALGEBRAIC(:,164).*CONSTANTS(:,136))./(1.00000+CONSTANTS(:,134)./CONSTANTS(:,135));
    ALGEBRAIC(:,162) =  CONSTANTS(:,128).*exp(( CONSTANTS(:,130).*STATES(:,1).*CONSTANTS(:,7))./( 3.00000.*CONSTANTS(:,5).*CONSTANTS(:,6)));
    ALGEBRAIC(:,165) = ( CONSTANTS(:,120).*power(STATES(:,4)./ALGEBRAIC(:,162), 3.00000))./((power(1.00000+STATES(:,4)./ALGEBRAIC(:,162), 3.00000)+power(1.00000+STATES(:,6)./CONSTANTS(:,131), 2.00000)) - 1.00000);
    ALGEBRAIC(:,166) = ( CONSTANTS(:,123).*power(CONSTANTS(:,2)./ALGEBRAIC(:,163), 3.00000))./((power(1.00000+CONSTANTS(:,2)./ALGEBRAIC(:,163), 3.00000)+power(1.00000+CONSTANTS(:,4)./CONSTANTS(:,132), 2.00000)) - 1.00000);
    ALGEBRAIC(:,169) = ( CONSTANTS(:,127).*power(STATES(:,6)./CONSTANTS(:,131), 2.00000))./((power(1.00000+STATES(:,4)./ALGEBRAIC(:,162), 3.00000)+power(1.00000+STATES(:,6)./CONSTANTS(:,131), 2.00000)) - 1.00000);
    ALGEBRAIC(:,170) =  CONSTANTS(:,204).*ALGEBRAIC(:,165).*CONSTANTS(:,203)+ ALGEBRAIC(:,166).*ALGEBRAIC(:,169).*ALGEBRAIC(:,168)+ CONSTANTS(:,203).*ALGEBRAIC(:,169).*ALGEBRAIC(:,168)+ ALGEBRAIC(:,168).*ALGEBRAIC(:,165).*CONSTANTS(:,203);
    ALGEBRAIC(:,171) =  ALGEBRAIC(:,166).*CONSTANTS(:,202).*ALGEBRAIC(:,169)+ ALGEBRAIC(:,165).*CONSTANTS(:,203).*ALGEBRAIC(:,167)+ ALGEBRAIC(:,167).*CONSTANTS(:,202).*ALGEBRAIC(:,169)+ CONSTANTS(:,203).*ALGEBRAIC(:,167).*ALGEBRAIC(:,169);
    ALGEBRAIC(:,172) =  CONSTANTS(:,203).*ALGEBRAIC(:,167).*CONSTANTS(:,204)+ ALGEBRAIC(:,168).*ALGEBRAIC(:,166).*CONSTANTS(:,202)+ ALGEBRAIC(:,166).*CONSTANTS(:,202).*CONSTANTS(:,204)+ ALGEBRAIC(:,167).*CONSTANTS(:,204).*CONSTANTS(:,202);
    ALGEBRAIC(:,173) =  ALGEBRAIC(:,169).*ALGEBRAIC(:,168).*ALGEBRAIC(:,166)+ ALGEBRAIC(:,167).*CONSTANTS(:,204).*ALGEBRAIC(:,165)+ ALGEBRAIC(:,166).*CONSTANTS(:,204).*ALGEBRAIC(:,165)+ ALGEBRAIC(:,168).*ALGEBRAIC(:,166).*ALGEBRAIC(:,165);
    ALGEBRAIC(:,174) = ALGEBRAIC(:,170)./(ALGEBRAIC(:,170)+ALGEBRAIC(:,171)+ALGEBRAIC(:,172)+ALGEBRAIC(:,173));
    ALGEBRAIC(:,175) = ALGEBRAIC(:,171)./(ALGEBRAIC(:,170)+ALGEBRAIC(:,171)+ALGEBRAIC(:,172)+ALGEBRAIC(:,173));
    ALGEBRAIC(:,178) =  3.00000.*( ALGEBRAIC(:,174).*ALGEBRAIC(:,167) -  ALGEBRAIC(:,175).*ALGEBRAIC(:,168));
    ALGEBRAIC(:,176) = ALGEBRAIC(:,172)./(ALGEBRAIC(:,170)+ALGEBRAIC(:,171)+ALGEBRAIC(:,172)+ALGEBRAIC(:,173));
    ALGEBRAIC(:,177) = ALGEBRAIC(:,173)./(ALGEBRAIC(:,170)+ALGEBRAIC(:,171)+ALGEBRAIC(:,172)+ALGEBRAIC(:,173));
    ALGEBRAIC(:,179) =  2.00000.*( ALGEBRAIC(:,177).*CONSTANTS(:,202) -  ALGEBRAIC(:,176).*ALGEBRAIC(:,165));
    ALGEBRAIC(:,180) =  CONSTANTS(:,205).*( CONSTANTS(:,8).*ALGEBRAIC(:,178)+ CONSTANTS(:,10).*ALGEBRAIC(:,179));
    ALGEBRAIC(:,181) = 1.00000./(1.00000+exp( - (STATES(:,1) - 14.4800)./18.3400));
    ALGEBRAIC(:,182) =  CONSTANTS(:,164).*ALGEBRAIC(:,181).*(STATES(:,1) - ALGEBRAIC(:,54));
    ALGEBRAIC(:,1) = piecewise({VOI>=CONSTANTS(:,13)&VOI<=CONSTANTS(:,14)&(VOI - CONSTANTS(:,13)) -  floor((VOI - CONSTANTS(:,13))./CONSTANTS(:,16)).*CONSTANTS(:,16)<=CONSTANTS(:,17), CONSTANTS(:,15) }, 0.00000);
    ALGEBRAIC(:,184) = (STATES(:,7) - STATES(:,6))./2.00000;
    ALGEBRAIC(:,80) = ( 0.750000.*CONSTANTS(:,170).*( STATES(:,7).*exp(ALGEBRAIC(:,13)) - CONSTANTS(:,4)))./CONSTANTS(:,177);
    ALGEBRAIC(:,81) =  CONSTANTS(:,177).*(STATES(:,1) - CONSTANTS(:,159));
    ALGEBRAIC(:,82) = piecewise({ - 1.00000e-07<=ALGEBRAIC(:,81)&ALGEBRAIC(:,81)<=1.00000e-07,  ALGEBRAIC(:,80).*(1.00000 -  0.500000.*ALGEBRAIC(:,81)) }, ( ALGEBRAIC(:,80).*ALGEBRAIC(:,81))./(exp(ALGEBRAIC(:,81)) - 1.00000));
    ALGEBRAIC(:,88) =  (1.00000 - ALGEBRAIC(:,83)).*CONSTANTS(:,174).*ALGEBRAIC(:,82).*STATES(:,26).*( ALGEBRAIC(:,68).*(1.00000 - STATES(:,34))+ STATES(:,31).*ALGEBRAIC(:,71).*STATES(:,34))+ ALGEBRAIC(:,83).*CONSTANTS(:,183).*ALGEBRAIC(:,82).*STATES(:,26).*( ALGEBRAIC(:,72).*(1.00000 - STATES(:,34))+ STATES(:,31).*ALGEBRAIC(:,73).*STATES(:,34));
    ALGEBRAIC(:,51) =  (( CONSTANTS(:,5).*CONSTANTS(:,6))./CONSTANTS(:,7)).*log(CONSTANTS(:,2)./STATES(:,4));
    ALGEBRAIC(:,56) =  CONSTANTS(:,45).*STATES(:,12)+ CONSTANTS(:,152).*STATES(:,13);
    ALGEBRAIC(:,57) =  CONSTANTS(:,45).*STATES(:,12)+ CONSTANTS(:,152).*STATES(:,15);
    ALGEBRAIC(:,58) = 1.00000./(1.00000+CONSTANTS(:,18)./ALGEBRAIC(:,43));
    ALGEBRAIC(:,59) =  CONSTANTS(:,46).*(STATES(:,1) - ALGEBRAIC(:,51)).*power(STATES(:,11), 3.00000).*( (1.00000 - ALGEBRAIC(:,58)).*ALGEBRAIC(:,56).*STATES(:,14)+ ALGEBRAIC(:,58).*ALGEBRAIC(:,57).*STATES(:,16));
    ALGEBRAIC(:,60) = 1.00000./(1.00000+CONSTANTS(:,18)./ALGEBRAIC(:,43));
    ALGEBRAIC(:,61) =  CONSTANTS(:,154).*(STATES(:,1) - ALGEBRAIC(:,51)).*STATES(:,17).*( (1.00000 - ALGEBRAIC(:,60)).*STATES(:,18)+ ALGEBRAIC(:,60).*STATES(:,19));
    ALGEBRAIC(:,128) = 1.00000./(1.00000+power(CONSTANTS(:,118)./STATES(:,10), 2.00000));
    ALGEBRAIC(:,101) = exp(( CONSTANTS(:,116).*STATES(:,1).*CONSTANTS(:,7))./( CONSTANTS(:,5).*CONSTANTS(:,6)));
    ALGEBRAIC(:,108) = 1.00000+ (CONSTANTS(:,2)./CONSTANTS(:,109)).*(1.00000+1.00000./ALGEBRAIC(:,101));
    ALGEBRAIC(:,109) = CONSTANTS(:,2)./( CONSTANTS(:,109).*ALGEBRAIC(:,101).*ALGEBRAIC(:,108));
    ALGEBRAIC(:,112) =  ALGEBRAIC(:,109).*CONSTANTS(:,113);
    ALGEBRAIC(:,102) = 1.00000+ (STATES(:,4)./CONSTANTS(:,109)).*(1.00000+ALGEBRAIC(:,101));
    ALGEBRAIC(:,103) = ( STATES(:,4).*ALGEBRAIC(:,101))./( CONSTANTS(:,109).*ALGEBRAIC(:,102));
    ALGEBRAIC(:,115) =  ALGEBRAIC(:,103).*CONSTANTS(:,113);
    ALGEBRAIC(:,105) = 1.00000+ (STATES(:,4)./CONSTANTS(:,107)).*(1.00000+STATES(:,4)./CONSTANTS(:,108));
    ALGEBRAIC(:,106) = ( STATES(:,4).*STATES(:,4))./( ALGEBRAIC(:,105).*CONSTANTS(:,107).*CONSTANTS(:,108));
    ALGEBRAIC(:,118) =  ALGEBRAIC(:,106).*ALGEBRAIC(:,103).*CONSTANTS(:,111);
    ALGEBRAIC(:,119) =  ALGEBRAIC(:,109).*CONSTANTS(:,190).*CONSTANTS(:,111);
    ALGEBRAIC(:,110) = 1.00000./ALGEBRAIC(:,108);
    ALGEBRAIC(:,111) =  ALGEBRAIC(:,110).*CONSTANTS(:,112);
    ALGEBRAIC(:,113) = ALGEBRAIC(:,111)+ALGEBRAIC(:,112);
    ALGEBRAIC(:,100) = exp(( CONSTANTS(:,117).*STATES(:,1).*CONSTANTS(:,7))./( CONSTANTS(:,5).*CONSTANTS(:,6)));
    ALGEBRAIC(:,104) = 1.00000./ALGEBRAIC(:,102);
    ALGEBRAIC(:,114) = ( ALGEBRAIC(:,104).*CONSTANTS(:,112))./ALGEBRAIC(:,100);
    ALGEBRAIC(:,116) = ALGEBRAIC(:,114)+ALGEBRAIC(:,115);
    ALGEBRAIC(:,107) = 1.00000./ALGEBRAIC(:,105);
    ALGEBRAIC(:,117) =  ALGEBRAIC(:,107).*STATES(:,10).*CONSTANTS(:,114);
    ALGEBRAIC(:,120) =  CONSTANTS(:,193).*ALGEBRAIC(:,116).*(ALGEBRAIC(:,118)+ALGEBRAIC(:,117))+ CONSTANTS(:,194).*ALGEBRAIC(:,118).*(CONSTANTS(:,193)+ALGEBRAIC(:,113));
    ALGEBRAIC(:,121) =  CONSTANTS(:,192).*ALGEBRAIC(:,118).*(ALGEBRAIC(:,116)+CONSTANTS(:,194))+ ALGEBRAIC(:,116).*ALGEBRAIC(:,117).*(CONSTANTS(:,192)+ALGEBRAIC(:,119));
    ALGEBRAIC(:,122) =  CONSTANTS(:,192).*ALGEBRAIC(:,113).*(ALGEBRAIC(:,118)+ALGEBRAIC(:,117))+ ALGEBRAIC(:,119).*ALGEBRAIC(:,117).*(CONSTANTS(:,193)+ALGEBRAIC(:,113));
    ALGEBRAIC(:,123) =  CONSTANTS(:,193).*ALGEBRAIC(:,119).*(ALGEBRAIC(:,116)+CONSTANTS(:,194))+ ALGEBRAIC(:,113).*CONSTANTS(:,194).*(CONSTANTS(:,192)+ALGEBRAIC(:,119));
    ALGEBRAIC(:,124) = ALGEBRAIC(:,120)./(ALGEBRAIC(:,120)+ALGEBRAIC(:,121)+ALGEBRAIC(:,122)+ALGEBRAIC(:,123));
    ALGEBRAIC(:,125) = ALGEBRAIC(:,121)./(ALGEBRAIC(:,120)+ALGEBRAIC(:,121)+ALGEBRAIC(:,122)+ALGEBRAIC(:,123));
    ALGEBRAIC(:,126) = ALGEBRAIC(:,122)./(ALGEBRAIC(:,120)+ALGEBRAIC(:,121)+ALGEBRAIC(:,122)+ALGEBRAIC(:,123));
    ALGEBRAIC(:,127) = ALGEBRAIC(:,123)./(ALGEBRAIC(:,120)+ALGEBRAIC(:,121)+ALGEBRAIC(:,122)+ALGEBRAIC(:,123));
    ALGEBRAIC(:,129) = ( 3.00000.*( ALGEBRAIC(:,127).*ALGEBRAIC(:,118) -  ALGEBRAIC(:,124).*ALGEBRAIC(:,119))+ ALGEBRAIC(:,126).*ALGEBRAIC(:,115)) -  ALGEBRAIC(:,125).*ALGEBRAIC(:,112);
    ALGEBRAIC(:,130) =  ALGEBRAIC(:,125).*CONSTANTS(:,193) -  ALGEBRAIC(:,124).*CONSTANTS(:,192);
    ALGEBRAIC(:,131) =  0.800000.*CONSTANTS(:,195).*ALGEBRAIC(:,128).*( CONSTANTS(:,8).*ALGEBRAIC(:,129)+ CONSTANTS(:,9).*ALGEBRAIC(:,130));
    ALGEBRAIC(:,183) = ( CONSTANTS(:,143).*CONSTANTS(:,170).*( STATES(:,4).*exp(ALGEBRAIC(:,13)) - CONSTANTS(:,2)))./CONSTANTS(:,179);
    ALGEBRAIC(:,185) =  CONSTANTS(:,179).*(STATES(:,1) - CONSTANTS(:,165));
    ALGEBRAIC(:,186) = piecewise({ - 1.00000e-07<=ALGEBRAIC(:,185)&ALGEBRAIC(:,185)<=1.00000e-07,  ALGEBRAIC(:,183).*(1.00000 -  0.500000.*ALGEBRAIC(:,185)) }, ( ALGEBRAIC(:,183).*ALGEBRAIC(:,185))./(exp(ALGEBRAIC(:,185)) - 1.00000));
    ALGEBRAIC(:,188) = (STATES(:,5) - STATES(:,4))./2.00000;
    ALGEBRAIC(:,77) = ( 0.750000.*CONSTANTS(:,170).*( STATES(:,5).*exp(ALGEBRAIC(:,13)) - CONSTANTS(:,2)))./CONSTANTS(:,176);
    ALGEBRAIC(:,78) =  CONSTANTS(:,176).*(STATES(:,1) - CONSTANTS(:,159));
    ALGEBRAIC(:,79) = piecewise({ - 1.00000e-07<=ALGEBRAIC(:,78)&ALGEBRAIC(:,78)<=1.00000e-07,  ALGEBRAIC(:,77).*(1.00000 -  0.500000.*ALGEBRAIC(:,78)) }, ( ALGEBRAIC(:,77).*ALGEBRAIC(:,78))./(exp(ALGEBRAIC(:,78)) - 1.00000));
    ALGEBRAIC(:,85) =  (1.00000 - ALGEBRAIC(:,83)).*CONSTANTS(:,173).*ALGEBRAIC(:,79).*STATES(:,26).*( ALGEBRAIC(:,68).*(1.00000 - STATES(:,34))+ STATES(:,31).*ALGEBRAIC(:,71).*STATES(:,34))+ ALGEBRAIC(:,83).*CONSTANTS(:,182).*ALGEBRAIC(:,79).*STATES(:,26).*( ALGEBRAIC(:,72).*(1.00000 - STATES(:,34))+ STATES(:,31).*ALGEBRAIC(:,73).*STATES(:,34));
    ALGEBRAIC(:,158) = 1.00000./(1.00000+power(CONSTANTS(:,118)./STATES(:,3), 2.00000));
    ALGEBRAIC(:,138) = 1.00000+ (CONSTANTS(:,2)./CONSTANTS(:,109)).*(1.00000+1.00000./ALGEBRAIC(:,101));
    ALGEBRAIC(:,139) = CONSTANTS(:,2)./( CONSTANTS(:,109).*ALGEBRAIC(:,101).*ALGEBRAIC(:,138));
    ALGEBRAIC(:,142) =  ALGEBRAIC(:,139).*CONSTANTS(:,113);
    ALGEBRAIC(:,132) = 1.00000+ (STATES(:,5)./CONSTANTS(:,109)).*(1.00000+ALGEBRAIC(:,101));
    ALGEBRAIC(:,133) = ( STATES(:,5).*ALGEBRAIC(:,101))./( CONSTANTS(:,109).*ALGEBRAIC(:,132));
    ALGEBRAIC(:,145) =  ALGEBRAIC(:,133).*CONSTANTS(:,113);
    ALGEBRAIC(:,135) = 1.00000+ (STATES(:,5)./CONSTANTS(:,107)).*(1.00000+STATES(:,5)./CONSTANTS(:,108));
    ALGEBRAIC(:,136) = ( STATES(:,5).*STATES(:,5))./( ALGEBRAIC(:,135).*CONSTANTS(:,107).*CONSTANTS(:,108));
    ALGEBRAIC(:,148) =  ALGEBRAIC(:,136).*ALGEBRAIC(:,133).*CONSTANTS(:,111);
    ALGEBRAIC(:,149) =  ALGEBRAIC(:,139).*CONSTANTS(:,197).*CONSTANTS(:,111);
    ALGEBRAIC(:,140) = 1.00000./ALGEBRAIC(:,138);
    ALGEBRAIC(:,141) =  ALGEBRAIC(:,140).*CONSTANTS(:,112);
    ALGEBRAIC(:,143) = ALGEBRAIC(:,141)+ALGEBRAIC(:,142);
    ALGEBRAIC(:,134) = 1.00000./ALGEBRAIC(:,132);
    ALGEBRAIC(:,144) = ( ALGEBRAIC(:,134).*CONSTANTS(:,112))./ALGEBRAIC(:,100);
    ALGEBRAIC(:,146) = ALGEBRAIC(:,144)+ALGEBRAIC(:,145);
    ALGEBRAIC(:,137) = 1.00000./ALGEBRAIC(:,135);
    ALGEBRAIC(:,147) =  ALGEBRAIC(:,137).*STATES(:,3).*CONSTANTS(:,114);
    ALGEBRAIC(:,150) =  CONSTANTS(:,200).*ALGEBRAIC(:,146).*(ALGEBRAIC(:,148)+ALGEBRAIC(:,147))+ CONSTANTS(:,201).*ALGEBRAIC(:,148).*(CONSTANTS(:,200)+ALGEBRAIC(:,143));
    ALGEBRAIC(:,151) =  CONSTANTS(:,199).*ALGEBRAIC(:,148).*(ALGEBRAIC(:,146)+CONSTANTS(:,201))+ ALGEBRAIC(:,146).*ALGEBRAIC(:,147).*(CONSTANTS(:,199)+ALGEBRAIC(:,149));
    ALGEBRAIC(:,152) =  CONSTANTS(:,199).*ALGEBRAIC(:,143).*(ALGEBRAIC(:,148)+ALGEBRAIC(:,147))+ ALGEBRAIC(:,149).*ALGEBRAIC(:,147).*(CONSTANTS(:,200)+ALGEBRAIC(:,143));
    ALGEBRAIC(:,153) =  CONSTANTS(:,200).*ALGEBRAIC(:,149).*(ALGEBRAIC(:,146)+CONSTANTS(:,201))+ ALGEBRAIC(:,143).*CONSTANTS(:,201).*(CONSTANTS(:,199)+ALGEBRAIC(:,149));
    ALGEBRAIC(:,154) = ALGEBRAIC(:,150)./(ALGEBRAIC(:,150)+ALGEBRAIC(:,151)+ALGEBRAIC(:,152)+ALGEBRAIC(:,153));
    ALGEBRAIC(:,155) = ALGEBRAIC(:,151)./(ALGEBRAIC(:,150)+ALGEBRAIC(:,151)+ALGEBRAIC(:,152)+ALGEBRAIC(:,153));
    ALGEBRAIC(:,156) = ALGEBRAIC(:,152)./(ALGEBRAIC(:,150)+ALGEBRAIC(:,151)+ALGEBRAIC(:,152)+ALGEBRAIC(:,153));
    ALGEBRAIC(:,157) = ALGEBRAIC(:,153)./(ALGEBRAIC(:,150)+ALGEBRAIC(:,151)+ALGEBRAIC(:,152)+ALGEBRAIC(:,153));
    ALGEBRAIC(:,159) = ( 3.00000.*( ALGEBRAIC(:,157).*ALGEBRAIC(:,148) -  ALGEBRAIC(:,154).*ALGEBRAIC(:,149))+ ALGEBRAIC(:,156).*ALGEBRAIC(:,145)) -  ALGEBRAIC(:,155).*ALGEBRAIC(:,142);
    ALGEBRAIC(:,160) =  ALGEBRAIC(:,155).*CONSTANTS(:,200) -  ALGEBRAIC(:,154).*CONSTANTS(:,199);
    ALGEBRAIC(:,161) =  0.200000.*CONSTANTS(:,195).*ALGEBRAIC(:,158).*( CONSTANTS(:,8).*ALGEBRAIC(:,159)+ CONSTANTS(:,9).*ALGEBRAIC(:,160));
    ALGEBRAIC(:,191) = ( CONSTANTS(:,145).*STATES(:,10))./(CONSTANTS(:,146)+STATES(:,10));
    ALGEBRAIC(:,187) = ( CONSTANTS(:,144).*4.00000.*CONSTANTS(:,170).*( STATES(:,10).*exp( 2.00000.*ALGEBRAIC(:,13)) -  0.341000.*CONSTANTS(:,3)))./CONSTANTS(:,180);
    ALGEBRAIC(:,189) =  CONSTANTS(:,180).*(STATES(:,1) - CONSTANTS(:,166));
    ALGEBRAIC(:,190) = piecewise({ - 1.00000e-07<=ALGEBRAIC(:,189)&ALGEBRAIC(:,189)<=1.00000e-07,  ALGEBRAIC(:,187).*(1.00000 -  0.500000.*ALGEBRAIC(:,189)) }, ( ALGEBRAIC(:,187).*ALGEBRAIC(:,189))./(exp(ALGEBRAIC(:,189)) - 1.00000));
    ALGEBRAIC(:,192) = (STATES(:,3) - STATES(:,10))./0.200000;
    ALGEBRAIC(:,193) = 1.00000./(1.00000+CONSTANTS(:,18)./ALGEBRAIC(:,43));
    ALGEBRAIC(:,194) =  CONSTANTS(:,148).*( (1.00000 - ALGEBRAIC(:,193)).*STATES(:,48)+ ALGEBRAIC(:,193).*STATES(:,49));
    ALGEBRAIC(:,47) = 1.00000./(1.00000+( CONSTANTS(:,27).*CONSTANTS(:,28))./power(CONSTANTS(:,28)+STATES(:,3), 2.00000)+( CONSTANTS(:,29).*CONSTANTS(:,30))./power(CONSTANTS(:,30)+STATES(:,3), 2.00000));
    ALGEBRAIC(:,195) = ( CONSTANTS(:,169).*0.00437500.*STATES(:,10))./(STATES(:,10)+0.000920000);
    ALGEBRAIC(:,196) = ( CONSTANTS(:,169).*2.75000.*0.00437500.*STATES(:,10))./((STATES(:,10)+0.000920000) - 0.000170000);
    ALGEBRAIC(:,197) = 1.00000./(1.00000+CONSTANTS(:,18)./ALGEBRAIC(:,43));
    ALGEBRAIC(:,198) = ( 0.00393750.*STATES(:,8))./15.0000;
    ALGEBRAIC(:,199) =  CONSTANTS(:,149).*(( (1.00000 - ALGEBRAIC(:,197)).*ALGEBRAIC(:,195)+ ALGEBRAIC(:,197).*ALGEBRAIC(:,196)) - ALGEBRAIC(:,198));
    ALGEBRAIC(:,45) = 1.00000./(1.00000+( CONSTANTS(:,151).*CONSTANTS(:,24))./power(CONSTANTS(:,24)+STATES(:,10), 2.00000)+( CONSTANTS(:,25).*CONSTANTS(:,26))./power(CONSTANTS(:,26)+STATES(:,10), 2.00000));
    ALGEBRAIC(:,200) = (STATES(:,8) - STATES(:,9))./100.000;
    ALGEBRAIC(:,49) = 1.00000./(1.00000+( CONSTANTS(:,31).*CONSTANTS(:,32))./power(CONSTANTS(:,32)+STATES(:,9), 2.00000));
end

% Compute result of a piecewise function
function x = piecewise(cases, default)
    set = [0];
    for i = 1:2:length(cases)
        if (length(cases{i+1}) == 1)
            x(cases{i} & ~set,:) = cases{i+1};
        else
            x(cases{i} & ~set,:) = cases{i+1}(cases{i} & ~set);
        end
        set = set | cases{i};
        if(set), break, end
    end
    if (length(default) == 1)
        x(~set,:) = default;
    else
        x(~set,:) = default(~set);
    end
end

% Pad out or shorten strings to a set length
function strout = strpad(strin)
    req_length = 160;
    insize = size(strin,2);
    if insize > req_length
        strout = strin(1:req_length);
    else
        strout = [strin, blanks(req_length - insize)];
    end
end

Source
Derived from workspace O'Hara-Rudy-CiPA-v1.0 (2017) at changeset 2c2629a8e2b6.
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.