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 =122;
end
% There are a total of 2 entries in each of the rate and state variable arrays.
% There are a total of 34 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_CONSTANTS(:,1) = strpad('k1_m in component gas_exchange (dimensionless)');
    LEGEND_CONSTANTS(:,2) = strpad('k1_81m in component gas_exchange (dimensionless)');
    LEGEND_CONSTANTS(:,3) = strpad('k2_m in component gas_exchange (dimensionless)');
    LEGEND_CONSTANTS(:,4) = strpad('k3_m in component gas_exchange (dimensionless)');
    LEGEND_CONSTANTS(:,5) = strpad('K3_81m in component gas_exchange (dimensionless)');
    LEGEND_CONSTANTS(:,6) = strpad('k4_m in component gas_exchange (dimensionless)');
    LEGEND_CONSTANTS(:,7) = strpad('pH_m in component gas_exchange (dimensionless)');
    LEGEND_CONSTANTS(:,8) = strpad('k1_f in component gas_exchange (dimensionless)');
    LEGEND_CONSTANTS(:,9) = strpad('k2_f in component gas_exchange (dimensionless)');
    LEGEND_CONSTANTS(:,10) = strpad('k3_f in component gas_exchange (dimensionless)');
    LEGEND_CONSTANTS(:,11) = strpad('k4_f in component gas_exchange (dimensionless)');
    LEGEND_CONSTANTS(:,12) = strpad('pH_f in component gas_exchange (dimensionless)');
    LEGEND_STATES(:,1) = strpad('Pin_m in component gas_exchange (mmHg)');
    LEGEND_STATES(:,2) = strpad('Pin_f in component gas_exchange (mmHg)');
    LEGEND_ALGEBRAIC(:,1) = strpad('x_m in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,2) = strpad('x_m1 in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,4) = strpad('x_f in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,5) = strpad('x_f1 in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,3) = strpad('S_m in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,6) = strpad('S_f in component gas_exchange (dimensionless)');
    LEGEND_VOI = strpad('t in component gas_exchange (second)');
    LEGEND_ALGEBRAIC(:,7) = strpad('O2_m in component gas_exchange (ml_per_ml)');
    LEGEND_ALGEBRAIC(:,8) = strpad('O2_f in component gas_exchange (ml_per_ml)');
    LEGEND_CONSTANTS(:,13) = strpad('Hb_m in component gas_exchange (dimensionless)');
    LEGEND_CONSTANTS(:,14) = strpad('Hb_f in component gas_exchange (dimensionless)');
    LEGEND_CONSTANTS(:,15) = strpad('a in component gas_exchange (dimensionless)');
    LEGEND_CONSTANTS(:,16) = strpad('ks_m in component gas_exchange (dimensionless)');
    LEGEND_CONSTANTS(:,17) = strpad('ks_f in component gas_exchange (dimensionless)');
    LEGEND_CONSTANTS(:,18) = strpad('kh in component gas_exchange (dimensionless)');
    LEGEND_CONSTANTS(:,19) = strpad('B in component gas_exchange (dimensionless)');
    LEGEND_CONSTANTS(:,20) = strpad('V_m in component gas_exchange (ml)');
    LEGEND_CONSTANTS(:,21) = strpad('V_f in component gas_exchange (ml)');
    LEGEND_CONSTANTS(:,22) = strpad('Q_m in component gas_exchange (ml_per_min)');
    LEGEND_CONSTANTS(:,23) = strpad('Q_f in component gas_exchange (ml_per_min)');
    LEGEND_CONSTANTS(:,24) = strpad('Dm in component gas_exchange (ml_per_ml_min_mmHg)');
    LEGEND_CONSTANTS(:,25) = strpad('c1 in component gas_exchange (dimensionless)');
    LEGEND_CONSTANTS(:,26) = strpad('c2 in component gas_exchange (dimensionless)');
    LEGEND_CONSTANTS(:,27) = strpad('c3 in component gas_exchange (dimensionless)');
    LEGEND_CONSTANTS(:,28) = strpad('c4 in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,11) = strpad('theta_m in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,14) = strpad('theta_f in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,9) = strpad('x1_m in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,12) = strpad('x1_f in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,15) = strpad('R_m in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,16) = strpad('R_f in component gas_exchange (dimensionless)');
    LEGEND_CONSTANTS(:,29) = strpad('R_p in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,17) = strpad('R_t in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,18) = strpad('Dp in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,19) = strpad('dodt_m in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,20) = strpad('dodt_f in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,21) = strpad('O2_mnew in component gas_exchange (ml_per_ml)');
    LEGEND_ALGEBRAIC(:,22) = strpad('O2_fnew in component gas_exchange (ml_per_ml)');
    LEGEND_ALGEBRAIC(:,23) = strpad('f_m in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,24) = strpad('f_f in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,25) = strpad('upper_m in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,26) = strpad('lower_m in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,28) = strpad('upper_f in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,29) = strpad('lower_f in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,30) = strpad('dfdP_f in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,27) = strpad('dfdP_m in component gas_exchange (dimensionless)');
    LEGEND_CONSTANTS(:,30) = strpad('tt in component gas_exchange (second)');
    LEGEND_CONSTANTS(:,31) = strpad('dt in component gas_exchange (second)');
    LEGEND_ALGEBRAIC(:,31) = strpad('Pend1_m in component gas_exchange (mmHg)');
    LEGEND_ALGEBRAIC(:,32) = strpad('Pend1_f in component gas_exchange (mmHg)');
    LEGEND_ALGEBRAIC(:,10) = strpad('theta_96_m in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,13) = strpad('theta_96_f in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,33) = strpad('x_m_sec in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,34) = strpad('x_m1_sec in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,35) = strpad('S_m_sec in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,36) = strpad('x_f_sec in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,37) = strpad('x_f1_sec in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,38) = strpad('S_f_sec in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,40) = strpad('theta_96_m_sec in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,43) = strpad('theta_96_f_sec in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,39) = strpad('x1_m_sec in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,41) = strpad('theta_m_sec in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,42) = strpad('x1_f_sec in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,44) = strpad('theta_f_sec in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,45) = strpad('R_m_sec in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,46) = strpad('R_f_sec in component gas_exchange (dimensionless)');
    LEGEND_CONSTANTS(:,32) = strpad('R_p_sec in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,47) = strpad('R_t_sec in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,48) = strpad('Dp_sec in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,49) = strpad('dodt_m_sec in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,50) = strpad('dodt_f_sec in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,51) = strpad('O2_mnew_sec in component gas_exchange (ml_per_ml)');
    LEGEND_ALGEBRAIC(:,52) = strpad('O2_fnew_sec in component gas_exchange (ml_per_ml)');
    LEGEND_ALGEBRAIC(:,53) = strpad('f_m_sec in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,54) = strpad('f_f_sec in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,55) = strpad('upper_m_sec in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,56) = strpad('lower_m_sec in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,57) = strpad('dfdP_m_sec in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,58) = strpad('upper_f_sec in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,59) = strpad('lower_f_sec in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,60) = strpad('dfdP_f_sec in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,61) = strpad('Pend2_m in component gas_exchange (mmHg)');
    LEGEND_ALGEBRAIC(:,62) = strpad('Pend2_f in component gas_exchange (mmHg)');
    LEGEND_ALGEBRAIC(:,63) = strpad('x_m_trd in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,64) = strpad('x_m1_trd in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,65) = strpad('S_m_trd in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,66) = strpad('x_f_trd in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,67) = strpad('x_f1_trd in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,68) = strpad('S_f_trd in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,70) = strpad('theta_96_m_trd in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,73) = strpad('theta_96_f_trd in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,69) = strpad('x1_m_trd in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,71) = strpad('theta_m_trd in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,72) = strpad('x1_f_trd in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,74) = strpad('theta_f_trd in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,75) = strpad('R_m_trd in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,76) = strpad('R_f_trd in component gas_exchange (dimensionless)');
    LEGEND_CONSTANTS(:,33) = strpad('R_p_trd in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,77) = strpad('R_t_trd in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,78) = strpad('Dp_trd in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,79) = strpad('dodt_m_trd in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,80) = strpad('dodt_f_trd in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,81) = strpad('O2_mnew_trd in component gas_exchange (ml_per_ml)');
    LEGEND_ALGEBRAIC(:,82) = strpad('O2_fnew_trd in component gas_exchange (ml_per_ml)');
    LEGEND_ALGEBRAIC(:,83) = strpad('f_m_trd in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,84) = strpad('f_f_trd in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,85) = strpad('upper_m_trd in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,86) = strpad('lower_m_trd in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,87) = strpad('dfdP_m_trd in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,88) = strpad('upper_f_trd in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,89) = strpad('lower_f_trd in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,90) = strpad('dfdP_f_trd in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,91) = strpad('Pend3_m in component gas_exchange (mmHg)');
    LEGEND_ALGEBRAIC(:,92) = strpad('Pend3_f in component gas_exchange (mmHg)');
    LEGEND_ALGEBRAIC(:,93) = strpad('x_m_for in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,94) = strpad('x_m1_for in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,95) = strpad('S_m_for in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,96) = strpad('x_f_for in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,97) = strpad('x_f1_for in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,98) = strpad('S_f_for in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,100) = strpad('theta_96_m_for in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,103) = strpad('theta_96_f_for in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,99) = strpad('x1_m_for in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,101) = strpad('theta_m_for in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,102) = strpad('x1_f_for in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,104) = strpad('theta_f_for in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,105) = strpad('R_m_for in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,106) = strpad('R_f_for in component gas_exchange (dimensionless)');
    LEGEND_CONSTANTS(:,34) = strpad('R_p_for in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,107) = strpad('R_t_for in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,108) = strpad('Dp_for in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,109) = strpad('dodt_m_for in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,111) = strpad('dodt_f_for in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,110) = strpad('O2_mnew_final in component gas_exchange (ml_per_ml)');
    LEGEND_ALGEBRAIC(:,113) = strpad('O2_fnew_final in component gas_exchange (ml_per_ml)');
    LEGEND_ALGEBRAIC(:,112) = strpad('f_m_final in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,115) = strpad('f_f_final in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,114) = strpad('upper_m_final in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,116) = strpad('lower_m_final in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,118) = strpad('dfdP_m_final in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,117) = strpad('upper_f_final in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,119) = strpad('lower_f_final in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,120) = strpad('dfdP_f_final in component gas_exchange (dimensionless)');
    LEGEND_ALGEBRAIC(:,121) = strpad('Pfinal_m in component gas_exchange (mmHg)');
    LEGEND_ALGEBRAIC(:,122) = strpad('Pfinal_f in component gas_exchange (mmHg)');
    LEGEND_RATES(:,1) = strpad('d/dt Pin_m in component gas_exchange (mmHg)');
    LEGEND_RATES(:,2) = strpad('d/dt Pin_f in component gas_exchange (mmHg)');
    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) = 1.4452;
    CONSTANTS(:,2) = 1.4452;
    CONSTANTS(:,3) = 0.456;
    CONSTANTS(:,4) = 0.3711;
    CONSTANTS(:,5) = 0.3711;
    CONSTANTS(:,6) = 7.8322e+03;
    CONSTANTS(:,7) = 7.4;
    CONSTANTS(:,8) = 1.302;
    CONSTANTS(:,9) = 0.464;
    CONSTANTS(:,10) = 0.395;
    CONSTANTS(:,11) = 2.2643e+03;
    CONSTANTS(:,12) = 7.35;
    STATES(:,1) = 33;
    STATES(:,2) = 15;
    CONSTANTS(:,13) = 12.5;
    CONSTANTS(:,14) = 15.5;
    CONSTANTS(:,15) = 3.0263e-05;
    CONSTANTS(:,16) = 164;
    CONSTANTS(:,17) = 164;
    CONSTANTS(:,18) = 164;
    CONSTANTS(:,19) = 1;
    CONSTANTS(:,20) = 4.89e-7;
    CONSTANTS(:,21) = 4.89e-7;
    CONSTANTS(:,22) = 1.2014e-04;
    CONSTANTS(:,23) = 1.2014e-04;
    CONSTANTS(:,24) = 6.21;
    CONSTANTS(:,25) = 3.287;
    CONSTANTS(:,26) = 0.1117;
    CONSTANTS(:,27) = 7.05e-3;
    CONSTANTS(:,28) = 0.8142;
    CONSTANTS(:,29) = 1.00000./CONSTANTS(:,24);
    CONSTANTS(:,30) = CONSTANTS(:,21)./(CONSTANTS(:,23)./60.0000);
    CONSTANTS(:,31) = CONSTANTS(:,30)./100.000;
    CONSTANTS(:,32) = 1.00000./CONSTANTS(:,24);
    CONSTANTS(:,33) = 1.00000./CONSTANTS(:,24);
    CONSTANTS(:,34) = 1.00000./CONSTANTS(:,24);
    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
    ALGEBRAIC(:,7) = (( 1.34000.*CONSTANTS(:,13))./100.000)./( CONSTANTS(:,6).*power(STATES(:,1),  - 1.00000./CONSTANTS(:,4))+1.00000)+ CONSTANTS(:,15).*STATES(:,1);
    ALGEBRAIC(:,1) = ((arbitrary_log(STATES(:,1), 10) - CONSTANTS(:,1))+ CONSTANTS(:,3).*(CONSTANTS(:,7) - 7.40000))./CONSTANTS(:,4);
    ALGEBRAIC(:,2) = power(10.0000, ALGEBRAIC(:,1));
    ALGEBRAIC(:,3) = ( 100.000.*ALGEBRAIC(:,2))./(1.00000+ALGEBRAIC(:,2));
    ALGEBRAIC(:,9) = piecewise({ALGEBRAIC(:,3)>96.0000, exp(  - 1.00000.*CONSTANTS(:,26).*(100.000 - 96.0000)) }, exp(  - 1.00000.*CONSTANTS(:,26).*(100.000 - ALGEBRAIC(:,3))));
    ALGEBRAIC(:,10) = ( (( (( (( CONSTANTS(:,25).*(1.00000 - ALGEBRAIC(:,9))+ CONSTANTS(:,27).*ALGEBRAIC(:,3)) - CONSTANTS(:,28)).*1.34000)./100.000).*CONSTANTS(:,13))./0.200000).*CONSTANTS(:,16))./CONSTANTS(:,18);
    ALGEBRAIC(:,11) = piecewise({ALGEBRAIC(:,3)>96.0000, ALGEBRAIC(:,10) - ( ALGEBRAIC(:,10).*(96.0000 - ALGEBRAIC(:,3)))./ - 4.00000 }, ( (( (( (( CONSTANTS(:,25).*(1.00000 - ALGEBRAIC(:,9))+ CONSTANTS(:,27).*ALGEBRAIC(:,3)) - CONSTANTS(:,28)).*1.34000)./100.000).*CONSTANTS(:,13))./0.200000).*CONSTANTS(:,16))./CONSTANTS(:,18));
    ALGEBRAIC(:,15) = 1.00000./( ALGEBRAIC(:,11).*CONSTANTS(:,20));
    ALGEBRAIC(:,4) = ((arbitrary_log(STATES(:,2), 10) - CONSTANTS(:,8))+ CONSTANTS(:,9).*(CONSTANTS(:,12) - 7.40000))./CONSTANTS(:,10);
    ALGEBRAIC(:,5) = power(10.0000, ALGEBRAIC(:,4));
    ALGEBRAIC(:,6) = ( 100.000.*ALGEBRAIC(:,5))./(1.00000+ALGEBRAIC(:,5));
    ALGEBRAIC(:,12) = piecewise({ALGEBRAIC(:,6)>96.0000, exp(  - 1.00000.*CONSTANTS(:,26).*(100.000 - 96.0000)) }, exp(  - 1.00000.*CONSTANTS(:,26).*(100.000 - ALGEBRAIC(:,6))));
    ALGEBRAIC(:,13) = ( (( (( (( CONSTANTS(:,25).*(1.00000 - ALGEBRAIC(:,12))+ CONSTANTS(:,27).*ALGEBRAIC(:,6)) - CONSTANTS(:,28)).*1.34000)./100.000).*CONSTANTS(:,14))./0.200000).*CONSTANTS(:,17))./CONSTANTS(:,18);
    ALGEBRAIC(:,14) = piecewise({ALGEBRAIC(:,6)>96.0000, ALGEBRAIC(:,13) - ( ALGEBRAIC(:,13).*(96.0000 - ALGEBRAIC(:,6)))./ - 4.00000 }, ( (( (( (( CONSTANTS(:,25).*(1.00000 - ALGEBRAIC(:,12))+ CONSTANTS(:,27).*ALGEBRAIC(:,6)) - CONSTANTS(:,28)).*1.34000)./100.000).*CONSTANTS(:,14))./0.200000).*CONSTANTS(:,17))./CONSTANTS(:,18));
    ALGEBRAIC(:,16) = 1.00000./( ALGEBRAIC(:,14).*CONSTANTS(:,21));
    ALGEBRAIC(:,17) = ALGEBRAIC(:,15)+ALGEBRAIC(:,16)+CONSTANTS(:,29);
    ALGEBRAIC(:,18) = (1.00000./ALGEBRAIC(:,17))./60.0000;
    ALGEBRAIC(:,19) = ( CONSTANTS(:,19).* - 1.00000.*ALGEBRAIC(:,18).*(STATES(:,1) - STATES(:,2)))./CONSTANTS(:,20);
    ALGEBRAIC(:,21) = ALGEBRAIC(:,7)+( ALGEBRAIC(:,19).*CONSTANTS(:,31))./2.00000;
    ALGEBRAIC(:,23) = ((( 1.34000.*CONSTANTS(:,13))./100.000)./( CONSTANTS(:,6).*power(STATES(:,1),  - 1.00000./CONSTANTS(:,4))+1.00000)+ CONSTANTS(:,15).*STATES(:,1)) - ALGEBRAIC(:,21);
    ALGEBRAIC(:,25) =  1.34000.*CONSTANTS(:,13).*CONSTANTS(:,6).*power(STATES(:,1),  - 1.00000./CONSTANTS(:,4) - 1.00000);
    ALGEBRAIC(:,26) =  100.000.*CONSTANTS(:,4).*power( CONSTANTS(:,6).*power(STATES(:,1),  - 1.00000./CONSTANTS(:,4))+1.00000, 2.00000);
    ALGEBRAIC(:,27) = ALGEBRAIC(:,25)./ALGEBRAIC(:,26)+CONSTANTS(:,15);
    ALGEBRAIC(:,31) = STATES(:,1) - ALGEBRAIC(:,23)./ALGEBRAIC(:,27);
    ALGEBRAIC(:,8) = (( 1.34000.*CONSTANTS(:,14))./100.000)./( CONSTANTS(:,11).*power(STATES(:,2),  - 1.00000./CONSTANTS(:,10))+1.00000)+ CONSTANTS(:,15).*STATES(:,2);
    ALGEBRAIC(:,20) =  (( ( - 1.00000./CONSTANTS(:,19)).*CONSTANTS(:,20))./CONSTANTS(:,21)).*ALGEBRAIC(:,19);
    ALGEBRAIC(:,22) = ALGEBRAIC(:,8)+( ALGEBRAIC(:,20).*CONSTANTS(:,31))./2.00000;
    ALGEBRAIC(:,24) = ((( 1.34000.*CONSTANTS(:,14))./100.000)./( CONSTANTS(:,11).*power(STATES(:,2),  - 1.00000./CONSTANTS(:,10))+1.00000)+ CONSTANTS(:,15).*STATES(:,2)) - ALGEBRAIC(:,22);
    ALGEBRAIC(:,28) =  1.34000.*CONSTANTS(:,14).*CONSTANTS(:,11).*power(STATES(:,2),  - 1.00000./CONSTANTS(:,10) - 1.00000);
    ALGEBRAIC(:,29) =  100.000.*CONSTANTS(:,10).*power( CONSTANTS(:,11).*power(STATES(:,2),  - 1.00000./CONSTANTS(:,10))+1.00000, 2.00000);
    ALGEBRAIC(:,30) = ALGEBRAIC(:,28)./ALGEBRAIC(:,29)+CONSTANTS(:,15);
    ALGEBRAIC(:,32) = STATES(:,2) - ALGEBRAIC(:,24)./ALGEBRAIC(:,30);
    ALGEBRAIC(:,33) = ((arbitrary_log(ALGEBRAIC(:,31), 10) - CONSTANTS(:,1))+ CONSTANTS(:,3).*(CONSTANTS(:,7) - 7.40000))./CONSTANTS(:,4);
    ALGEBRAIC(:,34) = power(10.0000, ALGEBRAIC(:,33));
    ALGEBRAIC(:,35) = ( 100.000.*ALGEBRAIC(:,34))./(1.00000+ALGEBRAIC(:,34));
    ALGEBRAIC(:,39) = piecewise({ALGEBRAIC(:,35)>96.0000, exp(  - 1.00000.*CONSTANTS(:,26).*(100.000 - 96.0000)) }, exp(  - 1.00000.*CONSTANTS(:,26).*(100.000 - ALGEBRAIC(:,35))));
    ALGEBRAIC(:,40) = ( (( (( (( CONSTANTS(:,25).*(1.00000 - ALGEBRAIC(:,39))+ CONSTANTS(:,27).*ALGEBRAIC(:,35)) - CONSTANTS(:,28)).*1.34000)./100.000).*CONSTANTS(:,13))./0.200000).*CONSTANTS(:,16))./CONSTANTS(:,18);
    ALGEBRAIC(:,41) = piecewise({ALGEBRAIC(:,35)>96.0000, ALGEBRAIC(:,40) - ( ALGEBRAIC(:,40).*(96.0000 - ALGEBRAIC(:,35)))./ - 4.00000 }, ( (( (( (( CONSTANTS(:,25).*(1.00000 - ALGEBRAIC(:,39))+ CONSTANTS(:,27).*ALGEBRAIC(:,35)) - CONSTANTS(:,28)).*1.34000)./100.000).*CONSTANTS(:,13))./0.200000).*CONSTANTS(:,16))./CONSTANTS(:,18));
    ALGEBRAIC(:,45) = 1.00000./( ALGEBRAIC(:,41).*CONSTANTS(:,20));
    ALGEBRAIC(:,36) = ((arbitrary_log(ALGEBRAIC(:,32), 10) - CONSTANTS(:,8))+ CONSTANTS(:,9).*(CONSTANTS(:,12) - 7.40000))./CONSTANTS(:,10);
    ALGEBRAIC(:,37) = power(10.0000, ALGEBRAIC(:,36));
    ALGEBRAIC(:,38) = ( 100.000.*ALGEBRAIC(:,37))./(1.00000+ALGEBRAIC(:,37));
    ALGEBRAIC(:,42) = piecewise({ALGEBRAIC(:,38)>96.0000, exp(  - 1.00000.*CONSTANTS(:,26).*(100.000 - 96.0000)) }, exp(  - 1.00000.*CONSTANTS(:,26).*(100.000 - ALGEBRAIC(:,38))));
    ALGEBRAIC(:,43) = ( (( (( (( CONSTANTS(:,25).*(1.00000 - ALGEBRAIC(:,42))+ CONSTANTS(:,27).*ALGEBRAIC(:,38)) - CONSTANTS(:,28)).*1.34000)./100.000).*CONSTANTS(:,14))./0.200000).*CONSTANTS(:,17))./CONSTANTS(:,18);
    ALGEBRAIC(:,44) = piecewise({ALGEBRAIC(:,38)>96.0000, ALGEBRAIC(:,43) - ( ALGEBRAIC(:,43).*(96.0000 - ALGEBRAIC(:,38)))./ - 4.00000 }, ( (( (( (( CONSTANTS(:,25).*(1.00000 - ALGEBRAIC(:,42))+ CONSTANTS(:,27).*ALGEBRAIC(:,38)) - CONSTANTS(:,28)).*1.34000)./100.000).*CONSTANTS(:,14))./0.200000).*CONSTANTS(:,17))./CONSTANTS(:,18));
    ALGEBRAIC(:,46) = 1.00000./( ALGEBRAIC(:,44).*CONSTANTS(:,21));
    ALGEBRAIC(:,47) = ALGEBRAIC(:,45)+ALGEBRAIC(:,46)+CONSTANTS(:,32);
    ALGEBRAIC(:,48) = (1.00000./ALGEBRAIC(:,47))./60.0000;
    ALGEBRAIC(:,49) = ( CONSTANTS(:,19).* - 1.00000.*ALGEBRAIC(:,48).*(ALGEBRAIC(:,31) - ALGEBRAIC(:,32)))./CONSTANTS(:,20);
    ALGEBRAIC(:,51) = ALGEBRAIC(:,7)+( ALGEBRAIC(:,49).*CONSTANTS(:,31))./2.00000;
    ALGEBRAIC(:,53) = ((( 1.34000.*CONSTANTS(:,13))./100.000)./( CONSTANTS(:,6).*power(ALGEBRAIC(:,31),  - 1.00000./CONSTANTS(:,4))+1.00000)+ CONSTANTS(:,15).*ALGEBRAIC(:,31)) - ALGEBRAIC(:,51);
    ALGEBRAIC(:,55) =  1.34000.*CONSTANTS(:,13).*CONSTANTS(:,6).*power(ALGEBRAIC(:,31),  - 1.00000./CONSTANTS(:,4) - 1.00000);
    ALGEBRAIC(:,56) =  100.000.*CONSTANTS(:,4).*power( CONSTANTS(:,6).*power(ALGEBRAIC(:,31),  - 1.00000./CONSTANTS(:,4))+1.00000, 2.00000);
    ALGEBRAIC(:,57) = ALGEBRAIC(:,55)./ALGEBRAIC(:,56)+CONSTANTS(:,15);
    ALGEBRAIC(:,61) = ALGEBRAIC(:,31) - ALGEBRAIC(:,53)./ALGEBRAIC(:,57);
    ALGEBRAIC(:,50) =  (( ( - 1.00000./CONSTANTS(:,19)).*CONSTANTS(:,20))./CONSTANTS(:,21)).*ALGEBRAIC(:,49);
    ALGEBRAIC(:,52) = ALGEBRAIC(:,8)+( ALGEBRAIC(:,50).*CONSTANTS(:,31))./2.00000;
    ALGEBRAIC(:,54) = ((( 1.34000.*CONSTANTS(:,14))./100.000)./( CONSTANTS(:,11).*power(ALGEBRAIC(:,32),  - 1.00000./CONSTANTS(:,10))+1.00000)+ CONSTANTS(:,15).*ALGEBRAIC(:,32)) - ALGEBRAIC(:,52);
    ALGEBRAIC(:,58) =  1.34000.*CONSTANTS(:,14).*CONSTANTS(:,11).*power(ALGEBRAIC(:,32),  - 1.00000./CONSTANTS(:,10) - 1.00000);
    ALGEBRAIC(:,59) =  100.000.*CONSTANTS(:,10).*power( CONSTANTS(:,11).*power(ALGEBRAIC(:,32),  - 1.00000./CONSTANTS(:,10))+1.00000, 2.00000);
    ALGEBRAIC(:,60) = ALGEBRAIC(:,58)./ALGEBRAIC(:,59)+CONSTANTS(:,15);
    ALGEBRAIC(:,62) = ALGEBRAIC(:,32) - ALGEBRAIC(:,54)./ALGEBRAIC(:,60);
    ALGEBRAIC(:,63) = ((arbitrary_log(ALGEBRAIC(:,61), 10) - CONSTANTS(:,1))+ CONSTANTS(:,3).*(CONSTANTS(:,7) - 7.40000))./CONSTANTS(:,4);
    ALGEBRAIC(:,64) = power(10.0000, ALGEBRAIC(:,63));
    ALGEBRAIC(:,65) = ( 100.000.*ALGEBRAIC(:,64))./(1.00000+ALGEBRAIC(:,64));
    ALGEBRAIC(:,69) = piecewise({ALGEBRAIC(:,65)>96.0000, exp(  - 1.00000.*CONSTANTS(:,26).*(100.000 - 96.0000)) }, exp(  - 1.00000.*CONSTANTS(:,26).*(100.000 - ALGEBRAIC(:,65))));
    ALGEBRAIC(:,70) = ( (( (( (( CONSTANTS(:,25).*(1.00000 - ALGEBRAIC(:,69))+ CONSTANTS(:,27).*ALGEBRAIC(:,65)) - CONSTANTS(:,28)).*1.34000)./100.000).*CONSTANTS(:,13))./0.200000).*CONSTANTS(:,16))./CONSTANTS(:,18);
    ALGEBRAIC(:,71) = piecewise({ALGEBRAIC(:,65)>96.0000, ALGEBRAIC(:,70) - ( ALGEBRAIC(:,70).*(96.0000 - ALGEBRAIC(:,65)))./ - 4.00000 }, ( (( (( (( CONSTANTS(:,25).*(1.00000 - ALGEBRAIC(:,69))+ CONSTANTS(:,27).*ALGEBRAIC(:,65)) - CONSTANTS(:,28)).*1.34000)./100.000).*CONSTANTS(:,13))./0.200000).*CONSTANTS(:,16))./CONSTANTS(:,18));
    ALGEBRAIC(:,75) = 1.00000./( ALGEBRAIC(:,71).*CONSTANTS(:,20));
    ALGEBRAIC(:,66) = ((arbitrary_log(ALGEBRAIC(:,62), 10) - CONSTANTS(:,8))+ CONSTANTS(:,9).*(CONSTANTS(:,12) - 7.40000))./CONSTANTS(:,10);
    ALGEBRAIC(:,67) = power(10.0000, ALGEBRAIC(:,66));
    ALGEBRAIC(:,68) = ( 100.000.*ALGEBRAIC(:,67))./(1.00000+ALGEBRAIC(:,67));
    ALGEBRAIC(:,72) = piecewise({ALGEBRAIC(:,68)>96.0000, exp(  - 1.00000.*CONSTANTS(:,26).*(100.000 - 96.0000)) }, exp(  - 1.00000.*CONSTANTS(:,26).*(100.000 - ALGEBRAIC(:,68))));
    ALGEBRAIC(:,73) = ( (( (( (( CONSTANTS(:,25).*(1.00000 - ALGEBRAIC(:,72))+ CONSTANTS(:,27).*ALGEBRAIC(:,68)) - CONSTANTS(:,28)).*1.34000)./100.000).*CONSTANTS(:,14))./0.200000).*CONSTANTS(:,17))./CONSTANTS(:,18);
    ALGEBRAIC(:,74) = piecewise({ALGEBRAIC(:,68)>96.0000, ALGEBRAIC(:,73) - ( ALGEBRAIC(:,73).*(96.0000 - ALGEBRAIC(:,68)))./ - 4.00000 }, ( (( (( (( CONSTANTS(:,25).*(1.00000 - ALGEBRAIC(:,72))+ CONSTANTS(:,27).*ALGEBRAIC(:,68)) - CONSTANTS(:,28)).*1.34000)./100.000).*CONSTANTS(:,14))./0.200000).*CONSTANTS(:,17))./CONSTANTS(:,18));
    ALGEBRAIC(:,76) = 1.00000./( ALGEBRAIC(:,74).*CONSTANTS(:,21));
    ALGEBRAIC(:,77) = ALGEBRAIC(:,75)+ALGEBRAIC(:,76)+CONSTANTS(:,33);
    ALGEBRAIC(:,78) = (1.00000./ALGEBRAIC(:,77))./60.0000;
    ALGEBRAIC(:,79) = ( CONSTANTS(:,19).* - 1.00000.*ALGEBRAIC(:,78).*(ALGEBRAIC(:,61) - ALGEBRAIC(:,62)))./CONSTANTS(:,20);
    ALGEBRAIC(:,81) = ALGEBRAIC(:,7)+ ALGEBRAIC(:,79).*CONSTANTS(:,31);
    ALGEBRAIC(:,83) = ((( 1.34000.*CONSTANTS(:,13))./100.000)./( CONSTANTS(:,6).*power(ALGEBRAIC(:,61),  - 1.00000./CONSTANTS(:,4))+1.00000)+ CONSTANTS(:,15).*ALGEBRAIC(:,61)) - ALGEBRAIC(:,81);
    ALGEBRAIC(:,85) =  1.34000.*CONSTANTS(:,13).*CONSTANTS(:,6).*power(ALGEBRAIC(:,61),  - 1.00000./CONSTANTS(:,4) - 1.00000);
    ALGEBRAIC(:,86) =  100.000.*CONSTANTS(:,4).*power( CONSTANTS(:,6).*power(ALGEBRAIC(:,61),  - 1.00000./CONSTANTS(:,4))+1.00000, 2.00000);
    ALGEBRAIC(:,87) = ALGEBRAIC(:,85)./ALGEBRAIC(:,86)+CONSTANTS(:,15);
    ALGEBRAIC(:,91) = ALGEBRAIC(:,61) - ALGEBRAIC(:,83)./ALGEBRAIC(:,87);
    ALGEBRAIC(:,80) =  (( ( - 1.00000./CONSTANTS(:,19)).*CONSTANTS(:,20))./CONSTANTS(:,21)).*ALGEBRAIC(:,79);
    ALGEBRAIC(:,82) = ALGEBRAIC(:,8)+ ALGEBRAIC(:,80).*CONSTANTS(:,31);
    ALGEBRAIC(:,84) = ((( 1.34000.*CONSTANTS(:,14))./100.000)./( CONSTANTS(:,11).*power(ALGEBRAIC(:,62),  - 1.00000./CONSTANTS(:,10))+1.00000)+ CONSTANTS(:,15).*ALGEBRAIC(:,62)) - ALGEBRAIC(:,82);
    ALGEBRAIC(:,88) =  1.34000.*CONSTANTS(:,14).*CONSTANTS(:,11).*power(ALGEBRAIC(:,62),  - 1.00000./CONSTANTS(:,10) - 1.00000);
    ALGEBRAIC(:,89) =  100.000.*CONSTANTS(:,10).*power( CONSTANTS(:,11).*power(ALGEBRAIC(:,62),  - 1.00000./CONSTANTS(:,10))+1.00000, 2.00000);
    ALGEBRAIC(:,90) = ALGEBRAIC(:,88)./ALGEBRAIC(:,89)+CONSTANTS(:,15);
    ALGEBRAIC(:,92) = ALGEBRAIC(:,62) - ALGEBRAIC(:,84)./ALGEBRAIC(:,90);
    ALGEBRAIC(:,93) = ((arbitrary_log(ALGEBRAIC(:,91), 10) - CONSTANTS(:,1))+ CONSTANTS(:,3).*(CONSTANTS(:,7) - 7.40000))./CONSTANTS(:,4);
    ALGEBRAIC(:,94) = power(10.0000, ALGEBRAIC(:,93));
    ALGEBRAIC(:,95) = ( 100.000.*ALGEBRAIC(:,94))./(1.00000+ALGEBRAIC(:,94));
    ALGEBRAIC(:,99) = piecewise({ALGEBRAIC(:,95)>96.0000, exp(  - 1.00000.*CONSTANTS(:,26).*(100.000 - 96.0000)) }, exp(  - 1.00000.*CONSTANTS(:,26).*(100.000 - ALGEBRAIC(:,95))));
    ALGEBRAIC(:,100) = ( (( (( (( CONSTANTS(:,25).*(1.00000 - ALGEBRAIC(:,99))+ CONSTANTS(:,27).*ALGEBRAIC(:,95)) - CONSTANTS(:,28)).*1.34000)./100.000).*CONSTANTS(:,13))./0.200000).*CONSTANTS(:,16))./CONSTANTS(:,18);
    ALGEBRAIC(:,101) = piecewise({ALGEBRAIC(:,95)>96.0000, ALGEBRAIC(:,100) - ( ALGEBRAIC(:,100).*(96.0000 - ALGEBRAIC(:,95)))./ - 4.00000 }, ( (( (( (( CONSTANTS(:,25).*(1.00000 - ALGEBRAIC(:,99))+ CONSTANTS(:,27).*ALGEBRAIC(:,95)) - CONSTANTS(:,28)).*1.34000)./100.000).*CONSTANTS(:,13))./0.200000).*CONSTANTS(:,16))./CONSTANTS(:,18));
    ALGEBRAIC(:,105) = 1.00000./( ALGEBRAIC(:,101).*CONSTANTS(:,20));
    ALGEBRAIC(:,96) = ((arbitrary_log(ALGEBRAIC(:,92), 10) - CONSTANTS(:,8))+ CONSTANTS(:,9).*(CONSTANTS(:,12) - 7.40000))./CONSTANTS(:,10);
    ALGEBRAIC(:,97) = power(10.0000, ALGEBRAIC(:,96));
    ALGEBRAIC(:,98) = ( 100.000.*ALGEBRAIC(:,97))./(1.00000+ALGEBRAIC(:,97));
    ALGEBRAIC(:,102) = piecewise({ALGEBRAIC(:,98)>96.0000, exp(  - 1.00000.*CONSTANTS(:,26).*(100.000 - 96.0000)) }, exp(  - 1.00000.*CONSTANTS(:,26).*(100.000 - ALGEBRAIC(:,98))));
    ALGEBRAIC(:,103) = ( (( (( (( CONSTANTS(:,25).*(1.00000 - ALGEBRAIC(:,102))+ CONSTANTS(:,27).*ALGEBRAIC(:,98)) - CONSTANTS(:,28)).*1.34000)./100.000).*CONSTANTS(:,14))./0.200000).*CONSTANTS(:,17))./CONSTANTS(:,18);
    ALGEBRAIC(:,104) = piecewise({ALGEBRAIC(:,98)>96.0000, ALGEBRAIC(:,103) - ( ALGEBRAIC(:,103).*(96.0000 - ALGEBRAIC(:,98)))./ - 4.00000 }, ( (( (( (( CONSTANTS(:,25).*(1.00000 - ALGEBRAIC(:,102))+ CONSTANTS(:,27).*ALGEBRAIC(:,98)) - CONSTANTS(:,28)).*1.34000)./100.000).*CONSTANTS(:,14))./0.200000).*CONSTANTS(:,17))./CONSTANTS(:,18));
    ALGEBRAIC(:,106) = 1.00000./( ALGEBRAIC(:,104).*CONSTANTS(:,21));
    ALGEBRAIC(:,107) = ALGEBRAIC(:,105)+ALGEBRAIC(:,106)+CONSTANTS(:,34);
    ALGEBRAIC(:,108) = (1.00000./ALGEBRAIC(:,107))./60.0000;
    ALGEBRAIC(:,109) = ( CONSTANTS(:,19).* - 1.00000.*ALGEBRAIC(:,108).*(ALGEBRAIC(:,91) - ALGEBRAIC(:,92)))./CONSTANTS(:,20);
    ALGEBRAIC(:,110) = ALGEBRAIC(:,7)+ (1.00000./6.00000).*(ALGEBRAIC(:,19)+ 2.00000.*ALGEBRAIC(:,49)+ 2.00000.*ALGEBRAIC(:,79)+ALGEBRAIC(:,109)).*CONSTANTS(:,31);
    ALGEBRAIC(:,112) = ((( 1.34000.*CONSTANTS(:,13))./100.000)./( CONSTANTS(:,6).*power(ALGEBRAIC(:,91),  - 1.00000./CONSTANTS(:,4))+1.00000)+ CONSTANTS(:,15).*ALGEBRAIC(:,91)) - ALGEBRAIC(:,110);
    ALGEBRAIC(:,114) =  1.34000.*CONSTANTS(:,13).*CONSTANTS(:,6).*power(ALGEBRAIC(:,91),  - 1.00000./CONSTANTS(:,4) - 1.00000);
    ALGEBRAIC(:,116) =  100.000.*CONSTANTS(:,4).*power( CONSTANTS(:,6).*power(ALGEBRAIC(:,91),  - 1.00000./CONSTANTS(:,4))+1.00000, 2.00000);
    ALGEBRAIC(:,118) = ALGEBRAIC(:,114)./ALGEBRAIC(:,116)+CONSTANTS(:,15);
    ALGEBRAIC(:,121) = ALGEBRAIC(:,91) - ALGEBRAIC(:,112)./ALGEBRAIC(:,118);
    RATES(:,1) = (ALGEBRAIC(:,121) - STATES(:,1))./CONSTANTS(:,31);
    ALGEBRAIC(:,111) =  (( ( - 1.00000./CONSTANTS(:,19)).*CONSTANTS(:,20))./CONSTANTS(:,21)).*ALGEBRAIC(:,109);
    ALGEBRAIC(:,113) = ALGEBRAIC(:,8)+ (1.00000./6.00000).*(ALGEBRAIC(:,20)+ 2.00000.*ALGEBRAIC(:,50)+ 2.00000.*ALGEBRAIC(:,80)+ALGEBRAIC(:,111)).*CONSTANTS(:,31);
    ALGEBRAIC(:,115) = ((( 1.34000.*CONSTANTS(:,14))./100.000)./( CONSTANTS(:,11).*power(ALGEBRAIC(:,92),  - 1.00000./CONSTANTS(:,10))+1.00000)+ CONSTANTS(:,15).*ALGEBRAIC(:,92)) - ALGEBRAIC(:,113);
    ALGEBRAIC(:,117) =  1.34000.*CONSTANTS(:,14).*CONSTANTS(:,11).*power(ALGEBRAIC(:,92),  - 1.00000./CONSTANTS(:,10) - 1.00000);
    ALGEBRAIC(:,119) =  100.000.*CONSTANTS(:,10).*power( CONSTANTS(:,11).*power(ALGEBRAIC(:,92),  - 1.00000./CONSTANTS(:,10))+1.00000, 2.00000);
    ALGEBRAIC(:,120) = ALGEBRAIC(:,117)./ALGEBRAIC(:,119)+CONSTANTS(:,15);
    ALGEBRAIC(:,122) = ALGEBRAIC(:,92) - ALGEBRAIC(:,115)./ALGEBRAIC(:,120);
    RATES(:,2) = (ALGEBRAIC(:,122) - STATES(:,2))./CONSTANTS(:,31);
   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(:,7) = (( 1.34000.*CONSTANTS(:,13))./100.000)./( CONSTANTS(:,6).*power(STATES(:,1),  - 1.00000./CONSTANTS(:,4))+1.00000)+ CONSTANTS(:,15).*STATES(:,1);
    ALGEBRAIC(:,1) = ((arbitrary_log(STATES(:,1), 10) - CONSTANTS(:,1))+ CONSTANTS(:,3).*(CONSTANTS(:,7) - 7.40000))./CONSTANTS(:,4);
    ALGEBRAIC(:,2) = power(10.0000, ALGEBRAIC(:,1));
    ALGEBRAIC(:,3) = ( 100.000.*ALGEBRAIC(:,2))./(1.00000+ALGEBRAIC(:,2));
    ALGEBRAIC(:,9) = piecewise({ALGEBRAIC(:,3)>96.0000, exp(  - 1.00000.*CONSTANTS(:,26).*(100.000 - 96.0000)) }, exp(  - 1.00000.*CONSTANTS(:,26).*(100.000 - ALGEBRAIC(:,3))));
    ALGEBRAIC(:,10) = ( (( (( (( CONSTANTS(:,25).*(1.00000 - ALGEBRAIC(:,9))+ CONSTANTS(:,27).*ALGEBRAIC(:,3)) - CONSTANTS(:,28)).*1.34000)./100.000).*CONSTANTS(:,13))./0.200000).*CONSTANTS(:,16))./CONSTANTS(:,18);
    ALGEBRAIC(:,11) = piecewise({ALGEBRAIC(:,3)>96.0000, ALGEBRAIC(:,10) - ( ALGEBRAIC(:,10).*(96.0000 - ALGEBRAIC(:,3)))./ - 4.00000 }, ( (( (( (( CONSTANTS(:,25).*(1.00000 - ALGEBRAIC(:,9))+ CONSTANTS(:,27).*ALGEBRAIC(:,3)) - CONSTANTS(:,28)).*1.34000)./100.000).*CONSTANTS(:,13))./0.200000).*CONSTANTS(:,16))./CONSTANTS(:,18));
    ALGEBRAIC(:,15) = 1.00000./( ALGEBRAIC(:,11).*CONSTANTS(:,20));
    ALGEBRAIC(:,4) = ((arbitrary_log(STATES(:,2), 10) - CONSTANTS(:,8))+ CONSTANTS(:,9).*(CONSTANTS(:,12) - 7.40000))./CONSTANTS(:,10);
    ALGEBRAIC(:,5) = power(10.0000, ALGEBRAIC(:,4));
    ALGEBRAIC(:,6) = ( 100.000.*ALGEBRAIC(:,5))./(1.00000+ALGEBRAIC(:,5));
    ALGEBRAIC(:,12) = piecewise({ALGEBRAIC(:,6)>96.0000, exp(  - 1.00000.*CONSTANTS(:,26).*(100.000 - 96.0000)) }, exp(  - 1.00000.*CONSTANTS(:,26).*(100.000 - ALGEBRAIC(:,6))));
    ALGEBRAIC(:,13) = ( (( (( (( CONSTANTS(:,25).*(1.00000 - ALGEBRAIC(:,12))+ CONSTANTS(:,27).*ALGEBRAIC(:,6)) - CONSTANTS(:,28)).*1.34000)./100.000).*CONSTANTS(:,14))./0.200000).*CONSTANTS(:,17))./CONSTANTS(:,18);
    ALGEBRAIC(:,14) = piecewise({ALGEBRAIC(:,6)>96.0000, ALGEBRAIC(:,13) - ( ALGEBRAIC(:,13).*(96.0000 - ALGEBRAIC(:,6)))./ - 4.00000 }, ( (( (( (( CONSTANTS(:,25).*(1.00000 - ALGEBRAIC(:,12))+ CONSTANTS(:,27).*ALGEBRAIC(:,6)) - CONSTANTS(:,28)).*1.34000)./100.000).*CONSTANTS(:,14))./0.200000).*CONSTANTS(:,17))./CONSTANTS(:,18));
    ALGEBRAIC(:,16) = 1.00000./( ALGEBRAIC(:,14).*CONSTANTS(:,21));
    ALGEBRAIC(:,17) = ALGEBRAIC(:,15)+ALGEBRAIC(:,16)+CONSTANTS(:,29);
    ALGEBRAIC(:,18) = (1.00000./ALGEBRAIC(:,17))./60.0000;
    ALGEBRAIC(:,19) = ( CONSTANTS(:,19).* - 1.00000.*ALGEBRAIC(:,18).*(STATES(:,1) - STATES(:,2)))./CONSTANTS(:,20);
    ALGEBRAIC(:,21) = ALGEBRAIC(:,7)+( ALGEBRAIC(:,19).*CONSTANTS(:,31))./2.00000;
    ALGEBRAIC(:,23) = ((( 1.34000.*CONSTANTS(:,13))./100.000)./( CONSTANTS(:,6).*power(STATES(:,1),  - 1.00000./CONSTANTS(:,4))+1.00000)+ CONSTANTS(:,15).*STATES(:,1)) - ALGEBRAIC(:,21);
    ALGEBRAIC(:,25) =  1.34000.*CONSTANTS(:,13).*CONSTANTS(:,6).*power(STATES(:,1),  - 1.00000./CONSTANTS(:,4) - 1.00000);
    ALGEBRAIC(:,26) =  100.000.*CONSTANTS(:,4).*power( CONSTANTS(:,6).*power(STATES(:,1),  - 1.00000./CONSTANTS(:,4))+1.00000, 2.00000);
    ALGEBRAIC(:,27) = ALGEBRAIC(:,25)./ALGEBRAIC(:,26)+CONSTANTS(:,15);
    ALGEBRAIC(:,31) = STATES(:,1) - ALGEBRAIC(:,23)./ALGEBRAIC(:,27);
    ALGEBRAIC(:,8) = (( 1.34000.*CONSTANTS(:,14))./100.000)./( CONSTANTS(:,11).*power(STATES(:,2),  - 1.00000./CONSTANTS(:,10))+1.00000)+ CONSTANTS(:,15).*STATES(:,2);
    ALGEBRAIC(:,20) =  (( ( - 1.00000./CONSTANTS(:,19)).*CONSTANTS(:,20))./CONSTANTS(:,21)).*ALGEBRAIC(:,19);
    ALGEBRAIC(:,22) = ALGEBRAIC(:,8)+( ALGEBRAIC(:,20).*CONSTANTS(:,31))./2.00000;
    ALGEBRAIC(:,24) = ((( 1.34000.*CONSTANTS(:,14))./100.000)./( CONSTANTS(:,11).*power(STATES(:,2),  - 1.00000./CONSTANTS(:,10))+1.00000)+ CONSTANTS(:,15).*STATES(:,2)) - ALGEBRAIC(:,22);
    ALGEBRAIC(:,28) =  1.34000.*CONSTANTS(:,14).*CONSTANTS(:,11).*power(STATES(:,2),  - 1.00000./CONSTANTS(:,10) - 1.00000);
    ALGEBRAIC(:,29) =  100.000.*CONSTANTS(:,10).*power( CONSTANTS(:,11).*power(STATES(:,2),  - 1.00000./CONSTANTS(:,10))+1.00000, 2.00000);
    ALGEBRAIC(:,30) = ALGEBRAIC(:,28)./ALGEBRAIC(:,29)+CONSTANTS(:,15);
    ALGEBRAIC(:,32) = STATES(:,2) - ALGEBRAIC(:,24)./ALGEBRAIC(:,30);
    ALGEBRAIC(:,33) = ((arbitrary_log(ALGEBRAIC(:,31), 10) - CONSTANTS(:,1))+ CONSTANTS(:,3).*(CONSTANTS(:,7) - 7.40000))./CONSTANTS(:,4);
    ALGEBRAIC(:,34) = power(10.0000, ALGEBRAIC(:,33));
    ALGEBRAIC(:,35) = ( 100.000.*ALGEBRAIC(:,34))./(1.00000+ALGEBRAIC(:,34));
    ALGEBRAIC(:,39) = piecewise({ALGEBRAIC(:,35)>96.0000, exp(  - 1.00000.*CONSTANTS(:,26).*(100.000 - 96.0000)) }, exp(  - 1.00000.*CONSTANTS(:,26).*(100.000 - ALGEBRAIC(:,35))));
    ALGEBRAIC(:,40) = ( (( (( (( CONSTANTS(:,25).*(1.00000 - ALGEBRAIC(:,39))+ CONSTANTS(:,27).*ALGEBRAIC(:,35)) - CONSTANTS(:,28)).*1.34000)./100.000).*CONSTANTS(:,13))./0.200000).*CONSTANTS(:,16))./CONSTANTS(:,18);
    ALGEBRAIC(:,41) = piecewise({ALGEBRAIC(:,35)>96.0000, ALGEBRAIC(:,40) - ( ALGEBRAIC(:,40).*(96.0000 - ALGEBRAIC(:,35)))./ - 4.00000 }, ( (( (( (( CONSTANTS(:,25).*(1.00000 - ALGEBRAIC(:,39))+ CONSTANTS(:,27).*ALGEBRAIC(:,35)) - CONSTANTS(:,28)).*1.34000)./100.000).*CONSTANTS(:,13))./0.200000).*CONSTANTS(:,16))./CONSTANTS(:,18));
    ALGEBRAIC(:,45) = 1.00000./( ALGEBRAIC(:,41).*CONSTANTS(:,20));
    ALGEBRAIC(:,36) = ((arbitrary_log(ALGEBRAIC(:,32), 10) - CONSTANTS(:,8))+ CONSTANTS(:,9).*(CONSTANTS(:,12) - 7.40000))./CONSTANTS(:,10);
    ALGEBRAIC(:,37) = power(10.0000, ALGEBRAIC(:,36));
    ALGEBRAIC(:,38) = ( 100.000.*ALGEBRAIC(:,37))./(1.00000+ALGEBRAIC(:,37));
    ALGEBRAIC(:,42) = piecewise({ALGEBRAIC(:,38)>96.0000, exp(  - 1.00000.*CONSTANTS(:,26).*(100.000 - 96.0000)) }, exp(  - 1.00000.*CONSTANTS(:,26).*(100.000 - ALGEBRAIC(:,38))));
    ALGEBRAIC(:,43) = ( (( (( (( CONSTANTS(:,25).*(1.00000 - ALGEBRAIC(:,42))+ CONSTANTS(:,27).*ALGEBRAIC(:,38)) - CONSTANTS(:,28)).*1.34000)./100.000).*CONSTANTS(:,14))./0.200000).*CONSTANTS(:,17))./CONSTANTS(:,18);
    ALGEBRAIC(:,44) = piecewise({ALGEBRAIC(:,38)>96.0000, ALGEBRAIC(:,43) - ( ALGEBRAIC(:,43).*(96.0000 - ALGEBRAIC(:,38)))./ - 4.00000 }, ( (( (( (( CONSTANTS(:,25).*(1.00000 - ALGEBRAIC(:,42))+ CONSTANTS(:,27).*ALGEBRAIC(:,38)) - CONSTANTS(:,28)).*1.34000)./100.000).*CONSTANTS(:,14))./0.200000).*CONSTANTS(:,17))./CONSTANTS(:,18));
    ALGEBRAIC(:,46) = 1.00000./( ALGEBRAIC(:,44).*CONSTANTS(:,21));
    ALGEBRAIC(:,47) = ALGEBRAIC(:,45)+ALGEBRAIC(:,46)+CONSTANTS(:,32);
    ALGEBRAIC(:,48) = (1.00000./ALGEBRAIC(:,47))./60.0000;
    ALGEBRAIC(:,49) = ( CONSTANTS(:,19).* - 1.00000.*ALGEBRAIC(:,48).*(ALGEBRAIC(:,31) - ALGEBRAIC(:,32)))./CONSTANTS(:,20);
    ALGEBRAIC(:,51) = ALGEBRAIC(:,7)+( ALGEBRAIC(:,49).*CONSTANTS(:,31))./2.00000;
    ALGEBRAIC(:,53) = ((( 1.34000.*CONSTANTS(:,13))./100.000)./( CONSTANTS(:,6).*power(ALGEBRAIC(:,31),  - 1.00000./CONSTANTS(:,4))+1.00000)+ CONSTANTS(:,15).*ALGEBRAIC(:,31)) - ALGEBRAIC(:,51);
    ALGEBRAIC(:,55) =  1.34000.*CONSTANTS(:,13).*CONSTANTS(:,6).*power(ALGEBRAIC(:,31),  - 1.00000./CONSTANTS(:,4) - 1.00000);
    ALGEBRAIC(:,56) =  100.000.*CONSTANTS(:,4).*power( CONSTANTS(:,6).*power(ALGEBRAIC(:,31),  - 1.00000./CONSTANTS(:,4))+1.00000, 2.00000);
    ALGEBRAIC(:,57) = ALGEBRAIC(:,55)./ALGEBRAIC(:,56)+CONSTANTS(:,15);
    ALGEBRAIC(:,61) = ALGEBRAIC(:,31) - ALGEBRAIC(:,53)./ALGEBRAIC(:,57);
    ALGEBRAIC(:,50) =  (( ( - 1.00000./CONSTANTS(:,19)).*CONSTANTS(:,20))./CONSTANTS(:,21)).*ALGEBRAIC(:,49);
    ALGEBRAIC(:,52) = ALGEBRAIC(:,8)+( ALGEBRAIC(:,50).*CONSTANTS(:,31))./2.00000;
    ALGEBRAIC(:,54) = ((( 1.34000.*CONSTANTS(:,14))./100.000)./( CONSTANTS(:,11).*power(ALGEBRAIC(:,32),  - 1.00000./CONSTANTS(:,10))+1.00000)+ CONSTANTS(:,15).*ALGEBRAIC(:,32)) - ALGEBRAIC(:,52);
    ALGEBRAIC(:,58) =  1.34000.*CONSTANTS(:,14).*CONSTANTS(:,11).*power(ALGEBRAIC(:,32),  - 1.00000./CONSTANTS(:,10) - 1.00000);
    ALGEBRAIC(:,59) =  100.000.*CONSTANTS(:,10).*power( CONSTANTS(:,11).*power(ALGEBRAIC(:,32),  - 1.00000./CONSTANTS(:,10))+1.00000, 2.00000);
    ALGEBRAIC(:,60) = ALGEBRAIC(:,58)./ALGEBRAIC(:,59)+CONSTANTS(:,15);
    ALGEBRAIC(:,62) = ALGEBRAIC(:,32) - ALGEBRAIC(:,54)./ALGEBRAIC(:,60);
    ALGEBRAIC(:,63) = ((arbitrary_log(ALGEBRAIC(:,61), 10) - CONSTANTS(:,1))+ CONSTANTS(:,3).*(CONSTANTS(:,7) - 7.40000))./CONSTANTS(:,4);
    ALGEBRAIC(:,64) = power(10.0000, ALGEBRAIC(:,63));
    ALGEBRAIC(:,65) = ( 100.000.*ALGEBRAIC(:,64))./(1.00000+ALGEBRAIC(:,64));
    ALGEBRAIC(:,69) = piecewise({ALGEBRAIC(:,65)>96.0000, exp(  - 1.00000.*CONSTANTS(:,26).*(100.000 - 96.0000)) }, exp(  - 1.00000.*CONSTANTS(:,26).*(100.000 - ALGEBRAIC(:,65))));
    ALGEBRAIC(:,70) = ( (( (( (( CONSTANTS(:,25).*(1.00000 - ALGEBRAIC(:,69))+ CONSTANTS(:,27).*ALGEBRAIC(:,65)) - CONSTANTS(:,28)).*1.34000)./100.000).*CONSTANTS(:,13))./0.200000).*CONSTANTS(:,16))./CONSTANTS(:,18);
    ALGEBRAIC(:,71) = piecewise({ALGEBRAIC(:,65)>96.0000, ALGEBRAIC(:,70) - ( ALGEBRAIC(:,70).*(96.0000 - ALGEBRAIC(:,65)))./ - 4.00000 }, ( (( (( (( CONSTANTS(:,25).*(1.00000 - ALGEBRAIC(:,69))+ CONSTANTS(:,27).*ALGEBRAIC(:,65)) - CONSTANTS(:,28)).*1.34000)./100.000).*CONSTANTS(:,13))./0.200000).*CONSTANTS(:,16))./CONSTANTS(:,18));
    ALGEBRAIC(:,75) = 1.00000./( ALGEBRAIC(:,71).*CONSTANTS(:,20));
    ALGEBRAIC(:,66) = ((arbitrary_log(ALGEBRAIC(:,62), 10) - CONSTANTS(:,8))+ CONSTANTS(:,9).*(CONSTANTS(:,12) - 7.40000))./CONSTANTS(:,10);
    ALGEBRAIC(:,67) = power(10.0000, ALGEBRAIC(:,66));
    ALGEBRAIC(:,68) = ( 100.000.*ALGEBRAIC(:,67))./(1.00000+ALGEBRAIC(:,67));
    ALGEBRAIC(:,72) = piecewise({ALGEBRAIC(:,68)>96.0000, exp(  - 1.00000.*CONSTANTS(:,26).*(100.000 - 96.0000)) }, exp(  - 1.00000.*CONSTANTS(:,26).*(100.000 - ALGEBRAIC(:,68))));
    ALGEBRAIC(:,73) = ( (( (( (( CONSTANTS(:,25).*(1.00000 - ALGEBRAIC(:,72))+ CONSTANTS(:,27).*ALGEBRAIC(:,68)) - CONSTANTS(:,28)).*1.34000)./100.000).*CONSTANTS(:,14))./0.200000).*CONSTANTS(:,17))./CONSTANTS(:,18);
    ALGEBRAIC(:,74) = piecewise({ALGEBRAIC(:,68)>96.0000, ALGEBRAIC(:,73) - ( ALGEBRAIC(:,73).*(96.0000 - ALGEBRAIC(:,68)))./ - 4.00000 }, ( (( (( (( CONSTANTS(:,25).*(1.00000 - ALGEBRAIC(:,72))+ CONSTANTS(:,27).*ALGEBRAIC(:,68)) - CONSTANTS(:,28)).*1.34000)./100.000).*CONSTANTS(:,14))./0.200000).*CONSTANTS(:,17))./CONSTANTS(:,18));
    ALGEBRAIC(:,76) = 1.00000./( ALGEBRAIC(:,74).*CONSTANTS(:,21));
    ALGEBRAIC(:,77) = ALGEBRAIC(:,75)+ALGEBRAIC(:,76)+CONSTANTS(:,33);
    ALGEBRAIC(:,78) = (1.00000./ALGEBRAIC(:,77))./60.0000;
    ALGEBRAIC(:,79) = ( CONSTANTS(:,19).* - 1.00000.*ALGEBRAIC(:,78).*(ALGEBRAIC(:,61) - ALGEBRAIC(:,62)))./CONSTANTS(:,20);
    ALGEBRAIC(:,81) = ALGEBRAIC(:,7)+ ALGEBRAIC(:,79).*CONSTANTS(:,31);
    ALGEBRAIC(:,83) = ((( 1.34000.*CONSTANTS(:,13))./100.000)./( CONSTANTS(:,6).*power(ALGEBRAIC(:,61),  - 1.00000./CONSTANTS(:,4))+1.00000)+ CONSTANTS(:,15).*ALGEBRAIC(:,61)) - ALGEBRAIC(:,81);
    ALGEBRAIC(:,85) =  1.34000.*CONSTANTS(:,13).*CONSTANTS(:,6).*power(ALGEBRAIC(:,61),  - 1.00000./CONSTANTS(:,4) - 1.00000);
    ALGEBRAIC(:,86) =  100.000.*CONSTANTS(:,4).*power( CONSTANTS(:,6).*power(ALGEBRAIC(:,61),  - 1.00000./CONSTANTS(:,4))+1.00000, 2.00000);
    ALGEBRAIC(:,87) = ALGEBRAIC(:,85)./ALGEBRAIC(:,86)+CONSTANTS(:,15);
    ALGEBRAIC(:,91) = ALGEBRAIC(:,61) - ALGEBRAIC(:,83)./ALGEBRAIC(:,87);
    ALGEBRAIC(:,80) =  (( ( - 1.00000./CONSTANTS(:,19)).*CONSTANTS(:,20))./CONSTANTS(:,21)).*ALGEBRAIC(:,79);
    ALGEBRAIC(:,82) = ALGEBRAIC(:,8)+ ALGEBRAIC(:,80).*CONSTANTS(:,31);
    ALGEBRAIC(:,84) = ((( 1.34000.*CONSTANTS(:,14))./100.000)./( CONSTANTS(:,11).*power(ALGEBRAIC(:,62),  - 1.00000./CONSTANTS(:,10))+1.00000)+ CONSTANTS(:,15).*ALGEBRAIC(:,62)) - ALGEBRAIC(:,82);
    ALGEBRAIC(:,88) =  1.34000.*CONSTANTS(:,14).*CONSTANTS(:,11).*power(ALGEBRAIC(:,62),  - 1.00000./CONSTANTS(:,10) - 1.00000);
    ALGEBRAIC(:,89) =  100.000.*CONSTANTS(:,10).*power( CONSTANTS(:,11).*power(ALGEBRAIC(:,62),  - 1.00000./CONSTANTS(:,10))+1.00000, 2.00000);
    ALGEBRAIC(:,90) = ALGEBRAIC(:,88)./ALGEBRAIC(:,89)+CONSTANTS(:,15);
    ALGEBRAIC(:,92) = ALGEBRAIC(:,62) - ALGEBRAIC(:,84)./ALGEBRAIC(:,90);
    ALGEBRAIC(:,93) = ((arbitrary_log(ALGEBRAIC(:,91), 10) - CONSTANTS(:,1))+ CONSTANTS(:,3).*(CONSTANTS(:,7) - 7.40000))./CONSTANTS(:,4);
    ALGEBRAIC(:,94) = power(10.0000, ALGEBRAIC(:,93));
    ALGEBRAIC(:,95) = ( 100.000.*ALGEBRAIC(:,94))./(1.00000+ALGEBRAIC(:,94));
    ALGEBRAIC(:,99) = piecewise({ALGEBRAIC(:,95)>96.0000, exp(  - 1.00000.*CONSTANTS(:,26).*(100.000 - 96.0000)) }, exp(  - 1.00000.*CONSTANTS(:,26).*(100.000 - ALGEBRAIC(:,95))));
    ALGEBRAIC(:,100) = ( (( (( (( CONSTANTS(:,25).*(1.00000 - ALGEBRAIC(:,99))+ CONSTANTS(:,27).*ALGEBRAIC(:,95)) - CONSTANTS(:,28)).*1.34000)./100.000).*CONSTANTS(:,13))./0.200000).*CONSTANTS(:,16))./CONSTANTS(:,18);
    ALGEBRAIC(:,101) = piecewise({ALGEBRAIC(:,95)>96.0000, ALGEBRAIC(:,100) - ( ALGEBRAIC(:,100).*(96.0000 - ALGEBRAIC(:,95)))./ - 4.00000 }, ( (( (( (( CONSTANTS(:,25).*(1.00000 - ALGEBRAIC(:,99))+ CONSTANTS(:,27).*ALGEBRAIC(:,95)) - CONSTANTS(:,28)).*1.34000)./100.000).*CONSTANTS(:,13))./0.200000).*CONSTANTS(:,16))./CONSTANTS(:,18));
    ALGEBRAIC(:,105) = 1.00000./( ALGEBRAIC(:,101).*CONSTANTS(:,20));
    ALGEBRAIC(:,96) = ((arbitrary_log(ALGEBRAIC(:,92), 10) - CONSTANTS(:,8))+ CONSTANTS(:,9).*(CONSTANTS(:,12) - 7.40000))./CONSTANTS(:,10);
    ALGEBRAIC(:,97) = power(10.0000, ALGEBRAIC(:,96));
    ALGEBRAIC(:,98) = ( 100.000.*ALGEBRAIC(:,97))./(1.00000+ALGEBRAIC(:,97));
    ALGEBRAIC(:,102) = piecewise({ALGEBRAIC(:,98)>96.0000, exp(  - 1.00000.*CONSTANTS(:,26).*(100.000 - 96.0000)) }, exp(  - 1.00000.*CONSTANTS(:,26).*(100.000 - ALGEBRAIC(:,98))));
    ALGEBRAIC(:,103) = ( (( (( (( CONSTANTS(:,25).*(1.00000 - ALGEBRAIC(:,102))+ CONSTANTS(:,27).*ALGEBRAIC(:,98)) - CONSTANTS(:,28)).*1.34000)./100.000).*CONSTANTS(:,14))./0.200000).*CONSTANTS(:,17))./CONSTANTS(:,18);
    ALGEBRAIC(:,104) = piecewise({ALGEBRAIC(:,98)>96.0000, ALGEBRAIC(:,103) - ( ALGEBRAIC(:,103).*(96.0000 - ALGEBRAIC(:,98)))./ - 4.00000 }, ( (( (( (( CONSTANTS(:,25).*(1.00000 - ALGEBRAIC(:,102))+ CONSTANTS(:,27).*ALGEBRAIC(:,98)) - CONSTANTS(:,28)).*1.34000)./100.000).*CONSTANTS(:,14))./0.200000).*CONSTANTS(:,17))./CONSTANTS(:,18));
    ALGEBRAIC(:,106) = 1.00000./( ALGEBRAIC(:,104).*CONSTANTS(:,21));
    ALGEBRAIC(:,107) = ALGEBRAIC(:,105)+ALGEBRAIC(:,106)+CONSTANTS(:,34);
    ALGEBRAIC(:,108) = (1.00000./ALGEBRAIC(:,107))./60.0000;
    ALGEBRAIC(:,109) = ( CONSTANTS(:,19).* - 1.00000.*ALGEBRAIC(:,108).*(ALGEBRAIC(:,91) - ALGEBRAIC(:,92)))./CONSTANTS(:,20);
    ALGEBRAIC(:,110) = ALGEBRAIC(:,7)+ (1.00000./6.00000).*(ALGEBRAIC(:,19)+ 2.00000.*ALGEBRAIC(:,49)+ 2.00000.*ALGEBRAIC(:,79)+ALGEBRAIC(:,109)).*CONSTANTS(:,31);
    ALGEBRAIC(:,112) = ((( 1.34000.*CONSTANTS(:,13))./100.000)./( CONSTANTS(:,6).*power(ALGEBRAIC(:,91),  - 1.00000./CONSTANTS(:,4))+1.00000)+ CONSTANTS(:,15).*ALGEBRAIC(:,91)) - ALGEBRAIC(:,110);
    ALGEBRAIC(:,114) =  1.34000.*CONSTANTS(:,13).*CONSTANTS(:,6).*power(ALGEBRAIC(:,91),  - 1.00000./CONSTANTS(:,4) - 1.00000);
    ALGEBRAIC(:,116) =  100.000.*CONSTANTS(:,4).*power( CONSTANTS(:,6).*power(ALGEBRAIC(:,91),  - 1.00000./CONSTANTS(:,4))+1.00000, 2.00000);
    ALGEBRAIC(:,118) = ALGEBRAIC(:,114)./ALGEBRAIC(:,116)+CONSTANTS(:,15);
    ALGEBRAIC(:,121) = ALGEBRAIC(:,91) - ALGEBRAIC(:,112)./ALGEBRAIC(:,118);
    ALGEBRAIC(:,111) =  (( ( - 1.00000./CONSTANTS(:,19)).*CONSTANTS(:,20))./CONSTANTS(:,21)).*ALGEBRAIC(:,109);
    ALGEBRAIC(:,113) = ALGEBRAIC(:,8)+ (1.00000./6.00000).*(ALGEBRAIC(:,20)+ 2.00000.*ALGEBRAIC(:,50)+ 2.00000.*ALGEBRAIC(:,80)+ALGEBRAIC(:,111)).*CONSTANTS(:,31);
    ALGEBRAIC(:,115) = ((( 1.34000.*CONSTANTS(:,14))./100.000)./( CONSTANTS(:,11).*power(ALGEBRAIC(:,92),  - 1.00000./CONSTANTS(:,10))+1.00000)+ CONSTANTS(:,15).*ALGEBRAIC(:,92)) - ALGEBRAIC(:,113);
    ALGEBRAIC(:,117) =  1.34000.*CONSTANTS(:,14).*CONSTANTS(:,11).*power(ALGEBRAIC(:,92),  - 1.00000./CONSTANTS(:,10) - 1.00000);
    ALGEBRAIC(:,119) =  100.000.*CONSTANTS(:,10).*power( CONSTANTS(:,11).*power(ALGEBRAIC(:,92),  - 1.00000./CONSTANTS(:,10))+1.00000, 2.00000);
    ALGEBRAIC(:,120) = ALGEBRAIC(:,117)./ALGEBRAIC(:,119)+CONSTANTS(:,15);
    ALGEBRAIC(:,122) = ALGEBRAIC(:,92) - ALGEBRAIC(:,115)./ALGEBRAIC(:,120);
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

% Compute a logarithm to any base" +
function x = arbitrary_log(a, base)
    x = log(a) ./ log(base);
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