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 =199;
end
% There are a total of 46 entries in each of the rate and state variable arrays.
% There are a total of 146 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('nao in component extracellular (millimolar)');
    LEGEND_CONSTANTS(:,2) = strpad('cao in component extracellular (millimolar)');
    LEGEND_CONSTANTS(:,3) = strpad('ko in component extracellular (millimolar)');
    LEGEND_CONSTANTS(:,4) = strpad('R in component physical_constants (joule_per_kilomole_kelvin)');
    LEGEND_CONSTANTS(:,5) = strpad('T in component physical_constants (kelvin)');
    LEGEND_CONSTANTS(:,6) = strpad('F in component physical_constants (coulomb_per_mole)');
    LEGEND_CONSTANTS(:,7) = strpad('zna in component physical_constants (dimensionless)');
    LEGEND_CONSTANTS(:,8) = strpad('zca in component physical_constants (dimensionless)');
    LEGEND_CONSTANTS(:,9) = strpad('zk in component physical_constants (dimensionless)');
    LEGEND_CONSTANTS(:,10) = strpad('L in component cell_geometry (centimeter)');
    LEGEND_CONSTANTS(:,11) = strpad('rad in component cell_geometry (centimeter)');
    LEGEND_CONSTANTS(:,12) = strpad('greekpi in component cell_geometry (dimensionless)');
    LEGEND_CONSTANTS(:,120) = strpad('vcell in component cell_geometry (microliter)');
    LEGEND_CONSTANTS(:,124) = strpad('Ageo in component cell_geometry (centimeter_squared)');
    LEGEND_CONSTANTS(:,125) = strpad('Acap in component cell_geometry (centimeter_squared)');
    LEGEND_CONSTANTS(:,126) = strpad('vmyo in component cell_geometry (microliter)');
    LEGEND_CONSTANTS(:,127) = strpad('vnsr in component cell_geometry (microliter)');
    LEGEND_CONSTANTS(:,128) = strpad('vjsr in component cell_geometry (microliter)');
    LEGEND_CONSTANTS(:,129) = strpad('vcsr in component cell_geometry (microliter)');
    LEGEND_CONSTANTS(:,131) = strpad('vsl in component cell_geometry (microliter)');
    LEGEND_CONSTANTS(:,130) = strpad('vss in component cell_geometry (microliter)');
    LEGEND_STATES(:,1) = strpad('v in component membrane (millivolt)');
    LEGEND_ALGEBRAIC(:,37) = strpad('vffrt in component membrane (coulomb_per_mole)');
    LEGEND_ALGEBRAIC(:,45) = strpad('vfrt in component membrane (dimensionless)');
    LEGEND_ALGEBRAIC(:,64) = strpad('INa in component INa (microA_per_microF)');
    LEGEND_ALGEBRAIC(:,66) = strpad('INaL in component INaL (microA_per_microF)');
    LEGEND_ALGEBRAIC(:,67) = strpad('Ito in component Ito (microA_per_microF)');
    LEGEND_ALGEBRAIC(:,69) = strpad('Isus in component Isus (microA_per_microF)');
    LEGEND_ALGEBRAIC(:,80) = strpad('ICaL in component ICaL (microA_per_microF)');
    LEGEND_ALGEBRAIC(:,83) = strpad('ICaT in component ICaT (microA_per_microF)');
    LEGEND_ALGEBRAIC(:,81) = strpad('ICaNa in component ICaL (microA_per_microF)');
    LEGEND_ALGEBRAIC(:,82) = strpad('ICaK in component ICaL (microA_per_microF)');
    LEGEND_ALGEBRAIC(:,88) = strpad('IKr in component IKr (microA_per_microF)');
    LEGEND_ALGEBRAIC(:,90) = strpad('IKs in component IKs (microA_per_microF)');
    LEGEND_ALGEBRAIC(:,93) = strpad('If in component If (microA_per_microF)');
    LEGEND_ALGEBRAIC(:,95) = strpad('IK1 in component IK1 (microA_per_microF)');
    LEGEND_ALGEBRAIC(:,127) = strpad('INaCa_i in component INaCa_i (microA_per_microF)');
    LEGEND_ALGEBRAIC(:,157) = strpad('INaCa_ss in component INaCa_i (microA_per_microF)');
    LEGEND_ALGEBRAIC(:,176) = strpad('INaK in component INaK (microA_per_microF)');
    LEGEND_ALGEBRAIC(:,177) = strpad('INab in component INab (microA_per_microF)');
    LEGEND_ALGEBRAIC(:,183) = strpad('IpCa in component IpCa (microA_per_microF)');
    LEGEND_ALGEBRAIC(:,180) = strpad('ICab in component ICab (microA_per_microF)');
    LEGEND_ALGEBRAIC(:,16) = strpad('Istim in component membrane (microA_per_microF)');
    LEGEND_CONSTANTS(:,13) = strpad('amp in component membrane (microA_per_microF)');
    LEGEND_CONSTANTS(:,14) = strpad('duration in component membrane (millisecond)');
    LEGEND_CONSTANTS(:,15) = strpad('KmCaMK in component CaMK (millimolar)');
    LEGEND_CONSTANTS(:,16) = strpad('aCaMK in component CaMK (per_millimolar_per_millisecond)');
    LEGEND_CONSTANTS(:,17) = strpad('bCaMK in component CaMK (per_millisecond)');
    LEGEND_CONSTANTS(:,18) = strpad('CaMKo in component CaMK (dimensionless)');
    LEGEND_CONSTANTS(:,19) = strpad('KmCaM in component CaMK (millimolar)');
    LEGEND_ALGEBRAIC(:,50) = strpad('CaMKb in component CaMK (millimolar)');
    LEGEND_ALGEBRAIC(:,51) = 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(:,20) = strpad('BSRmax in component intracellular_ions (millimolar)');
    LEGEND_CONSTANTS(:,21) = strpad('KmBSR in component intracellular_ions (millimolar)');
    LEGEND_CONSTANTS(:,22) = strpad('BSLmax in component intracellular_ions (millimolar)');
    LEGEND_CONSTANTS(:,23) = strpad('KmBSL in component intracellular_ions (millimolar)');
    LEGEND_CONSTANTS(:,24) = strpad('csqnmax in component intracellular_ions (millimolar)');
    LEGEND_CONSTANTS(:,25) = strpad('kmcsqn in component intracellular_ions (millimolar)');
    LEGEND_CONSTANTS(:,26) = strpad('csqnmaxsl in component intracellular_ions (millimolar)');
    LEGEND_CONSTANTS(:,27) = strpad('cmdnmax in component intracellular_ions (millimolar)');
    LEGEND_CONSTANTS(:,28) = strpad('kmcmdn in component intracellular_ions (millimolar)');
    LEGEND_CONSTANTS(:,29) = strpad('cmdnmaxsl in component intracellular_ions (millimolar)');
    LEGEND_CONSTANTS(:,30) = strpad('trpnmax in component intracellular_ions (millimolar)');
    LEGEND_CONSTANTS(:,31) = strpad('kmtrpn in component intracellular_ions (millimolar)');
    LEGEND_CONSTANTS(:,32) = strpad('trpnmaxsl in component intracellular_ions (millimolar)');
    LEGEND_STATES(:,4) = strpad('nai in component intracellular_ions (millimolar)');
    LEGEND_STATES(:,5) = strpad('nasl in component intracellular_ions (millimolar)');
    LEGEND_STATES(:,6) = strpad('nass in component intracellular_ions (millimolar)');
    LEGEND_STATES(:,7) = strpad('ki in component intracellular_ions (millimolar)');
    LEGEND_STATES(:,8) = strpad('kss in component intracellular_ions (millimolar)');
    LEGEND_STATES(:,9) = strpad('ksl in component intracellular_ions (millimolar)');
    LEGEND_STATES(:,10) = strpad('cai in component intracellular_ions (millimolar)');
    LEGEND_STATES(:,11) = strpad('casl in component intracellular_ions (millimolar)');
    LEGEND_STATES(:,12) = strpad('cansr in component intracellular_ions (millimolar)');
    LEGEND_STATES(:,13) = strpad('cajsr in component intracellular_ions (millimolar)');
    LEGEND_STATES(:,14) = strpad('cacsr in component intracellular_ions (millimolar)');
    LEGEND_ALGEBRAIC(:,91) = strpad('IfNa in component If (microA_per_microF)');
    LEGEND_ALGEBRAIC(:,92) = strpad('IfK in component If (microA_per_microF)');
    LEGEND_ALGEBRAIC(:,179) = strpad('JdiffNa in component diff (millimolar_per_millisecond)');
    LEGEND_ALGEBRAIC(:,182) = strpad('JgapNa in component diff (millimolar_per_millisecond)');
    LEGEND_ALGEBRAIC(:,184) = strpad('Jdiff in component diff (millimolar_per_millisecond)');
    LEGEND_ALGEBRAIC(:,185) = strpad('Jgap in component diff (millimolar_per_millisecond)');
    LEGEND_ALGEBRAIC(:,178) = strpad('JdiffK in component diff (millimolar_per_millisecond)');
    LEGEND_ALGEBRAIC(:,181) = strpad('JgapK in component diff (millimolar_per_millisecond)');
    LEGEND_ALGEBRAIC(:,190) = strpad('Jup1 in component SERCA (millimolar_per_millisecond)');
    LEGEND_ALGEBRAIC(:,191) = strpad('Jup2 in component SERCA (millimolar_per_millisecond)');
    LEGEND_STATES(:,15) = strpad('Jrel1 in component ryr (millimolar_per_millisecond)');
    LEGEND_STATES(:,16) = strpad('Jrel2 in component ryr (millimolar_per_millisecond)');
    LEGEND_ALGEBRAIC(:,194) = strpad('Jip3 in component IP3 (millimolar_per_millisecond)');
    LEGEND_ALGEBRAIC(:,196) = strpad('Jtr1 in component trans_flux (millimolar_per_millisecond)');
    LEGEND_ALGEBRAIC(:,198) = strpad('Jtr2 in component trans_flux (millimolar_per_millisecond)');
    LEGEND_ALGEBRAIC(:,52) = strpad('Bcai in component intracellular_ions (dimensionless)');
    LEGEND_ALGEBRAIC(:,55) = strpad('Bcajsr in component intracellular_ions (dimensionless)');
    LEGEND_ALGEBRAIC(:,56) = strpad('Bcacsr in component intracellular_ions (dimensionless)');
    LEGEND_ALGEBRAIC(:,53) = strpad('Bcass in component intracellular_ions (dimensionless)');
    LEGEND_ALGEBRAIC(:,54) = strpad('Bcasl 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(:,57) = strpad('ENa in component reversal_potentials (millivolt)');
    LEGEND_ALGEBRAIC(:,58) = strpad('EK in component reversal_potentials (millivolt)');
    LEGEND_ALGEBRAIC(:,59) = strpad('ECa in component reversal_potentials (millivolt)');
    LEGEND_ALGEBRAIC(:,60) = strpad('EKs in component reversal_potentials (millivolt)');
    LEGEND_ALGEBRAIC(:,1) = strpad('mss in component INa (dimensionless)');
    LEGEND_ALGEBRAIC(:,17) = 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(:,17) = strpad('m in component INa (dimensionless)');
    LEGEND_ALGEBRAIC(:,2) = strpad('hss in component INa (dimensionless)');
    LEGEND_ALGEBRAIC(:,18) = strpad('thf in component INa (millisecond)');
    LEGEND_ALGEBRAIC(:,19) = 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(:,113) = strpad('Ahs in component INa (dimensionless)');
    LEGEND_CONSTANTS(:,45) = strpad('Ahf in component INa (dimensionless)');
    LEGEND_STATES(:,18) = strpad('hf in component INa (dimensionless)');
    LEGEND_STATES(:,19) = strpad('hs in component INa (dimensionless)');
    LEGEND_ALGEBRAIC(:,61) = strpad('h in component INa (dimensionless)');
    LEGEND_CONSTANTS(:,46) = strpad('GNa in component INa (milliS_per_microF)');
    LEGEND_ALGEBRAIC(:,20) = strpad('jss in component INa (dimensionless)');
    LEGEND_ALGEBRAIC(:,38) = strpad('tj in component INa (millisecond)');
    LEGEND_STATES(:,20) = strpad('j in component INa (dimensionless)');
    LEGEND_ALGEBRAIC(:,39) = strpad('hssp in component INa (dimensionless)');
    LEGEND_ALGEBRAIC(:,46) = strpad('thsp in component INa (millisecond)');
    LEGEND_STATES(:,21) = strpad('hsp in component INa (dimensionless)');
    LEGEND_ALGEBRAIC(:,62) = strpad('hp in component INa (dimensionless)');
    LEGEND_ALGEBRAIC(:,47) = strpad('tjp in component INa (millisecond)');
    LEGEND_STATES(:,22) = strpad('jp in component INa (dimensionless)');
    LEGEND_ALGEBRAIC(:,63) = strpad('fINap in component INa (dimensionless)');
    LEGEND_ALGEBRAIC(:,40) = strpad('mLss in component INaL (dimensionless)');
    LEGEND_ALGEBRAIC(:,48) = strpad('tmL in component INaL (millisecond)');
    LEGEND_STATES(:,23) = strpad('mL in component INaL (dimensionless)');
    LEGEND_CONSTANTS(:,47) = strpad('thL in component INaL (millisecond)');
    LEGEND_ALGEBRAIC(:,3) = strpad('hLss in component INaL (dimensionless)');
    LEGEND_STATES(:,24) = strpad('hL in component INaL (dimensionless)');
    LEGEND_ALGEBRAIC(:,4) = strpad('hLssp in component INaL (dimensionless)');
    LEGEND_CONSTANTS(:,114) = strpad('thLp in component INaL (millisecond)');
    LEGEND_STATES(:,25) = strpad('hLp in component INaL (dimensionless)');
    LEGEND_CONSTANTS(:,48) = strpad('GNaL in component INaL (milliS_per_microF)');
    LEGEND_ALGEBRAIC(:,65) = strpad('fINaLp in component INaL (dimensionless)');
    LEGEND_ALGEBRAIC(:,5) = strpad('ass in component Ito (dimensionless)');
    LEGEND_ALGEBRAIC(:,21) = strpad('taua in component Ito (millisecond)');
    LEGEND_ALGEBRAIC(:,6) = strpad('iss in component Ito (dimensionless)');
    LEGEND_ALGEBRAIC(:,22) = strpad('tauis in component Ito (millisecond)');
    LEGEND_ALGEBRAIC(:,23) = strpad('tauif in component Ito (millisecond)');
    LEGEND_STATES(:,26) = strpad('a in component Ito (dimensionless)');
    LEGEND_STATES(:,27) = strpad('i1 in component Ito (dimensionless)');
    LEGEND_STATES(:,28) = strpad('i2 in component Ito (dimensionless)');
    LEGEND_CONSTANTS(:,49) = strpad('Gto in component Ito (milliS_per_microF)');
    LEGEND_CONSTANTS(:,50) = strpad('Gsus in component Isus (milliS_per_microF)');
    LEGEND_ALGEBRAIC(:,68) = strpad('asus in component Isus (dimensionless)');
    LEGEND_CONSTANTS(:,51) = strpad('Kmn in component ICaL (millimolar)');
    LEGEND_CONSTANTS(:,52) = strpad('k2n in component ICaL (per_millisecond)');
    LEGEND_ALGEBRAIC(:,7) = strpad('dss in component ICaL (dimensionless)');
    LEGEND_STATES(:,29) = strpad('d in component ICaL (dimensionless)');
    LEGEND_ALGEBRAIC(:,8) = strpad('fss in component ICaL (dimensionless)');
    LEGEND_CONSTANTS(:,115) = strpad('Aff in component ICaL (dimensionless)');
    LEGEND_CONSTANTS(:,121) = strpad('Afs in component ICaL (dimensionless)');
    LEGEND_STATES(:,30) = strpad('ff in component ICaL (dimensionless)');
    LEGEND_STATES(:,31) = strpad('fs in component ICaL (dimensionless)');
    LEGEND_ALGEBRAIC(:,70) = strpad('f in component ICaL (dimensionless)');
    LEGEND_ALGEBRAIC(:,24) = strpad('fcass in component ICaL (dimensionless)');
    LEGEND_ALGEBRAIC(:,71) = strpad('Afcaf in component ICaL (dimensionless)');
    LEGEND_ALGEBRAIC(:,72) = strpad('Afcas in component ICaL (dimensionless)');
    LEGEND_STATES(:,32) = strpad('fcaf in component ICaL (dimensionless)');
    LEGEND_STATES(:,33) = strpad('fcas in component ICaL (dimensionless)');
    LEGEND_ALGEBRAIC(:,73) = strpad('fca in component ICaL (dimensionless)');
    LEGEND_STATES(:,34) = strpad('jca in component ICaL (dimensionless)');
    LEGEND_STATES(:,35) = strpad('ffp in component ICaL (dimensionless)');
    LEGEND_ALGEBRAIC(:,74) = strpad('fp in component ICaL (dimensionless)');
    LEGEND_STATES(:,36) = strpad('fcafp in component ICaL (dimensionless)');
    LEGEND_ALGEBRAIC(:,75) = strpad('fcap in component ICaL (dimensionless)');
    LEGEND_ALGEBRAIC(:,9) = strpad('km2n in component ICaL (per_millisecond)');
    LEGEND_ALGEBRAIC(:,25) = strpad('anca in component ICaL (dimensionless)');
    LEGEND_STATES(:,37) = strpad('nca in component ICaL (dimensionless)');
    LEGEND_ALGEBRAIC(:,76) = strpad('PhiCaL in component ICaL (dimensionless)');
    LEGEND_ALGEBRAIC(:,77) = strpad('PhiCaNa in component ICaL (dimensionless)');
    LEGEND_ALGEBRAIC(:,78) = strpad('PhiCaK in component ICaL (dimensionless)');
    LEGEND_CONSTANTS(:,53) = strpad('PCa in component ICaL (dimensionless)');
    LEGEND_CONSTANTS(:,116) = strpad('PCap in component ICaL (dimensionless)');
    LEGEND_CONSTANTS(:,117) = strpad('PCaNa in component ICaL (dimensionless)');
    LEGEND_CONSTANTS(:,118) = strpad('PCaK in component ICaL (dimensionless)');
    LEGEND_CONSTANTS(:,122) = strpad('PCaNap in component ICaL (dimensionless)');
    LEGEND_CONSTANTS(:,123) = strpad('PCaKp in component ICaL (dimensionless)');
    LEGEND_ALGEBRAIC(:,79) = strpad('fICaLp in component ICaL (dimensionless)');
    LEGEND_ALGEBRAIC(:,26) = strpad('td in component ICaL (millisecond)');
    LEGEND_ALGEBRAIC(:,27) = strpad('tff in component ICaL (millisecond)');
    LEGEND_ALGEBRAIC(:,28) = strpad('tfs in component ICaL (millisecond)');
    LEGEND_ALGEBRAIC(:,41) = strpad('tfcaf in component ICaL (millisecond)');
    LEGEND_ALGEBRAIC(:,42) = strpad('tfcas in component ICaL (millisecond)');
    LEGEND_CONSTANTS(:,119) = strpad('tjca in component ICaL (millisecond)');
    LEGEND_ALGEBRAIC(:,43) = strpad('tffp in component ICaL (millisecond)');
    LEGEND_ALGEBRAIC(:,49) = strpad('tfcafp in component ICaL (millisecond)');
    LEGEND_CONSTANTS(:,54) = strpad('GCaT in component ICaT (milliS_per_microF)');
    LEGEND_ALGEBRAIC(:,10) = strpad('bss in component ICaT (dimensionless)');
    LEGEND_ALGEBRAIC(:,11) = strpad('gss in component ICaT (dimensionless)');
    LEGEND_ALGEBRAIC(:,29) = strpad('taub in component ICaT (millisecond)');
    LEGEND_ALGEBRAIC(:,30) = strpad('taug in component ICaT (millisecond)');
    LEGEND_STATES(:,38) = strpad('b in component ICaT (dimensionless)');
    LEGEND_STATES(:,39) = strpad('g in component ICaT (dimensionless)');
    LEGEND_CONSTANTS(:,55) = strpad('GKr in component IKr (milliS_per_microF)');
    LEGEND_ALGEBRAIC(:,12) = strpad('xrss in component IKr (dimensionless)');
    LEGEND_ALGEBRAIC(:,31) = strpad('txrf in component IKr (millisecond)');
    LEGEND_ALGEBRAIC(:,32) = strpad('txrs in component IKr (millisecond)');
    LEGEND_ALGEBRAIC(:,84) = strpad('Axrf in component IKr (dimensionless)');
    LEGEND_ALGEBRAIC(:,85) = strpad('Axrs in component IKr (dimensionless)');
    LEGEND_STATES(:,40) = strpad('xrf in component IKr (dimensionless)');
    LEGEND_STATES(:,41) = strpad('xrs in component IKr (dimensionless)');
    LEGEND_ALGEBRAIC(:,86) = strpad('xr in component IKr (dimensionless)');
    LEGEND_ALGEBRAIC(:,87) = strpad('rkr in component IKr (dimensionless)');
    LEGEND_CONSTANTS(:,56) = strpad('GKs in component IKs (milliS_per_microF)');
    LEGEND_ALGEBRAIC(:,13) = strpad('xs1ss in component IKs (dimensionless)');
    LEGEND_ALGEBRAIC(:,33) = strpad('xs2ss in component IKs (dimensionless)');
    LEGEND_ALGEBRAIC(:,34) = strpad('txs1 in component IKs (millisecond)');
    LEGEND_STATES(:,42) = strpad('xs1 in component IKs (dimensionless)');
    LEGEND_STATES(:,43) = strpad('xs2 in component IKs (dimensionless)');
    LEGEND_ALGEBRAIC(:,89) = strpad('KsCa in component IKs (dimensionless)');
    LEGEND_ALGEBRAIC(:,44) = strpad('txs2 in component IKs (millisecond)');
    LEGEND_CONSTANTS(:,57) = strpad('GfNa in component If (milliS_per_microF)');
    LEGEND_CONSTANTS(:,58) = strpad('GfK in component If (milliS_per_microF)');
    LEGEND_ALGEBRAIC(:,14) = strpad('yss in component If (dimensionless)');
    LEGEND_ALGEBRAIC(:,35) = strpad('tauy in component If (millisecond)');
    LEGEND_STATES(:,44) = strpad('y in component If (dimensionless)');
    LEGEND_CONSTANTS(:,59) = strpad('GK1 in component IK1 (milliS_per_microF)');
    LEGEND_ALGEBRAIC(:,15) = strpad('xk1ss in component IK1 (dimensionless)');
    LEGEND_ALGEBRAIC(:,36) = strpad('txk1 in component IK1 (millisecond)');
    LEGEND_STATES(:,45) = strpad('xk1 in component IK1 (dimensionless)');
    LEGEND_ALGEBRAIC(:,94) = strpad('rk1 in component IK1 (millisecond)');
    LEGEND_CONSTANTS(:,60) = strpad('kna1 in component INaCa_i (per_millisecond)');
    LEGEND_CONSTANTS(:,61) = strpad('kna2 in component INaCa_i (per_millisecond)');
    LEGEND_CONSTANTS(:,62) = strpad('kna3 in component INaCa_i (per_millisecond)');
    LEGEND_CONSTANTS(:,63) = strpad('kasymm in component INaCa_i (dimensionless)');
    LEGEND_CONSTANTS(:,64) = strpad('wna in component INaCa_i (dimensionless)');
    LEGEND_CONSTANTS(:,65) = strpad('wca in component INaCa_i (dimensionless)');
    LEGEND_CONSTANTS(:,66) = strpad('wnaca in component INaCa_i (dimensionless)');
    LEGEND_CONSTANTS(:,67) = strpad('kcaon in component INaCa_i (per_millisecond)');
    LEGEND_CONSTANTS(:,68) = strpad('kcaoff in component INaCa_i (per_millisecond)');
    LEGEND_CONSTANTS(:,69) = strpad('qna in component INaCa_i (dimensionless)');
    LEGEND_CONSTANTS(:,70) = strpad('qca in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,97) = strpad('hna in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,96) = strpad('hca in component INaCa_i (dimensionless)');
    LEGEND_CONSTANTS(:,71) = strpad('KmCaAct in component INaCa_i (millimolar)');
    LEGEND_CONSTANTS(:,72) = strpad('Gncx in component INaCa_i (milliS_per_microF)');
    LEGEND_ALGEBRAIC(:,98) = strpad('h1_i in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,99) = strpad('h2_i in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,100) = strpad('h3_i in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,101) = strpad('h4_i in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,102) = strpad('h5_i in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,103) = strpad('h6_i in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,104) = strpad('h7_i in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,105) = strpad('h8_i in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,106) = strpad('h9_i in component INaCa_i (dimensionless)');
    LEGEND_CONSTANTS(:,132) = strpad('h10_i in component INaCa_i (dimensionless)');
    LEGEND_CONSTANTS(:,133) = strpad('h11_i in component INaCa_i (dimensionless)');
    LEGEND_CONSTANTS(:,134) = strpad('h12_i in component INaCa_i (dimensionless)');
    LEGEND_CONSTANTS(:,135) = strpad('k1_i in component INaCa_i (dimensionless)');
    LEGEND_CONSTANTS(:,136) = strpad('k2_i in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,107) = strpad('k3p_i in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,108) = strpad('k3pp_i in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,109) = strpad('k3_i in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,112) = strpad('k4_i in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,110) = strpad('k4p_i in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,111) = strpad('k4pp_i in component INaCa_i (dimensionless)');
    LEGEND_CONSTANTS(:,137) = strpad('k5_i in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,113) = strpad('k6_i in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,114) = strpad('k7_i in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,115) = strpad('k8_i in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,116) = strpad('x1_i in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,117) = strpad('x2_i in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,118) = strpad('x3_i in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,119) = strpad('x4_i in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,120) = strpad('E1_i in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,121) = strpad('E2_i in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,122) = strpad('E3_i in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,123) = strpad('E4_i in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,124) = strpad('allo_i in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,125) = strpad('JncxNa_i in component INaCa_i (millimolar_per_millisecond)');
    LEGEND_ALGEBRAIC(:,126) = strpad('JncxCa_i in component INaCa_i (millimolar_per_millisecond)');
    LEGEND_ALGEBRAIC(:,128) = strpad('h1_ss in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,129) = strpad('h2_ss in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,130) = strpad('h3_ss in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,131) = strpad('h4_ss in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,132) = strpad('h5_ss in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,133) = strpad('h6_ss in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,134) = strpad('h7_ss in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,135) = strpad('h8_ss in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,136) = strpad('h9_ss in component INaCa_i (dimensionless)');
    LEGEND_CONSTANTS(:,138) = strpad('h10_ss in component INaCa_i (dimensionless)');
    LEGEND_CONSTANTS(:,139) = strpad('h11_ss in component INaCa_i (dimensionless)');
    LEGEND_CONSTANTS(:,140) = strpad('h12_ss in component INaCa_i (dimensionless)');
    LEGEND_CONSTANTS(:,141) = strpad('k1_ss in component INaCa_i (dimensionless)');
    LEGEND_CONSTANTS(:,142) = strpad('k2_ss in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,137) = strpad('k3p_ss in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,138) = strpad('k3pp_ss in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,139) = strpad('k3_ss in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,142) = strpad('k4_ss in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,140) = strpad('k4p_ss in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,141) = strpad('k4pp_ss in component INaCa_i (dimensionless)');
    LEGEND_CONSTANTS(:,143) = strpad('k5_ss in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,143) = strpad('k6_ss in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,144) = strpad('k7_ss in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,145) = strpad('k8_ss in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,146) = strpad('x1_ss in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,147) = strpad('x2_ss in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,148) = strpad('x3_ss in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,149) = strpad('x4_ss in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,150) = strpad('E1_ss in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,151) = strpad('E2_ss in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,152) = strpad('E3_ss in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,153) = strpad('E4_ss in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,154) = strpad('allo_ss in component INaCa_i (dimensionless)');
    LEGEND_ALGEBRAIC(:,155) = strpad('JncxNa_ss in component INaCa_i (millimolar_per_millisecond)');
    LEGEND_ALGEBRAIC(:,156) = strpad('JncxCa_ss in component INaCa_i (millimolar_per_millisecond)');
    LEGEND_CONSTANTS(:,73) = strpad('k1p in component INaK (per_millisecond)');
    LEGEND_CONSTANTS(:,74) = strpad('k1m in component INaK (per_millisecond)');
    LEGEND_CONSTANTS(:,75) = strpad('k2p in component INaK (per_millisecond)');
    LEGEND_CONSTANTS(:,76) = strpad('k2m in component INaK (per_millisecond)');
    LEGEND_CONSTANTS(:,77) = strpad('k3p in component INaK (per_millisecond)');
    LEGEND_CONSTANTS(:,78) = strpad('k3m in component INaK (per_millisecond)');
    LEGEND_CONSTANTS(:,79) = strpad('k4p in component INaK (per_millisecond)');
    LEGEND_CONSTANTS(:,80) = strpad('k4m in component INaK (per_millisecond)');
    LEGEND_CONSTANTS(:,81) = strpad('Knai0 in component INaK (millimolar)');
    LEGEND_CONSTANTS(:,82) = strpad('Knao0 in component INaK (millimolar)');
    LEGEND_CONSTANTS(:,83) = strpad('delta in component INaK (millivolt)');
    LEGEND_CONSTANTS(:,84) = strpad('Kki in component INaK (per_millisecond)');
    LEGEND_CONSTANTS(:,85) = strpad('Kko in component INaK (per_millisecond)');
    LEGEND_CONSTANTS(:,86) = strpad('MgADP in component INaK (millimolar)');
    LEGEND_CONSTANTS(:,87) = strpad('MgATP in component INaK (millimolar)');
    LEGEND_CONSTANTS(:,88) = strpad('Kmgatp in component INaK (millimolar)');
    LEGEND_CONSTANTS(:,89) = strpad('H in component INaK (millimolar)');
    LEGEND_CONSTANTS(:,90) = strpad('eP in component INaK (dimensionless)');
    LEGEND_CONSTANTS(:,91) = strpad('Khp in component INaK (millimolar)');
    LEGEND_CONSTANTS(:,92) = strpad('Knap in component INaK (millimolar)');
    LEGEND_CONSTANTS(:,93) = strpad('Kxkur in component INaK (millimolar)');
    LEGEND_CONSTANTS(:,94) = strpad('Pnak in component INaK (milliS_per_microF)');
    LEGEND_ALGEBRAIC(:,158) = strpad('Knai in component INaK (millimolar)');
    LEGEND_ALGEBRAIC(:,159) = strpad('Knao in component INaK (millimolar)');
    LEGEND_ALGEBRAIC(:,160) = strpad('P in component INaK (dimensionless)');
    LEGEND_ALGEBRAIC(:,161) = strpad('a1 in component INaK (dimensionless)');
    LEGEND_CONSTANTS(:,144) = strpad('b1 in component INaK (dimensionless)');
    LEGEND_CONSTANTS(:,145) = strpad('a2 in component INaK (dimensionless)');
    LEGEND_ALGEBRAIC(:,162) = strpad('b2 in component INaK (dimensionless)');
    LEGEND_ALGEBRAIC(:,163) = strpad('a3 in component INaK (dimensionless)');
    LEGEND_ALGEBRAIC(:,164) = strpad('b3 in component INaK (dimensionless)');
    LEGEND_CONSTANTS(:,146) = strpad('a4 in component INaK (dimensionless)');
    LEGEND_ALGEBRAIC(:,165) = strpad('b4 in component INaK (dimensionless)');
    LEGEND_ALGEBRAIC(:,166) = strpad('x1 in component INaK (dimensionless)');
    LEGEND_ALGEBRAIC(:,167) = strpad('x2 in component INaK (dimensionless)');
    LEGEND_ALGEBRAIC(:,168) = strpad('x3 in component INaK (dimensionless)');
    LEGEND_ALGEBRAIC(:,169) = strpad('x4 in component INaK (dimensionless)');
    LEGEND_ALGEBRAIC(:,170) = strpad('E1 in component INaK (dimensionless)');
    LEGEND_ALGEBRAIC(:,171) = strpad('E2 in component INaK (dimensionless)');
    LEGEND_ALGEBRAIC(:,172) = strpad('E3 in component INaK (dimensionless)');
    LEGEND_ALGEBRAIC(:,173) = strpad('E4 in component INaK (dimensionless)');
    LEGEND_ALGEBRAIC(:,174) = strpad('JnakNa in component INaK (millimolar_per_millisecond)');
    LEGEND_ALGEBRAIC(:,175) = strpad('JnakK in component INaK (millimolar_per_millisecond)');
    LEGEND_CONSTANTS(:,95) = strpad('PNab in component INab (milliS_per_microF)');
    LEGEND_CONSTANTS(:,96) = strpad('PCab in component ICab (milliS_per_microF)');
    LEGEND_CONSTANTS(:,97) = strpad('GpCa in component IpCa (milliS_per_microF)');
    LEGEND_CONSTANTS(:,98) = strpad('KmCap in component IpCa (millimolar)');
    LEGEND_CONSTANTS(:,99) = strpad('sstau in component diff (millisecond)');
    LEGEND_CONSTANTS(:,100) = strpad('gaptau in component diff (millisecond)');
    LEGEND_ALGEBRAIC(:,197) = strpad('REL in component ryr (millimolar_per_millisecond)');
    LEGEND_ALGEBRAIC(:,199) = strpad('irelss in component ryr (millimolar_per_millisecond)');
    LEGEND_ALGEBRAIC(:,186) = strpad('ireltau in component ryr (dimensionless)');
    LEGEND_ALGEBRAIC(:,193) = strpad('REL2 in component ryr (millimolar_per_millisecond)');
    LEGEND_ALGEBRAIC(:,195) = strpad('irelss2 in component ryr (millimolar_per_millisecond)');
    LEGEND_ALGEBRAIC(:,187) = strpad('ireltau2 in component ryr (dimensionless)');
    LEGEND_CONSTANTS(:,101) = strpad('dqupcamkbar in component SERCA (dimensionless)');
    LEGEND_CONSTANTS(:,102) = strpad('dkmplbbar in component SERCA (dimensionless)');
    LEGEND_CONSTANTS(:,103) = strpad('kmup in component SERCA (dimensionless)');
    LEGEND_CONSTANTS(:,104) = strpad('nsrbar in component SERCA (dimensionless)');
    LEGEND_ALGEBRAIC(:,188) = strpad('dkmplb in component SERCA (dimensionless)');
    LEGEND_ALGEBRAIC(:,189) = strpad('dqupcamk in component SERCA (dimensionless)');
    LEGEND_CONSTANTS(:,105) = strpad('IP3 in component IP3 (dimensionless)');
    LEGEND_CONSTANTS(:,106) = strpad('k1 in component IP3 (dimensionless)');
    LEGEND_CONSTANTS(:,107) = strpad('k1a in component IP3 (dimensionless)');
    LEGEND_CONSTANTS(:,108) = strpad('k0 in component IP3 (dimensionless)');
    LEGEND_CONSTANTS(:,109) = strpad('k0a in component IP3 (dimensionless)');
    LEGEND_CONSTANTS(:,110) = strpad('k2 in component IP3 (dimensionless)');
    LEGEND_CONSTANTS(:,111) = strpad('k2a in component IP3 (dimensionless)');
    LEGEND_CONSTANTS(:,112) = strpad('tauip3 in component IP3 (millisecond)');
    LEGEND_ALGEBRAIC(:,192) = strpad('POip3 in component IP3 (dimensionless)');
    LEGEND_STATES(:,46) = strpad('u in component IP3 (millimolar_per_millisecond)');
    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 nasl in component intracellular_ions (millimolar)');
    LEGEND_RATES(:,6) = strpad('d/dt nass in component intracellular_ions (millimolar)');
    LEGEND_RATES(:,7) = strpad('d/dt ki in component intracellular_ions (millimolar)');
    LEGEND_RATES(:,9) = strpad('d/dt ksl in component intracellular_ions (millimolar)');
    LEGEND_RATES(:,8) = 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(:,11) = strpad('d/dt casl in component intracellular_ions (millimolar)');
    LEGEND_RATES(:,12) = strpad('d/dt cansr in component intracellular_ions (millimolar)');
    LEGEND_RATES(:,13) = strpad('d/dt cajsr in component intracellular_ions (millimolar)');
    LEGEND_RATES(:,14) = strpad('d/dt cacsr in component intracellular_ions (millimolar)');
    LEGEND_RATES(:,17) = strpad('d/dt m in component INa (dimensionless)');
    LEGEND_RATES(:,18) = strpad('d/dt hf in component INa (dimensionless)');
    LEGEND_RATES(:,19) = strpad('d/dt hs in component INa (dimensionless)');
    LEGEND_RATES(:,20) = strpad('d/dt j in component INa (dimensionless)');
    LEGEND_RATES(:,21) = strpad('d/dt hsp in component INa (dimensionless)');
    LEGEND_RATES(:,22) = strpad('d/dt jp in component INa (dimensionless)');
    LEGEND_RATES(:,23) = strpad('d/dt mL in component INaL (dimensionless)');
    LEGEND_RATES(:,24) = strpad('d/dt hL in component INaL (dimensionless)');
    LEGEND_RATES(:,25) = strpad('d/dt hLp in component INaL (dimensionless)');
    LEGEND_RATES(:,26) = strpad('d/dt a in component Ito (dimensionless)');
    LEGEND_RATES(:,27) = strpad('d/dt i1 in component Ito (dimensionless)');
    LEGEND_RATES(:,28) = strpad('d/dt i2 in component Ito (dimensionless)');
    LEGEND_RATES(:,29) = strpad('d/dt d in component ICaL (dimensionless)');
    LEGEND_RATES(:,30) = strpad('d/dt ff in component ICaL (dimensionless)');
    LEGEND_RATES(:,31) = strpad('d/dt fs in component ICaL (dimensionless)');
    LEGEND_RATES(:,32) = strpad('d/dt fcaf in component ICaL (dimensionless)');
    LEGEND_RATES(:,33) = strpad('d/dt fcas in component ICaL (dimensionless)');
    LEGEND_RATES(:,34) = strpad('d/dt jca in component ICaL (dimensionless)');
    LEGEND_RATES(:,35) = strpad('d/dt ffp in component ICaL (dimensionless)');
    LEGEND_RATES(:,36) = strpad('d/dt fcafp in component ICaL (dimensionless)');
    LEGEND_RATES(:,37) = strpad('d/dt nca in component ICaL (dimensionless)');
    LEGEND_RATES(:,38) = strpad('d/dt b in component ICaT (dimensionless)');
    LEGEND_RATES(:,39) = strpad('d/dt g in component ICaT (dimensionless)');
    LEGEND_RATES(:,40) = strpad('d/dt xrf in component IKr (dimensionless)');
    LEGEND_RATES(:,41) = strpad('d/dt xrs in component IKr (dimensionless)');
    LEGEND_RATES(:,42) = strpad('d/dt xs1 in component IKs (dimensionless)');
    LEGEND_RATES(:,43) = strpad('d/dt xs2 in component IKs (dimensionless)');
    LEGEND_RATES(:,44) = strpad('d/dt y in component If (dimensionless)');
    LEGEND_RATES(:,45) = strpad('d/dt xk1 in component IK1 (dimensionless)');
    LEGEND_RATES(:,15) = strpad('d/dt Jrel1 in component ryr (millimolar_per_millisecond)');
    LEGEND_RATES(:,16) = strpad('d/dt Jrel2 in component ryr (millimolar_per_millisecond)');
    LEGEND_RATES(:,46) = strpad('d/dt u in component IP3 (millimolar_per_millisecond)');
    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) = 140;
    CONSTANTS(:,2) = 1.8;
    CONSTANTS(:,3) = 5.4;
    CONSTANTS(:,4) = 8314;
    CONSTANTS(:,5) = 310;
    CONSTANTS(:,6) = 96485;
    CONSTANTS(:,7) = 1;
    CONSTANTS(:,8) = 2;
    CONSTANTS(:,9) = 1;
    CONSTANTS(:,10) = 0.0164;
    CONSTANTS(:,11) = 0.00175;
    CONSTANTS(:,12) = 3.14159265;
    STATES(:,1) = -86.6814002878592;
    CONSTANTS(:,13) = -40;
    CONSTANTS(:,14) = 1;
    CONSTANTS(:,15) = 0.15;
    CONSTANTS(:,16) = 0.05;
    CONSTANTS(:,17) = 0.00068;
    CONSTANTS(:,18) = 0.05;
    CONSTANTS(:,19) = 0.0015;
    STATES(:,2) = 0.00505983330678751;
    STATES(:,3) = 0.000101777993438818;
    CONSTANTS(:,20) = 0.019975;
    CONSTANTS(:,21) = 0.00087;
    CONSTANTS(:,22) = 0.4777;
    CONSTANTS(:,23) = 0.0087;
    CONSTANTS(:,24) = 2.88;
    CONSTANTS(:,25) = 0.8;
    CONSTANTS(:,26) = 1.2;
    CONSTANTS(:,27) = 0.1125;
    CONSTANTS(:,28) = 0.00238;
    CONSTANTS(:,29) = 0.0125;
    CONSTANTS(:,30) = 0.0315;
    CONSTANTS(:,31) = 0.0005;
    CONSTANTS(:,32) = 0.0035;
    STATES(:,4) = 8.23183964616932;
    STATES(:,5) = 8.23153516580562;
    STATES(:,6) = 8.23154325237268;
    STATES(:,7) = 143.767359809132;
    STATES(:,8) = 143.767768218104;
    STATES(:,9) = 143.767769906216;
    STATES(:,10) = 4.36004404734282e-5;
    STATES(:,11) = 0.000102004317781147;
    STATES(:,12) = 1.26350902016858;
    STATES(:,13) = 1.24811940209535;
    STATES(:,14) = 1.26516959198518;
    STATES(:,15) = 0.000108240945806962;
    STATES(:,16) = 1.25045800437317e-69;
    CONSTANTS(:,33) = 1;
    CONSTANTS(:,34) = 0.01833;
    CONSTANTS(:,35) = 48.4264;
    CONSTANTS(:,36) = 7.5653;
    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(:,17) = 0.00632661703915808;
    CONSTANTS(:,43) = 78.5;
    CONSTANTS(:,44) = 6.22;
    CONSTANTS(:,45) = 0.99;
    STATES(:,18) = 0.788611739889677;
    STATES(:,19) = 0.788545979951331;
    CONSTANTS(:,46) = 39.4572;
    STATES(:,20) = 0.790474358603666;
    STATES(:,21) = 0.579693514309867;
    STATES(:,22) = 0.790947058236417;
    STATES(:,23) = 0.000241925773627233;
    CONSTANTS(:,47) = 200;
    STATES(:,24) = 0.463574582508218;
    STATES(:,25) = 0.240216198686475;
    CONSTANTS(:,48) = 0.0189;
    STATES(:,26) = 0.000272851144435704;
    STATES(:,27) = 0.649604795721571;
    STATES(:,28) = 0.989965695822495;
    CONSTANTS(:,49) = 0.192;
    CONSTANTS(:,50) = 0.0301;
    CONSTANTS(:,51) = 0.002;
    CONSTANTS(:,52) = 1000;
    STATES(:,29) = 6.97735089296892e-9;
    STATES(:,30) = 0.999999968230738;
    STATES(:,31) = 0.926692153319136;
    STATES(:,32) = 0.99999996819573;
    STATES(:,33) = 0.999999905741936;
    STATES(:,34) = 0.999978907334662;
    STATES(:,35) = 0.999999968365903;
    STATES(:,36) = 0.999999968278239;
    STATES(:,37) = 0.00547252500964926;
    CONSTANTS(:,53) = 7.7677e-5;
    CONSTANTS(:,54) = 0.0754;
    STATES(:,38) = 0.000304250912559619;
    STATES(:,39) = 0.994214357917907;
    CONSTANTS(:,55) = 0.0342;
    STATES(:,40) = 0.000331691184084272;
    STATES(:,41) = 0.568716473334161;
    CONSTANTS(:,56) = 0.0029;
    STATES(:,42) = 0.191165248085394;
    STATES(:,43) = 0.000222677365291219;
    CONSTANTS(:,57) = 0.0116;
    CONSTANTS(:,58) = 0.0232;
    STATES(:,44) = 0.233119011214908;
    CONSTANTS(:,59) = 0.0455;
    STATES(:,45) = 0.997084813729909;
    CONSTANTS(:,60) = 15;
    CONSTANTS(:,61) = 5;
    CONSTANTS(:,62) = 88.12;
    CONSTANTS(:,63) = 12.5;
    CONSTANTS(:,64) = 60000;
    CONSTANTS(:,65) = 60000;
    CONSTANTS(:,66) = 5000;
    CONSTANTS(:,67) = 1500000;
    CONSTANTS(:,68) = 5000;
    CONSTANTS(:,69) = 0.5224;
    CONSTANTS(:,70) = 0.167;
    CONSTANTS(:,71) = 0.00015;
    CONSTANTS(:,72) = 0.00095709;
    CONSTANTS(:,73) = 949.5;
    CONSTANTS(:,74) = 182.4;
    CONSTANTS(:,75) = 687.2;
    CONSTANTS(:,76) = 39.4;
    CONSTANTS(:,77) = 1899;
    CONSTANTS(:,78) = 79300;
    CONSTANTS(:,79) = 639;
    CONSTANTS(:,80) = 40;
    CONSTANTS(:,81) = 9.073;
    CONSTANTS(:,82) = 27.78;
    CONSTANTS(:,83) = -0.155;
    CONSTANTS(:,84) = 0.5;
    CONSTANTS(:,85) = 0.3582;
    CONSTANTS(:,86) = 0.05;
    CONSTANTS(:,87) = 9.8;
    CONSTANTS(:,88) = 1.698e-7;
    CONSTANTS(:,89) = 1e-7;
    CONSTANTS(:,90) = 4.2;
    CONSTANTS(:,91) = 1.698e-7;
    CONSTANTS(:,92) = 224;
    CONSTANTS(:,93) = 292;
    CONSTANTS(:,94) = 32.4872;
    CONSTANTS(:,95) = 9.375e-10;
    CONSTANTS(:,96) = 2.5e-8;
    CONSTANTS(:,97) = 0.0005;
    CONSTANTS(:,98) = 0.0005;
    CONSTANTS(:,99) = 0.2;
    CONSTANTS(:,100) = 12;
    CONSTANTS(:,101) = 0.75;
    CONSTANTS(:,102) = 0.00017;
    CONSTANTS(:,103) = 0.00028;
    CONSTANTS(:,104) = 15;
    CONSTANTS(:,105) = 0.0001;
    CONSTANTS(:,106) = 150000;
    CONSTANTS(:,107) = 16.5;
    CONSTANTS(:,108) = 96000;
    CONSTANTS(:,109) = 9.6;
    CONSTANTS(:,110) = 1800;
    CONSTANTS(:,111) = 0.21;
    CONSTANTS(:,112) = 3.7;
    STATES(:,46) = 0.466236137183558;
    CONSTANTS(:,113) = 1.00000 - CONSTANTS(:,45);
    CONSTANTS(:,114) =  3.00000.*CONSTANTS(:,47);
    CONSTANTS(:,115) = 0.600000;
    CONSTANTS(:,116) =  1.10000.*CONSTANTS(:,53);
    CONSTANTS(:,117) =  0.00125000.*CONSTANTS(:,53);
    CONSTANTS(:,118) =  0.000357400.*CONSTANTS(:,53);
    CONSTANTS(:,119) = 75.0000;
    CONSTANTS(:,120) =  1000.00.*3.14159.*CONSTANTS(:,11).*CONSTANTS(:,11).*CONSTANTS(:,10);
    CONSTANTS(:,121) = 1.00000 - CONSTANTS(:,115);
    CONSTANTS(:,122) =  0.00125000.*CONSTANTS(:,116);
    CONSTANTS(:,123) =  0.000357400.*CONSTANTS(:,116);
    CONSTANTS(:,124) =  2.00000.*CONSTANTS(:,12).*CONSTANTS(:,11).*CONSTANTS(:,11)+ 2.00000.*CONSTANTS(:,12).*CONSTANTS(:,11).*CONSTANTS(:,10);
    CONSTANTS(:,125) =  2.00000.*CONSTANTS(:,124);
    CONSTANTS(:,126) =  0.600000.*CONSTANTS(:,120);
    CONSTANTS(:,127) =  0.0400000.*CONSTANTS(:,120);
    CONSTANTS(:,128) =  0.00200000.*CONSTANTS(:,120);
    CONSTANTS(:,129) =  0.00800000.*CONSTANTS(:,120);
    CONSTANTS(:,130) =  0.0200000.*CONSTANTS(:,120);
    CONSTANTS(:,131) =  0.150000.*CONSTANTS(:,120);
    CONSTANTS(:,132) = CONSTANTS(:,63)+1.00000+ (CONSTANTS(:,1)./CONSTANTS(:,60)).*(1.00000+CONSTANTS(:,1)./CONSTANTS(:,61));
    CONSTANTS(:,133) = ( CONSTANTS(:,1).*CONSTANTS(:,1))./( CONSTANTS(:,132).*CONSTANTS(:,60).*CONSTANTS(:,61));
    CONSTANTS(:,134) = 1.00000./CONSTANTS(:,132);
    CONSTANTS(:,135) =  CONSTANTS(:,134).*CONSTANTS(:,2).*CONSTANTS(:,67);
    CONSTANTS(:,136) = CONSTANTS(:,68);
    CONSTANTS(:,137) = CONSTANTS(:,68);
    CONSTANTS(:,138) = CONSTANTS(:,63)+1.00000+ (CONSTANTS(:,1)./CONSTANTS(:,60)).*(1.00000+CONSTANTS(:,1)./CONSTANTS(:,61));
    CONSTANTS(:,139) = ( CONSTANTS(:,1).*CONSTANTS(:,1))./( CONSTANTS(:,138).*CONSTANTS(:,60).*CONSTANTS(:,61));
    CONSTANTS(:,140) = 1.00000./CONSTANTS(:,138);
    CONSTANTS(:,141) =  CONSTANTS(:,140).*CONSTANTS(:,2).*CONSTANTS(:,67);
    CONSTANTS(:,142) = CONSTANTS(:,68);
    CONSTANTS(:,143) = CONSTANTS(:,68);
    CONSTANTS(:,144) =  CONSTANTS(:,74).*CONSTANTS(:,86);
    CONSTANTS(:,145) = CONSTANTS(:,75);
    CONSTANTS(:,146) = (( CONSTANTS(:,79).*CONSTANTS(:,87))./CONSTANTS(:,88))./(1.00000+CONSTANTS(:,87)./CONSTANTS(:,88));
    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(:,46) =  STATES(:,3).*CONSTANTS(:,110).*(1.00000 - STATES(:,46)) -  CONSTANTS(:,111).*STATES(:,46);
    ALGEBRAIC(:,3) = 1.00000./(1.00000+exp((STATES(:,1)+87.6100)./7.48800));
    RATES(:,24) = (ALGEBRAIC(:,3) - STATES(:,24))./CONSTANTS(:,47);
    ALGEBRAIC(:,4) = 1.00000./(1.00000+exp((STATES(:,1)+93.8100)./7.48800));
    RATES(:,25) = (ALGEBRAIC(:,4) - STATES(:,25))./CONSTANTS(:,114);
    ALGEBRAIC(:,1) = 1.00000./(1.00000+exp( - (STATES(:,1)+CONSTANTS(:,35))./CONSTANTS(:,36)));
    ALGEBRAIC(:,17) = 1.00000./( CONSTANTS(:,39).*exp((STATES(:,1)+CONSTANTS(:,37))./CONSTANTS(:,38))+ CONSTANTS(:,40).*exp( - (STATES(:,1)+CONSTANTS(:,41))./CONSTANTS(:,42)));
    RATES(:,17) = (ALGEBRAIC(:,1) - STATES(:,17))./ALGEBRAIC(:,17);
    ALGEBRAIC(:,2) = 1.00000./(1.00000+exp((STATES(:,1)+CONSTANTS(:,43))./CONSTANTS(:,44)));
    ALGEBRAIC(:,18) = 1.00000./( 3.68600e-06.*exp( - (STATES(:,1)+3.88750)./7.85790)+ 16.0000.*exp((STATES(:,1) - 0.496300)./9.18430));
    RATES(:,18) = (ALGEBRAIC(:,2) - STATES(:,18))./ALGEBRAIC(:,18);
    ALGEBRAIC(:,19) = 1.00000./( 0.00979400.*exp( - (STATES(:,1)+17.9500)./28.0500)+ 0.334300.*exp((STATES(:,1)+5.73000)./56.6600));
    RATES(:,19) = (ALGEBRAIC(:,2) - STATES(:,19))./ALGEBRAIC(:,19);
    ALGEBRAIC(:,5) = 1.00000./(1.00000+exp((20.0000 - STATES(:,1))./13.0000));
    ALGEBRAIC(:,21) = 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(:,26) = (ALGEBRAIC(:,5) - STATES(:,26))./ALGEBRAIC(:,21);
    ALGEBRAIC(:,6) = 1.00000./(1.00000+exp((27.0000+STATES(:,1))./13.0000));
    ALGEBRAIC(:,22) = 43.0000+1.00000./( 0.00141600.*exp( - (STATES(:,1)+96.5200)./59.0500)+ 1.78000e-08.*exp((STATES(:,1)+114.100)./8.07900));
    RATES(:,27) = (ALGEBRAIC(:,6) - STATES(:,27))./ALGEBRAIC(:,22);
    ALGEBRAIC(:,23) = 6.16200+1.00000./( 0.393300.*exp( - (STATES(:,1)+100.000)./100.000)+ 0.0800400.*exp((STATES(:,1) - 8.00000)./8.59000));
    RATES(:,28) = (ALGEBRAIC(:,6) - STATES(:,28))./ALGEBRAIC(:,23);
    ALGEBRAIC(:,7) = 1.00000./(1.00000+exp( - (STATES(:,1)+3.94000+3.30000)./4.23000));
    ALGEBRAIC(:,26) = 0.600000+1.00000./(exp(  - 0.0500000.*(STATES(:,1)+6.00000))+exp( 0.0900000.*(STATES(:,1)+14.0000)));
    RATES(:,29) = (ALGEBRAIC(:,7) - STATES(:,29))./ALGEBRAIC(:,26);
    ALGEBRAIC(:,8) = 1.00000./(1.00000+exp((STATES(:,1)+19.5800+3.30000)./3.69600));
    ALGEBRAIC(:,27) = 7.00000+1.00000./( 0.00450000.*exp( - (STATES(:,1)+20.0000+15.1900)./10.0000)+ 0.00450000.*exp((STATES(:,1)+20.0000+15.1900)./10.0000));
    RATES(:,30) = (ALGEBRAIC(:,8) - STATES(:,30))./ALGEBRAIC(:,27);
    ALGEBRAIC(:,28) = 1000.00+1.00000./( 3.50000e-05.*exp( - (STATES(:,1)+5.00000+15.1900)./4.00000)+ 3.50000e-05.*exp((STATES(:,1)+5.00000+15.1900)./6.00000));
    RATES(:,31) = (ALGEBRAIC(:,8) - STATES(:,31))./ALGEBRAIC(:,28);
    ALGEBRAIC(:,24) = ALGEBRAIC(:,8);
    RATES(:,34) = (ALGEBRAIC(:,24) - STATES(:,34))./CONSTANTS(:,119);
    ALGEBRAIC(:,9) =  STATES(:,34).*1.00000;
    ALGEBRAIC(:,25) = 1.00000./(CONSTANTS(:,52)./ALGEBRAIC(:,9)+power(1.00000+CONSTANTS(:,51)./STATES(:,3), 4.00000));
    RATES(:,37) =  ALGEBRAIC(:,25).*CONSTANTS(:,52) -  STATES(:,37).*ALGEBRAIC(:,9);
    ALGEBRAIC(:,10) = 1.00000./(1.00000+exp( - (STATES(:,1)+30.0000)./7.00000));
    ALGEBRAIC(:,29) = 1.00000./( 1.06800.*exp((STATES(:,1)+16.3000)./30.0000)+ 1.06800.*exp( - (STATES(:,1)+16.3000)./30.0000));
    RATES(:,38) = (ALGEBRAIC(:,10) - STATES(:,38))./ALGEBRAIC(:,29);
    ALGEBRAIC(:,11) = 1.00000./(1.00000+exp((STATES(:,1)+61.0000)./5.00000));
    ALGEBRAIC(:,30) = 1.00000./( 0.0150000.*exp((STATES(:,1)+71.7000)./15.4000)+ 0.0150000.*exp( - (STATES(:,1)+71.7000)./83.3000));
    RATES(:,39) = (ALGEBRAIC(:,11) - STATES(:,39))./ALGEBRAIC(:,30);
    ALGEBRAIC(:,12) = 1.00000./(1.00000+exp( - (STATES(:,1)+8.33700)./6.78900));
    ALGEBRAIC(:,31) = 12.9800+1.00000./( 0.365200.*exp(((STATES(:,1)+17.6000) - 31.6600)./3.86900)+ 4.12300e-05.*exp( - ((STATES(:,1)+17.6000) - 47.7800)./20.3800));
    RATES(:,40) = (ALGEBRAIC(:,12) - STATES(:,40))./ALGEBRAIC(:,31);
    ALGEBRAIC(:,32) = 1.86500+1.00000./( 0.0662900.*exp(((STATES(:,1)+17.2000) - 34.7000)./7.35500)+ 1.12800e-05.*exp( - ((STATES(:,1)+17.2000) - 29.7400)./25.9400));
    RATES(:,41) = (ALGEBRAIC(:,12) - STATES(:,41))./ALGEBRAIC(:,32);
    ALGEBRAIC(:,13) = 1.00000./(1.00000+exp( - (STATES(:,1)+11.6000)./8.93200));
    ALGEBRAIC(:,34) = 817.300+1.00000./( 0.000232600.*exp((STATES(:,1)+48.2800)./17.8000)+ 0.00129200.*exp( - (STATES(:,1)+210.000)./230.000));
    RATES(:,42) = (ALGEBRAIC(:,13) - STATES(:,42))./ALGEBRAIC(:,34);
    ALGEBRAIC(:,14) = 1.00000./(1.00000+exp((STATES(:,1)+87.0000)./9.50000));
    ALGEBRAIC(:,35) = 2000.00./(exp((STATES(:,1)+57.0000)./60.0000)+exp( - (STATES(:,1)+132.000)./10.0000));
    RATES(:,44) = (ALGEBRAIC(:,14) - STATES(:,44))./ALGEBRAIC(:,35);
    ALGEBRAIC(:,15) = 1.00000./(1.00000+exp( - (STATES(:,1)+ 2.55380.*CONSTANTS(:,3)+144.590)./( 1.56920.*CONSTANTS(:,3)+3.81150)));
    ALGEBRAIC(:,36) = 122.200./(exp( - (STATES(:,1)+127.200)./20.3600)+exp((STATES(:,1)+236.800)./69.3300));
    RATES(:,45) = (ALGEBRAIC(:,15) - STATES(:,45))./ALGEBRAIC(:,36);
    ALGEBRAIC(:,20) = ALGEBRAIC(:,2);
    ALGEBRAIC(:,38) = 4.85900+1.00000./( 0.862800.*exp( - (STATES(:,1)+116.726)./7.60050)+ 1.10960.*exp((STATES(:,1)+6.27190)./9.03580));
    RATES(:,20) = (ALGEBRAIC(:,20) - STATES(:,20))./ALGEBRAIC(:,38);
    ALGEBRAIC(:,41) =  0.720000.*(7.00000+1.00000./( 0.0400000.*exp( - ((STATES(:,1)+15.1900) - 4.00000)./7.00000)+ 0.0400000.*exp(((STATES(:,1)+15.1900) - 4.00000)./7.00000)));
    RATES(:,32) = (ALGEBRAIC(:,24) - STATES(:,32))./ALGEBRAIC(:,41);
    ALGEBRAIC(:,42) =  0.490000.*(100.000+1.00000./( 0.000120000.*exp( - (STATES(:,1)+15.1900)./3.00000)+ 0.000120000.*exp((STATES(:,1)+15.1900)./7.00000)));
    RATES(:,33) = (ALGEBRAIC(:,24) - STATES(:,33))./ALGEBRAIC(:,42);
    ALGEBRAIC(:,43) =  2.50000.*ALGEBRAIC(:,27);
    RATES(:,35) = (ALGEBRAIC(:,8) - STATES(:,35))./ALGEBRAIC(:,43);
    ALGEBRAIC(:,33) = ALGEBRAIC(:,13);
    ALGEBRAIC(:,44) = 1.00000./( 0.0100000.*exp((STATES(:,1) - 50.0000)./20.0000)+ 0.0193000.*exp( - (STATES(:,1)+66.5400)./31.0000));
    RATES(:,43) = (ALGEBRAIC(:,33) - STATES(:,43))./ALGEBRAIC(:,44);
    ALGEBRAIC(:,50) = ( CONSTANTS(:,18).*(1.00000 - STATES(:,2)))./(1.00000+CONSTANTS(:,19)./STATES(:,3));
    RATES(:,2) =  CONSTANTS(:,16).*ALGEBRAIC(:,50).*(ALGEBRAIC(:,50)+STATES(:,2)) -  CONSTANTS(:,17).*STATES(:,2);
    ALGEBRAIC(:,39) = 1.00000./(1.00000+exp((STATES(:,1)+84.7000)./6.22000));
    ALGEBRAIC(:,46) =  3.00000.*ALGEBRAIC(:,19);
    RATES(:,21) = (ALGEBRAIC(:,39) - STATES(:,21))./ALGEBRAIC(:,46);
    ALGEBRAIC(:,47) =  1.46000.*ALGEBRAIC(:,38);
    RATES(:,22) = (ALGEBRAIC(:,20) - STATES(:,22))./ALGEBRAIC(:,47);
    ALGEBRAIC(:,40) = 1.00000./(1.00000+exp( - (STATES(:,1)+42.8500)./5.26400));
    ALGEBRAIC(:,48) = ALGEBRAIC(:,17);
    RATES(:,23) = (ALGEBRAIC(:,40) - STATES(:,23))./ALGEBRAIC(:,48);
    ALGEBRAIC(:,49) =  2.50000.*ALGEBRAIC(:,41);
    RATES(:,36) = (ALGEBRAIC(:,24) - STATES(:,36))./ALGEBRAIC(:,49);
    ALGEBRAIC(:,70) =  CONSTANTS(:,115).*STATES(:,30)+ CONSTANTS(:,121).*STATES(:,31);
    ALGEBRAIC(:,71) = 0.300000+0.600000./(1.00000+exp((STATES(:,1) - 10.0000)./10.0000));
    ALGEBRAIC(:,72) = 1.00000 - ALGEBRAIC(:,71);
    ALGEBRAIC(:,73) =  ALGEBRAIC(:,71).*STATES(:,32)+ ALGEBRAIC(:,72).*STATES(:,33);
    ALGEBRAIC(:,74) =  CONSTANTS(:,115).*STATES(:,35)+ CONSTANTS(:,121).*STATES(:,31);
    ALGEBRAIC(:,75) =  ALGEBRAIC(:,71).*STATES(:,36)+ ALGEBRAIC(:,72).*STATES(:,33);
    ALGEBRAIC(:,37) = ( STATES(:,1).*CONSTANTS(:,6).*CONSTANTS(:,6))./( CONSTANTS(:,4).*CONSTANTS(:,5));
    ALGEBRAIC(:,45) = ( STATES(:,1).*CONSTANTS(:,6))./( CONSTANTS(:,4).*CONSTANTS(:,5));
    ALGEBRAIC(:,78) = ( 1.00000.*ALGEBRAIC(:,37).*( 0.750000.*STATES(:,8).*exp( 1.00000.*ALGEBRAIC(:,45)) -  0.750000.*CONSTANTS(:,3)))./(exp( 1.00000.*ALGEBRAIC(:,45)) - 1.00000);
    ALGEBRAIC(:,51) = ALGEBRAIC(:,50)+STATES(:,2);
    ALGEBRAIC(:,79) = 1.00000./(1.00000+CONSTANTS(:,15)./ALGEBRAIC(:,51));
    ALGEBRAIC(:,82) =  (1.00000 - ALGEBRAIC(:,79)).*CONSTANTS(:,118).*ALGEBRAIC(:,78).*STATES(:,29).*( ALGEBRAIC(:,70).*(1.00000 - STATES(:,37))+ STATES(:,34).*ALGEBRAIC(:,73).*STATES(:,37))+ ALGEBRAIC(:,79).*CONSTANTS(:,123).*ALGEBRAIC(:,78).*STATES(:,29).*( ALGEBRAIC(:,74).*(1.00000 - STATES(:,37))+ STATES(:,34).*ALGEBRAIC(:,75).*STATES(:,37));
    ALGEBRAIC(:,178) = (STATES(:,8) - STATES(:,9))./CONSTANTS(:,99);
    RATES(:,8) = (  - ALGEBRAIC(:,82).*CONSTANTS(:,33).*CONSTANTS(:,125))./( CONSTANTS(:,6).*CONSTANTS(:,130)) - ALGEBRAIC(:,178);
    ALGEBRAIC(:,77) = ( 1.00000.*ALGEBRAIC(:,37).*( 0.750000.*STATES(:,6).*exp( 1.00000.*ALGEBRAIC(:,45)) -  0.750000.*CONSTANTS(:,1)))./(exp( 1.00000.*ALGEBRAIC(:,45)) - 1.00000);
    ALGEBRAIC(:,81) =  (1.00000 - ALGEBRAIC(:,79)).*CONSTANTS(:,117).*ALGEBRAIC(:,77).*STATES(:,29).*( ALGEBRAIC(:,70).*(1.00000 - STATES(:,37))+ STATES(:,34).*ALGEBRAIC(:,73).*STATES(:,37))+ ALGEBRAIC(:,79).*CONSTANTS(:,122).*ALGEBRAIC(:,77).*STATES(:,29).*( ALGEBRAIC(:,74).*(1.00000 - STATES(:,37))+ STATES(:,34).*ALGEBRAIC(:,75).*STATES(:,37));
    ALGEBRAIC(:,154) = 1.00000./(1.00000+power(CONSTANTS(:,71)./STATES(:,3), 2.00000));
    ALGEBRAIC(:,97) = exp(( CONSTANTS(:,69).*STATES(:,1).*CONSTANTS(:,6))./( CONSTANTS(:,4).*CONSTANTS(:,5)));
    ALGEBRAIC(:,134) = 1.00000+ (CONSTANTS(:,1)./CONSTANTS(:,62)).*(1.00000+1.00000./ALGEBRAIC(:,97));
    ALGEBRAIC(:,135) = CONSTANTS(:,1)./( CONSTANTS(:,62).*ALGEBRAIC(:,97).*ALGEBRAIC(:,134));
    ALGEBRAIC(:,138) =  ALGEBRAIC(:,135).*CONSTANTS(:,66);
    ALGEBRAIC(:,128) = 1.00000+ (STATES(:,6)./CONSTANTS(:,62)).*(1.00000+ALGEBRAIC(:,97));
    ALGEBRAIC(:,129) = ( STATES(:,6).*ALGEBRAIC(:,97))./( CONSTANTS(:,62).*ALGEBRAIC(:,128));
    ALGEBRAIC(:,141) =  ALGEBRAIC(:,129).*CONSTANTS(:,66);
    ALGEBRAIC(:,131) = 1.00000+ (STATES(:,6)./CONSTANTS(:,60)).*(1.00000+STATES(:,6)./CONSTANTS(:,61));
    ALGEBRAIC(:,132) = ( STATES(:,6).*STATES(:,6))./( ALGEBRAIC(:,131).*CONSTANTS(:,60).*CONSTANTS(:,61));
    ALGEBRAIC(:,144) =  ALGEBRAIC(:,132).*ALGEBRAIC(:,129).*CONSTANTS(:,64);
    ALGEBRAIC(:,145) =  ALGEBRAIC(:,135).*CONSTANTS(:,139).*CONSTANTS(:,64);
    ALGEBRAIC(:,136) = 1.00000./ALGEBRAIC(:,134);
    ALGEBRAIC(:,137) =  ALGEBRAIC(:,136).*CONSTANTS(:,65);
    ALGEBRAIC(:,139) = ALGEBRAIC(:,137)+ALGEBRAIC(:,138);
    ALGEBRAIC(:,96) = exp(( CONSTANTS(:,70).*STATES(:,1).*CONSTANTS(:,6))./( CONSTANTS(:,4).*CONSTANTS(:,5)));
    ALGEBRAIC(:,130) = 1.00000./ALGEBRAIC(:,128);
    ALGEBRAIC(:,140) = ( ALGEBRAIC(:,130).*CONSTANTS(:,65))./ALGEBRAIC(:,96);
    ALGEBRAIC(:,142) = ALGEBRAIC(:,140)+ALGEBRAIC(:,141);
    ALGEBRAIC(:,133) = 1.00000./ALGEBRAIC(:,131);
    ALGEBRAIC(:,143) =  ALGEBRAIC(:,133).*STATES(:,3).*CONSTANTS(:,67);
    ALGEBRAIC(:,146) =  CONSTANTS(:,142).*ALGEBRAIC(:,142).*(ALGEBRAIC(:,144)+ALGEBRAIC(:,143))+ CONSTANTS(:,143).*ALGEBRAIC(:,144).*(CONSTANTS(:,142)+ALGEBRAIC(:,139));
    ALGEBRAIC(:,147) =  CONSTANTS(:,141).*ALGEBRAIC(:,144).*(ALGEBRAIC(:,142)+CONSTANTS(:,143))+ ALGEBRAIC(:,142).*ALGEBRAIC(:,143).*(CONSTANTS(:,141)+ALGEBRAIC(:,145));
    ALGEBRAIC(:,148) =  CONSTANTS(:,141).*ALGEBRAIC(:,139).*(ALGEBRAIC(:,144)+ALGEBRAIC(:,143))+ ALGEBRAIC(:,145).*ALGEBRAIC(:,143).*(CONSTANTS(:,142)+ALGEBRAIC(:,139));
    ALGEBRAIC(:,149) =  CONSTANTS(:,142).*ALGEBRAIC(:,145).*(ALGEBRAIC(:,142)+CONSTANTS(:,143))+ ALGEBRAIC(:,139).*CONSTANTS(:,143).*(CONSTANTS(:,141)+ALGEBRAIC(:,145));
    ALGEBRAIC(:,150) = ALGEBRAIC(:,146)./(ALGEBRAIC(:,146)+ALGEBRAIC(:,147)+ALGEBRAIC(:,148)+ALGEBRAIC(:,149));
    ALGEBRAIC(:,151) = ALGEBRAIC(:,147)./(ALGEBRAIC(:,146)+ALGEBRAIC(:,147)+ALGEBRAIC(:,148)+ALGEBRAIC(:,149));
    ALGEBRAIC(:,152) = ALGEBRAIC(:,148)./(ALGEBRAIC(:,146)+ALGEBRAIC(:,147)+ALGEBRAIC(:,148)+ALGEBRAIC(:,149));
    ALGEBRAIC(:,153) = ALGEBRAIC(:,149)./(ALGEBRAIC(:,146)+ALGEBRAIC(:,147)+ALGEBRAIC(:,148)+ALGEBRAIC(:,149));
    ALGEBRAIC(:,155) = ( 3.00000.*( ALGEBRAIC(:,153).*ALGEBRAIC(:,144) -  ALGEBRAIC(:,150).*ALGEBRAIC(:,145))+ ALGEBRAIC(:,152).*ALGEBRAIC(:,141)) -  ALGEBRAIC(:,151).*ALGEBRAIC(:,138);
    ALGEBRAIC(:,156) =  ALGEBRAIC(:,151).*CONSTANTS(:,142) -  ALGEBRAIC(:,150).*CONSTANTS(:,141);
    ALGEBRAIC(:,157) =  0.200000.*CONSTANTS(:,72).*ALGEBRAIC(:,154).*( CONSTANTS(:,7).*ALGEBRAIC(:,155)+ CONSTANTS(:,8).*ALGEBRAIC(:,156));
    ALGEBRAIC(:,179) = (STATES(:,6) - STATES(:,5))./CONSTANTS(:,99);
    RATES(:,6) = (  - (ALGEBRAIC(:,81)+ 3.00000.*ALGEBRAIC(:,157)).*CONSTANTS(:,33).*CONSTANTS(:,125))./( CONSTANTS(:,6).*CONSTANTS(:,130)) - ALGEBRAIC(:,179);
    ALGEBRAIC(:,181) = (STATES(:,9) - STATES(:,7))./CONSTANTS(:,100);
    RATES(:,7) = ( ALGEBRAIC(:,181).*CONSTANTS(:,131))./CONSTANTS(:,126);
    ALGEBRAIC(:,58) =  (( CONSTANTS(:,4).*CONSTANTS(:,5))./CONSTANTS(:,6)).*log(CONSTANTS(:,3)./STATES(:,9));
    ALGEBRAIC(:,67) =  CONSTANTS(:,49).*STATES(:,26).*STATES(:,27).*STATES(:,28).*(STATES(:,1) - ALGEBRAIC(:,58));
    ALGEBRAIC(:,68) = 1.00000./(1.00000+exp( - (STATES(:,1) - 12.0000)./16.0000));
    ALGEBRAIC(:,69) =  CONSTANTS(:,50).*ALGEBRAIC(:,68).*(STATES(:,1) - ALGEBRAIC(:,58));
    ALGEBRAIC(:,84) = 1.00000./(1.00000+exp((STATES(:,1)+54.8100)./38.2100));
    ALGEBRAIC(:,85) = 1.00000 - ALGEBRAIC(:,84);
    ALGEBRAIC(:,86) =  ALGEBRAIC(:,84).*STATES(:,40)+ ALGEBRAIC(:,85).*STATES(:,41);
    ALGEBRAIC(:,87) = ( (1.00000./(1.00000+exp((STATES(:,1)+55.0000)./( 0.320000.*75.0000)))).*1.00000)./(1.00000+exp((STATES(:,1) - 10.0000)./( 0.320000.*30.0000)));
    ALGEBRAIC(:,88) =  CONSTANTS(:,55).*power((CONSTANTS(:,3)./5.40000), 1.0 ./ 2).*ALGEBRAIC(:,86).*ALGEBRAIC(:,87).*(STATES(:,1) - ALGEBRAIC(:,58));
    ALGEBRAIC(:,60) =  (( CONSTANTS(:,4).*CONSTANTS(:,5))./CONSTANTS(:,6)).*log((CONSTANTS(:,3)+ CONSTANTS(:,34).*CONSTANTS(:,1))./(STATES(:,9)+ CONSTANTS(:,34).*STATES(:,5)));
    ALGEBRAIC(:,89) = 1.00000+0.600000./(1.00000+power(3.80000e-05./STATES(:,11), 1.40000));
    ALGEBRAIC(:,90) =  CONSTANTS(:,56).*ALGEBRAIC(:,89).*STATES(:,42).*STATES(:,43).*(STATES(:,1) - ALGEBRAIC(:,60));
    ALGEBRAIC(:,94) = 1.00000./(1.00000+exp(((STATES(:,1)+116.000) -  5.50000.*CONSTANTS(:,3))./11.0000));
    ALGEBRAIC(:,95) =  CONSTANTS(:,59).*2.32380.*power((CONSTANTS(:,3)./5.40000), 1.0 ./ 2).*ALGEBRAIC(:,94).*STATES(:,45).*(STATES(:,1) - ALGEBRAIC(:,58));
    ALGEBRAIC(:,159) =  CONSTANTS(:,82).*exp(( (1.00000 - CONSTANTS(:,83)).*STATES(:,1).*CONSTANTS(:,6))./( 3.00000.*CONSTANTS(:,4).*CONSTANTS(:,5)));
    ALGEBRAIC(:,163) = ( CONSTANTS(:,77).*power(CONSTANTS(:,3)./CONSTANTS(:,85), 2.00000))./((power(1.00000+CONSTANTS(:,1)./ALGEBRAIC(:,159), 3.00000)+power(1.00000+CONSTANTS(:,3)./CONSTANTS(:,85), 2.00000)) - 1.00000);
    ALGEBRAIC(:,160) = CONSTANTS(:,90)./(1.00000+CONSTANTS(:,89)./CONSTANTS(:,91)+STATES(:,5)./CONSTANTS(:,92)+STATES(:,9)./CONSTANTS(:,93));
    ALGEBRAIC(:,164) = ( CONSTANTS(:,78).*ALGEBRAIC(:,160).*CONSTANTS(:,89))./(1.00000+CONSTANTS(:,87)./CONSTANTS(:,88));
    ALGEBRAIC(:,158) =  CONSTANTS(:,81).*exp(( CONSTANTS(:,83).*STATES(:,1).*CONSTANTS(:,6))./( 3.00000.*CONSTANTS(:,4).*CONSTANTS(:,5)));
    ALGEBRAIC(:,161) = ( CONSTANTS(:,73).*power(STATES(:,5)./ALGEBRAIC(:,158), 3.00000))./((power(1.00000+STATES(:,5)./ALGEBRAIC(:,158), 3.00000)+power(1.00000+STATES(:,9)./CONSTANTS(:,84), 2.00000)) - 1.00000);
    ALGEBRAIC(:,162) = ( CONSTANTS(:,76).*power(CONSTANTS(:,1)./ALGEBRAIC(:,159), 3.00000))./((power(1.00000+CONSTANTS(:,1)./ALGEBRAIC(:,159), 3.00000)+power(1.00000+CONSTANTS(:,3)./CONSTANTS(:,85), 2.00000)) - 1.00000);
    ALGEBRAIC(:,165) = ( CONSTANTS(:,80).*power(STATES(:,9)./CONSTANTS(:,84), 2.00000))./((power(1.00000+STATES(:,5)./ALGEBRAIC(:,158), 3.00000)+power(1.00000+STATES(:,9)./CONSTANTS(:,84), 2.00000)) - 1.00000);
    ALGEBRAIC(:,166) =  CONSTANTS(:,146).*ALGEBRAIC(:,161).*CONSTANTS(:,145)+ ALGEBRAIC(:,162).*ALGEBRAIC(:,165).*ALGEBRAIC(:,164)+ CONSTANTS(:,145).*ALGEBRAIC(:,165).*ALGEBRAIC(:,164)+ ALGEBRAIC(:,164).*ALGEBRAIC(:,161).*CONSTANTS(:,145);
    ALGEBRAIC(:,167) =  ALGEBRAIC(:,162).*CONSTANTS(:,144).*ALGEBRAIC(:,165)+ ALGEBRAIC(:,161).*CONSTANTS(:,145).*ALGEBRAIC(:,163)+ ALGEBRAIC(:,163).*CONSTANTS(:,144).*ALGEBRAIC(:,165)+ CONSTANTS(:,145).*ALGEBRAIC(:,163).*ALGEBRAIC(:,165);
    ALGEBRAIC(:,168) =  CONSTANTS(:,145).*ALGEBRAIC(:,163).*CONSTANTS(:,146)+ ALGEBRAIC(:,164).*ALGEBRAIC(:,162).*CONSTANTS(:,144)+ ALGEBRAIC(:,162).*CONSTANTS(:,144).*CONSTANTS(:,146)+ ALGEBRAIC(:,163).*CONSTANTS(:,146).*CONSTANTS(:,144);
    ALGEBRAIC(:,169) =  ALGEBRAIC(:,165).*ALGEBRAIC(:,164).*ALGEBRAIC(:,162)+ ALGEBRAIC(:,163).*CONSTANTS(:,146).*ALGEBRAIC(:,161)+ ALGEBRAIC(:,162).*CONSTANTS(:,146).*ALGEBRAIC(:,161)+ ALGEBRAIC(:,164).*ALGEBRAIC(:,162).*ALGEBRAIC(:,161);
    ALGEBRAIC(:,170) = ALGEBRAIC(:,166)./(ALGEBRAIC(:,166)+ALGEBRAIC(:,167)+ALGEBRAIC(:,168)+ALGEBRAIC(:,169));
    ALGEBRAIC(:,171) = ALGEBRAIC(:,167)./(ALGEBRAIC(:,166)+ALGEBRAIC(:,167)+ALGEBRAIC(:,168)+ALGEBRAIC(:,169));
    ALGEBRAIC(:,174) =  3.00000.*( ALGEBRAIC(:,170).*ALGEBRAIC(:,163) -  ALGEBRAIC(:,171).*ALGEBRAIC(:,164));
    ALGEBRAIC(:,172) = ALGEBRAIC(:,168)./(ALGEBRAIC(:,166)+ALGEBRAIC(:,167)+ALGEBRAIC(:,168)+ALGEBRAIC(:,169));
    ALGEBRAIC(:,173) = ALGEBRAIC(:,169)./(ALGEBRAIC(:,166)+ALGEBRAIC(:,167)+ALGEBRAIC(:,168)+ALGEBRAIC(:,169));
    ALGEBRAIC(:,175) =  2.00000.*( ALGEBRAIC(:,173).*CONSTANTS(:,144) -  ALGEBRAIC(:,172).*ALGEBRAIC(:,161));
    ALGEBRAIC(:,176) =  CONSTANTS(:,94).*( CONSTANTS(:,7).*ALGEBRAIC(:,174)+ CONSTANTS(:,9).*ALGEBRAIC(:,175));
    ALGEBRAIC(:,16) = piecewise({VOI<=CONSTANTS(:,14), CONSTANTS(:,13) }, 0.00000);
    ALGEBRAIC(:,92) =  CONSTANTS(:,58).*STATES(:,44).*STATES(:,44).*(STATES(:,1) - ALGEBRAIC(:,58));
    RATES(:,9) = (  - ((ALGEBRAIC(:,67)+ALGEBRAIC(:,69)+ALGEBRAIC(:,88)+ALGEBRAIC(:,90)+ALGEBRAIC(:,92)+ALGEBRAIC(:,95)+ALGEBRAIC(:,16)) -  2.00000.*ALGEBRAIC(:,176)).*CONSTANTS(:,33).*CONSTANTS(:,125))./( CONSTANTS(:,6).*CONSTANTS(:,131))+( ALGEBRAIC(:,178).*CONSTANTS(:,130))./CONSTANTS(:,131)+ - ALGEBRAIC(:,181);
    ALGEBRAIC(:,57) =  (( CONSTANTS(:,4).*CONSTANTS(:,5))./CONSTANTS(:,6)).*log(CONSTANTS(:,1)./STATES(:,5));
    ALGEBRAIC(:,61) =  CONSTANTS(:,45).*STATES(:,18)+ CONSTANTS(:,113).*STATES(:,19);
    ALGEBRAIC(:,62) =  CONSTANTS(:,45).*STATES(:,18)+ CONSTANTS(:,113).*STATES(:,21);
    ALGEBRAIC(:,63) = 1.00000./(1.00000+CONSTANTS(:,15)./ALGEBRAIC(:,51));
    ALGEBRAIC(:,64) =  CONSTANTS(:,46).*(STATES(:,1) - ALGEBRAIC(:,57)).*power(STATES(:,17), 3.00000).*( (1.00000 - ALGEBRAIC(:,63)).*ALGEBRAIC(:,61).*STATES(:,20)+ ALGEBRAIC(:,63).*ALGEBRAIC(:,62).*STATES(:,22));
    ALGEBRAIC(:,65) = 1.00000./(1.00000+CONSTANTS(:,15)./ALGEBRAIC(:,51));
    ALGEBRAIC(:,66) =  CONSTANTS(:,48).*(STATES(:,1) - ALGEBRAIC(:,57)).*STATES(:,23).*( (1.00000 - ALGEBRAIC(:,65)).*STATES(:,24)+ ALGEBRAIC(:,65).*STATES(:,25));
    ALGEBRAIC(:,76) = ( 4.00000.*ALGEBRAIC(:,37).*( STATES(:,3).*exp( 2.00000.*ALGEBRAIC(:,45)) -  0.341000.*CONSTANTS(:,2)))./(exp( 2.00000.*ALGEBRAIC(:,45)) - 1.00000);
    ALGEBRAIC(:,80) =  (1.00000 - ALGEBRAIC(:,79)).*CONSTANTS(:,53).*ALGEBRAIC(:,76).*STATES(:,29).*( ALGEBRAIC(:,70).*(1.00000 - STATES(:,37))+ STATES(:,34).*ALGEBRAIC(:,73).*STATES(:,37))+ ALGEBRAIC(:,79).*CONSTANTS(:,116).*ALGEBRAIC(:,76).*STATES(:,29).*( ALGEBRAIC(:,74).*(1.00000 - STATES(:,37))+ STATES(:,34).*ALGEBRAIC(:,75).*STATES(:,37));
    ALGEBRAIC(:,59) =  (( CONSTANTS(:,4).*CONSTANTS(:,5))./( 2.00000.*CONSTANTS(:,6))).*log(CONSTANTS(:,2)./STATES(:,11));
    ALGEBRAIC(:,83) =  CONSTANTS(:,54).*STATES(:,38).*STATES(:,39).*(STATES(:,1) - ALGEBRAIC(:,59));
    ALGEBRAIC(:,91) =  CONSTANTS(:,57).*STATES(:,44).*STATES(:,44).*(STATES(:,1) - ALGEBRAIC(:,57));
    ALGEBRAIC(:,93) = ALGEBRAIC(:,91)+ALGEBRAIC(:,92);
    ALGEBRAIC(:,124) = 1.00000./(1.00000+power(CONSTANTS(:,71)./STATES(:,11), 2.00000));
    ALGEBRAIC(:,104) = 1.00000+ (CONSTANTS(:,1)./CONSTANTS(:,62)).*(1.00000+1.00000./ALGEBRAIC(:,97));
    ALGEBRAIC(:,105) = CONSTANTS(:,1)./( CONSTANTS(:,62).*ALGEBRAIC(:,97).*ALGEBRAIC(:,104));
    ALGEBRAIC(:,108) =  ALGEBRAIC(:,105).*CONSTANTS(:,66);
    ALGEBRAIC(:,98) = 1.00000+ (STATES(:,5)./CONSTANTS(:,62)).*(1.00000+ALGEBRAIC(:,97));
    ALGEBRAIC(:,99) = ( STATES(:,5).*ALGEBRAIC(:,97))./( CONSTANTS(:,62).*ALGEBRAIC(:,98));
    ALGEBRAIC(:,111) =  ALGEBRAIC(:,99).*CONSTANTS(:,66);
    ALGEBRAIC(:,101) = 1.00000+ (STATES(:,5)./CONSTANTS(:,60)).*(1.00000+STATES(:,5)./CONSTANTS(:,61));
    ALGEBRAIC(:,102) = ( STATES(:,5).*STATES(:,5))./( ALGEBRAIC(:,101).*CONSTANTS(:,60).*CONSTANTS(:,61));
    ALGEBRAIC(:,114) =  ALGEBRAIC(:,102).*ALGEBRAIC(:,99).*CONSTANTS(:,64);
    ALGEBRAIC(:,115) =  ALGEBRAIC(:,105).*CONSTANTS(:,133).*CONSTANTS(:,64);
    ALGEBRAIC(:,106) = 1.00000./ALGEBRAIC(:,104);
    ALGEBRAIC(:,107) =  ALGEBRAIC(:,106).*CONSTANTS(:,65);
    ALGEBRAIC(:,109) = ALGEBRAIC(:,107)+ALGEBRAIC(:,108);
    ALGEBRAIC(:,100) = 1.00000./ALGEBRAIC(:,98);
    ALGEBRAIC(:,110) = ( ALGEBRAIC(:,100).*CONSTANTS(:,65))./ALGEBRAIC(:,96);
    ALGEBRAIC(:,112) = ALGEBRAIC(:,110)+ALGEBRAIC(:,111);
    ALGEBRAIC(:,103) = 1.00000./ALGEBRAIC(:,101);
    ALGEBRAIC(:,113) =  ALGEBRAIC(:,103).*STATES(:,11).*CONSTANTS(:,67);
    ALGEBRAIC(:,116) =  CONSTANTS(:,136).*ALGEBRAIC(:,112).*(ALGEBRAIC(:,114)+ALGEBRAIC(:,113))+ CONSTANTS(:,137).*ALGEBRAIC(:,114).*(CONSTANTS(:,136)+ALGEBRAIC(:,109));
    ALGEBRAIC(:,117) =  CONSTANTS(:,135).*ALGEBRAIC(:,114).*(ALGEBRAIC(:,112)+CONSTANTS(:,137))+ ALGEBRAIC(:,112).*ALGEBRAIC(:,113).*(CONSTANTS(:,135)+ALGEBRAIC(:,115));
    ALGEBRAIC(:,118) =  CONSTANTS(:,135).*ALGEBRAIC(:,109).*(ALGEBRAIC(:,114)+ALGEBRAIC(:,113))+ ALGEBRAIC(:,115).*ALGEBRAIC(:,113).*(CONSTANTS(:,136)+ALGEBRAIC(:,109));
    ALGEBRAIC(:,119) =  CONSTANTS(:,136).*ALGEBRAIC(:,115).*(ALGEBRAIC(:,112)+CONSTANTS(:,137))+ ALGEBRAIC(:,109).*CONSTANTS(:,137).*(CONSTANTS(:,135)+ALGEBRAIC(:,115));
    ALGEBRAIC(:,120) = ALGEBRAIC(:,116)./(ALGEBRAIC(:,116)+ALGEBRAIC(:,117)+ALGEBRAIC(:,118)+ALGEBRAIC(:,119));
    ALGEBRAIC(:,121) = ALGEBRAIC(:,117)./(ALGEBRAIC(:,116)+ALGEBRAIC(:,117)+ALGEBRAIC(:,118)+ALGEBRAIC(:,119));
    ALGEBRAIC(:,122) = ALGEBRAIC(:,118)./(ALGEBRAIC(:,116)+ALGEBRAIC(:,117)+ALGEBRAIC(:,118)+ALGEBRAIC(:,119));
    ALGEBRAIC(:,123) = ALGEBRAIC(:,119)./(ALGEBRAIC(:,116)+ALGEBRAIC(:,117)+ALGEBRAIC(:,118)+ALGEBRAIC(:,119));
    ALGEBRAIC(:,125) = ( 3.00000.*( ALGEBRAIC(:,123).*ALGEBRAIC(:,114) -  ALGEBRAIC(:,120).*ALGEBRAIC(:,115))+ ALGEBRAIC(:,122).*ALGEBRAIC(:,111)) -  ALGEBRAIC(:,121).*ALGEBRAIC(:,108);
    ALGEBRAIC(:,126) =  ALGEBRAIC(:,121).*CONSTANTS(:,136) -  ALGEBRAIC(:,120).*CONSTANTS(:,135);
    ALGEBRAIC(:,127) =  0.800000.*CONSTANTS(:,72).*ALGEBRAIC(:,124).*( CONSTANTS(:,7).*ALGEBRAIC(:,125)+ CONSTANTS(:,8).*ALGEBRAIC(:,126));
    ALGEBRAIC(:,177) = ( CONSTANTS(:,95).*ALGEBRAIC(:,37).*( STATES(:,5).*exp(ALGEBRAIC(:,45)) - CONSTANTS(:,1)))./(exp(ALGEBRAIC(:,45)) - 1.00000);
    ALGEBRAIC(:,183) = ( CONSTANTS(:,97).*STATES(:,11))./(CONSTANTS(:,98)+STATES(:,11));
    ALGEBRAIC(:,180) = ( CONSTANTS(:,96).*4.00000.*ALGEBRAIC(:,37).*( STATES(:,11).*exp( 2.00000.*ALGEBRAIC(:,45)) -  0.341000.*CONSTANTS(:,2)))./(exp( 2.00000.*ALGEBRAIC(:,45)) - 1.00000);
    RATES(:,1) =  - (ALGEBRAIC(:,64)+ALGEBRAIC(:,66)+ALGEBRAIC(:,67)+ALGEBRAIC(:,69)+ALGEBRAIC(:,80)+ALGEBRAIC(:,83)+ALGEBRAIC(:,81)+ALGEBRAIC(:,82)+ALGEBRAIC(:,88)+ALGEBRAIC(:,90)+ALGEBRAIC(:,93)+ALGEBRAIC(:,95)+ALGEBRAIC(:,127)+ALGEBRAIC(:,157)+ALGEBRAIC(:,176)+ALGEBRAIC(:,177)+ALGEBRAIC(:,183)+ALGEBRAIC(:,180)+ALGEBRAIC(:,16));
    ALGEBRAIC(:,182) = (STATES(:,5) - STATES(:,4))./CONSTANTS(:,100);
    RATES(:,4) = ( ALGEBRAIC(:,182).*CONSTANTS(:,131))./CONSTANTS(:,126);
    RATES(:,5) = (  - (ALGEBRAIC(:,64)+ALGEBRAIC(:,66)+ 3.00000.*ALGEBRAIC(:,127)+ 3.00000.*ALGEBRAIC(:,176)+ALGEBRAIC(:,91)+ALGEBRAIC(:,177)).*CONSTANTS(:,125).*CONSTANTS(:,33))./( CONSTANTS(:,6).*CONSTANTS(:,131))+( ALGEBRAIC(:,179).*CONSTANTS(:,130))./CONSTANTS(:,131)+ - ALGEBRAIC(:,182);
    ALGEBRAIC(:,184) = (STATES(:,3) - STATES(:,11))./CONSTANTS(:,99);
    ALGEBRAIC(:,185) = (STATES(:,11) - STATES(:,10))./CONSTANTS(:,100);
    ALGEBRAIC(:,188) = ( CONSTANTS(:,102).*ALGEBRAIC(:,51))./(ALGEBRAIC(:,51)+CONSTANTS(:,15));
    ALGEBRAIC(:,189) = ( CONSTANTS(:,101).*ALGEBRAIC(:,51))./(ALGEBRAIC(:,51)+CONSTANTS(:,15));
    ALGEBRAIC(:,190) = ( 0.000200000.*(ALGEBRAIC(:,189)+1.00000))./(1.00000+(CONSTANTS(:,103) - ALGEBRAIC(:,188))./STATES(:,11)) - ( 0.00105000.*STATES(:,12))./CONSTANTS(:,104);
    ALGEBRAIC(:,54) = 1.00000./(1.00000+( CONSTANTS(:,29).*CONSTANTS(:,28))./power(CONSTANTS(:,28)+STATES(:,11), 2.00000)+( CONSTANTS(:,32).*CONSTANTS(:,31))./power(CONSTANTS(:,31)+STATES(:,11), 2.00000));
    RATES(:,11) =  ALGEBRAIC(:,54).*(((  - ((ALGEBRAIC(:,183)+ALGEBRAIC(:,180)+ALGEBRAIC(:,83)) -  2.00000.*ALGEBRAIC(:,127)).*CONSTANTS(:,33).*CONSTANTS(:,125))./( 2.00000.*CONSTANTS(:,6).*CONSTANTS(:,131)) - ( ALGEBRAIC(:,190).*CONSTANTS(:,127))./CONSTANTS(:,131))+ - ALGEBRAIC(:,185)+( ALGEBRAIC(:,184).*CONSTANTS(:,130))./CONSTANTS(:,131));
    ALGEBRAIC(:,191) = ( 0.00260000.*(ALGEBRAIC(:,189)+1.00000))./(1.00000+(CONSTANTS(:,103) - ALGEBRAIC(:,188))./STATES(:,10)) - ( 0.00420000.*STATES(:,12))./CONSTANTS(:,104);
    ALGEBRAIC(:,52) = 1.00000./(1.00000+( CONSTANTS(:,27).*CONSTANTS(:,28))./power(CONSTANTS(:,28)+STATES(:,10), 2.00000)+( CONSTANTS(:,30).*CONSTANTS(:,31))./power(CONSTANTS(:,31)+STATES(:,10), 2.00000));
    RATES(:,10) =  ALGEBRAIC(:,52).*((( ALGEBRAIC(:,185).*CONSTANTS(:,131))./CONSTANTS(:,126)+( STATES(:,16).*CONSTANTS(:,129))./CONSTANTS(:,126)) - ( ALGEBRAIC(:,191).*CONSTANTS(:,127))./CONSTANTS(:,126));
    ALGEBRAIC(:,192) = ( CONSTANTS(:,112).*CONSTANTS(:,105).*STATES(:,3).*(1.00000 - STATES(:,46)))./( (1.00000+( CONSTANTS(:,105).*CONSTANTS(:,108))./CONSTANTS(:,109)).*(1.00000+( STATES(:,3).*CONSTANTS(:,106))./CONSTANTS(:,107)));
    ALGEBRAIC(:,194) =  10.9200.*ALGEBRAIC(:,192).*(STATES(:,13) - STATES(:,3));
    ALGEBRAIC(:,53) = 1.00000./(1.00000+( CONSTANTS(:,20).*CONSTANTS(:,21))./power(CONSTANTS(:,21)+STATES(:,3), 2.00000)+( CONSTANTS(:,22).*CONSTANTS(:,23))./power(CONSTANTS(:,23)+STATES(:,3), 2.00000));
    RATES(:,3) =  ALGEBRAIC(:,53).*(((  - (ALGEBRAIC(:,80) -  2.00000.*ALGEBRAIC(:,157)).*CONSTANTS(:,33).*CONSTANTS(:,125))./( 2.00000.*CONSTANTS(:,6).*CONSTANTS(:,130))+( (STATES(:,15)+ALGEBRAIC(:,194)).*CONSTANTS(:,128))./CONSTANTS(:,130)) - ALGEBRAIC(:,184));
    ALGEBRAIC(:,193) = ( ALGEBRAIC(:,185).*CONSTANTS(:,131))./CONSTANTS(:,126)+(  - ALGEBRAIC(:,191).*CONSTANTS(:,127))./CONSTANTS(:,126)+( STATES(:,16).*CONSTANTS(:,129))./CONSTANTS(:,126);
    ALGEBRAIC(:,195) = piecewise({ALGEBRAIC(:,193)>0.00000, ( 91.0000.*(1.00000+( 1.00000.*1.00000)./(1.00000+power(0.280000./ALGEBRAIC(:,51), 8.00000))).*ALGEBRAIC(:,193))./(1.00000+power(1.00000./STATES(:,14), 8.00000)) }, 0.00000);
    ALGEBRAIC(:,187) = ( 6.00000.*(1.00000+( 1.00000.*1.00000)./(1.00000+power(0.280000./ALGEBRAIC(:,51), 8.00000))))./(1.00000+0.0123000./STATES(:,14));
    RATES(:,16) = (ALGEBRAIC(:,195) - STATES(:,16))./ALGEBRAIC(:,187);
    ALGEBRAIC(:,196) = (STATES(:,12) - STATES(:,13))./120.000;
    ALGEBRAIC(:,55) = 1.00000./(1.00000+( CONSTANTS(:,26).*CONSTANTS(:,25))./power(CONSTANTS(:,25)+STATES(:,13), 2.00000));
    RATES(:,13) =  ALGEBRAIC(:,55).*(ALGEBRAIC(:,196) - (STATES(:,15)+ALGEBRAIC(:,194)));
    ALGEBRAIC(:,198) = (STATES(:,12) - STATES(:,14))./120.000;
    RATES(:,12) = (ALGEBRAIC(:,190)+ALGEBRAIC(:,191)) - (( ALGEBRAIC(:,196).*CONSTANTS(:,128))./CONSTANTS(:,127)+( ALGEBRAIC(:,198).*CONSTANTS(:,129))./CONSTANTS(:,127));
    ALGEBRAIC(:,56) = 1.00000./(1.00000+( CONSTANTS(:,24).*CONSTANTS(:,25))./power(CONSTANTS(:,25)+STATES(:,14), 2.00000));
    RATES(:,14) =  ALGEBRAIC(:,56).*(ALGEBRAIC(:,198) - STATES(:,16));
    ALGEBRAIC(:,197) =  - (( ALGEBRAIC(:,80).*CONSTANTS(:,125))./( CONSTANTS(:,130).*CONSTANTS(:,6).*2.00000)+(  - (STATES(:,15)+ALGEBRAIC(:,194)).*CONSTANTS(:,128))./CONSTANTS(:,130)+ALGEBRAIC(:,184));
    ALGEBRAIC(:,199) = piecewise({ALGEBRAIC(:,197)>0.00000, ( 15.0000.*(1.00000+( 1.00000.*1.00000)./(1.00000+power(0.280000./ALGEBRAIC(:,51), 8.00000))).*ALGEBRAIC(:,197))./(1.00000+power(1.00000./STATES(:,13), 8.00000)) }, 0.00000);
    ALGEBRAIC(:,186) = ( 2.00000.*(1.00000+( 1.00000.*1.00000)./(1.00000+power(0.280000./ALGEBRAIC(:,51), 8.00000))))./(1.00000+0.0123000./STATES(:,13));
    RATES(:,15) = (ALGEBRAIC(:,199) - STATES(:,15))./ALGEBRAIC(:,186);
   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(:,3) = 1.00000./(1.00000+exp((STATES(:,1)+87.6100)./7.48800));
    ALGEBRAIC(:,4) = 1.00000./(1.00000+exp((STATES(:,1)+93.8100)./7.48800));
    ALGEBRAIC(:,1) = 1.00000./(1.00000+exp( - (STATES(:,1)+CONSTANTS(:,35))./CONSTANTS(:,36)));
    ALGEBRAIC(:,17) = 1.00000./( CONSTANTS(:,39).*exp((STATES(:,1)+CONSTANTS(:,37))./CONSTANTS(:,38))+ CONSTANTS(:,40).*exp( - (STATES(:,1)+CONSTANTS(:,41))./CONSTANTS(:,42)));
    ALGEBRAIC(:,2) = 1.00000./(1.00000+exp((STATES(:,1)+CONSTANTS(:,43))./CONSTANTS(:,44)));
    ALGEBRAIC(:,18) = 1.00000./( 3.68600e-06.*exp( - (STATES(:,1)+3.88750)./7.85790)+ 16.0000.*exp((STATES(:,1) - 0.496300)./9.18430));
    ALGEBRAIC(:,19) = 1.00000./( 0.00979400.*exp( - (STATES(:,1)+17.9500)./28.0500)+ 0.334300.*exp((STATES(:,1)+5.73000)./56.6600));
    ALGEBRAIC(:,5) = 1.00000./(1.00000+exp((20.0000 - STATES(:,1))./13.0000));
    ALGEBRAIC(:,21) = 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(:,6) = 1.00000./(1.00000+exp((27.0000+STATES(:,1))./13.0000));
    ALGEBRAIC(:,22) = 43.0000+1.00000./( 0.00141600.*exp( - (STATES(:,1)+96.5200)./59.0500)+ 1.78000e-08.*exp((STATES(:,1)+114.100)./8.07900));
    ALGEBRAIC(:,23) = 6.16200+1.00000./( 0.393300.*exp( - (STATES(:,1)+100.000)./100.000)+ 0.0800400.*exp((STATES(:,1) - 8.00000)./8.59000));
    ALGEBRAIC(:,7) = 1.00000./(1.00000+exp( - (STATES(:,1)+3.94000+3.30000)./4.23000));
    ALGEBRAIC(:,26) = 0.600000+1.00000./(exp(  - 0.0500000.*(STATES(:,1)+6.00000))+exp( 0.0900000.*(STATES(:,1)+14.0000)));
    ALGEBRAIC(:,8) = 1.00000./(1.00000+exp((STATES(:,1)+19.5800+3.30000)./3.69600));
    ALGEBRAIC(:,27) = 7.00000+1.00000./( 0.00450000.*exp( - (STATES(:,1)+20.0000+15.1900)./10.0000)+ 0.00450000.*exp((STATES(:,1)+20.0000+15.1900)./10.0000));
    ALGEBRAIC(:,28) = 1000.00+1.00000./( 3.50000e-05.*exp( - (STATES(:,1)+5.00000+15.1900)./4.00000)+ 3.50000e-05.*exp((STATES(:,1)+5.00000+15.1900)./6.00000));
    ALGEBRAIC(:,24) = ALGEBRAIC(:,8);
    ALGEBRAIC(:,9) =  STATES(:,34).*1.00000;
    ALGEBRAIC(:,25) = 1.00000./(CONSTANTS(:,52)./ALGEBRAIC(:,9)+power(1.00000+CONSTANTS(:,51)./STATES(:,3), 4.00000));
    ALGEBRAIC(:,10) = 1.00000./(1.00000+exp( - (STATES(:,1)+30.0000)./7.00000));
    ALGEBRAIC(:,29) = 1.00000./( 1.06800.*exp((STATES(:,1)+16.3000)./30.0000)+ 1.06800.*exp( - (STATES(:,1)+16.3000)./30.0000));
    ALGEBRAIC(:,11) = 1.00000./(1.00000+exp((STATES(:,1)+61.0000)./5.00000));
    ALGEBRAIC(:,30) = 1.00000./( 0.0150000.*exp((STATES(:,1)+71.7000)./15.4000)+ 0.0150000.*exp( - (STATES(:,1)+71.7000)./83.3000));
    ALGEBRAIC(:,12) = 1.00000./(1.00000+exp( - (STATES(:,1)+8.33700)./6.78900));
    ALGEBRAIC(:,31) = 12.9800+1.00000./( 0.365200.*exp(((STATES(:,1)+17.6000) - 31.6600)./3.86900)+ 4.12300e-05.*exp( - ((STATES(:,1)+17.6000) - 47.7800)./20.3800));
    ALGEBRAIC(:,32) = 1.86500+1.00000./( 0.0662900.*exp(((STATES(:,1)+17.2000) - 34.7000)./7.35500)+ 1.12800e-05.*exp( - ((STATES(:,1)+17.2000) - 29.7400)./25.9400));
    ALGEBRAIC(:,13) = 1.00000./(1.00000+exp( - (STATES(:,1)+11.6000)./8.93200));
    ALGEBRAIC(:,34) = 817.300+1.00000./( 0.000232600.*exp((STATES(:,1)+48.2800)./17.8000)+ 0.00129200.*exp( - (STATES(:,1)+210.000)./230.000));
    ALGEBRAIC(:,14) = 1.00000./(1.00000+exp((STATES(:,1)+87.0000)./9.50000));
    ALGEBRAIC(:,35) = 2000.00./(exp((STATES(:,1)+57.0000)./60.0000)+exp( - (STATES(:,1)+132.000)./10.0000));
    ALGEBRAIC(:,15) = 1.00000./(1.00000+exp( - (STATES(:,1)+ 2.55380.*CONSTANTS(:,3)+144.590)./( 1.56920.*CONSTANTS(:,3)+3.81150)));
    ALGEBRAIC(:,36) = 122.200./(exp( - (STATES(:,1)+127.200)./20.3600)+exp((STATES(:,1)+236.800)./69.3300));
    ALGEBRAIC(:,20) = ALGEBRAIC(:,2);
    ALGEBRAIC(:,38) = 4.85900+1.00000./( 0.862800.*exp( - (STATES(:,1)+116.726)./7.60050)+ 1.10960.*exp((STATES(:,1)+6.27190)./9.03580));
    ALGEBRAIC(:,41) =  0.720000.*(7.00000+1.00000./( 0.0400000.*exp( - ((STATES(:,1)+15.1900) - 4.00000)./7.00000)+ 0.0400000.*exp(((STATES(:,1)+15.1900) - 4.00000)./7.00000)));
    ALGEBRAIC(:,42) =  0.490000.*(100.000+1.00000./( 0.000120000.*exp( - (STATES(:,1)+15.1900)./3.00000)+ 0.000120000.*exp((STATES(:,1)+15.1900)./7.00000)));
    ALGEBRAIC(:,43) =  2.50000.*ALGEBRAIC(:,27);
    ALGEBRAIC(:,33) = ALGEBRAIC(:,13);
    ALGEBRAIC(:,44) = 1.00000./( 0.0100000.*exp((STATES(:,1) - 50.0000)./20.0000)+ 0.0193000.*exp( - (STATES(:,1)+66.5400)./31.0000));
    ALGEBRAIC(:,50) = ( CONSTANTS(:,18).*(1.00000 - STATES(:,2)))./(1.00000+CONSTANTS(:,19)./STATES(:,3));
    ALGEBRAIC(:,39) = 1.00000./(1.00000+exp((STATES(:,1)+84.7000)./6.22000));
    ALGEBRAIC(:,46) =  3.00000.*ALGEBRAIC(:,19);
    ALGEBRAIC(:,47) =  1.46000.*ALGEBRAIC(:,38);
    ALGEBRAIC(:,40) = 1.00000./(1.00000+exp( - (STATES(:,1)+42.8500)./5.26400));
    ALGEBRAIC(:,48) = ALGEBRAIC(:,17);
    ALGEBRAIC(:,49) =  2.50000.*ALGEBRAIC(:,41);
    ALGEBRAIC(:,70) =  CONSTANTS(:,115).*STATES(:,30)+ CONSTANTS(:,121).*STATES(:,31);
    ALGEBRAIC(:,71) = 0.300000+0.600000./(1.00000+exp((STATES(:,1) - 10.0000)./10.0000));
    ALGEBRAIC(:,72) = 1.00000 - ALGEBRAIC(:,71);
    ALGEBRAIC(:,73) =  ALGEBRAIC(:,71).*STATES(:,32)+ ALGEBRAIC(:,72).*STATES(:,33);
    ALGEBRAIC(:,74) =  CONSTANTS(:,115).*STATES(:,35)+ CONSTANTS(:,121).*STATES(:,31);
    ALGEBRAIC(:,75) =  ALGEBRAIC(:,71).*STATES(:,36)+ ALGEBRAIC(:,72).*STATES(:,33);
    ALGEBRAIC(:,37) = ( STATES(:,1).*CONSTANTS(:,6).*CONSTANTS(:,6))./( CONSTANTS(:,4).*CONSTANTS(:,5));
    ALGEBRAIC(:,45) = ( STATES(:,1).*CONSTANTS(:,6))./( CONSTANTS(:,4).*CONSTANTS(:,5));
    ALGEBRAIC(:,78) = ( 1.00000.*ALGEBRAIC(:,37).*( 0.750000.*STATES(:,8).*exp( 1.00000.*ALGEBRAIC(:,45)) -  0.750000.*CONSTANTS(:,3)))./(exp( 1.00000.*ALGEBRAIC(:,45)) - 1.00000);
    ALGEBRAIC(:,51) = ALGEBRAIC(:,50)+STATES(:,2);
    ALGEBRAIC(:,79) = 1.00000./(1.00000+CONSTANTS(:,15)./ALGEBRAIC(:,51));
    ALGEBRAIC(:,82) =  (1.00000 - ALGEBRAIC(:,79)).*CONSTANTS(:,118).*ALGEBRAIC(:,78).*STATES(:,29).*( ALGEBRAIC(:,70).*(1.00000 - STATES(:,37))+ STATES(:,34).*ALGEBRAIC(:,73).*STATES(:,37))+ ALGEBRAIC(:,79).*CONSTANTS(:,123).*ALGEBRAIC(:,78).*STATES(:,29).*( ALGEBRAIC(:,74).*(1.00000 - STATES(:,37))+ STATES(:,34).*ALGEBRAIC(:,75).*STATES(:,37));
    ALGEBRAIC(:,178) = (STATES(:,8) - STATES(:,9))./CONSTANTS(:,99);
    ALGEBRAIC(:,77) = ( 1.00000.*ALGEBRAIC(:,37).*( 0.750000.*STATES(:,6).*exp( 1.00000.*ALGEBRAIC(:,45)) -  0.750000.*CONSTANTS(:,1)))./(exp( 1.00000.*ALGEBRAIC(:,45)) - 1.00000);
    ALGEBRAIC(:,81) =  (1.00000 - ALGEBRAIC(:,79)).*CONSTANTS(:,117).*ALGEBRAIC(:,77).*STATES(:,29).*( ALGEBRAIC(:,70).*(1.00000 - STATES(:,37))+ STATES(:,34).*ALGEBRAIC(:,73).*STATES(:,37))+ ALGEBRAIC(:,79).*CONSTANTS(:,122).*ALGEBRAIC(:,77).*STATES(:,29).*( ALGEBRAIC(:,74).*(1.00000 - STATES(:,37))+ STATES(:,34).*ALGEBRAIC(:,75).*STATES(:,37));
    ALGEBRAIC(:,154) = 1.00000./(1.00000+power(CONSTANTS(:,71)./STATES(:,3), 2.00000));
    ALGEBRAIC(:,97) = exp(( CONSTANTS(:,69).*STATES(:,1).*CONSTANTS(:,6))./( CONSTANTS(:,4).*CONSTANTS(:,5)));
    ALGEBRAIC(:,134) = 1.00000+ (CONSTANTS(:,1)./CONSTANTS(:,62)).*(1.00000+1.00000./ALGEBRAIC(:,97));
    ALGEBRAIC(:,135) = CONSTANTS(:,1)./( CONSTANTS(:,62).*ALGEBRAIC(:,97).*ALGEBRAIC(:,134));
    ALGEBRAIC(:,138) =  ALGEBRAIC(:,135).*CONSTANTS(:,66);
    ALGEBRAIC(:,128) = 1.00000+ (STATES(:,6)./CONSTANTS(:,62)).*(1.00000+ALGEBRAIC(:,97));
    ALGEBRAIC(:,129) = ( STATES(:,6).*ALGEBRAIC(:,97))./( CONSTANTS(:,62).*ALGEBRAIC(:,128));
    ALGEBRAIC(:,141) =  ALGEBRAIC(:,129).*CONSTANTS(:,66);
    ALGEBRAIC(:,131) = 1.00000+ (STATES(:,6)./CONSTANTS(:,60)).*(1.00000+STATES(:,6)./CONSTANTS(:,61));
    ALGEBRAIC(:,132) = ( STATES(:,6).*STATES(:,6))./( ALGEBRAIC(:,131).*CONSTANTS(:,60).*CONSTANTS(:,61));
    ALGEBRAIC(:,144) =  ALGEBRAIC(:,132).*ALGEBRAIC(:,129).*CONSTANTS(:,64);
    ALGEBRAIC(:,145) =  ALGEBRAIC(:,135).*CONSTANTS(:,139).*CONSTANTS(:,64);
    ALGEBRAIC(:,136) = 1.00000./ALGEBRAIC(:,134);
    ALGEBRAIC(:,137) =  ALGEBRAIC(:,136).*CONSTANTS(:,65);
    ALGEBRAIC(:,139) = ALGEBRAIC(:,137)+ALGEBRAIC(:,138);
    ALGEBRAIC(:,96) = exp(( CONSTANTS(:,70).*STATES(:,1).*CONSTANTS(:,6))./( CONSTANTS(:,4).*CONSTANTS(:,5)));
    ALGEBRAIC(:,130) = 1.00000./ALGEBRAIC(:,128);
    ALGEBRAIC(:,140) = ( ALGEBRAIC(:,130).*CONSTANTS(:,65))./ALGEBRAIC(:,96);
    ALGEBRAIC(:,142) = ALGEBRAIC(:,140)+ALGEBRAIC(:,141);
    ALGEBRAIC(:,133) = 1.00000./ALGEBRAIC(:,131);
    ALGEBRAIC(:,143) =  ALGEBRAIC(:,133).*STATES(:,3).*CONSTANTS(:,67);
    ALGEBRAIC(:,146) =  CONSTANTS(:,142).*ALGEBRAIC(:,142).*(ALGEBRAIC(:,144)+ALGEBRAIC(:,143))+ CONSTANTS(:,143).*ALGEBRAIC(:,144).*(CONSTANTS(:,142)+ALGEBRAIC(:,139));
    ALGEBRAIC(:,147) =  CONSTANTS(:,141).*ALGEBRAIC(:,144).*(ALGEBRAIC(:,142)+CONSTANTS(:,143))+ ALGEBRAIC(:,142).*ALGEBRAIC(:,143).*(CONSTANTS(:,141)+ALGEBRAIC(:,145));
    ALGEBRAIC(:,148) =  CONSTANTS(:,141).*ALGEBRAIC(:,139).*(ALGEBRAIC(:,144)+ALGEBRAIC(:,143))+ ALGEBRAIC(:,145).*ALGEBRAIC(:,143).*(CONSTANTS(:,142)+ALGEBRAIC(:,139));
    ALGEBRAIC(:,149) =  CONSTANTS(:,142).*ALGEBRAIC(:,145).*(ALGEBRAIC(:,142)+CONSTANTS(:,143))+ ALGEBRAIC(:,139).*CONSTANTS(:,143).*(CONSTANTS(:,141)+ALGEBRAIC(:,145));
    ALGEBRAIC(:,150) = ALGEBRAIC(:,146)./(ALGEBRAIC(:,146)+ALGEBRAIC(:,147)+ALGEBRAIC(:,148)+ALGEBRAIC(:,149));
    ALGEBRAIC(:,151) = ALGEBRAIC(:,147)./(ALGEBRAIC(:,146)+ALGEBRAIC(:,147)+ALGEBRAIC(:,148)+ALGEBRAIC(:,149));
    ALGEBRAIC(:,152) = ALGEBRAIC(:,148)./(ALGEBRAIC(:,146)+ALGEBRAIC(:,147)+ALGEBRAIC(:,148)+ALGEBRAIC(:,149));
    ALGEBRAIC(:,153) = ALGEBRAIC(:,149)./(ALGEBRAIC(:,146)+ALGEBRAIC(:,147)+ALGEBRAIC(:,148)+ALGEBRAIC(:,149));
    ALGEBRAIC(:,155) = ( 3.00000.*( ALGEBRAIC(:,153).*ALGEBRAIC(:,144) -  ALGEBRAIC(:,150).*ALGEBRAIC(:,145))+ ALGEBRAIC(:,152).*ALGEBRAIC(:,141)) -  ALGEBRAIC(:,151).*ALGEBRAIC(:,138);
    ALGEBRAIC(:,156) =  ALGEBRAIC(:,151).*CONSTANTS(:,142) -  ALGEBRAIC(:,150).*CONSTANTS(:,141);
    ALGEBRAIC(:,157) =  0.200000.*CONSTANTS(:,72).*ALGEBRAIC(:,154).*( CONSTANTS(:,7).*ALGEBRAIC(:,155)+ CONSTANTS(:,8).*ALGEBRAIC(:,156));
    ALGEBRAIC(:,179) = (STATES(:,6) - STATES(:,5))./CONSTANTS(:,99);
    ALGEBRAIC(:,181) = (STATES(:,9) - STATES(:,7))./CONSTANTS(:,100);
    ALGEBRAIC(:,58) =  (( CONSTANTS(:,4).*CONSTANTS(:,5))./CONSTANTS(:,6)).*log(CONSTANTS(:,3)./STATES(:,9));
    ALGEBRAIC(:,67) =  CONSTANTS(:,49).*STATES(:,26).*STATES(:,27).*STATES(:,28).*(STATES(:,1) - ALGEBRAIC(:,58));
    ALGEBRAIC(:,68) = 1.00000./(1.00000+exp( - (STATES(:,1) - 12.0000)./16.0000));
    ALGEBRAIC(:,69) =  CONSTANTS(:,50).*ALGEBRAIC(:,68).*(STATES(:,1) - ALGEBRAIC(:,58));
    ALGEBRAIC(:,84) = 1.00000./(1.00000+exp((STATES(:,1)+54.8100)./38.2100));
    ALGEBRAIC(:,85) = 1.00000 - ALGEBRAIC(:,84);
    ALGEBRAIC(:,86) =  ALGEBRAIC(:,84).*STATES(:,40)+ ALGEBRAIC(:,85).*STATES(:,41);
    ALGEBRAIC(:,87) = ( (1.00000./(1.00000+exp((STATES(:,1)+55.0000)./( 0.320000.*75.0000)))).*1.00000)./(1.00000+exp((STATES(:,1) - 10.0000)./( 0.320000.*30.0000)));
    ALGEBRAIC(:,88) =  CONSTANTS(:,55).*power((CONSTANTS(:,3)./5.40000), 1.0 ./ 2).*ALGEBRAIC(:,86).*ALGEBRAIC(:,87).*(STATES(:,1) - ALGEBRAIC(:,58));
    ALGEBRAIC(:,60) =  (( CONSTANTS(:,4).*CONSTANTS(:,5))./CONSTANTS(:,6)).*log((CONSTANTS(:,3)+ CONSTANTS(:,34).*CONSTANTS(:,1))./(STATES(:,9)+ CONSTANTS(:,34).*STATES(:,5)));
    ALGEBRAIC(:,89) = 1.00000+0.600000./(1.00000+power(3.80000e-05./STATES(:,11), 1.40000));
    ALGEBRAIC(:,90) =  CONSTANTS(:,56).*ALGEBRAIC(:,89).*STATES(:,42).*STATES(:,43).*(STATES(:,1) - ALGEBRAIC(:,60));
    ALGEBRAIC(:,94) = 1.00000./(1.00000+exp(((STATES(:,1)+116.000) -  5.50000.*CONSTANTS(:,3))./11.0000));
    ALGEBRAIC(:,95) =  CONSTANTS(:,59).*2.32380.*power((CONSTANTS(:,3)./5.40000), 1.0 ./ 2).*ALGEBRAIC(:,94).*STATES(:,45).*(STATES(:,1) - ALGEBRAIC(:,58));
    ALGEBRAIC(:,159) =  CONSTANTS(:,82).*exp(( (1.00000 - CONSTANTS(:,83)).*STATES(:,1).*CONSTANTS(:,6))./( 3.00000.*CONSTANTS(:,4).*CONSTANTS(:,5)));
    ALGEBRAIC(:,163) = ( CONSTANTS(:,77).*power(CONSTANTS(:,3)./CONSTANTS(:,85), 2.00000))./((power(1.00000+CONSTANTS(:,1)./ALGEBRAIC(:,159), 3.00000)+power(1.00000+CONSTANTS(:,3)./CONSTANTS(:,85), 2.00000)) - 1.00000);
    ALGEBRAIC(:,160) = CONSTANTS(:,90)./(1.00000+CONSTANTS(:,89)./CONSTANTS(:,91)+STATES(:,5)./CONSTANTS(:,92)+STATES(:,9)./CONSTANTS(:,93));
    ALGEBRAIC(:,164) = ( CONSTANTS(:,78).*ALGEBRAIC(:,160).*CONSTANTS(:,89))./(1.00000+CONSTANTS(:,87)./CONSTANTS(:,88));
    ALGEBRAIC(:,158) =  CONSTANTS(:,81).*exp(( CONSTANTS(:,83).*STATES(:,1).*CONSTANTS(:,6))./( 3.00000.*CONSTANTS(:,4).*CONSTANTS(:,5)));
    ALGEBRAIC(:,161) = ( CONSTANTS(:,73).*power(STATES(:,5)./ALGEBRAIC(:,158), 3.00000))./((power(1.00000+STATES(:,5)./ALGEBRAIC(:,158), 3.00000)+power(1.00000+STATES(:,9)./CONSTANTS(:,84), 2.00000)) - 1.00000);
    ALGEBRAIC(:,162) = ( CONSTANTS(:,76).*power(CONSTANTS(:,1)./ALGEBRAIC(:,159), 3.00000))./((power(1.00000+CONSTANTS(:,1)./ALGEBRAIC(:,159), 3.00000)+power(1.00000+CONSTANTS(:,3)./CONSTANTS(:,85), 2.00000)) - 1.00000);
    ALGEBRAIC(:,165) = ( CONSTANTS(:,80).*power(STATES(:,9)./CONSTANTS(:,84), 2.00000))./((power(1.00000+STATES(:,5)./ALGEBRAIC(:,158), 3.00000)+power(1.00000+STATES(:,9)./CONSTANTS(:,84), 2.00000)) - 1.00000);
    ALGEBRAIC(:,166) =  CONSTANTS(:,146).*ALGEBRAIC(:,161).*CONSTANTS(:,145)+ ALGEBRAIC(:,162).*ALGEBRAIC(:,165).*ALGEBRAIC(:,164)+ CONSTANTS(:,145).*ALGEBRAIC(:,165).*ALGEBRAIC(:,164)+ ALGEBRAIC(:,164).*ALGEBRAIC(:,161).*CONSTANTS(:,145);
    ALGEBRAIC(:,167) =  ALGEBRAIC(:,162).*CONSTANTS(:,144).*ALGEBRAIC(:,165)+ ALGEBRAIC(:,161).*CONSTANTS(:,145).*ALGEBRAIC(:,163)+ ALGEBRAIC(:,163).*CONSTANTS(:,144).*ALGEBRAIC(:,165)+ CONSTANTS(:,145).*ALGEBRAIC(:,163).*ALGEBRAIC(:,165);
    ALGEBRAIC(:,168) =  CONSTANTS(:,145).*ALGEBRAIC(:,163).*CONSTANTS(:,146)+ ALGEBRAIC(:,164).*ALGEBRAIC(:,162).*CONSTANTS(:,144)+ ALGEBRAIC(:,162).*CONSTANTS(:,144).*CONSTANTS(:,146)+ ALGEBRAIC(:,163).*CONSTANTS(:,146).*CONSTANTS(:,144);
    ALGEBRAIC(:,169) =  ALGEBRAIC(:,165).*ALGEBRAIC(:,164).*ALGEBRAIC(:,162)+ ALGEBRAIC(:,163).*CONSTANTS(:,146).*ALGEBRAIC(:,161)+ ALGEBRAIC(:,162).*CONSTANTS(:,146).*ALGEBRAIC(:,161)+ ALGEBRAIC(:,164).*ALGEBRAIC(:,162).*ALGEBRAIC(:,161);
    ALGEBRAIC(:,170) = ALGEBRAIC(:,166)./(ALGEBRAIC(:,166)+ALGEBRAIC(:,167)+ALGEBRAIC(:,168)+ALGEBRAIC(:,169));
    ALGEBRAIC(:,171) = ALGEBRAIC(:,167)./(ALGEBRAIC(:,166)+ALGEBRAIC(:,167)+ALGEBRAIC(:,168)+ALGEBRAIC(:,169));
    ALGEBRAIC(:,174) =  3.00000.*( ALGEBRAIC(:,170).*ALGEBRAIC(:,163) -  ALGEBRAIC(:,171).*ALGEBRAIC(:,164));
    ALGEBRAIC(:,172) = ALGEBRAIC(:,168)./(ALGEBRAIC(:,166)+ALGEBRAIC(:,167)+ALGEBRAIC(:,168)+ALGEBRAIC(:,169));
    ALGEBRAIC(:,173) = ALGEBRAIC(:,169)./(ALGEBRAIC(:,166)+ALGEBRAIC(:,167)+ALGEBRAIC(:,168)+ALGEBRAIC(:,169));
    ALGEBRAIC(:,175) =  2.00000.*( ALGEBRAIC(:,173).*CONSTANTS(:,144) -  ALGEBRAIC(:,172).*ALGEBRAIC(:,161));
    ALGEBRAIC(:,176) =  CONSTANTS(:,94).*( CONSTANTS(:,7).*ALGEBRAIC(:,174)+ CONSTANTS(:,9).*ALGEBRAIC(:,175));
    ALGEBRAIC(:,16) = piecewise({VOI<=CONSTANTS(:,14), CONSTANTS(:,13) }, 0.00000);
    ALGEBRAIC(:,92) =  CONSTANTS(:,58).*STATES(:,44).*STATES(:,44).*(STATES(:,1) - ALGEBRAIC(:,58));
    ALGEBRAIC(:,57) =  (( CONSTANTS(:,4).*CONSTANTS(:,5))./CONSTANTS(:,6)).*log(CONSTANTS(:,1)./STATES(:,5));
    ALGEBRAIC(:,61) =  CONSTANTS(:,45).*STATES(:,18)+ CONSTANTS(:,113).*STATES(:,19);
    ALGEBRAIC(:,62) =  CONSTANTS(:,45).*STATES(:,18)+ CONSTANTS(:,113).*STATES(:,21);
    ALGEBRAIC(:,63) = 1.00000./(1.00000+CONSTANTS(:,15)./ALGEBRAIC(:,51));
    ALGEBRAIC(:,64) =  CONSTANTS(:,46).*(STATES(:,1) - ALGEBRAIC(:,57)).*power(STATES(:,17), 3.00000).*( (1.00000 - ALGEBRAIC(:,63)).*ALGEBRAIC(:,61).*STATES(:,20)+ ALGEBRAIC(:,63).*ALGEBRAIC(:,62).*STATES(:,22));
    ALGEBRAIC(:,65) = 1.00000./(1.00000+CONSTANTS(:,15)./ALGEBRAIC(:,51));
    ALGEBRAIC(:,66) =  CONSTANTS(:,48).*(STATES(:,1) - ALGEBRAIC(:,57)).*STATES(:,23).*( (1.00000 - ALGEBRAIC(:,65)).*STATES(:,24)+ ALGEBRAIC(:,65).*STATES(:,25));
    ALGEBRAIC(:,76) = ( 4.00000.*ALGEBRAIC(:,37).*( STATES(:,3).*exp( 2.00000.*ALGEBRAIC(:,45)) -  0.341000.*CONSTANTS(:,2)))./(exp( 2.00000.*ALGEBRAIC(:,45)) - 1.00000);
    ALGEBRAIC(:,80) =  (1.00000 - ALGEBRAIC(:,79)).*CONSTANTS(:,53).*ALGEBRAIC(:,76).*STATES(:,29).*( ALGEBRAIC(:,70).*(1.00000 - STATES(:,37))+ STATES(:,34).*ALGEBRAIC(:,73).*STATES(:,37))+ ALGEBRAIC(:,79).*CONSTANTS(:,116).*ALGEBRAIC(:,76).*STATES(:,29).*( ALGEBRAIC(:,74).*(1.00000 - STATES(:,37))+ STATES(:,34).*ALGEBRAIC(:,75).*STATES(:,37));
    ALGEBRAIC(:,59) =  (( CONSTANTS(:,4).*CONSTANTS(:,5))./( 2.00000.*CONSTANTS(:,6))).*log(CONSTANTS(:,2)./STATES(:,11));
    ALGEBRAIC(:,83) =  CONSTANTS(:,54).*STATES(:,38).*STATES(:,39).*(STATES(:,1) - ALGEBRAIC(:,59));
    ALGEBRAIC(:,91) =  CONSTANTS(:,57).*STATES(:,44).*STATES(:,44).*(STATES(:,1) - ALGEBRAIC(:,57));
    ALGEBRAIC(:,93) = ALGEBRAIC(:,91)+ALGEBRAIC(:,92);
    ALGEBRAIC(:,124) = 1.00000./(1.00000+power(CONSTANTS(:,71)./STATES(:,11), 2.00000));
    ALGEBRAIC(:,104) = 1.00000+ (CONSTANTS(:,1)./CONSTANTS(:,62)).*(1.00000+1.00000./ALGEBRAIC(:,97));
    ALGEBRAIC(:,105) = CONSTANTS(:,1)./( CONSTANTS(:,62).*ALGEBRAIC(:,97).*ALGEBRAIC(:,104));
    ALGEBRAIC(:,108) =  ALGEBRAIC(:,105).*CONSTANTS(:,66);
    ALGEBRAIC(:,98) = 1.00000+ (STATES(:,5)./CONSTANTS(:,62)).*(1.00000+ALGEBRAIC(:,97));
    ALGEBRAIC(:,99) = ( STATES(:,5).*ALGEBRAIC(:,97))./( CONSTANTS(:,62).*ALGEBRAIC(:,98));
    ALGEBRAIC(:,111) =  ALGEBRAIC(:,99).*CONSTANTS(:,66);
    ALGEBRAIC(:,101) = 1.00000+ (STATES(:,5)./CONSTANTS(:,60)).*(1.00000+STATES(:,5)./CONSTANTS(:,61));
    ALGEBRAIC(:,102) = ( STATES(:,5).*STATES(:,5))./( ALGEBRAIC(:,101).*CONSTANTS(:,60).*CONSTANTS(:,61));
    ALGEBRAIC(:,114) =  ALGEBRAIC(:,102).*ALGEBRAIC(:,99).*CONSTANTS(:,64);
    ALGEBRAIC(:,115) =  ALGEBRAIC(:,105).*CONSTANTS(:,133).*CONSTANTS(:,64);
    ALGEBRAIC(:,106) = 1.00000./ALGEBRAIC(:,104);
    ALGEBRAIC(:,107) =  ALGEBRAIC(:,106).*CONSTANTS(:,65);
    ALGEBRAIC(:,109) = ALGEBRAIC(:,107)+ALGEBRAIC(:,108);
    ALGEBRAIC(:,100) = 1.00000./ALGEBRAIC(:,98);
    ALGEBRAIC(:,110) = ( ALGEBRAIC(:,100).*CONSTANTS(:,65))./ALGEBRAIC(:,96);
    ALGEBRAIC(:,112) = ALGEBRAIC(:,110)+ALGEBRAIC(:,111);
    ALGEBRAIC(:,103) = 1.00000./ALGEBRAIC(:,101);
    ALGEBRAIC(:,113) =  ALGEBRAIC(:,103).*STATES(:,11).*CONSTANTS(:,67);
    ALGEBRAIC(:,116) =  CONSTANTS(:,136).*ALGEBRAIC(:,112).*(ALGEBRAIC(:,114)+ALGEBRAIC(:,113))+ CONSTANTS(:,137).*ALGEBRAIC(:,114).*(CONSTANTS(:,136)+ALGEBRAIC(:,109));
    ALGEBRAIC(:,117) =  CONSTANTS(:,135).*ALGEBRAIC(:,114).*(ALGEBRAIC(:,112)+CONSTANTS(:,137))+ ALGEBRAIC(:,112).*ALGEBRAIC(:,113).*(CONSTANTS(:,135)+ALGEBRAIC(:,115));
    ALGEBRAIC(:,118) =  CONSTANTS(:,135).*ALGEBRAIC(:,109).*(ALGEBRAIC(:,114)+ALGEBRAIC(:,113))+ ALGEBRAIC(:,115).*ALGEBRAIC(:,113).*(CONSTANTS(:,136)+ALGEBRAIC(:,109));
    ALGEBRAIC(:,119) =  CONSTANTS(:,136).*ALGEBRAIC(:,115).*(ALGEBRAIC(:,112)+CONSTANTS(:,137))+ ALGEBRAIC(:,109).*CONSTANTS(:,137).*(CONSTANTS(:,135)+ALGEBRAIC(:,115));
    ALGEBRAIC(:,120) = ALGEBRAIC(:,116)./(ALGEBRAIC(:,116)+ALGEBRAIC(:,117)+ALGEBRAIC(:,118)+ALGEBRAIC(:,119));
    ALGEBRAIC(:,121) = ALGEBRAIC(:,117)./(ALGEBRAIC(:,116)+ALGEBRAIC(:,117)+ALGEBRAIC(:,118)+ALGEBRAIC(:,119));
    ALGEBRAIC(:,122) = ALGEBRAIC(:,118)./(ALGEBRAIC(:,116)+ALGEBRAIC(:,117)+ALGEBRAIC(:,118)+ALGEBRAIC(:,119));
    ALGEBRAIC(:,123) = ALGEBRAIC(:,119)./(ALGEBRAIC(:,116)+ALGEBRAIC(:,117)+ALGEBRAIC(:,118)+ALGEBRAIC(:,119));
    ALGEBRAIC(:,125) = ( 3.00000.*( ALGEBRAIC(:,123).*ALGEBRAIC(:,114) -  ALGEBRAIC(:,120).*ALGEBRAIC(:,115))+ ALGEBRAIC(:,122).*ALGEBRAIC(:,111)) -  ALGEBRAIC(:,121).*ALGEBRAIC(:,108);
    ALGEBRAIC(:,126) =  ALGEBRAIC(:,121).*CONSTANTS(:,136) -  ALGEBRAIC(:,120).*CONSTANTS(:,135);
    ALGEBRAIC(:,127) =  0.800000.*CONSTANTS(:,72).*ALGEBRAIC(:,124).*( CONSTANTS(:,7).*ALGEBRAIC(:,125)+ CONSTANTS(:,8).*ALGEBRAIC(:,126));
    ALGEBRAIC(:,177) = ( CONSTANTS(:,95).*ALGEBRAIC(:,37).*( STATES(:,5).*exp(ALGEBRAIC(:,45)) - CONSTANTS(:,1)))./(exp(ALGEBRAIC(:,45)) - 1.00000);
    ALGEBRAIC(:,183) = ( CONSTANTS(:,97).*STATES(:,11))./(CONSTANTS(:,98)+STATES(:,11));
    ALGEBRAIC(:,180) = ( CONSTANTS(:,96).*4.00000.*ALGEBRAIC(:,37).*( STATES(:,11).*exp( 2.00000.*ALGEBRAIC(:,45)) -  0.341000.*CONSTANTS(:,2)))./(exp( 2.00000.*ALGEBRAIC(:,45)) - 1.00000);
    ALGEBRAIC(:,182) = (STATES(:,5) - STATES(:,4))./CONSTANTS(:,100);
    ALGEBRAIC(:,184) = (STATES(:,3) - STATES(:,11))./CONSTANTS(:,99);
    ALGEBRAIC(:,185) = (STATES(:,11) - STATES(:,10))./CONSTANTS(:,100);
    ALGEBRAIC(:,188) = ( CONSTANTS(:,102).*ALGEBRAIC(:,51))./(ALGEBRAIC(:,51)+CONSTANTS(:,15));
    ALGEBRAIC(:,189) = ( CONSTANTS(:,101).*ALGEBRAIC(:,51))./(ALGEBRAIC(:,51)+CONSTANTS(:,15));
    ALGEBRAIC(:,190) = ( 0.000200000.*(ALGEBRAIC(:,189)+1.00000))./(1.00000+(CONSTANTS(:,103) - ALGEBRAIC(:,188))./STATES(:,11)) - ( 0.00105000.*STATES(:,12))./CONSTANTS(:,104);
    ALGEBRAIC(:,54) = 1.00000./(1.00000+( CONSTANTS(:,29).*CONSTANTS(:,28))./power(CONSTANTS(:,28)+STATES(:,11), 2.00000)+( CONSTANTS(:,32).*CONSTANTS(:,31))./power(CONSTANTS(:,31)+STATES(:,11), 2.00000));
    ALGEBRAIC(:,191) = ( 0.00260000.*(ALGEBRAIC(:,189)+1.00000))./(1.00000+(CONSTANTS(:,103) - ALGEBRAIC(:,188))./STATES(:,10)) - ( 0.00420000.*STATES(:,12))./CONSTANTS(:,104);
    ALGEBRAIC(:,52) = 1.00000./(1.00000+( CONSTANTS(:,27).*CONSTANTS(:,28))./power(CONSTANTS(:,28)+STATES(:,10), 2.00000)+( CONSTANTS(:,30).*CONSTANTS(:,31))./power(CONSTANTS(:,31)+STATES(:,10), 2.00000));
    ALGEBRAIC(:,192) = ( CONSTANTS(:,112).*CONSTANTS(:,105).*STATES(:,3).*(1.00000 - STATES(:,46)))./( (1.00000+( CONSTANTS(:,105).*CONSTANTS(:,108))./CONSTANTS(:,109)).*(1.00000+( STATES(:,3).*CONSTANTS(:,106))./CONSTANTS(:,107)));
    ALGEBRAIC(:,194) =  10.9200.*ALGEBRAIC(:,192).*(STATES(:,13) - STATES(:,3));
    ALGEBRAIC(:,53) = 1.00000./(1.00000+( CONSTANTS(:,20).*CONSTANTS(:,21))./power(CONSTANTS(:,21)+STATES(:,3), 2.00000)+( CONSTANTS(:,22).*CONSTANTS(:,23))./power(CONSTANTS(:,23)+STATES(:,3), 2.00000));
    ALGEBRAIC(:,193) = ( ALGEBRAIC(:,185).*CONSTANTS(:,131))./CONSTANTS(:,126)+(  - ALGEBRAIC(:,191).*CONSTANTS(:,127))./CONSTANTS(:,126)+( STATES(:,16).*CONSTANTS(:,129))./CONSTANTS(:,126);
    ALGEBRAIC(:,195) = piecewise({ALGEBRAIC(:,193)>0.00000, ( 91.0000.*(1.00000+( 1.00000.*1.00000)./(1.00000+power(0.280000./ALGEBRAIC(:,51), 8.00000))).*ALGEBRAIC(:,193))./(1.00000+power(1.00000./STATES(:,14), 8.00000)) }, 0.00000);
    ALGEBRAIC(:,187) = ( 6.00000.*(1.00000+( 1.00000.*1.00000)./(1.00000+power(0.280000./ALGEBRAIC(:,51), 8.00000))))./(1.00000+0.0123000./STATES(:,14));
    ALGEBRAIC(:,196) = (STATES(:,12) - STATES(:,13))./120.000;
    ALGEBRAIC(:,55) = 1.00000./(1.00000+( CONSTANTS(:,26).*CONSTANTS(:,25))./power(CONSTANTS(:,25)+STATES(:,13), 2.00000));
    ALGEBRAIC(:,198) = (STATES(:,12) - STATES(:,14))./120.000;
    ALGEBRAIC(:,56) = 1.00000./(1.00000+( CONSTANTS(:,24).*CONSTANTS(:,25))./power(CONSTANTS(:,25)+STATES(:,14), 2.00000));
    ALGEBRAIC(:,197) =  - (( ALGEBRAIC(:,80).*CONSTANTS(:,125))./( CONSTANTS(:,130).*CONSTANTS(:,6).*2.00000)+(  - (STATES(:,15)+ALGEBRAIC(:,194)).*CONSTANTS(:,128))./CONSTANTS(:,130)+ALGEBRAIC(:,184));
    ALGEBRAIC(:,199) = piecewise({ALGEBRAIC(:,197)>0.00000, ( 15.0000.*(1.00000+( 1.00000.*1.00000)./(1.00000+power(0.280000./ALGEBRAIC(:,51), 8.00000))).*ALGEBRAIC(:,197))./(1.00000+power(1.00000./STATES(:,13), 8.00000)) }, 0.00000);
    ALGEBRAIC(:,186) = ( 2.00000.*(1.00000+( 1.00000.*1.00000)./(1.00000+power(0.280000./ALGEBRAIC(:,51), 8.00000))))./(1.00000+0.0123000./STATES(:,13));
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