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 =160;
end
% There are a total of 50 entries in each of the rate and state variable arrays.
% There are a total of 370 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_ALGEBRAIC(:,1) = strpad('sum_g_syn_e_s_1 in component synaptic_coupling (nanoS)');
    LEGEND_ALGEBRAIC(:,6) = strpad('sum_g_syn_e_s_2 in component synaptic_coupling (nanoS)');
    LEGEND_ALGEBRAIC(:,11) = strpad('sum_g_syn_e_s_3 in component synaptic_coupling (nanoS)');
    LEGEND_ALGEBRAIC(:,16) = strpad('sum_g_syn_e_s_4 in component synaptic_coupling (nanoS)');
    LEGEND_ALGEBRAIC(:,21) = strpad('sum_g_syn_e_s_5 in component synaptic_coupling (nanoS)');
    LEGEND_ALGEBRAIC(:,26) = strpad('sum_g_syn_e_s_6 in component synaptic_coupling (nanoS)');
    LEGEND_ALGEBRAIC(:,31) = strpad('sum_g_syn_e_s_7 in component synaptic_coupling (nanoS)');
    LEGEND_ALGEBRAIC(:,36) = strpad('sum_g_syn_e_s_8 in component synaptic_coupling (nanoS)');
    LEGEND_ALGEBRAIC(:,41) = strpad('sum_g_syn_e_s_9 in component synaptic_coupling (nanoS)');
    LEGEND_ALGEBRAIC(:,46) = strpad('sum_g_syn_e_s_10 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,1) = strpad('g_syn_e_1_2 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,2) = strpad('g_syn_e_1_3 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,3) = strpad('g_syn_e_1_4 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,4) = strpad('g_syn_e_1_5 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,5) = strpad('g_syn_e_1_6 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,6) = strpad('g_syn_e_1_7 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,7) = strpad('g_syn_e_1_8 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,8) = strpad('g_syn_e_1_9 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,9) = strpad('g_syn_e_1_10 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,10) = strpad('g_syn_e_2_1 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,11) = strpad('g_syn_e_2_3 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,12) = strpad('g_syn_e_2_4 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,13) = strpad('g_syn_e_2_5 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,14) = strpad('g_syn_e_2_6 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,15) = strpad('g_syn_e_2_7 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,16) = strpad('g_syn_e_2_8 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,17) = strpad('g_syn_e_2_9 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,18) = strpad('g_syn_e_2_10 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,19) = strpad('g_syn_e_3_1 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,20) = strpad('g_syn_e_3_2 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,21) = strpad('g_syn_e_3_4 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,22) = strpad('g_syn_e_3_5 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,23) = strpad('g_syn_e_3_6 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,24) = strpad('g_syn_e_3_7 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,25) = strpad('g_syn_e_3_8 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,26) = strpad('g_syn_e_3_9 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,27) = strpad('g_syn_e_3_10 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,28) = strpad('g_syn_e_4_1 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,29) = strpad('g_syn_e_4_2 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,30) = strpad('g_syn_e_4_3 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,31) = strpad('g_syn_e_4_5 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,32) = strpad('g_syn_e_4_6 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,33) = strpad('g_syn_e_4_7 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,34) = strpad('g_syn_e_4_8 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,35) = strpad('g_syn_e_4_9 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,36) = strpad('g_syn_e_4_10 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,37) = strpad('g_syn_e_5_1 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,38) = strpad('g_syn_e_5_2 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,39) = strpad('g_syn_e_5_3 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,40) = strpad('g_syn_e_5_4 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,41) = strpad('g_syn_e_5_6 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,42) = strpad('g_syn_e_5_7 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,43) = strpad('g_syn_e_5_8 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,44) = strpad('g_syn_e_5_9 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,45) = strpad('g_syn_e_5_10 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,46) = strpad('g_syn_e_6_1 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,47) = strpad('g_syn_e_6_2 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,48) = strpad('g_syn_e_6_3 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,49) = strpad('g_syn_e_6_4 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,50) = strpad('g_syn_e_6_5 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,51) = strpad('g_syn_e_6_7 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,52) = strpad('g_syn_e_6_8 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,53) = strpad('g_syn_e_6_9 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,54) = strpad('g_syn_e_6_10 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,55) = strpad('g_syn_e_7_1 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,56) = strpad('g_syn_e_7_2 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,57) = strpad('g_syn_e_7_3 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,58) = strpad('g_syn_e_7_4 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,59) = strpad('g_syn_e_7_5 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,60) = strpad('g_syn_e_7_6 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,61) = strpad('g_syn_e_7_8 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,62) = strpad('g_syn_e_7_9 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,63) = strpad('g_syn_e_7_10 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,64) = strpad('g_syn_e_8_1 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,65) = strpad('g_syn_e_8_2 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,66) = strpad('g_syn_e_8_3 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,67) = strpad('g_syn_e_8_4 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,68) = strpad('g_syn_e_8_5 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,69) = strpad('g_syn_e_8_6 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,70) = strpad('g_syn_e_8_7 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,71) = strpad('g_syn_e_8_9 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,72) = strpad('g_syn_e_8_10 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,73) = strpad('g_syn_e_9_1 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,74) = strpad('g_syn_e_9_2 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,75) = strpad('g_syn_e_9_3 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,76) = strpad('g_syn_e_9_4 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,77) = strpad('g_syn_e_9_5 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,78) = strpad('g_syn_e_9_6 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,79) = strpad('g_syn_e_9_7 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,80) = strpad('g_syn_e_9_8 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,81) = strpad('g_syn_e_9_10 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,82) = strpad('g_syn_e_10_1 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,83) = strpad('g_syn_e_10_2 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,84) = strpad('g_syn_e_10_3 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,85) = strpad('g_syn_e_10_4 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,86) = strpad('g_syn_e_10_5 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,87) = strpad('g_syn_e_10_6 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,88) = strpad('g_syn_e_10_7 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,89) = strpad('g_syn_e_10_8 in component synaptic_coupling (nanoS)');
    LEGEND_CONSTANTS(:,90) = strpad('g_syn_e_10_9 in component synaptic_coupling (nanoS)');
    LEGEND_STATES(:,1) = strpad('s in component synaptic_input (dimensionless)');
    LEGEND_STATES(:,2) = strpad('s in component synaptic_input (dimensionless)');
    LEGEND_STATES(:,3) = strpad('s in component synaptic_input (dimensionless)');
    LEGEND_STATES(:,4) = strpad('s in component synaptic_input (dimensionless)');
    LEGEND_STATES(:,5) = strpad('s in component synaptic_input (dimensionless)');
    LEGEND_STATES(:,6) = strpad('s in component synaptic_input (dimensionless)');
    LEGEND_STATES(:,7) = strpad('s in component synaptic_input (dimensionless)');
    LEGEND_STATES(:,8) = strpad('s in component synaptic_input (dimensionless)');
    LEGEND_STATES(:,9) = strpad('s in component synaptic_input (dimensionless)');
    LEGEND_STATES(:,10) = strpad('s in component synaptic_input (dimensionless)');
    LEGEND_VOI = strpad('time in component environment (millisecond)');
    LEGEND_STATES(:,11) = strpad('V in component membrane (millivolt)');
    LEGEND_CONSTANTS(:,91) = strpad('C in component membrane (picoF)');
    LEGEND_CONSTANTS(:,92) = strpad('i_app in component membrane (picoA)');
    LEGEND_ALGEBRAIC(:,121) = strpad('i_NaP in component persistent_sodium_current (picoA)');
    LEGEND_ALGEBRAIC(:,91) = strpad('i_Na in component fast_sodium_current (picoA)');
    LEGEND_ALGEBRAIC(:,101) = strpad('i_K in component potassium_current (picoA)');
    LEGEND_ALGEBRAIC(:,131) = strpad('i_L in component leakage_current (picoA)');
    LEGEND_ALGEBRAIC(:,141) = strpad('i_tonic_e in component tonic_current (picoA)');
    LEGEND_ALGEBRAIC(:,151) = strpad('i_syn_e in component synaptic_input (picoA)');
    LEGEND_CONSTANTS(:,93) = strpad('E_Na in component fast_sodium_current (millivolt)');
    LEGEND_CONSTANTS(:,94) = strpad('g_Na in component fast_sodium_current (nanoS)');
    LEGEND_ALGEBRAIC(:,51) = strpad('m_infinity in component fast_sodium_current_m_gate (dimensionless)');
    LEGEND_STATES(:,12) = strpad('n in component fast_sodium_current_n_gate (dimensionless)');
    LEGEND_CONSTANTS(:,95) = strpad('theta_m in component fast_sodium_current_m_gate (millivolt)');
    LEGEND_CONSTANTS(:,96) = strpad('sigma_m in component fast_sodium_current_m_gate (millivolt)');
    LEGEND_ALGEBRAIC(:,2) = strpad('n_infinity in component fast_sodium_current_n_gate (dimensionless)');
    LEGEND_ALGEBRAIC(:,52) = strpad('tau_n in component fast_sodium_current_n_gate (millisecond)');
    LEGEND_CONSTANTS(:,97) = strpad('tau_n_max in component fast_sodium_current_n_gate (millisecond)');
    LEGEND_CONSTANTS(:,98) = strpad('theta_n in component fast_sodium_current_n_gate (millivolt)');
    LEGEND_CONSTANTS(:,99) = strpad('sigma_n in component fast_sodium_current_n_gate (millivolt)');
    LEGEND_CONSTANTS(:,100) = strpad('g_K in component potassium_current (nanoS)');
    LEGEND_CONSTANTS(:,101) = strpad('E_K in component potassium_current (millivolt)');
    LEGEND_STATES(:,13) = strpad('n in component potassium_current_n_gate (dimensionless)');
    LEGEND_ALGEBRAIC(:,3) = strpad('n_infinity in component potassium_current_n_gate (dimensionless)');
    LEGEND_ALGEBRAIC(:,53) = strpad('tau_n in component potassium_current_n_gate (millisecond)');
    LEGEND_CONSTANTS(:,102) = strpad('tau_n_max in component potassium_current_n_gate (millisecond)');
    LEGEND_CONSTANTS(:,103) = strpad('theta_n in component potassium_current_n_gate (millivolt)');
    LEGEND_CONSTANTS(:,104) = strpad('sigma_n in component potassium_current_n_gate (millivolt)');
    LEGEND_CONSTANTS(:,105) = strpad('g_NaP in component persistent_sodium_current (nanoS)');
    LEGEND_ALGEBRAIC(:,111) = strpad('m_infinity in component persistent_sodium_current_m_gate (dimensionless)');
    LEGEND_STATES(:,14) = strpad('h in component persistent_sodium_current_h_gate (dimensionless)');
    LEGEND_CONSTANTS(:,106) = strpad('theta_m in component persistent_sodium_current_m_gate (millivolt)');
    LEGEND_CONSTANTS(:,107) = strpad('sigma_m in component persistent_sodium_current_m_gate (millivolt)');
    LEGEND_ALGEBRAIC(:,4) = strpad('h_infinity in component persistent_sodium_current_h_gate (dimensionless)');
    LEGEND_ALGEBRAIC(:,54) = strpad('tau_h in component persistent_sodium_current_h_gate (millisecond)');
    LEGEND_CONSTANTS(:,108) = strpad('tau_h_max in component persistent_sodium_current_h_gate (millisecond)');
    LEGEND_CONSTANTS(:,109) = strpad('theta_h in component persistent_sodium_current_h_gate (millivolt)');
    LEGEND_CONSTANTS(:,110) = strpad('sigma_h in component persistent_sodium_current_h_gate (millivolt)');
    LEGEND_CONSTANTS(:,111) = strpad('g_L in component leakage_current (nanoS)');
    LEGEND_CONSTANTS(:,112) = strpad('E_L in component leakage_current (millivolt)');
    LEGEND_CONSTANTS(:,113) = strpad('E_syn_e in component tonic_current (millivolt)');
    LEGEND_CONSTANTS(:,114) = strpad('g_tonic_e in component tonic_current (nanoS)');
    LEGEND_ALGEBRAIC(:,5) = strpad('s_infinity in component synaptic_input (dimensionless)');
    LEGEND_CONSTANTS(:,115) = strpad('kr in component synaptic_input (dimensionless)');
    LEGEND_CONSTANTS(:,116) = strpad('tau_s in component synaptic_input (millisecond)');
    LEGEND_CONSTANTS(:,117) = strpad('sigma_s in component synaptic_input (millivolt)');
    LEGEND_CONSTANTS(:,118) = strpad('theta_s in component synaptic_input (millivolt)');
    LEGEND_VOI = strpad('time in component environment (millisecond)');
    LEGEND_STATES(:,15) = strpad('V in component membrane (millivolt)');
    LEGEND_CONSTANTS(:,119) = strpad('C in component membrane (picoF)');
    LEGEND_CONSTANTS(:,120) = strpad('i_app in component membrane (picoA)');
    LEGEND_ALGEBRAIC(:,122) = strpad('i_NaP in component persistent_sodium_current (picoA)');
    LEGEND_ALGEBRAIC(:,92) = strpad('i_Na in component fast_sodium_current (picoA)');
    LEGEND_ALGEBRAIC(:,102) = strpad('i_K in component potassium_current (picoA)');
    LEGEND_ALGEBRAIC(:,132) = strpad('i_L in component leakage_current (picoA)');
    LEGEND_ALGEBRAIC(:,142) = strpad('i_tonic_e in component tonic_current (picoA)');
    LEGEND_ALGEBRAIC(:,152) = strpad('i_syn_e in component synaptic_input (picoA)');
    LEGEND_CONSTANTS(:,121) = strpad('E_Na in component fast_sodium_current (millivolt)');
    LEGEND_CONSTANTS(:,122) = strpad('g_Na in component fast_sodium_current (nanoS)');
    LEGEND_ALGEBRAIC(:,55) = strpad('m_infinity in component fast_sodium_current_m_gate (dimensionless)');
    LEGEND_STATES(:,16) = strpad('n in component fast_sodium_current_n_gate (dimensionless)');
    LEGEND_CONSTANTS(:,123) = strpad('theta_m in component fast_sodium_current_m_gate (millivolt)');
    LEGEND_CONSTANTS(:,124) = strpad('sigma_m in component fast_sodium_current_m_gate (millivolt)');
    LEGEND_ALGEBRAIC(:,7) = strpad('n_infinity in component fast_sodium_current_n_gate (dimensionless)');
    LEGEND_ALGEBRAIC(:,56) = strpad('tau_n in component fast_sodium_current_n_gate (millisecond)');
    LEGEND_CONSTANTS(:,125) = strpad('tau_n_max in component fast_sodium_current_n_gate (millisecond)');
    LEGEND_CONSTANTS(:,126) = strpad('theta_n in component fast_sodium_current_n_gate (millivolt)');
    LEGEND_CONSTANTS(:,127) = strpad('sigma_n in component fast_sodium_current_n_gate (millivolt)');
    LEGEND_CONSTANTS(:,128) = strpad('g_K in component potassium_current (nanoS)');
    LEGEND_CONSTANTS(:,129) = strpad('E_K in component potassium_current (millivolt)');
    LEGEND_STATES(:,17) = strpad('n in component potassium_current_n_gate (dimensionless)');
    LEGEND_ALGEBRAIC(:,8) = strpad('n_infinity in component potassium_current_n_gate (dimensionless)');
    LEGEND_ALGEBRAIC(:,57) = strpad('tau_n in component potassium_current_n_gate (millisecond)');
    LEGEND_CONSTANTS(:,130) = strpad('tau_n_max in component potassium_current_n_gate (millisecond)');
    LEGEND_CONSTANTS(:,131) = strpad('theta_n in component potassium_current_n_gate (millivolt)');
    LEGEND_CONSTANTS(:,132) = strpad('sigma_n in component potassium_current_n_gate (millivolt)');
    LEGEND_CONSTANTS(:,133) = strpad('g_NaP in component persistent_sodium_current (nanoS)');
    LEGEND_ALGEBRAIC(:,112) = strpad('m_infinity in component persistent_sodium_current_m_gate (dimensionless)');
    LEGEND_STATES(:,18) = strpad('h in component persistent_sodium_current_h_gate (dimensionless)');
    LEGEND_CONSTANTS(:,134) = strpad('theta_m in component persistent_sodium_current_m_gate (millivolt)');
    LEGEND_CONSTANTS(:,135) = strpad('sigma_m in component persistent_sodium_current_m_gate (millivolt)');
    LEGEND_ALGEBRAIC(:,9) = strpad('h_infinity in component persistent_sodium_current_h_gate (dimensionless)');
    LEGEND_ALGEBRAIC(:,58) = strpad('tau_h in component persistent_sodium_current_h_gate (millisecond)');
    LEGEND_CONSTANTS(:,136) = strpad('tau_h_max in component persistent_sodium_current_h_gate (millisecond)');
    LEGEND_CONSTANTS(:,137) = strpad('theta_h in component persistent_sodium_current_h_gate (millivolt)');
    LEGEND_CONSTANTS(:,138) = strpad('sigma_h in component persistent_sodium_current_h_gate (millivolt)');
    LEGEND_CONSTANTS(:,139) = strpad('g_L in component leakage_current (nanoS)');
    LEGEND_CONSTANTS(:,140) = strpad('E_L in component leakage_current (millivolt)');
    LEGEND_CONSTANTS(:,141) = strpad('E_syn_e in component tonic_current (millivolt)');
    LEGEND_CONSTANTS(:,142) = strpad('g_tonic_e in component tonic_current (nanoS)');
    LEGEND_ALGEBRAIC(:,10) = strpad('s_infinity in component synaptic_input (dimensionless)');
    LEGEND_CONSTANTS(:,143) = strpad('kr in component synaptic_input (dimensionless)');
    LEGEND_CONSTANTS(:,144) = strpad('tau_s in component synaptic_input (millisecond)');
    LEGEND_CONSTANTS(:,145) = strpad('sigma_s in component synaptic_input (millivolt)');
    LEGEND_CONSTANTS(:,146) = strpad('theta_s in component synaptic_input (millivolt)');
    LEGEND_VOI = strpad('time in component environment (millisecond)');
    LEGEND_STATES(:,19) = strpad('V in component membrane (millivolt)');
    LEGEND_CONSTANTS(:,147) = strpad('C in component membrane (picoF)');
    LEGEND_CONSTANTS(:,148) = strpad('i_app in component membrane (picoA)');
    LEGEND_ALGEBRAIC(:,123) = strpad('i_NaP in component persistent_sodium_current (picoA)');
    LEGEND_ALGEBRAIC(:,93) = strpad('i_Na in component fast_sodium_current (picoA)');
    LEGEND_ALGEBRAIC(:,103) = strpad('i_K in component potassium_current (picoA)');
    LEGEND_ALGEBRAIC(:,133) = strpad('i_L in component leakage_current (picoA)');
    LEGEND_ALGEBRAIC(:,143) = strpad('i_tonic_e in component tonic_current (picoA)');
    LEGEND_ALGEBRAIC(:,153) = strpad('i_syn_e in component synaptic_input (picoA)');
    LEGEND_CONSTANTS(:,149) = strpad('E_Na in component fast_sodium_current (millivolt)');
    LEGEND_CONSTANTS(:,150) = strpad('g_Na in component fast_sodium_current (nanoS)');
    LEGEND_ALGEBRAIC(:,59) = strpad('m_infinity in component fast_sodium_current_m_gate (dimensionless)');
    LEGEND_STATES(:,20) = strpad('n in component fast_sodium_current_n_gate (dimensionless)');
    LEGEND_CONSTANTS(:,151) = strpad('theta_m in component fast_sodium_current_m_gate (millivolt)');
    LEGEND_CONSTANTS(:,152) = strpad('sigma_m in component fast_sodium_current_m_gate (millivolt)');
    LEGEND_ALGEBRAIC(:,12) = strpad('n_infinity in component fast_sodium_current_n_gate (dimensionless)');
    LEGEND_ALGEBRAIC(:,60) = strpad('tau_n in component fast_sodium_current_n_gate (millisecond)');
    LEGEND_CONSTANTS(:,153) = strpad('tau_n_max in component fast_sodium_current_n_gate (millisecond)');
    LEGEND_CONSTANTS(:,154) = strpad('theta_n in component fast_sodium_current_n_gate (millivolt)');
    LEGEND_CONSTANTS(:,155) = strpad('sigma_n in component fast_sodium_current_n_gate (millivolt)');
    LEGEND_CONSTANTS(:,156) = strpad('g_K in component potassium_current (nanoS)');
    LEGEND_CONSTANTS(:,157) = strpad('E_K in component potassium_current (millivolt)');
    LEGEND_STATES(:,21) = strpad('n in component potassium_current_n_gate (dimensionless)');
    LEGEND_ALGEBRAIC(:,13) = strpad('n_infinity in component potassium_current_n_gate (dimensionless)');
    LEGEND_ALGEBRAIC(:,61) = strpad('tau_n in component potassium_current_n_gate (millisecond)');
    LEGEND_CONSTANTS(:,158) = strpad('tau_n_max in component potassium_current_n_gate (millisecond)');
    LEGEND_CONSTANTS(:,159) = strpad('theta_n in component potassium_current_n_gate (millivolt)');
    LEGEND_CONSTANTS(:,160) = strpad('sigma_n in component potassium_current_n_gate (millivolt)');
    LEGEND_CONSTANTS(:,161) = strpad('g_NaP in component persistent_sodium_current (nanoS)');
    LEGEND_ALGEBRAIC(:,113) = strpad('m_infinity in component persistent_sodium_current_m_gate (dimensionless)');
    LEGEND_STATES(:,22) = strpad('h in component persistent_sodium_current_h_gate (dimensionless)');
    LEGEND_CONSTANTS(:,162) = strpad('theta_m in component persistent_sodium_current_m_gate (millivolt)');
    LEGEND_CONSTANTS(:,163) = strpad('sigma_m in component persistent_sodium_current_m_gate (millivolt)');
    LEGEND_ALGEBRAIC(:,14) = strpad('h_infinity in component persistent_sodium_current_h_gate (dimensionless)');
    LEGEND_ALGEBRAIC(:,62) = strpad('tau_h in component persistent_sodium_current_h_gate (millisecond)');
    LEGEND_CONSTANTS(:,164) = strpad('tau_h_max in component persistent_sodium_current_h_gate (millisecond)');
    LEGEND_CONSTANTS(:,165) = strpad('theta_h in component persistent_sodium_current_h_gate (millivolt)');
    LEGEND_CONSTANTS(:,166) = strpad('sigma_h in component persistent_sodium_current_h_gate (millivolt)');
    LEGEND_CONSTANTS(:,167) = strpad('g_L in component leakage_current (nanoS)');
    LEGEND_CONSTANTS(:,168) = strpad('E_L in component leakage_current (millivolt)');
    LEGEND_CONSTANTS(:,169) = strpad('E_syn_e in component tonic_current (millivolt)');
    LEGEND_CONSTANTS(:,170) = strpad('g_tonic_e in component tonic_current (nanoS)');
    LEGEND_ALGEBRAIC(:,15) = strpad('s_infinity in component synaptic_input (dimensionless)');
    LEGEND_CONSTANTS(:,171) = strpad('kr in component synaptic_input (dimensionless)');
    LEGEND_CONSTANTS(:,172) = strpad('tau_s in component synaptic_input (millisecond)');
    LEGEND_CONSTANTS(:,173) = strpad('sigma_s in component synaptic_input (millivolt)');
    LEGEND_CONSTANTS(:,174) = strpad('theta_s in component synaptic_input (millivolt)');
    LEGEND_VOI = strpad('time in component environment (millisecond)');
    LEGEND_STATES(:,23) = strpad('V in component membrane (millivolt)');
    LEGEND_CONSTANTS(:,175) = strpad('C in component membrane (picoF)');
    LEGEND_CONSTANTS(:,176) = strpad('i_app in component membrane (picoA)');
    LEGEND_ALGEBRAIC(:,124) = strpad('i_NaP in component persistent_sodium_current (picoA)');
    LEGEND_ALGEBRAIC(:,94) = strpad('i_Na in component fast_sodium_current (picoA)');
    LEGEND_ALGEBRAIC(:,104) = strpad('i_K in component potassium_current (picoA)');
    LEGEND_ALGEBRAIC(:,134) = strpad('i_L in component leakage_current (picoA)');
    LEGEND_ALGEBRAIC(:,144) = strpad('i_tonic_e in component tonic_current (picoA)');
    LEGEND_ALGEBRAIC(:,154) = strpad('i_syn_e in component synaptic_input (picoA)');
    LEGEND_CONSTANTS(:,177) = strpad('E_Na in component fast_sodium_current (millivolt)');
    LEGEND_CONSTANTS(:,178) = strpad('g_Na in component fast_sodium_current (nanoS)');
    LEGEND_ALGEBRAIC(:,63) = strpad('m_infinity in component fast_sodium_current_m_gate (dimensionless)');
    LEGEND_STATES(:,24) = strpad('n in component fast_sodium_current_n_gate (dimensionless)');
    LEGEND_CONSTANTS(:,179) = strpad('theta_m in component fast_sodium_current_m_gate (millivolt)');
    LEGEND_CONSTANTS(:,180) = strpad('sigma_m in component fast_sodium_current_m_gate (millivolt)');
    LEGEND_ALGEBRAIC(:,17) = strpad('n_infinity in component fast_sodium_current_n_gate (dimensionless)');
    LEGEND_ALGEBRAIC(:,64) = strpad('tau_n in component fast_sodium_current_n_gate (millisecond)');
    LEGEND_CONSTANTS(:,181) = strpad('tau_n_max in component fast_sodium_current_n_gate (millisecond)');
    LEGEND_CONSTANTS(:,182) = strpad('theta_n in component fast_sodium_current_n_gate (millivolt)');
    LEGEND_CONSTANTS(:,183) = strpad('sigma_n in component fast_sodium_current_n_gate (millivolt)');
    LEGEND_CONSTANTS(:,184) = strpad('g_K in component potassium_current (nanoS)');
    LEGEND_CONSTANTS(:,185) = strpad('E_K in component potassium_current (millivolt)');
    LEGEND_STATES(:,25) = strpad('n in component potassium_current_n_gate (dimensionless)');
    LEGEND_ALGEBRAIC(:,18) = strpad('n_infinity in component potassium_current_n_gate (dimensionless)');
    LEGEND_ALGEBRAIC(:,65) = strpad('tau_n in component potassium_current_n_gate (millisecond)');
    LEGEND_CONSTANTS(:,186) = strpad('tau_n_max in component potassium_current_n_gate (millisecond)');
    LEGEND_CONSTANTS(:,187) = strpad('theta_n in component potassium_current_n_gate (millivolt)');
    LEGEND_CONSTANTS(:,188) = strpad('sigma_n in component potassium_current_n_gate (millivolt)');
    LEGEND_CONSTANTS(:,189) = strpad('g_NaP in component persistent_sodium_current (nanoS)');
    LEGEND_ALGEBRAIC(:,114) = strpad('m_infinity in component persistent_sodium_current_m_gate (dimensionless)');
    LEGEND_STATES(:,26) = strpad('h in component persistent_sodium_current_h_gate (dimensionless)');
    LEGEND_CONSTANTS(:,190) = strpad('theta_m in component persistent_sodium_current_m_gate (millivolt)');
    LEGEND_CONSTANTS(:,191) = strpad('sigma_m in component persistent_sodium_current_m_gate (millivolt)');
    LEGEND_ALGEBRAIC(:,19) = strpad('h_infinity in component persistent_sodium_current_h_gate (dimensionless)');
    LEGEND_ALGEBRAIC(:,66) = strpad('tau_h in component persistent_sodium_current_h_gate (millisecond)');
    LEGEND_CONSTANTS(:,192) = strpad('tau_h_max in component persistent_sodium_current_h_gate (millisecond)');
    LEGEND_CONSTANTS(:,193) = strpad('theta_h in component persistent_sodium_current_h_gate (millivolt)');
    LEGEND_CONSTANTS(:,194) = strpad('sigma_h in component persistent_sodium_current_h_gate (millivolt)');
    LEGEND_CONSTANTS(:,195) = strpad('g_L in component leakage_current (nanoS)');
    LEGEND_CONSTANTS(:,196) = strpad('E_L in component leakage_current (millivolt)');
    LEGEND_CONSTANTS(:,197) = strpad('E_syn_e in component tonic_current (millivolt)');
    LEGEND_CONSTANTS(:,198) = strpad('g_tonic_e in component tonic_current (nanoS)');
    LEGEND_ALGEBRAIC(:,20) = strpad('s_infinity in component synaptic_input (dimensionless)');
    LEGEND_CONSTANTS(:,199) = strpad('kr in component synaptic_input (dimensionless)');
    LEGEND_CONSTANTS(:,200) = strpad('tau_s in component synaptic_input (millisecond)');
    LEGEND_CONSTANTS(:,201) = strpad('sigma_s in component synaptic_input (millivolt)');
    LEGEND_CONSTANTS(:,202) = strpad('theta_s in component synaptic_input (millivolt)');
    LEGEND_VOI = strpad('time in component environment (millisecond)');
    LEGEND_STATES(:,27) = strpad('V in component membrane (millivolt)');
    LEGEND_CONSTANTS(:,203) = strpad('C in component membrane (picoF)');
    LEGEND_CONSTANTS(:,204) = strpad('i_app in component membrane (picoA)');
    LEGEND_ALGEBRAIC(:,125) = strpad('i_NaP in component persistent_sodium_current (picoA)');
    LEGEND_ALGEBRAIC(:,95) = strpad('i_Na in component fast_sodium_current (picoA)');
    LEGEND_ALGEBRAIC(:,105) = strpad('i_K in component potassium_current (picoA)');
    LEGEND_ALGEBRAIC(:,135) = strpad('i_L in component leakage_current (picoA)');
    LEGEND_ALGEBRAIC(:,145) = strpad('i_tonic_e in component tonic_current (picoA)');
    LEGEND_ALGEBRAIC(:,155) = strpad('i_syn_e in component synaptic_input (picoA)');
    LEGEND_CONSTANTS(:,205) = strpad('E_Na in component fast_sodium_current (millivolt)');
    LEGEND_CONSTANTS(:,206) = strpad('g_Na in component fast_sodium_current (nanoS)');
    LEGEND_ALGEBRAIC(:,67) = strpad('m_infinity in component fast_sodium_current_m_gate (dimensionless)');
    LEGEND_STATES(:,28) = strpad('n in component fast_sodium_current_n_gate (dimensionless)');
    LEGEND_CONSTANTS(:,207) = strpad('theta_m in component fast_sodium_current_m_gate (millivolt)');
    LEGEND_CONSTANTS(:,208) = strpad('sigma_m in component fast_sodium_current_m_gate (millivolt)');
    LEGEND_ALGEBRAIC(:,22) = strpad('n_infinity in component fast_sodium_current_n_gate (dimensionless)');
    LEGEND_ALGEBRAIC(:,68) = strpad('tau_n in component fast_sodium_current_n_gate (millisecond)');
    LEGEND_CONSTANTS(:,209) = strpad('tau_n_max in component fast_sodium_current_n_gate (millisecond)');
    LEGEND_CONSTANTS(:,210) = strpad('theta_n in component fast_sodium_current_n_gate (millivolt)');
    LEGEND_CONSTANTS(:,211) = strpad('sigma_n in component fast_sodium_current_n_gate (millivolt)');
    LEGEND_CONSTANTS(:,212) = strpad('g_K in component potassium_current (nanoS)');
    LEGEND_CONSTANTS(:,213) = strpad('E_K in component potassium_current (millivolt)');
    LEGEND_STATES(:,29) = strpad('n in component potassium_current_n_gate (dimensionless)');
    LEGEND_ALGEBRAIC(:,23) = strpad('n_infinity in component potassium_current_n_gate (dimensionless)');
    LEGEND_ALGEBRAIC(:,69) = strpad('tau_n in component potassium_current_n_gate (millisecond)');
    LEGEND_CONSTANTS(:,214) = strpad('tau_n_max in component potassium_current_n_gate (millisecond)');
    LEGEND_CONSTANTS(:,215) = strpad('theta_n in component potassium_current_n_gate (millivolt)');
    LEGEND_CONSTANTS(:,216) = strpad('sigma_n in component potassium_current_n_gate (millivolt)');
    LEGEND_CONSTANTS(:,217) = strpad('g_NaP in component persistent_sodium_current (nanoS)');
    LEGEND_ALGEBRAIC(:,115) = strpad('m_infinity in component persistent_sodium_current_m_gate (dimensionless)');
    LEGEND_STATES(:,30) = strpad('h in component persistent_sodium_current_h_gate (dimensionless)');
    LEGEND_CONSTANTS(:,218) = strpad('theta_m in component persistent_sodium_current_m_gate (millivolt)');
    LEGEND_CONSTANTS(:,219) = strpad('sigma_m in component persistent_sodium_current_m_gate (millivolt)');
    LEGEND_ALGEBRAIC(:,24) = strpad('h_infinity in component persistent_sodium_current_h_gate (dimensionless)');
    LEGEND_ALGEBRAIC(:,70) = strpad('tau_h in component persistent_sodium_current_h_gate (millisecond)');
    LEGEND_CONSTANTS(:,220) = strpad('tau_h_max in component persistent_sodium_current_h_gate (millisecond)');
    LEGEND_CONSTANTS(:,221) = strpad('theta_h in component persistent_sodium_current_h_gate (millivolt)');
    LEGEND_CONSTANTS(:,222) = strpad('sigma_h in component persistent_sodium_current_h_gate (millivolt)');
    LEGEND_CONSTANTS(:,223) = strpad('g_L in component leakage_current (nanoS)');
    LEGEND_CONSTANTS(:,224) = strpad('E_L in component leakage_current (millivolt)');
    LEGEND_CONSTANTS(:,225) = strpad('E_syn_e in component tonic_current (millivolt)');
    LEGEND_CONSTANTS(:,226) = strpad('g_tonic_e in component tonic_current (nanoS)');
    LEGEND_ALGEBRAIC(:,25) = strpad('s_infinity in component synaptic_input (dimensionless)');
    LEGEND_CONSTANTS(:,227) = strpad('kr in component synaptic_input (dimensionless)');
    LEGEND_CONSTANTS(:,228) = strpad('tau_s in component synaptic_input (millisecond)');
    LEGEND_CONSTANTS(:,229) = strpad('sigma_s in component synaptic_input (millivolt)');
    LEGEND_CONSTANTS(:,230) = strpad('theta_s in component synaptic_input (millivolt)');
    LEGEND_VOI = strpad('time in component environment (millisecond)');
    LEGEND_STATES(:,31) = strpad('V in component membrane (millivolt)');
    LEGEND_CONSTANTS(:,231) = strpad('C in component membrane (picoF)');
    LEGEND_CONSTANTS(:,232) = strpad('i_app in component membrane (picoA)');
    LEGEND_ALGEBRAIC(:,126) = strpad('i_NaP in component persistent_sodium_current (picoA)');
    LEGEND_ALGEBRAIC(:,96) = strpad('i_Na in component fast_sodium_current (picoA)');
    LEGEND_ALGEBRAIC(:,106) = strpad('i_K in component potassium_current (picoA)');
    LEGEND_ALGEBRAIC(:,136) = strpad('i_L in component leakage_current (picoA)');
    LEGEND_ALGEBRAIC(:,146) = strpad('i_tonic_e in component tonic_current (picoA)');
    LEGEND_ALGEBRAIC(:,156) = strpad('i_syn_e in component synaptic_input (picoA)');
    LEGEND_CONSTANTS(:,233) = strpad('E_Na in component fast_sodium_current (millivolt)');
    LEGEND_CONSTANTS(:,234) = strpad('g_Na in component fast_sodium_current (nanoS)');
    LEGEND_ALGEBRAIC(:,71) = strpad('m_infinity in component fast_sodium_current_m_gate (dimensionless)');
    LEGEND_STATES(:,32) = strpad('n in component fast_sodium_current_n_gate (dimensionless)');
    LEGEND_CONSTANTS(:,235) = strpad('theta_m in component fast_sodium_current_m_gate (millivolt)');
    LEGEND_CONSTANTS(:,236) = strpad('sigma_m in component fast_sodium_current_m_gate (millivolt)');
    LEGEND_ALGEBRAIC(:,27) = strpad('n_infinity in component fast_sodium_current_n_gate (dimensionless)');
    LEGEND_ALGEBRAIC(:,72) = strpad('tau_n in component fast_sodium_current_n_gate (millisecond)');
    LEGEND_CONSTANTS(:,237) = strpad('tau_n_max in component fast_sodium_current_n_gate (millisecond)');
    LEGEND_CONSTANTS(:,238) = strpad('theta_n in component fast_sodium_current_n_gate (millivolt)');
    LEGEND_CONSTANTS(:,239) = strpad('sigma_n in component fast_sodium_current_n_gate (millivolt)');
    LEGEND_CONSTANTS(:,240) = strpad('g_K in component potassium_current (nanoS)');
    LEGEND_CONSTANTS(:,241) = strpad('E_K in component potassium_current (millivolt)');
    LEGEND_STATES(:,33) = strpad('n in component potassium_current_n_gate (dimensionless)');
    LEGEND_ALGEBRAIC(:,28) = strpad('n_infinity in component potassium_current_n_gate (dimensionless)');
    LEGEND_ALGEBRAIC(:,73) = strpad('tau_n in component potassium_current_n_gate (millisecond)');
    LEGEND_CONSTANTS(:,242) = strpad('tau_n_max in component potassium_current_n_gate (millisecond)');
    LEGEND_CONSTANTS(:,243) = strpad('theta_n in component potassium_current_n_gate (millivolt)');
    LEGEND_CONSTANTS(:,244) = strpad('sigma_n in component potassium_current_n_gate (millivolt)');
    LEGEND_CONSTANTS(:,245) = strpad('g_NaP in component persistent_sodium_current (nanoS)');
    LEGEND_ALGEBRAIC(:,116) = strpad('m_infinity in component persistent_sodium_current_m_gate (dimensionless)');
    LEGEND_STATES(:,34) = strpad('h in component persistent_sodium_current_h_gate (dimensionless)');
    LEGEND_CONSTANTS(:,246) = strpad('theta_m in component persistent_sodium_current_m_gate (millivolt)');
    LEGEND_CONSTANTS(:,247) = strpad('sigma_m in component persistent_sodium_current_m_gate (millivolt)');
    LEGEND_ALGEBRAIC(:,29) = strpad('h_infinity in component persistent_sodium_current_h_gate (dimensionless)');
    LEGEND_ALGEBRAIC(:,74) = strpad('tau_h in component persistent_sodium_current_h_gate (millisecond)');
    LEGEND_CONSTANTS(:,248) = strpad('tau_h_max in component persistent_sodium_current_h_gate (millisecond)');
    LEGEND_CONSTANTS(:,249) = strpad('theta_h in component persistent_sodium_current_h_gate (millivolt)');
    LEGEND_CONSTANTS(:,250) = strpad('sigma_h in component persistent_sodium_current_h_gate (millivolt)');
    LEGEND_CONSTANTS(:,251) = strpad('g_L in component leakage_current (nanoS)');
    LEGEND_CONSTANTS(:,252) = strpad('E_L in component leakage_current (millivolt)');
    LEGEND_CONSTANTS(:,253) = strpad('E_syn_e in component tonic_current (millivolt)');
    LEGEND_CONSTANTS(:,254) = strpad('g_tonic_e in component tonic_current (nanoS)');
    LEGEND_ALGEBRAIC(:,30) = strpad('s_infinity in component synaptic_input (dimensionless)');
    LEGEND_CONSTANTS(:,255) = strpad('kr in component synaptic_input (dimensionless)');
    LEGEND_CONSTANTS(:,256) = strpad('tau_s in component synaptic_input (millisecond)');
    LEGEND_CONSTANTS(:,257) = strpad('sigma_s in component synaptic_input (millivolt)');
    LEGEND_CONSTANTS(:,258) = strpad('theta_s in component synaptic_input (millivolt)');
    LEGEND_VOI = strpad('time in component environment (millisecond)');
    LEGEND_STATES(:,35) = strpad('V in component membrane (millivolt)');
    LEGEND_CONSTANTS(:,259) = strpad('C in component membrane (picoF)');
    LEGEND_CONSTANTS(:,260) = strpad('i_app in component membrane (picoA)');
    LEGEND_ALGEBRAIC(:,127) = strpad('i_NaP in component persistent_sodium_current (picoA)');
    LEGEND_ALGEBRAIC(:,97) = strpad('i_Na in component fast_sodium_current (picoA)');
    LEGEND_ALGEBRAIC(:,107) = strpad('i_K in component potassium_current (picoA)');
    LEGEND_ALGEBRAIC(:,137) = strpad('i_L in component leakage_current (picoA)');
    LEGEND_ALGEBRAIC(:,147) = strpad('i_tonic_e in component tonic_current (picoA)');
    LEGEND_ALGEBRAIC(:,157) = strpad('i_syn_e in component synaptic_input (picoA)');
    LEGEND_CONSTANTS(:,261) = strpad('E_Na in component fast_sodium_current (millivolt)');
    LEGEND_CONSTANTS(:,262) = strpad('g_Na in component fast_sodium_current (nanoS)');
    LEGEND_ALGEBRAIC(:,75) = strpad('m_infinity in component fast_sodium_current_m_gate (dimensionless)');
    LEGEND_STATES(:,36) = strpad('n in component fast_sodium_current_n_gate (dimensionless)');
    LEGEND_CONSTANTS(:,263) = strpad('theta_m in component fast_sodium_current_m_gate (millivolt)');
    LEGEND_CONSTANTS(:,264) = strpad('sigma_m in component fast_sodium_current_m_gate (millivolt)');
    LEGEND_ALGEBRAIC(:,32) = strpad('n_infinity in component fast_sodium_current_n_gate (dimensionless)');
    LEGEND_ALGEBRAIC(:,76) = strpad('tau_n in component fast_sodium_current_n_gate (millisecond)');
    LEGEND_CONSTANTS(:,265) = strpad('tau_n_max in component fast_sodium_current_n_gate (millisecond)');
    LEGEND_CONSTANTS(:,266) = strpad('theta_n in component fast_sodium_current_n_gate (millivolt)');
    LEGEND_CONSTANTS(:,267) = strpad('sigma_n in component fast_sodium_current_n_gate (millivolt)');
    LEGEND_CONSTANTS(:,268) = strpad('g_K in component potassium_current (nanoS)');
    LEGEND_CONSTANTS(:,269) = strpad('E_K in component potassium_current (millivolt)');
    LEGEND_STATES(:,37) = strpad('n in component potassium_current_n_gate (dimensionless)');
    LEGEND_ALGEBRAIC(:,33) = strpad('n_infinity in component potassium_current_n_gate (dimensionless)');
    LEGEND_ALGEBRAIC(:,77) = strpad('tau_n in component potassium_current_n_gate (millisecond)');
    LEGEND_CONSTANTS(:,270) = strpad('tau_n_max in component potassium_current_n_gate (millisecond)');
    LEGEND_CONSTANTS(:,271) = strpad('theta_n in component potassium_current_n_gate (millivolt)');
    LEGEND_CONSTANTS(:,272) = strpad('sigma_n in component potassium_current_n_gate (millivolt)');
    LEGEND_CONSTANTS(:,273) = strpad('g_NaP in component persistent_sodium_current (nanoS)');
    LEGEND_ALGEBRAIC(:,117) = strpad('m_infinity in component persistent_sodium_current_m_gate (dimensionless)');
    LEGEND_STATES(:,38) = strpad('h in component persistent_sodium_current_h_gate (dimensionless)');
    LEGEND_CONSTANTS(:,274) = strpad('theta_m in component persistent_sodium_current_m_gate (millivolt)');
    LEGEND_CONSTANTS(:,275) = strpad('sigma_m in component persistent_sodium_current_m_gate (millivolt)');
    LEGEND_ALGEBRAIC(:,34) = strpad('h_infinity in component persistent_sodium_current_h_gate (dimensionless)');
    LEGEND_ALGEBRAIC(:,78) = strpad('tau_h in component persistent_sodium_current_h_gate (millisecond)');
    LEGEND_CONSTANTS(:,276) = strpad('tau_h_max in component persistent_sodium_current_h_gate (millisecond)');
    LEGEND_CONSTANTS(:,277) = strpad('theta_h in component persistent_sodium_current_h_gate (millivolt)');
    LEGEND_CONSTANTS(:,278) = strpad('sigma_h in component persistent_sodium_current_h_gate (millivolt)');
    LEGEND_CONSTANTS(:,279) = strpad('g_L in component leakage_current (nanoS)');
    LEGEND_CONSTANTS(:,280) = strpad('E_L in component leakage_current (millivolt)');
    LEGEND_CONSTANTS(:,281) = strpad('E_syn_e in component tonic_current (millivolt)');
    LEGEND_CONSTANTS(:,282) = strpad('g_tonic_e in component tonic_current (nanoS)');
    LEGEND_ALGEBRAIC(:,35) = strpad('s_infinity in component synaptic_input (dimensionless)');
    LEGEND_CONSTANTS(:,283) = strpad('kr in component synaptic_input (dimensionless)');
    LEGEND_CONSTANTS(:,284) = strpad('tau_s in component synaptic_input (millisecond)');
    LEGEND_CONSTANTS(:,285) = strpad('sigma_s in component synaptic_input (millivolt)');
    LEGEND_CONSTANTS(:,286) = strpad('theta_s in component synaptic_input (millivolt)');
    LEGEND_VOI = strpad('time in component environment (millisecond)');
    LEGEND_STATES(:,39) = strpad('V in component membrane (millivolt)');
    LEGEND_CONSTANTS(:,287) = strpad('C in component membrane (picoF)');
    LEGEND_CONSTANTS(:,288) = strpad('i_app in component membrane (picoA)');
    LEGEND_ALGEBRAIC(:,128) = strpad('i_NaP in component persistent_sodium_current (picoA)');
    LEGEND_ALGEBRAIC(:,98) = strpad('i_Na in component fast_sodium_current (picoA)');
    LEGEND_ALGEBRAIC(:,108) = strpad('i_K in component potassium_current (picoA)');
    LEGEND_ALGEBRAIC(:,138) = strpad('i_L in component leakage_current (picoA)');
    LEGEND_ALGEBRAIC(:,148) = strpad('i_tonic_e in component tonic_current (picoA)');
    LEGEND_ALGEBRAIC(:,158) = strpad('i_syn_e in component synaptic_input (picoA)');
    LEGEND_CONSTANTS(:,289) = strpad('E_Na in component fast_sodium_current (millivolt)');
    LEGEND_CONSTANTS(:,290) = strpad('g_Na in component fast_sodium_current (nanoS)');
    LEGEND_ALGEBRAIC(:,79) = strpad('m_infinity in component fast_sodium_current_m_gate (dimensionless)');
    LEGEND_STATES(:,40) = strpad('n in component fast_sodium_current_n_gate (dimensionless)');
    LEGEND_CONSTANTS(:,291) = strpad('theta_m in component fast_sodium_current_m_gate (millivolt)');
    LEGEND_CONSTANTS(:,292) = strpad('sigma_m in component fast_sodium_current_m_gate (millivolt)');
    LEGEND_ALGEBRAIC(:,37) = strpad('n_infinity in component fast_sodium_current_n_gate (dimensionless)');
    LEGEND_ALGEBRAIC(:,80) = strpad('tau_n in component fast_sodium_current_n_gate (millisecond)');
    LEGEND_CONSTANTS(:,293) = strpad('tau_n_max in component fast_sodium_current_n_gate (millisecond)');
    LEGEND_CONSTANTS(:,294) = strpad('theta_n in component fast_sodium_current_n_gate (millivolt)');
    LEGEND_CONSTANTS(:,295) = strpad('sigma_n in component fast_sodium_current_n_gate (millivolt)');
    LEGEND_CONSTANTS(:,296) = strpad('g_K in component potassium_current (nanoS)');
    LEGEND_CONSTANTS(:,297) = strpad('E_K in component potassium_current (millivolt)');
    LEGEND_STATES(:,41) = strpad('n in component potassium_current_n_gate (dimensionless)');
    LEGEND_ALGEBRAIC(:,38) = strpad('n_infinity in component potassium_current_n_gate (dimensionless)');
    LEGEND_ALGEBRAIC(:,81) = strpad('tau_n in component potassium_current_n_gate (millisecond)');
    LEGEND_CONSTANTS(:,298) = strpad('tau_n_max in component potassium_current_n_gate (millisecond)');
    LEGEND_CONSTANTS(:,299) = strpad('theta_n in component potassium_current_n_gate (millivolt)');
    LEGEND_CONSTANTS(:,300) = strpad('sigma_n in component potassium_current_n_gate (millivolt)');
    LEGEND_CONSTANTS(:,301) = strpad('g_NaP in component persistent_sodium_current (nanoS)');
    LEGEND_ALGEBRAIC(:,118) = strpad('m_infinity in component persistent_sodium_current_m_gate (dimensionless)');
    LEGEND_STATES(:,42) = strpad('h in component persistent_sodium_current_h_gate (dimensionless)');
    LEGEND_CONSTANTS(:,302) = strpad('theta_m in component persistent_sodium_current_m_gate (millivolt)');
    LEGEND_CONSTANTS(:,303) = strpad('sigma_m in component persistent_sodium_current_m_gate (millivolt)');
    LEGEND_ALGEBRAIC(:,39) = strpad('h_infinity in component persistent_sodium_current_h_gate (dimensionless)');
    LEGEND_ALGEBRAIC(:,82) = strpad('tau_h in component persistent_sodium_current_h_gate (millisecond)');
    LEGEND_CONSTANTS(:,304) = strpad('tau_h_max in component persistent_sodium_current_h_gate (millisecond)');
    LEGEND_CONSTANTS(:,305) = strpad('theta_h in component persistent_sodium_current_h_gate (millivolt)');
    LEGEND_CONSTANTS(:,306) = strpad('sigma_h in component persistent_sodium_current_h_gate (millivolt)');
    LEGEND_CONSTANTS(:,307) = strpad('g_L in component leakage_current (nanoS)');
    LEGEND_CONSTANTS(:,308) = strpad('E_L in component leakage_current (millivolt)');
    LEGEND_CONSTANTS(:,309) = strpad('E_syn_e in component tonic_current (millivolt)');
    LEGEND_CONSTANTS(:,310) = strpad('g_tonic_e in component tonic_current (nanoS)');
    LEGEND_ALGEBRAIC(:,40) = strpad('s_infinity in component synaptic_input (dimensionless)');
    LEGEND_CONSTANTS(:,311) = strpad('kr in component synaptic_input (dimensionless)');
    LEGEND_CONSTANTS(:,312) = strpad('tau_s in component synaptic_input (millisecond)');
    LEGEND_CONSTANTS(:,313) = strpad('sigma_s in component synaptic_input (millivolt)');
    LEGEND_CONSTANTS(:,314) = strpad('theta_s in component synaptic_input (millivolt)');
    LEGEND_VOI = strpad('time in component environment (millisecond)');
    LEGEND_STATES(:,43) = strpad('V in component membrane (millivolt)');
    LEGEND_CONSTANTS(:,315) = strpad('C in component membrane (picoF)');
    LEGEND_CONSTANTS(:,316) = strpad('i_app in component membrane (picoA)');
    LEGEND_ALGEBRAIC(:,129) = strpad('i_NaP in component persistent_sodium_current (picoA)');
    LEGEND_ALGEBRAIC(:,99) = strpad('i_Na in component fast_sodium_current (picoA)');
    LEGEND_ALGEBRAIC(:,109) = strpad('i_K in component potassium_current (picoA)');
    LEGEND_ALGEBRAIC(:,139) = strpad('i_L in component leakage_current (picoA)');
    LEGEND_ALGEBRAIC(:,149) = strpad('i_tonic_e in component tonic_current (picoA)');
    LEGEND_ALGEBRAIC(:,159) = strpad('i_syn_e in component synaptic_input (picoA)');
    LEGEND_CONSTANTS(:,317) = strpad('E_Na in component fast_sodium_current (millivolt)');
    LEGEND_CONSTANTS(:,318) = strpad('g_Na in component fast_sodium_current (nanoS)');
    LEGEND_ALGEBRAIC(:,83) = strpad('m_infinity in component fast_sodium_current_m_gate (dimensionless)');
    LEGEND_STATES(:,44) = strpad('n in component fast_sodium_current_n_gate (dimensionless)');
    LEGEND_CONSTANTS(:,319) = strpad('theta_m in component fast_sodium_current_m_gate (millivolt)');
    LEGEND_CONSTANTS(:,320) = strpad('sigma_m in component fast_sodium_current_m_gate (millivolt)');
    LEGEND_ALGEBRAIC(:,42) = strpad('n_infinity in component fast_sodium_current_n_gate (dimensionless)');
    LEGEND_ALGEBRAIC(:,84) = strpad('tau_n in component fast_sodium_current_n_gate (millisecond)');
    LEGEND_CONSTANTS(:,321) = strpad('tau_n_max in component fast_sodium_current_n_gate (millisecond)');
    LEGEND_CONSTANTS(:,322) = strpad('theta_n in component fast_sodium_current_n_gate (millivolt)');
    LEGEND_CONSTANTS(:,323) = strpad('sigma_n in component fast_sodium_current_n_gate (millivolt)');
    LEGEND_CONSTANTS(:,324) = strpad('g_K in component potassium_current (nanoS)');
    LEGEND_CONSTANTS(:,325) = strpad('E_K in component potassium_current (millivolt)');
    LEGEND_STATES(:,45) = strpad('n in component potassium_current_n_gate (dimensionless)');
    LEGEND_ALGEBRAIC(:,43) = strpad('n_infinity in component potassium_current_n_gate (dimensionless)');
    LEGEND_ALGEBRAIC(:,85) = strpad('tau_n in component potassium_current_n_gate (millisecond)');
    LEGEND_CONSTANTS(:,326) = strpad('tau_n_max in component potassium_current_n_gate (millisecond)');
    LEGEND_CONSTANTS(:,327) = strpad('theta_n in component potassium_current_n_gate (millivolt)');
    LEGEND_CONSTANTS(:,328) = strpad('sigma_n in component potassium_current_n_gate (millivolt)');
    LEGEND_CONSTANTS(:,329) = strpad('g_NaP in component persistent_sodium_current (nanoS)');
    LEGEND_ALGEBRAIC(:,119) = strpad('m_infinity in component persistent_sodium_current_m_gate (dimensionless)');
    LEGEND_STATES(:,46) = strpad('h in component persistent_sodium_current_h_gate (dimensionless)');
    LEGEND_CONSTANTS(:,330) = strpad('theta_m in component persistent_sodium_current_m_gate (millivolt)');
    LEGEND_CONSTANTS(:,331) = strpad('sigma_m in component persistent_sodium_current_m_gate (millivolt)');
    LEGEND_ALGEBRAIC(:,44) = strpad('h_infinity in component persistent_sodium_current_h_gate (dimensionless)');
    LEGEND_ALGEBRAIC(:,86) = strpad('tau_h in component persistent_sodium_current_h_gate (millisecond)');
    LEGEND_CONSTANTS(:,332) = strpad('tau_h_max in component persistent_sodium_current_h_gate (millisecond)');
    LEGEND_CONSTANTS(:,333) = strpad('theta_h in component persistent_sodium_current_h_gate (millivolt)');
    LEGEND_CONSTANTS(:,334) = strpad('sigma_h in component persistent_sodium_current_h_gate (millivolt)');
    LEGEND_CONSTANTS(:,335) = strpad('g_L in component leakage_current (nanoS)');
    LEGEND_CONSTANTS(:,336) = strpad('E_L in component leakage_current (millivolt)');
    LEGEND_CONSTANTS(:,337) = strpad('E_syn_e in component tonic_current (millivolt)');
    LEGEND_CONSTANTS(:,338) = strpad('g_tonic_e in component tonic_current (nanoS)');
    LEGEND_ALGEBRAIC(:,45) = strpad('s_infinity in component synaptic_input (dimensionless)');
    LEGEND_CONSTANTS(:,339) = strpad('kr in component synaptic_input (dimensionless)');
    LEGEND_CONSTANTS(:,340) = strpad('tau_s in component synaptic_input (millisecond)');
    LEGEND_CONSTANTS(:,341) = strpad('sigma_s in component synaptic_input (millivolt)');
    LEGEND_CONSTANTS(:,342) = strpad('theta_s in component synaptic_input (millivolt)');
    LEGEND_VOI = strpad('time in component environment (millisecond)');
    LEGEND_STATES(:,47) = strpad('V in component membrane (millivolt)');
    LEGEND_CONSTANTS(:,343) = strpad('C in component membrane (picoF)');
    LEGEND_CONSTANTS(:,344) = strpad('i_app in component membrane (picoA)');
    LEGEND_ALGEBRAIC(:,130) = strpad('i_NaP in component persistent_sodium_current (picoA)');
    LEGEND_ALGEBRAIC(:,100) = strpad('i_Na in component fast_sodium_current (picoA)');
    LEGEND_ALGEBRAIC(:,110) = strpad('i_K in component potassium_current (picoA)');
    LEGEND_ALGEBRAIC(:,140) = strpad('i_L in component leakage_current (picoA)');
    LEGEND_ALGEBRAIC(:,150) = strpad('i_tonic_e in component tonic_current (picoA)');
    LEGEND_ALGEBRAIC(:,160) = strpad('i_syn_e in component synaptic_input (picoA)');
    LEGEND_CONSTANTS(:,345) = strpad('E_Na in component fast_sodium_current (millivolt)');
    LEGEND_CONSTANTS(:,346) = strpad('g_Na in component fast_sodium_current (nanoS)');
    LEGEND_ALGEBRAIC(:,87) = strpad('m_infinity in component fast_sodium_current_m_gate (dimensionless)');
    LEGEND_STATES(:,48) = strpad('n in component fast_sodium_current_n_gate (dimensionless)');
    LEGEND_CONSTANTS(:,347) = strpad('theta_m in component fast_sodium_current_m_gate (millivolt)');
    LEGEND_CONSTANTS(:,348) = strpad('sigma_m in component fast_sodium_current_m_gate (millivolt)');
    LEGEND_ALGEBRAIC(:,47) = strpad('n_infinity in component fast_sodium_current_n_gate (dimensionless)');
    LEGEND_ALGEBRAIC(:,88) = strpad('tau_n in component fast_sodium_current_n_gate (millisecond)');
    LEGEND_CONSTANTS(:,349) = strpad('tau_n_max in component fast_sodium_current_n_gate (millisecond)');
    LEGEND_CONSTANTS(:,350) = strpad('theta_n in component fast_sodium_current_n_gate (millivolt)');
    LEGEND_CONSTANTS(:,351) = strpad('sigma_n in component fast_sodium_current_n_gate (millivolt)');
    LEGEND_CONSTANTS(:,352) = strpad('g_K in component potassium_current (nanoS)');
    LEGEND_CONSTANTS(:,353) = strpad('E_K in component potassium_current (millivolt)');
    LEGEND_STATES(:,49) = strpad('n in component potassium_current_n_gate (dimensionless)');
    LEGEND_ALGEBRAIC(:,48) = strpad('n_infinity in component potassium_current_n_gate (dimensionless)');
    LEGEND_ALGEBRAIC(:,89) = strpad('tau_n in component potassium_current_n_gate (millisecond)');
    LEGEND_CONSTANTS(:,354) = strpad('tau_n_max in component potassium_current_n_gate (millisecond)');
    LEGEND_CONSTANTS(:,355) = strpad('theta_n in component potassium_current_n_gate (millivolt)');
    LEGEND_CONSTANTS(:,356) = strpad('sigma_n in component potassium_current_n_gate (millivolt)');
    LEGEND_CONSTANTS(:,357) = strpad('g_NaP in component persistent_sodium_current (nanoS)');
    LEGEND_ALGEBRAIC(:,120) = strpad('m_infinity in component persistent_sodium_current_m_gate (dimensionless)');
    LEGEND_STATES(:,50) = strpad('h in component persistent_sodium_current_h_gate (dimensionless)');
    LEGEND_CONSTANTS(:,358) = strpad('theta_m in component persistent_sodium_current_m_gate (millivolt)');
    LEGEND_CONSTANTS(:,359) = strpad('sigma_m in component persistent_sodium_current_m_gate (millivolt)');
    LEGEND_ALGEBRAIC(:,49) = strpad('h_infinity in component persistent_sodium_current_h_gate (dimensionless)');
    LEGEND_ALGEBRAIC(:,90) = strpad('tau_h in component persistent_sodium_current_h_gate (millisecond)');
    LEGEND_CONSTANTS(:,360) = strpad('tau_h_max in component persistent_sodium_current_h_gate (millisecond)');
    LEGEND_CONSTANTS(:,361) = strpad('theta_h in component persistent_sodium_current_h_gate (millivolt)');
    LEGEND_CONSTANTS(:,362) = strpad('sigma_h in component persistent_sodium_current_h_gate (millivolt)');
    LEGEND_CONSTANTS(:,363) = strpad('g_L in component leakage_current (nanoS)');
    LEGEND_CONSTANTS(:,364) = strpad('E_L in component leakage_current (millivolt)');
    LEGEND_CONSTANTS(:,365) = strpad('E_syn_e in component tonic_current (millivolt)');
    LEGEND_CONSTANTS(:,366) = strpad('g_tonic_e in component tonic_current (nanoS)');
    LEGEND_ALGEBRAIC(:,50) = strpad('s_infinity in component synaptic_input (dimensionless)');
    LEGEND_CONSTANTS(:,367) = strpad('kr in component synaptic_input (dimensionless)');
    LEGEND_CONSTANTS(:,368) = strpad('tau_s in component synaptic_input (millisecond)');
    LEGEND_CONSTANTS(:,369) = strpad('sigma_s in component synaptic_input (millivolt)');
    LEGEND_CONSTANTS(:,370) = strpad('theta_s in component synaptic_input (millivolt)');
    LEGEND_RATES(:,11) = strpad('d/dt V in component membrane (millivolt)');
    LEGEND_RATES(:,12) = strpad('d/dt n in component fast_sodium_current_n_gate (dimensionless)');
    LEGEND_RATES(:,13) = strpad('d/dt n in component potassium_current_n_gate (dimensionless)');
    LEGEND_RATES(:,14) = strpad('d/dt h in component persistent_sodium_current_h_gate (dimensionless)');
    LEGEND_RATES(:,1) = strpad('d/dt s in component synaptic_input (dimensionless)');
    LEGEND_RATES(:,15) = strpad('d/dt V in component membrane (millivolt)');
    LEGEND_RATES(:,16) = strpad('d/dt n in component fast_sodium_current_n_gate (dimensionless)');
    LEGEND_RATES(:,17) = strpad('d/dt n in component potassium_current_n_gate (dimensionless)');
    LEGEND_RATES(:,18) = strpad('d/dt h in component persistent_sodium_current_h_gate (dimensionless)');
    LEGEND_RATES(:,2) = strpad('d/dt s in component synaptic_input (dimensionless)');
    LEGEND_RATES(:,19) = strpad('d/dt V in component membrane (millivolt)');
    LEGEND_RATES(:,20) = strpad('d/dt n in component fast_sodium_current_n_gate (dimensionless)');
    LEGEND_RATES(:,21) = strpad('d/dt n in component potassium_current_n_gate (dimensionless)');
    LEGEND_RATES(:,22) = strpad('d/dt h in component persistent_sodium_current_h_gate (dimensionless)');
    LEGEND_RATES(:,3) = strpad('d/dt s in component synaptic_input (dimensionless)');
    LEGEND_RATES(:,23) = strpad('d/dt V in component membrane (millivolt)');
    LEGEND_RATES(:,24) = strpad('d/dt n in component fast_sodium_current_n_gate (dimensionless)');
    LEGEND_RATES(:,25) = strpad('d/dt n in component potassium_current_n_gate (dimensionless)');
    LEGEND_RATES(:,26) = strpad('d/dt h in component persistent_sodium_current_h_gate (dimensionless)');
    LEGEND_RATES(:,4) = strpad('d/dt s in component synaptic_input (dimensionless)');
    LEGEND_RATES(:,27) = strpad('d/dt V in component membrane (millivolt)');
    LEGEND_RATES(:,28) = strpad('d/dt n in component fast_sodium_current_n_gate (dimensionless)');
    LEGEND_RATES(:,29) = strpad('d/dt n in component potassium_current_n_gate (dimensionless)');
    LEGEND_RATES(:,30) = strpad('d/dt h in component persistent_sodium_current_h_gate (dimensionless)');
    LEGEND_RATES(:,5) = strpad('d/dt s in component synaptic_input (dimensionless)');
    LEGEND_RATES(:,31) = strpad('d/dt V in component membrane (millivolt)');
    LEGEND_RATES(:,32) = strpad('d/dt n in component fast_sodium_current_n_gate (dimensionless)');
    LEGEND_RATES(:,33) = strpad('d/dt n in component potassium_current_n_gate (dimensionless)');
    LEGEND_RATES(:,34) = strpad('d/dt h in component persistent_sodium_current_h_gate (dimensionless)');
    LEGEND_RATES(:,6) = strpad('d/dt s in component synaptic_input (dimensionless)');
    LEGEND_RATES(:,35) = strpad('d/dt V in component membrane (millivolt)');
    LEGEND_RATES(:,36) = strpad('d/dt n in component fast_sodium_current_n_gate (dimensionless)');
    LEGEND_RATES(:,37) = strpad('d/dt n in component potassium_current_n_gate (dimensionless)');
    LEGEND_RATES(:,38) = strpad('d/dt h in component persistent_sodium_current_h_gate (dimensionless)');
    LEGEND_RATES(:,7) = strpad('d/dt s in component synaptic_input (dimensionless)');
    LEGEND_RATES(:,39) = strpad('d/dt V in component membrane (millivolt)');
    LEGEND_RATES(:,40) = strpad('d/dt n in component fast_sodium_current_n_gate (dimensionless)');
    LEGEND_RATES(:,41) = strpad('d/dt n in component potassium_current_n_gate (dimensionless)');
    LEGEND_RATES(:,42) = strpad('d/dt h in component persistent_sodium_current_h_gate (dimensionless)');
    LEGEND_RATES(:,8) = strpad('d/dt s in component synaptic_input (dimensionless)');
    LEGEND_RATES(:,43) = strpad('d/dt V in component membrane (millivolt)');
    LEGEND_RATES(:,44) = strpad('d/dt n in component fast_sodium_current_n_gate (dimensionless)');
    LEGEND_RATES(:,45) = strpad('d/dt n in component potassium_current_n_gate (dimensionless)');
    LEGEND_RATES(:,46) = strpad('d/dt h in component persistent_sodium_current_h_gate (dimensionless)');
    LEGEND_RATES(:,9) = strpad('d/dt s in component synaptic_input (dimensionless)');
    LEGEND_RATES(:,47) = strpad('d/dt V in component membrane (millivolt)');
    LEGEND_RATES(:,48) = strpad('d/dt n in component fast_sodium_current_n_gate (dimensionless)');
    LEGEND_RATES(:,49) = strpad('d/dt n in component potassium_current_n_gate (dimensionless)');
    LEGEND_RATES(:,50) = strpad('d/dt h in component persistent_sodium_current_h_gate (dimensionless)');
    LEGEND_RATES(:,10) = strpad('d/dt s in component synaptic_input (dimensionless)');
    LEGEND_STATES  = LEGEND_STATES';
    LEGEND_ALGEBRAIC = LEGEND_ALGEBRAIC';
    LEGEND_RATES = LEGEND_RATES';
    LEGEND_CONSTANTS = LEGEND_CONSTANTS';
end

function [STATES, CONSTANTS] = initConsts()
    VOI = 0; CONSTANTS = []; STATES = []; ALGEBRAIC = [];
    CONSTANTS(:,1) = 0.10;
    CONSTANTS(:,2) = 0.10;
    CONSTANTS(:,3) = 0.10;
    CONSTANTS(:,4) = 0.10;
    CONSTANTS(:,5) = 0.10;
    CONSTANTS(:,6) = 0.10;
    CONSTANTS(:,7) = 0.10;
    CONSTANTS(:,8) = 0.10;
    CONSTANTS(:,9) = 0.10;
    CONSTANTS(:,10) = 0.10;
    CONSTANTS(:,11) = 0.10;
    CONSTANTS(:,12) = 0.10;
    CONSTANTS(:,13) = 0.10;
    CONSTANTS(:,14) = 0.10;
    CONSTANTS(:,15) = 0.10;
    CONSTANTS(:,16) = 0.10;
    CONSTANTS(:,17) = 0.10;
    CONSTANTS(:,18) = 0.10;
    CONSTANTS(:,19) = 0.10;
    CONSTANTS(:,20) = 0.10;
    CONSTANTS(:,21) = 0.10;
    CONSTANTS(:,22) = 0.10;
    CONSTANTS(:,23) = 0.10;
    CONSTANTS(:,24) = 0.10;
    CONSTANTS(:,25) = 0.10;
    CONSTANTS(:,26) = 0.10;
    CONSTANTS(:,27) = 0.10;
    CONSTANTS(:,28) = 0.10;
    CONSTANTS(:,29) = 0.10;
    CONSTANTS(:,30) = 0.10;
    CONSTANTS(:,31) = 0.10;
    CONSTANTS(:,32) = 0.10;
    CONSTANTS(:,33) = 0.10;
    CONSTANTS(:,34) = 0.10;
    CONSTANTS(:,35) = 0.10;
    CONSTANTS(:,36) = 0.10;
    CONSTANTS(:,37) = 0.10;
    CONSTANTS(:,38) = 0.10;
    CONSTANTS(:,39) = 0.10;
    CONSTANTS(:,40) = 0.10;
    CONSTANTS(:,41) = 0.10;
    CONSTANTS(:,42) = 0.10;
    CONSTANTS(:,43) = 0.10;
    CONSTANTS(:,44) = 0.10;
    CONSTANTS(:,45) = 0.10;
    CONSTANTS(:,46) = 0.10;
    CONSTANTS(:,47) = 0.10;
    CONSTANTS(:,48) = 0.10;
    CONSTANTS(:,49) = 0.10;
    CONSTANTS(:,50) = 0.10;
    CONSTANTS(:,51) = 0.10;
    CONSTANTS(:,52) = 0.10;
    CONSTANTS(:,53) = 0.10;
    CONSTANTS(:,54) = 0.10;
    CONSTANTS(:,55) = 0.10;
    CONSTANTS(:,56) = 0.10;
    CONSTANTS(:,57) = 0.10;
    CONSTANTS(:,58) = 0.10;
    CONSTANTS(:,59) = 0.10;
    CONSTANTS(:,60) = 0.10;
    CONSTANTS(:,61) = 0.10;
    CONSTANTS(:,62) = 0.10;
    CONSTANTS(:,63) = 0.10;
    CONSTANTS(:,64) = 0.10;
    CONSTANTS(:,65) = 0.10;
    CONSTANTS(:,66) = 0.10;
    CONSTANTS(:,67) = 0.10;
    CONSTANTS(:,68) = 0.10;
    CONSTANTS(:,69) = 0.10;
    CONSTANTS(:,70) = 0.10;
    CONSTANTS(:,71) = 0.10;
    CONSTANTS(:,72) = 0.10;
    CONSTANTS(:,73) = 0.10;
    CONSTANTS(:,74) = 0.10;
    CONSTANTS(:,75) = 0.10;
    CONSTANTS(:,76) = 0.10;
    CONSTANTS(:,77) = 0.10;
    CONSTANTS(:,78) = 0.10;
    CONSTANTS(:,79) = 0.10;
    CONSTANTS(:,80) = 0.10;
    CONSTANTS(:,81) = 0.10;
    CONSTANTS(:,82) = 0.10;
    CONSTANTS(:,83) = 0.10;
    CONSTANTS(:,84) = 0.10;
    CONSTANTS(:,85) = 0.10;
    CONSTANTS(:,86) = 0.10;
    CONSTANTS(:,87) = 0.10;
    CONSTANTS(:,88) = 0.10;
    CONSTANTS(:,89) = 0.10;
    CONSTANTS(:,90) = 0.10;
    STATES(:,1) = 1;
    STATES(:,2) = 1;
    STATES(:,3) = 1;
    STATES(:,4) = 1;
    STATES(:,5) = 1;
    STATES(:,6) = 1;
    STATES(:,7) = 1;
    STATES(:,8) = 1;
    STATES(:,9) = 1;
    STATES(:,10) = 1;
    STATES(:,11) = -50.0;
    CONSTANTS(:,91) = 21.0;
    CONSTANTS(:,92) = 0.0;
    CONSTANTS(:,93) = 50.0;
    CONSTANTS(:,94) = 28.0;
    STATES(:,12) = 0.01;
    CONSTANTS(:,95) = -34.0;
    CONSTANTS(:,96) = -5.0;
    CONSTANTS(:,97) = 10.0;
    CONSTANTS(:,98) = -29.0;
    CONSTANTS(:,99) = -4.0;
    CONSTANTS(:,100) = 11.2;
    CONSTANTS(:,101) = -85.0;
    STATES(:,13) = 0.01;
    CONSTANTS(:,102) = 10.0;
    CONSTANTS(:,103) = -29.0;
    CONSTANTS(:,104) = -4.0;
    CONSTANTS(:,105) = 2.8;
    STATES(:,14) = 0.46;
    CONSTANTS(:,106) = -40.0;
    CONSTANTS(:,107) = -6.0;
    CONSTANTS(:,108) = 10000.0;
    CONSTANTS(:,109) = -48.0;
    CONSTANTS(:,110) = 6.0;
    CONSTANTS(:,111) = 2.8;
    CONSTANTS(:,112) = -57.5;
    CONSTANTS(:,113) = 0.0;
    CONSTANTS(:,114) = 0.0;
    CONSTANTS(:,115) = 1.0;
    CONSTANTS(:,116) = 5.0;
    CONSTANTS(:,117) = -5.0;
    CONSTANTS(:,118) = -10.0;
    STATES(:,15) = -50.0;
    CONSTANTS(:,119) = 21.0;
    CONSTANTS(:,120) = 0.0;
    CONSTANTS(:,121) = 50.0;
    CONSTANTS(:,122) = 28.0;
    STATES(:,16) = 0.01;
    CONSTANTS(:,123) = -34.0;
    CONSTANTS(:,124) = -5.0;
    CONSTANTS(:,125) = 10.0;
    CONSTANTS(:,126) = -29.0;
    CONSTANTS(:,127) = -4.0;
    CONSTANTS(:,128) = 11.2;
    CONSTANTS(:,129) = -85.0;
    STATES(:,17) = 0.01;
    CONSTANTS(:,130) = 10.0;
    CONSTANTS(:,131) = -29.0;
    CONSTANTS(:,132) = -4.0;
    CONSTANTS(:,133) = 2.8;
    STATES(:,18) = 0.46;
    CONSTANTS(:,134) = -40.0;
    CONSTANTS(:,135) = -6.0;
    CONSTANTS(:,136) = 10000.0;
    CONSTANTS(:,137) = -48.0;
    CONSTANTS(:,138) = 6.0;
    CONSTANTS(:,139) = 2.8;
    CONSTANTS(:,140) = -57.5;
    CONSTANTS(:,141) = 0.0;
    CONSTANTS(:,142) = 0.0;
    CONSTANTS(:,143) = 1.0;
    CONSTANTS(:,144) = 5.0;
    CONSTANTS(:,145) = -5.0;
    CONSTANTS(:,146) = -10.0;
    STATES(:,19) = -50.0;
    CONSTANTS(:,147) = 21.0;
    CONSTANTS(:,148) = 0.0;
    CONSTANTS(:,149) = 50.0;
    CONSTANTS(:,150) = 28.0;
    STATES(:,20) = 0.01;
    CONSTANTS(:,151) = -34.0;
    CONSTANTS(:,152) = -5.0;
    CONSTANTS(:,153) = 10.0;
    CONSTANTS(:,154) = -29.0;
    CONSTANTS(:,155) = -4.0;
    CONSTANTS(:,156) = 11.2;
    CONSTANTS(:,157) = -85.0;
    STATES(:,21) = 0.01;
    CONSTANTS(:,158) = 10.0;
    CONSTANTS(:,159) = -29.0;
    CONSTANTS(:,160) = -4.0;
    CONSTANTS(:,161) = 2.8;
    STATES(:,22) = 0.46;
    CONSTANTS(:,162) = -40.0;
    CONSTANTS(:,163) = -6.0;
    CONSTANTS(:,164) = 10000.0;
    CONSTANTS(:,165) = -48.0;
    CONSTANTS(:,166) = 6.0;
    CONSTANTS(:,167) = 2.8;
    CONSTANTS(:,168) = -57.5;
    CONSTANTS(:,169) = 0.0;
    CONSTANTS(:,170) = 0.0;
    CONSTANTS(:,171) = 1.0;
    CONSTANTS(:,172) = 5.0;
    CONSTANTS(:,173) = -5.0;
    CONSTANTS(:,174) = -10.0;
    STATES(:,23) = -50.0;
    CONSTANTS(:,175) = 21.0;
    CONSTANTS(:,176) = 0.0;
    CONSTANTS(:,177) = 50.0;
    CONSTANTS(:,178) = 28.0;
    STATES(:,24) = 0.01;
    CONSTANTS(:,179) = -34.0;
    CONSTANTS(:,180) = -5.0;
    CONSTANTS(:,181) = 10.0;
    CONSTANTS(:,182) = -29.0;
    CONSTANTS(:,183) = -4.0;
    CONSTANTS(:,184) = 11.2;
    CONSTANTS(:,185) = -85.0;
    STATES(:,25) = 0.01;
    CONSTANTS(:,186) = 10.0;
    CONSTANTS(:,187) = -29.0;
    CONSTANTS(:,188) = -4.0;
    CONSTANTS(:,189) = 2.8;
    STATES(:,26) = 0.46;
    CONSTANTS(:,190) = -40.0;
    CONSTANTS(:,191) = -6.0;
    CONSTANTS(:,192) = 10000.0;
    CONSTANTS(:,193) = -48.0;
    CONSTANTS(:,194) = 6.0;
    CONSTANTS(:,195) = 2.8;
    CONSTANTS(:,196) = -57.5;
    CONSTANTS(:,197) = 0.0;
    CONSTANTS(:,198) = 0.0;
    CONSTANTS(:,199) = 1.0;
    CONSTANTS(:,200) = 5.0;
    CONSTANTS(:,201) = -5.0;
    CONSTANTS(:,202) = -10.0;
    STATES(:,27) = -50.0;
    CONSTANTS(:,203) = 21.0;
    CONSTANTS(:,204) = 0.0;
    CONSTANTS(:,205) = 50.0;
    CONSTANTS(:,206) = 28.0;
    STATES(:,28) = 0.01;
    CONSTANTS(:,207) = -34.0;
    CONSTANTS(:,208) = -5.0;
    CONSTANTS(:,209) = 10.0;
    CONSTANTS(:,210) = -29.0;
    CONSTANTS(:,211) = -4.0;
    CONSTANTS(:,212) = 11.2;
    CONSTANTS(:,213) = -85.0;
    STATES(:,29) = 0.01;
    CONSTANTS(:,214) = 10.0;
    CONSTANTS(:,215) = -29.0;
    CONSTANTS(:,216) = -4.0;
    CONSTANTS(:,217) = 2.8;
    STATES(:,30) = 0.46;
    CONSTANTS(:,218) = -40.0;
    CONSTANTS(:,219) = -6.0;
    CONSTANTS(:,220) = 10000.0;
    CONSTANTS(:,221) = -48.0;
    CONSTANTS(:,222) = 6.0;
    CONSTANTS(:,223) = 2.8;
    CONSTANTS(:,224) = -57.5;
    CONSTANTS(:,225) = 0.0;
    CONSTANTS(:,226) = 0.0;
    CONSTANTS(:,227) = 1.0;
    CONSTANTS(:,228) = 5.0;
    CONSTANTS(:,229) = -5.0;
    CONSTANTS(:,230) = -10.0;
    STATES(:,31) = -50.0;
    CONSTANTS(:,231) = 21.0;
    CONSTANTS(:,232) = 0.0;
    CONSTANTS(:,233) = 50.0;
    CONSTANTS(:,234) = 28.0;
    STATES(:,32) = 0.01;
    CONSTANTS(:,235) = -34.0;
    CONSTANTS(:,236) = -5.0;
    CONSTANTS(:,237) = 10.0;
    CONSTANTS(:,238) = -29.0;
    CONSTANTS(:,239) = -4.0;
    CONSTANTS(:,240) = 11.2;
    CONSTANTS(:,241) = -85.0;
    STATES(:,33) = 0.01;
    CONSTANTS(:,242) = 10.0;
    CONSTANTS(:,243) = -29.0;
    CONSTANTS(:,244) = -4.0;
    CONSTANTS(:,245) = 2.8;
    STATES(:,34) = 0.46;
    CONSTANTS(:,246) = -40.0;
    CONSTANTS(:,247) = -6.0;
    CONSTANTS(:,248) = 10000.0;
    CONSTANTS(:,249) = -48.0;
    CONSTANTS(:,250) = 6.0;
    CONSTANTS(:,251) = 2.8;
    CONSTANTS(:,252) = -57.5;
    CONSTANTS(:,253) = 0.0;
    CONSTANTS(:,254) = 0.0;
    CONSTANTS(:,255) = 1.0;
    CONSTANTS(:,256) = 5.0;
    CONSTANTS(:,257) = -5.0;
    CONSTANTS(:,258) = -10.0;
    STATES(:,35) = -50.0;
    CONSTANTS(:,259) = 21.0;
    CONSTANTS(:,260) = 0.0;
    CONSTANTS(:,261) = 50.0;
    CONSTANTS(:,262) = 28.0;
    STATES(:,36) = 0.01;
    CONSTANTS(:,263) = -34.0;
    CONSTANTS(:,264) = -5.0;
    CONSTANTS(:,265) = 10.0;
    CONSTANTS(:,266) = -29.0;
    CONSTANTS(:,267) = -4.0;
    CONSTANTS(:,268) = 11.2;
    CONSTANTS(:,269) = -85.0;
    STATES(:,37) = 0.01;
    CONSTANTS(:,270) = 10.0;
    CONSTANTS(:,271) = -29.0;
    CONSTANTS(:,272) = -4.0;
    CONSTANTS(:,273) = 2.8;
    STATES(:,38) = 0.46;
    CONSTANTS(:,274) = -40.0;
    CONSTANTS(:,275) = -6.0;
    CONSTANTS(:,276) = 10000.0;
    CONSTANTS(:,277) = -48.0;
    CONSTANTS(:,278) = 6.0;
    CONSTANTS(:,279) = 2.8;
    CONSTANTS(:,280) = -57.5;
    CONSTANTS(:,281) = 0.0;
    CONSTANTS(:,282) = 0.0;
    CONSTANTS(:,283) = 1.0;
    CONSTANTS(:,284) = 5.0;
    CONSTANTS(:,285) = -5.0;
    CONSTANTS(:,286) = -10.0;
    STATES(:,39) = -50.0;
    CONSTANTS(:,287) = 21.0;
    CONSTANTS(:,288) = 0.0;
    CONSTANTS(:,289) = 50.0;
    CONSTANTS(:,290) = 28.0;
    STATES(:,40) = 0.01;
    CONSTANTS(:,291) = -34.0;
    CONSTANTS(:,292) = -5.0;
    CONSTANTS(:,293) = 10.0;
    CONSTANTS(:,294) = -29.0;
    CONSTANTS(:,295) = -4.0;
    CONSTANTS(:,296) = 11.2;
    CONSTANTS(:,297) = -85.0;
    STATES(:,41) = 0.01;
    CONSTANTS(:,298) = 10.0;
    CONSTANTS(:,299) = -29.0;
    CONSTANTS(:,300) = -4.0;
    CONSTANTS(:,301) = 2.8;
    STATES(:,42) = 0.46;
    CONSTANTS(:,302) = -40.0;
    CONSTANTS(:,303) = -6.0;
    CONSTANTS(:,304) = 10000.0;
    CONSTANTS(:,305) = -48.0;
    CONSTANTS(:,306) = 6.0;
    CONSTANTS(:,307) = 2.8;
    CONSTANTS(:,308) = -57.5;
    CONSTANTS(:,309) = 0.0;
    CONSTANTS(:,310) = 0.0;
    CONSTANTS(:,311) = 1.0;
    CONSTANTS(:,312) = 5.0;
    CONSTANTS(:,313) = -5.0;
    CONSTANTS(:,314) = -10.0;
    STATES(:,43) = -50.0;
    CONSTANTS(:,315) = 21.0;
    CONSTANTS(:,316) = 0.0;
    CONSTANTS(:,317) = 50.0;
    CONSTANTS(:,318) = 28.0;
    STATES(:,44) = 0.01;
    CONSTANTS(:,319) = -34.0;
    CONSTANTS(:,320) = -5.0;
    CONSTANTS(:,321) = 10.0;
    CONSTANTS(:,322) = -29.0;
    CONSTANTS(:,323) = -4.0;
    CONSTANTS(:,324) = 11.2;
    CONSTANTS(:,325) = -85.0;
    STATES(:,45) = 0.01;
    CONSTANTS(:,326) = 10.0;
    CONSTANTS(:,327) = -29.0;
    CONSTANTS(:,328) = -4.0;
    CONSTANTS(:,329) = 2.8;
    STATES(:,46) = 0.46;
    CONSTANTS(:,330) = -40.0;
    CONSTANTS(:,331) = -6.0;
    CONSTANTS(:,332) = 10000.0;
    CONSTANTS(:,333) = -48.0;
    CONSTANTS(:,334) = 6.0;
    CONSTANTS(:,335) = 2.8;
    CONSTANTS(:,336) = -57.5;
    CONSTANTS(:,337) = 0.0;
    CONSTANTS(:,338) = 0.0;
    CONSTANTS(:,339) = 1.0;
    CONSTANTS(:,340) = 5.0;
    CONSTANTS(:,341) = -5.0;
    CONSTANTS(:,342) = -10.0;
    STATES(:,47) = -50.0;
    CONSTANTS(:,343) = 21.0;
    CONSTANTS(:,344) = 0.0;
    CONSTANTS(:,345) = 50.0;
    CONSTANTS(:,346) = 28.0;
    STATES(:,48) = 0.01;
    CONSTANTS(:,347) = -34.0;
    CONSTANTS(:,348) = -5.0;
    CONSTANTS(:,349) = 10.0;
    CONSTANTS(:,350) = -29.0;
    CONSTANTS(:,351) = -4.0;
    CONSTANTS(:,352) = 11.2;
    CONSTANTS(:,353) = -85.0;
    STATES(:,49) = 0.01;
    CONSTANTS(:,354) = 10.0;
    CONSTANTS(:,355) = -29.0;
    CONSTANTS(:,356) = -4.0;
    CONSTANTS(:,357) = 2.8;
    STATES(:,50) = 0.46;
    CONSTANTS(:,358) = -40.0;
    CONSTANTS(:,359) = -6.0;
    CONSTANTS(:,360) = 10000.0;
    CONSTANTS(:,361) = -48.0;
    CONSTANTS(:,362) = 6.0;
    CONSTANTS(:,363) = 2.8;
    CONSTANTS(:,364) = -57.5;
    CONSTANTS(:,365) = 0.0;
    CONSTANTS(:,366) = 0.0;
    CONSTANTS(:,367) = 1.0;
    CONSTANTS(:,368) = 5.0;
    CONSTANTS(:,369) = -5.0;
    CONSTANTS(:,370) = -10.0;
    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);
    else
        statesRowCount = statesSize(1);
        ALGEBRAIC = zeros(statesRowCount, algebraicVariableCount);
        RATES = zeros(statesRowCount, statesColumnCount);
    end
    ALGEBRAIC(:,5) = 1.00000./(1.00000+exp((STATES(:,11) - CONSTANTS(:,118))./CONSTANTS(:,117)));
    RATES(:,1) = ( (1.00000 - STATES(:,1)).*ALGEBRAIC(:,5) -  - ( CONSTANTS(:,115).*STATES(:,1)))./CONSTANTS(:,116);
    ALGEBRAIC(:,10) = 1.00000./(1.00000+exp((STATES(:,15) - CONSTANTS(:,146))./CONSTANTS(:,145)));
    RATES(:,2) = ( (1.00000 - STATES(:,2)).*ALGEBRAIC(:,10) -  - ( CONSTANTS(:,143).*STATES(:,2)))./CONSTANTS(:,144);
    ALGEBRAIC(:,15) = 1.00000./(1.00000+exp((STATES(:,19) - CONSTANTS(:,174))./CONSTANTS(:,173)));
    RATES(:,3) = ( (1.00000 - STATES(:,3)).*ALGEBRAIC(:,15) -  - ( CONSTANTS(:,171).*STATES(:,3)))./CONSTANTS(:,172);
    ALGEBRAIC(:,20) = 1.00000./(1.00000+exp((STATES(:,23) - CONSTANTS(:,202))./CONSTANTS(:,201)));
    RATES(:,4) = ( (1.00000 - STATES(:,4)).*ALGEBRAIC(:,20) -  - ( CONSTANTS(:,199).*STATES(:,4)))./CONSTANTS(:,200);
    ALGEBRAIC(:,25) = 1.00000./(1.00000+exp((STATES(:,27) - CONSTANTS(:,230))./CONSTANTS(:,229)));
    RATES(:,5) = ( (1.00000 - STATES(:,5)).*ALGEBRAIC(:,25) -  - ( CONSTANTS(:,227).*STATES(:,5)))./CONSTANTS(:,228);
    ALGEBRAIC(:,30) = 1.00000./(1.00000+exp((STATES(:,31) - CONSTANTS(:,258))./CONSTANTS(:,257)));
    RATES(:,6) = ( (1.00000 - STATES(:,6)).*ALGEBRAIC(:,30) -  - ( CONSTANTS(:,255).*STATES(:,6)))./CONSTANTS(:,256);
    ALGEBRAIC(:,35) = 1.00000./(1.00000+exp((STATES(:,35) - CONSTANTS(:,286))./CONSTANTS(:,285)));
    RATES(:,7) = ( (1.00000 - STATES(:,7)).*ALGEBRAIC(:,35) -  - ( CONSTANTS(:,283).*STATES(:,7)))./CONSTANTS(:,284);
    ALGEBRAIC(:,40) = 1.00000./(1.00000+exp((STATES(:,39) - CONSTANTS(:,314))./CONSTANTS(:,313)));
    RATES(:,8) = ( (1.00000 - STATES(:,8)).*ALGEBRAIC(:,40) -  - ( CONSTANTS(:,311).*STATES(:,8)))./CONSTANTS(:,312);
    ALGEBRAIC(:,45) = 1.00000./(1.00000+exp((STATES(:,43) - CONSTANTS(:,342))./CONSTANTS(:,341)));
    RATES(:,9) = ( (1.00000 - STATES(:,9)).*ALGEBRAIC(:,45) -  - ( CONSTANTS(:,339).*STATES(:,9)))./CONSTANTS(:,340);
    ALGEBRAIC(:,50) = 1.00000./(1.00000+exp((STATES(:,47) - CONSTANTS(:,370))./CONSTANTS(:,369)));
    RATES(:,10) = ( (1.00000 - STATES(:,10)).*ALGEBRAIC(:,50) -  - ( CONSTANTS(:,367).*STATES(:,10)))./CONSTANTS(:,368);
    ALGEBRAIC(:,2) = 1.00000./(1.00000+exp((STATES(:,11) - CONSTANTS(:,98))./CONSTANTS(:,99)));
    ALGEBRAIC(:,52) = CONSTANTS(:,97)./cosh((STATES(:,11) - CONSTANTS(:,98))./( 2.00000.*CONSTANTS(:,99)));
    RATES(:,12) = (ALGEBRAIC(:,2) - STATES(:,12))./ALGEBRAIC(:,52);
    ALGEBRAIC(:,3) = 1.00000./(1.00000+exp((STATES(:,11) - CONSTANTS(:,103))./CONSTANTS(:,104)));
    ALGEBRAIC(:,53) = CONSTANTS(:,102)./cosh((STATES(:,11) - CONSTANTS(:,103))./( 2.00000.*CONSTANTS(:,104)));
    RATES(:,13) = (ALGEBRAIC(:,3) - STATES(:,13))./ALGEBRAIC(:,53);
    ALGEBRAIC(:,4) = 1.00000./(1.00000+exp((STATES(:,11) - CONSTANTS(:,109))./CONSTANTS(:,110)));
    ALGEBRAIC(:,54) = CONSTANTS(:,108)./cosh((STATES(:,11) - CONSTANTS(:,109))./( 2.00000.*CONSTANTS(:,110)));
    RATES(:,14) = (ALGEBRAIC(:,4) - STATES(:,14))./ALGEBRAIC(:,54);
    ALGEBRAIC(:,7) = 1.00000./(1.00000+exp((STATES(:,15) - CONSTANTS(:,126))./CONSTANTS(:,127)));
    ALGEBRAIC(:,56) = CONSTANTS(:,125)./cosh((STATES(:,15) - CONSTANTS(:,126))./( 2.00000.*CONSTANTS(:,127)));
    RATES(:,16) = (ALGEBRAIC(:,7) - STATES(:,16))./ALGEBRAIC(:,56);
    ALGEBRAIC(:,8) = 1.00000./(1.00000+exp((STATES(:,15) - CONSTANTS(:,131))./CONSTANTS(:,132)));
    ALGEBRAIC(:,57) = CONSTANTS(:,130)./cosh((STATES(:,15) - CONSTANTS(:,131))./( 2.00000.*CONSTANTS(:,132)));
    RATES(:,17) = (ALGEBRAIC(:,8) - STATES(:,17))./ALGEBRAIC(:,57);
    ALGEBRAIC(:,9) = 1.00000./(1.00000+exp((STATES(:,15) - CONSTANTS(:,137))./CONSTANTS(:,138)));
    ALGEBRAIC(:,58) = CONSTANTS(:,136)./cosh((STATES(:,15) - CONSTANTS(:,137))./( 2.00000.*CONSTANTS(:,138)));
    RATES(:,18) = (ALGEBRAIC(:,9) - STATES(:,18))./ALGEBRAIC(:,58);
    ALGEBRAIC(:,12) = 1.00000./(1.00000+exp((STATES(:,19) - CONSTANTS(:,154))./CONSTANTS(:,155)));
    ALGEBRAIC(:,60) = CONSTANTS(:,153)./cosh((STATES(:,19) - CONSTANTS(:,154))./( 2.00000.*CONSTANTS(:,155)));
    RATES(:,20) = (ALGEBRAIC(:,12) - STATES(:,20))./ALGEBRAIC(:,60);
    ALGEBRAIC(:,13) = 1.00000./(1.00000+exp((STATES(:,19) - CONSTANTS(:,159))./CONSTANTS(:,160)));
    ALGEBRAIC(:,61) = CONSTANTS(:,158)./cosh((STATES(:,19) - CONSTANTS(:,159))./( 2.00000.*CONSTANTS(:,160)));
    RATES(:,21) = (ALGEBRAIC(:,13) - STATES(:,21))./ALGEBRAIC(:,61);
    ALGEBRAIC(:,14) = 1.00000./(1.00000+exp((STATES(:,19) - CONSTANTS(:,165))./CONSTANTS(:,166)));
    ALGEBRAIC(:,62) = CONSTANTS(:,164)./cosh((STATES(:,19) - CONSTANTS(:,165))./( 2.00000.*CONSTANTS(:,166)));
    RATES(:,22) = (ALGEBRAIC(:,14) - STATES(:,22))./ALGEBRAIC(:,62);
    ALGEBRAIC(:,17) = 1.00000./(1.00000+exp((STATES(:,23) - CONSTANTS(:,182))./CONSTANTS(:,183)));
    ALGEBRAIC(:,64) = CONSTANTS(:,181)./cosh((STATES(:,23) - CONSTANTS(:,182))./( 2.00000.*CONSTANTS(:,183)));
    RATES(:,24) = (ALGEBRAIC(:,17) - STATES(:,24))./ALGEBRAIC(:,64);
    ALGEBRAIC(:,18) = 1.00000./(1.00000+exp((STATES(:,23) - CONSTANTS(:,187))./CONSTANTS(:,188)));
    ALGEBRAIC(:,65) = CONSTANTS(:,186)./cosh((STATES(:,23) - CONSTANTS(:,187))./( 2.00000.*CONSTANTS(:,188)));
    RATES(:,25) = (ALGEBRAIC(:,18) - STATES(:,25))./ALGEBRAIC(:,65);
    ALGEBRAIC(:,19) = 1.00000./(1.00000+exp((STATES(:,23) - CONSTANTS(:,193))./CONSTANTS(:,194)));
    ALGEBRAIC(:,66) = CONSTANTS(:,192)./cosh((STATES(:,23) - CONSTANTS(:,193))./( 2.00000.*CONSTANTS(:,194)));
    RATES(:,26) = (ALGEBRAIC(:,19) - STATES(:,26))./ALGEBRAIC(:,66);
    ALGEBRAIC(:,22) = 1.00000./(1.00000+exp((STATES(:,27) - CONSTANTS(:,210))./CONSTANTS(:,211)));
    ALGEBRAIC(:,68) = CONSTANTS(:,209)./cosh((STATES(:,27) - CONSTANTS(:,210))./( 2.00000.*CONSTANTS(:,211)));
    RATES(:,28) = (ALGEBRAIC(:,22) - STATES(:,28))./ALGEBRAIC(:,68);
    ALGEBRAIC(:,23) = 1.00000./(1.00000+exp((STATES(:,27) - CONSTANTS(:,215))./CONSTANTS(:,216)));
    ALGEBRAIC(:,69) = CONSTANTS(:,214)./cosh((STATES(:,27) - CONSTANTS(:,215))./( 2.00000.*CONSTANTS(:,216)));
    RATES(:,29) = (ALGEBRAIC(:,23) - STATES(:,29))./ALGEBRAIC(:,69);
    ALGEBRAIC(:,24) = 1.00000./(1.00000+exp((STATES(:,27) - CONSTANTS(:,221))./CONSTANTS(:,222)));
    ALGEBRAIC(:,70) = CONSTANTS(:,220)./cosh((STATES(:,27) - CONSTANTS(:,221))./( 2.00000.*CONSTANTS(:,222)));
    RATES(:,30) = (ALGEBRAIC(:,24) - STATES(:,30))./ALGEBRAIC(:,70);
    ALGEBRAIC(:,27) = 1.00000./(1.00000+exp((STATES(:,31) - CONSTANTS(:,238))./CONSTANTS(:,239)));
    ALGEBRAIC(:,72) = CONSTANTS(:,237)./cosh((STATES(:,31) - CONSTANTS(:,238))./( 2.00000.*CONSTANTS(:,239)));
    RATES(:,32) = (ALGEBRAIC(:,27) - STATES(:,32))./ALGEBRAIC(:,72);
    ALGEBRAIC(:,28) = 1.00000./(1.00000+exp((STATES(:,31) - CONSTANTS(:,243))./CONSTANTS(:,244)));
    ALGEBRAIC(:,73) = CONSTANTS(:,242)./cosh((STATES(:,31) - CONSTANTS(:,243))./( 2.00000.*CONSTANTS(:,244)));
    RATES(:,33) = (ALGEBRAIC(:,28) - STATES(:,33))./ALGEBRAIC(:,73);
    ALGEBRAIC(:,29) = 1.00000./(1.00000+exp((STATES(:,31) - CONSTANTS(:,249))./CONSTANTS(:,250)));
    ALGEBRAIC(:,74) = CONSTANTS(:,248)./cosh((STATES(:,31) - CONSTANTS(:,249))./( 2.00000.*CONSTANTS(:,250)));
    RATES(:,34) = (ALGEBRAIC(:,29) - STATES(:,34))./ALGEBRAIC(:,74);
    ALGEBRAIC(:,32) = 1.00000./(1.00000+exp((STATES(:,35) - CONSTANTS(:,266))./CONSTANTS(:,267)));
    ALGEBRAIC(:,76) = CONSTANTS(:,265)./cosh((STATES(:,35) - CONSTANTS(:,266))./( 2.00000.*CONSTANTS(:,267)));
    RATES(:,36) = (ALGEBRAIC(:,32) - STATES(:,36))./ALGEBRAIC(:,76);
    ALGEBRAIC(:,33) = 1.00000./(1.00000+exp((STATES(:,35) - CONSTANTS(:,271))./CONSTANTS(:,272)));
    ALGEBRAIC(:,77) = CONSTANTS(:,270)./cosh((STATES(:,35) - CONSTANTS(:,271))./( 2.00000.*CONSTANTS(:,272)));
    RATES(:,37) = (ALGEBRAIC(:,33) - STATES(:,37))./ALGEBRAIC(:,77);
    ALGEBRAIC(:,34) = 1.00000./(1.00000+exp((STATES(:,35) - CONSTANTS(:,277))./CONSTANTS(:,278)));
    ALGEBRAIC(:,78) = CONSTANTS(:,276)./cosh((STATES(:,35) - CONSTANTS(:,277))./( 2.00000.*CONSTANTS(:,278)));
    RATES(:,38) = (ALGEBRAIC(:,34) - STATES(:,38))./ALGEBRAIC(:,78);
    ALGEBRAIC(:,37) = 1.00000./(1.00000+exp((STATES(:,39) - CONSTANTS(:,294))./CONSTANTS(:,295)));
    ALGEBRAIC(:,80) = CONSTANTS(:,293)./cosh((STATES(:,39) - CONSTANTS(:,294))./( 2.00000.*CONSTANTS(:,295)));
    RATES(:,40) = (ALGEBRAIC(:,37) - STATES(:,40))./ALGEBRAIC(:,80);
    ALGEBRAIC(:,38) = 1.00000./(1.00000+exp((STATES(:,39) - CONSTANTS(:,299))./CONSTANTS(:,300)));
    ALGEBRAIC(:,81) = CONSTANTS(:,298)./cosh((STATES(:,39) - CONSTANTS(:,299))./( 2.00000.*CONSTANTS(:,300)));
    RATES(:,41) = (ALGEBRAIC(:,38) - STATES(:,41))./ALGEBRAIC(:,81);
    ALGEBRAIC(:,39) = 1.00000./(1.00000+exp((STATES(:,39) - CONSTANTS(:,305))./CONSTANTS(:,306)));
    ALGEBRAIC(:,82) = CONSTANTS(:,304)./cosh((STATES(:,39) - CONSTANTS(:,305))./( 2.00000.*CONSTANTS(:,306)));
    RATES(:,42) = (ALGEBRAIC(:,39) - STATES(:,42))./ALGEBRAIC(:,82);
    ALGEBRAIC(:,42) = 1.00000./(1.00000+exp((STATES(:,43) - CONSTANTS(:,322))./CONSTANTS(:,323)));
    ALGEBRAIC(:,84) = CONSTANTS(:,321)./cosh((STATES(:,43) - CONSTANTS(:,322))./( 2.00000.*CONSTANTS(:,323)));
    RATES(:,44) = (ALGEBRAIC(:,42) - STATES(:,44))./ALGEBRAIC(:,84);
    ALGEBRAIC(:,43) = 1.00000./(1.00000+exp((STATES(:,43) - CONSTANTS(:,327))./CONSTANTS(:,328)));
    ALGEBRAIC(:,85) = CONSTANTS(:,326)./cosh((STATES(:,43) - CONSTANTS(:,327))./( 2.00000.*CONSTANTS(:,328)));
    RATES(:,45) = (ALGEBRAIC(:,43) - STATES(:,45))./ALGEBRAIC(:,85);
    ALGEBRAIC(:,44) = 1.00000./(1.00000+exp((STATES(:,43) - CONSTANTS(:,333))./CONSTANTS(:,334)));
    ALGEBRAIC(:,86) = CONSTANTS(:,332)./cosh((STATES(:,43) - CONSTANTS(:,333))./( 2.00000.*CONSTANTS(:,334)));
    RATES(:,46) = (ALGEBRAIC(:,44) - STATES(:,46))./ALGEBRAIC(:,86);
    ALGEBRAIC(:,47) = 1.00000./(1.00000+exp((STATES(:,47) - CONSTANTS(:,350))./CONSTANTS(:,351)));
    ALGEBRAIC(:,88) = CONSTANTS(:,349)./cosh((STATES(:,47) - CONSTANTS(:,350))./( 2.00000.*CONSTANTS(:,351)));
    RATES(:,48) = (ALGEBRAIC(:,47) - STATES(:,48))./ALGEBRAIC(:,88);
    ALGEBRAIC(:,48) = 1.00000./(1.00000+exp((STATES(:,47) - CONSTANTS(:,355))./CONSTANTS(:,356)));
    ALGEBRAIC(:,89) = CONSTANTS(:,354)./cosh((STATES(:,47) - CONSTANTS(:,355))./( 2.00000.*CONSTANTS(:,356)));
    RATES(:,49) = (ALGEBRAIC(:,48) - STATES(:,49))./ALGEBRAIC(:,89);
    ALGEBRAIC(:,49) = 1.00000./(1.00000+exp((STATES(:,47) - CONSTANTS(:,361))./CONSTANTS(:,362)));
    ALGEBRAIC(:,90) = CONSTANTS(:,360)./cosh((STATES(:,47) - CONSTANTS(:,361))./( 2.00000.*CONSTANTS(:,362)));
    RATES(:,50) = (ALGEBRAIC(:,49) - STATES(:,50))./ALGEBRAIC(:,90);
    ALGEBRAIC(:,111) = 1.00000./(1.00000+exp((STATES(:,11) - CONSTANTS(:,106))./CONSTANTS(:,107)));
    ALGEBRAIC(:,121) =  CONSTANTS(:,105).*ALGEBRAIC(:,111).*STATES(:,14).*(STATES(:,11) - CONSTANTS(:,93));
    ALGEBRAIC(:,51) = 1.00000./(1.00000+exp((STATES(:,11) - CONSTANTS(:,95))./CONSTANTS(:,96)));
    ALGEBRAIC(:,91) =  CONSTANTS(:,94).*ALGEBRAIC(:,51) .^ 3.00000.*(1.00000 - STATES(:,12)).*(STATES(:,11) - CONSTANTS(:,93));
    ALGEBRAIC(:,101) =  CONSTANTS(:,100).*STATES(:,13) .^ 4.00000.*(STATES(:,11) - CONSTANTS(:,101));
    ALGEBRAIC(:,131) =  CONSTANTS(:,111).*(STATES(:,11) - CONSTANTS(:,112));
    ALGEBRAIC(:,141) =  CONSTANTS(:,114).*(STATES(:,11) - CONSTANTS(:,113));
    ALGEBRAIC(:,1) =  CONSTANTS(:,1).*STATES(:,1)+ CONSTANTS(:,2).*STATES(:,1)+ CONSTANTS(:,3).*STATES(:,1)+ CONSTANTS(:,4).*STATES(:,1)+ CONSTANTS(:,5).*STATES(:,1)+ CONSTANTS(:,6).*STATES(:,1)+ CONSTANTS(:,7).*STATES(:,1)+ CONSTANTS(:,8).*STATES(:,1)+ CONSTANTS(:,9).*STATES(:,1);
    ALGEBRAIC(:,151) =  ALGEBRAIC(:,1).*(STATES(:,11) - CONSTANTS(:,113));
    RATES(:,11) = ( - (ALGEBRAIC(:,121)+ALGEBRAIC(:,91)+ALGEBRAIC(:,101)+ALGEBRAIC(:,131)+ALGEBRAIC(:,141)+ALGEBRAIC(:,151))+CONSTANTS(:,92))./CONSTANTS(:,91);
    ALGEBRAIC(:,112) = 1.00000./(1.00000+exp((STATES(:,15) - CONSTANTS(:,134))./CONSTANTS(:,135)));
    ALGEBRAIC(:,122) =  CONSTANTS(:,133).*ALGEBRAIC(:,112).*STATES(:,18).*(STATES(:,15) - CONSTANTS(:,121));
    ALGEBRAIC(:,55) = 1.00000./(1.00000+exp((STATES(:,15) - CONSTANTS(:,123))./CONSTANTS(:,124)));
    ALGEBRAIC(:,92) =  CONSTANTS(:,122).*ALGEBRAIC(:,55) .^ 3.00000.*(1.00000 - STATES(:,16)).*(STATES(:,15) - CONSTANTS(:,121));
    ALGEBRAIC(:,102) =  CONSTANTS(:,128).*STATES(:,17) .^ 4.00000.*(STATES(:,15) - CONSTANTS(:,129));
    ALGEBRAIC(:,132) =  CONSTANTS(:,139).*(STATES(:,15) - CONSTANTS(:,140));
    ALGEBRAIC(:,142) =  CONSTANTS(:,142).*(STATES(:,15) - CONSTANTS(:,141));
    ALGEBRAIC(:,6) =  CONSTANTS(:,10).*STATES(:,2)+ CONSTANTS(:,11).*STATES(:,2)+ CONSTANTS(:,12).*STATES(:,2)+ CONSTANTS(:,13).*STATES(:,2)+ CONSTANTS(:,14).*STATES(:,2)+ CONSTANTS(:,15).*STATES(:,2)+ CONSTANTS(:,16).*STATES(:,2)+ CONSTANTS(:,17).*STATES(:,2)+ CONSTANTS(:,18).*STATES(:,2);
    ALGEBRAIC(:,152) =  ALGEBRAIC(:,6).*(STATES(:,15) - CONSTANTS(:,141));
    RATES(:,15) = ( - (ALGEBRAIC(:,122)+ALGEBRAIC(:,92)+ALGEBRAIC(:,102)+ALGEBRAIC(:,132)+ALGEBRAIC(:,142)+ALGEBRAIC(:,152))+CONSTANTS(:,120))./CONSTANTS(:,119);
    ALGEBRAIC(:,113) = 1.00000./(1.00000+exp((STATES(:,19) - CONSTANTS(:,162))./CONSTANTS(:,163)));
    ALGEBRAIC(:,123) =  CONSTANTS(:,161).*ALGEBRAIC(:,113).*STATES(:,22).*(STATES(:,19) - CONSTANTS(:,149));
    ALGEBRAIC(:,59) = 1.00000./(1.00000+exp((STATES(:,19) - CONSTANTS(:,151))./CONSTANTS(:,152)));
    ALGEBRAIC(:,93) =  CONSTANTS(:,150).*ALGEBRAIC(:,59) .^ 3.00000.*(1.00000 - STATES(:,20)).*(STATES(:,19) - CONSTANTS(:,149));
    ALGEBRAIC(:,103) =  CONSTANTS(:,156).*STATES(:,21) .^ 4.00000.*(STATES(:,19) - CONSTANTS(:,157));
    ALGEBRAIC(:,133) =  CONSTANTS(:,167).*(STATES(:,19) - CONSTANTS(:,168));
    ALGEBRAIC(:,143) =  CONSTANTS(:,170).*(STATES(:,19) - CONSTANTS(:,169));
    ALGEBRAIC(:,11) =  CONSTANTS(:,19).*STATES(:,3)+ CONSTANTS(:,20).*STATES(:,3)+ CONSTANTS(:,21).*STATES(:,3)+ CONSTANTS(:,22).*STATES(:,3)+ CONSTANTS(:,23).*STATES(:,3)+ CONSTANTS(:,24).*STATES(:,3)+ CONSTANTS(:,25).*STATES(:,3)+ CONSTANTS(:,26).*STATES(:,3)+ CONSTANTS(:,27).*STATES(:,3);
    ALGEBRAIC(:,153) =  ALGEBRAIC(:,11).*(STATES(:,19) - CONSTANTS(:,169));
    RATES(:,19) = ( - (ALGEBRAIC(:,123)+ALGEBRAIC(:,93)+ALGEBRAIC(:,103)+ALGEBRAIC(:,133)+ALGEBRAIC(:,143)+ALGEBRAIC(:,153))+CONSTANTS(:,148))./CONSTANTS(:,147);
    ALGEBRAIC(:,114) = 1.00000./(1.00000+exp((STATES(:,23) - CONSTANTS(:,190))./CONSTANTS(:,191)));
    ALGEBRAIC(:,124) =  CONSTANTS(:,189).*ALGEBRAIC(:,114).*STATES(:,26).*(STATES(:,23) - CONSTANTS(:,177));
    ALGEBRAIC(:,63) = 1.00000./(1.00000+exp((STATES(:,23) - CONSTANTS(:,179))./CONSTANTS(:,180)));
    ALGEBRAIC(:,94) =  CONSTANTS(:,178).*ALGEBRAIC(:,63) .^ 3.00000.*(1.00000 - STATES(:,24)).*(STATES(:,23) - CONSTANTS(:,177));
    ALGEBRAIC(:,104) =  CONSTANTS(:,184).*STATES(:,25) .^ 4.00000.*(STATES(:,23) - CONSTANTS(:,185));
    ALGEBRAIC(:,134) =  CONSTANTS(:,195).*(STATES(:,23) - CONSTANTS(:,196));
    ALGEBRAIC(:,144) =  CONSTANTS(:,198).*(STATES(:,23) - CONSTANTS(:,197));
    ALGEBRAIC(:,16) =  CONSTANTS(:,28).*STATES(:,4)+ CONSTANTS(:,29).*STATES(:,4)+ CONSTANTS(:,30).*STATES(:,4)+ CONSTANTS(:,31).*STATES(:,4)+ CONSTANTS(:,32).*STATES(:,4)+ CONSTANTS(:,33).*STATES(:,4)+ CONSTANTS(:,34).*STATES(:,4)+ CONSTANTS(:,35).*STATES(:,4)+ CONSTANTS(:,36).*STATES(:,4);
    ALGEBRAIC(:,154) =  ALGEBRAIC(:,16).*(STATES(:,23) - CONSTANTS(:,197));
    RATES(:,23) = ( - (ALGEBRAIC(:,124)+ALGEBRAIC(:,94)+ALGEBRAIC(:,104)+ALGEBRAIC(:,134)+ALGEBRAIC(:,144)+ALGEBRAIC(:,154))+CONSTANTS(:,176))./CONSTANTS(:,175);
    ALGEBRAIC(:,115) = 1.00000./(1.00000+exp((STATES(:,27) - CONSTANTS(:,218))./CONSTANTS(:,219)));
    ALGEBRAIC(:,125) =  CONSTANTS(:,217).*ALGEBRAIC(:,115).*STATES(:,30).*(STATES(:,27) - CONSTANTS(:,205));
    ALGEBRAIC(:,67) = 1.00000./(1.00000+exp((STATES(:,27) - CONSTANTS(:,207))./CONSTANTS(:,208)));
    ALGEBRAIC(:,95) =  CONSTANTS(:,206).*ALGEBRAIC(:,67) .^ 3.00000.*(1.00000 - STATES(:,28)).*(STATES(:,27) - CONSTANTS(:,205));
    ALGEBRAIC(:,105) =  CONSTANTS(:,212).*STATES(:,29) .^ 4.00000.*(STATES(:,27) - CONSTANTS(:,213));
    ALGEBRAIC(:,135) =  CONSTANTS(:,223).*(STATES(:,27) - CONSTANTS(:,224));
    ALGEBRAIC(:,145) =  CONSTANTS(:,226).*(STATES(:,27) - CONSTANTS(:,225));
    ALGEBRAIC(:,21) =  CONSTANTS(:,37).*STATES(:,5)+ CONSTANTS(:,38).*STATES(:,5)+ CONSTANTS(:,39).*STATES(:,5)+ CONSTANTS(:,40).*STATES(:,5)+ CONSTANTS(:,41).*STATES(:,5)+ CONSTANTS(:,42).*STATES(:,5)+ CONSTANTS(:,43).*STATES(:,5)+ CONSTANTS(:,44).*STATES(:,5)+ CONSTANTS(:,45).*STATES(:,5);
    ALGEBRAIC(:,155) =  ALGEBRAIC(:,21).*(STATES(:,27) - CONSTANTS(:,225));
    RATES(:,27) = ( - (ALGEBRAIC(:,125)+ALGEBRAIC(:,95)+ALGEBRAIC(:,105)+ALGEBRAIC(:,135)+ALGEBRAIC(:,145)+ALGEBRAIC(:,155))+CONSTANTS(:,204))./CONSTANTS(:,203);
    ALGEBRAIC(:,116) = 1.00000./(1.00000+exp((STATES(:,31) - CONSTANTS(:,246))./CONSTANTS(:,247)));
    ALGEBRAIC(:,126) =  CONSTANTS(:,245).*ALGEBRAIC(:,116).*STATES(:,34).*(STATES(:,31) - CONSTANTS(:,233));
    ALGEBRAIC(:,71) = 1.00000./(1.00000+exp((STATES(:,31) - CONSTANTS(:,235))./CONSTANTS(:,236)));
    ALGEBRAIC(:,96) =  CONSTANTS(:,234).*ALGEBRAIC(:,71) .^ 3.00000.*(1.00000 - STATES(:,32)).*(STATES(:,31) - CONSTANTS(:,233));
    ALGEBRAIC(:,106) =  CONSTANTS(:,240).*STATES(:,33) .^ 4.00000.*(STATES(:,31) - CONSTANTS(:,241));
    ALGEBRAIC(:,136) =  CONSTANTS(:,251).*(STATES(:,31) - CONSTANTS(:,252));
    ALGEBRAIC(:,146) =  CONSTANTS(:,254).*(STATES(:,31) - CONSTANTS(:,253));
    ALGEBRAIC(:,26) =  CONSTANTS(:,46).*STATES(:,6)+ CONSTANTS(:,47).*STATES(:,6)+ CONSTANTS(:,48).*STATES(:,6)+ CONSTANTS(:,49).*STATES(:,6)+ CONSTANTS(:,50).*STATES(:,6)+ CONSTANTS(:,51).*STATES(:,6)+ CONSTANTS(:,52).*STATES(:,6)+ CONSTANTS(:,53).*STATES(:,6)+ CONSTANTS(:,54).*STATES(:,6);
    ALGEBRAIC(:,156) =  ALGEBRAIC(:,26).*(STATES(:,31) - CONSTANTS(:,253));
    RATES(:,31) = ( - (ALGEBRAIC(:,126)+ALGEBRAIC(:,96)+ALGEBRAIC(:,106)+ALGEBRAIC(:,136)+ALGEBRAIC(:,146)+ALGEBRAIC(:,156))+CONSTANTS(:,232))./CONSTANTS(:,231);
    ALGEBRAIC(:,117) = 1.00000./(1.00000+exp((STATES(:,35) - CONSTANTS(:,274))./CONSTANTS(:,275)));
    ALGEBRAIC(:,127) =  CONSTANTS(:,273).*ALGEBRAIC(:,117).*STATES(:,38).*(STATES(:,35) - CONSTANTS(:,261));
    ALGEBRAIC(:,75) = 1.00000./(1.00000+exp((STATES(:,35) - CONSTANTS(:,263))./CONSTANTS(:,264)));
    ALGEBRAIC(:,97) =  CONSTANTS(:,262).*ALGEBRAIC(:,75) .^ 3.00000.*(1.00000 - STATES(:,36)).*(STATES(:,35) - CONSTANTS(:,261));
    ALGEBRAIC(:,107) =  CONSTANTS(:,268).*STATES(:,37) .^ 4.00000.*(STATES(:,35) - CONSTANTS(:,269));
    ALGEBRAIC(:,137) =  CONSTANTS(:,279).*(STATES(:,35) - CONSTANTS(:,280));
    ALGEBRAIC(:,147) =  CONSTANTS(:,282).*(STATES(:,35) - CONSTANTS(:,281));
    ALGEBRAIC(:,31) =  CONSTANTS(:,55).*STATES(:,7)+ CONSTANTS(:,56).*STATES(:,7)+ CONSTANTS(:,57).*STATES(:,7)+ CONSTANTS(:,58).*STATES(:,7)+ CONSTANTS(:,59).*STATES(:,7)+ CONSTANTS(:,60).*STATES(:,7)+ CONSTANTS(:,61).*STATES(:,7)+ CONSTANTS(:,62).*STATES(:,7)+ CONSTANTS(:,63).*STATES(:,7);
    ALGEBRAIC(:,157) =  ALGEBRAIC(:,31).*(STATES(:,35) - CONSTANTS(:,281));
    RATES(:,35) = ( - (ALGEBRAIC(:,127)+ALGEBRAIC(:,97)+ALGEBRAIC(:,107)+ALGEBRAIC(:,137)+ALGEBRAIC(:,147)+ALGEBRAIC(:,157))+CONSTANTS(:,260))./CONSTANTS(:,259);
    ALGEBRAIC(:,118) = 1.00000./(1.00000+exp((STATES(:,39) - CONSTANTS(:,302))./CONSTANTS(:,303)));
    ALGEBRAIC(:,128) =  CONSTANTS(:,301).*ALGEBRAIC(:,118).*STATES(:,42).*(STATES(:,39) - CONSTANTS(:,289));
    ALGEBRAIC(:,79) = 1.00000./(1.00000+exp((STATES(:,39) - CONSTANTS(:,291))./CONSTANTS(:,292)));
    ALGEBRAIC(:,98) =  CONSTANTS(:,290).*ALGEBRAIC(:,79) .^ 3.00000.*(1.00000 - STATES(:,40)).*(STATES(:,39) - CONSTANTS(:,289));
    ALGEBRAIC(:,108) =  CONSTANTS(:,296).*STATES(:,41) .^ 4.00000.*(STATES(:,39) - CONSTANTS(:,297));
    ALGEBRAIC(:,138) =  CONSTANTS(:,307).*(STATES(:,39) - CONSTANTS(:,308));
    ALGEBRAIC(:,148) =  CONSTANTS(:,310).*(STATES(:,39) - CONSTANTS(:,309));
    ALGEBRAIC(:,36) =  CONSTANTS(:,64).*STATES(:,8)+ CONSTANTS(:,65).*STATES(:,8)+ CONSTANTS(:,66).*STATES(:,8)+ CONSTANTS(:,67).*STATES(:,8)+ CONSTANTS(:,68).*STATES(:,8)+ CONSTANTS(:,69).*STATES(:,8)+ CONSTANTS(:,70).*STATES(:,8)+ CONSTANTS(:,71).*STATES(:,8)+ CONSTANTS(:,72).*STATES(:,8);
    ALGEBRAIC(:,158) =  ALGEBRAIC(:,36).*(STATES(:,39) - CONSTANTS(:,309));
    RATES(:,39) = ( - (ALGEBRAIC(:,128)+ALGEBRAIC(:,98)+ALGEBRAIC(:,108)+ALGEBRAIC(:,138)+ALGEBRAIC(:,148)+ALGEBRAIC(:,158))+CONSTANTS(:,288))./CONSTANTS(:,287);
    ALGEBRAIC(:,119) = 1.00000./(1.00000+exp((STATES(:,43) - CONSTANTS(:,330))./CONSTANTS(:,331)));
    ALGEBRAIC(:,129) =  CONSTANTS(:,329).*ALGEBRAIC(:,119).*STATES(:,46).*(STATES(:,43) - CONSTANTS(:,317));
    ALGEBRAIC(:,83) = 1.00000./(1.00000+exp((STATES(:,43) - CONSTANTS(:,319))./CONSTANTS(:,320)));
    ALGEBRAIC(:,99) =  CONSTANTS(:,318).*ALGEBRAIC(:,83) .^ 3.00000.*(1.00000 - STATES(:,44)).*(STATES(:,43) - CONSTANTS(:,317));
    ALGEBRAIC(:,109) =  CONSTANTS(:,324).*STATES(:,45) .^ 4.00000.*(STATES(:,43) - CONSTANTS(:,325));
    ALGEBRAIC(:,139) =  CONSTANTS(:,335).*(STATES(:,43) - CONSTANTS(:,336));
    ALGEBRAIC(:,149) =  CONSTANTS(:,338).*(STATES(:,43) - CONSTANTS(:,337));
    ALGEBRAIC(:,41) =  CONSTANTS(:,73).*STATES(:,9)+ CONSTANTS(:,74).*STATES(:,9)+ CONSTANTS(:,75).*STATES(:,9)+ CONSTANTS(:,76).*STATES(:,9)+ CONSTANTS(:,77).*STATES(:,9)+ CONSTANTS(:,78).*STATES(:,9)+ CONSTANTS(:,79).*STATES(:,9)+ CONSTANTS(:,80).*STATES(:,9)+ CONSTANTS(:,81).*STATES(:,9);
    ALGEBRAIC(:,159) =  ALGEBRAIC(:,41).*(STATES(:,43) - CONSTANTS(:,337));
    RATES(:,43) = ( - (ALGEBRAIC(:,129)+ALGEBRAIC(:,99)+ALGEBRAIC(:,109)+ALGEBRAIC(:,139)+ALGEBRAIC(:,149)+ALGEBRAIC(:,159))+CONSTANTS(:,316))./CONSTANTS(:,315);
    ALGEBRAIC(:,120) = 1.00000./(1.00000+exp((STATES(:,47) - CONSTANTS(:,358))./CONSTANTS(:,359)));
    ALGEBRAIC(:,130) =  CONSTANTS(:,357).*ALGEBRAIC(:,120).*STATES(:,50).*(STATES(:,47) - CONSTANTS(:,345));
    ALGEBRAIC(:,87) = 1.00000./(1.00000+exp((STATES(:,47) - CONSTANTS(:,347))./CONSTANTS(:,348)));
    ALGEBRAIC(:,100) =  CONSTANTS(:,346).*ALGEBRAIC(:,87) .^ 3.00000.*(1.00000 - STATES(:,48)).*(STATES(:,47) - CONSTANTS(:,345));
    ALGEBRAIC(:,110) =  CONSTANTS(:,352).*STATES(:,49) .^ 4.00000.*(STATES(:,47) - CONSTANTS(:,353));
    ALGEBRAIC(:,140) =  CONSTANTS(:,363).*(STATES(:,47) - CONSTANTS(:,364));
    ALGEBRAIC(:,150) =  CONSTANTS(:,366).*(STATES(:,47) - CONSTANTS(:,365));
    ALGEBRAIC(:,46) =  CONSTANTS(:,82).*STATES(:,10)+ CONSTANTS(:,83).*STATES(:,10)+ CONSTANTS(:,84).*STATES(:,10)+ CONSTANTS(:,85).*STATES(:,10)+ CONSTANTS(:,86).*STATES(:,10)+ CONSTANTS(:,87).*STATES(:,10)+ CONSTANTS(:,88).*STATES(:,10)+ CONSTANTS(:,89).*STATES(:,10)+ CONSTANTS(:,90).*STATES(:,10);
    ALGEBRAIC(:,160) =  ALGEBRAIC(:,46).*(STATES(:,47) - CONSTANTS(:,365));
    RATES(:,47) = ( - (ALGEBRAIC(:,130)+ALGEBRAIC(:,100)+ALGEBRAIC(:,110)+ALGEBRAIC(:,140)+ALGEBRAIC(:,150)+ALGEBRAIC(:,160))+CONSTANTS(:,344))./CONSTANTS(:,343);
   RATES = RATES';
end

% Calculate algebraic variables
function ALGEBRAIC = computeAlgebraic(ALGEBRAIC, CONSTANTS, STATES, VOI)
    ALGEBRAIC(:,5) = 1.00000./(1.00000+exp((STATES(:,11) - CONSTANTS(:,118))./CONSTANTS(:,117)));
    ALGEBRAIC(:,10) = 1.00000./(1.00000+exp((STATES(:,15) - CONSTANTS(:,146))./CONSTANTS(:,145)));
    ALGEBRAIC(:,15) = 1.00000./(1.00000+exp((STATES(:,19) - CONSTANTS(:,174))./CONSTANTS(:,173)));
    ALGEBRAIC(:,20) = 1.00000./(1.00000+exp((STATES(:,23) - CONSTANTS(:,202))./CONSTANTS(:,201)));
    ALGEBRAIC(:,25) = 1.00000./(1.00000+exp((STATES(:,27) - CONSTANTS(:,230))./CONSTANTS(:,229)));
    ALGEBRAIC(:,30) = 1.00000./(1.00000+exp((STATES(:,31) - CONSTANTS(:,258))./CONSTANTS(:,257)));
    ALGEBRAIC(:,35) = 1.00000./(1.00000+exp((STATES(:,35) - CONSTANTS(:,286))./CONSTANTS(:,285)));
    ALGEBRAIC(:,40) = 1.00000./(1.00000+exp((STATES(:,39) - CONSTANTS(:,314))./CONSTANTS(:,313)));
    ALGEBRAIC(:,45) = 1.00000./(1.00000+exp((STATES(:,43) - CONSTANTS(:,342))./CONSTANTS(:,341)));
    ALGEBRAIC(:,50) = 1.00000./(1.00000+exp((STATES(:,47) - CONSTANTS(:,370))./CONSTANTS(:,369)));
    ALGEBRAIC(:,2) = 1.00000./(1.00000+exp((STATES(:,11) - CONSTANTS(:,98))./CONSTANTS(:,99)));
    ALGEBRAIC(:,52) = CONSTANTS(:,97)./cosh((STATES(:,11) - CONSTANTS(:,98))./( 2.00000.*CONSTANTS(:,99)));
    ALGEBRAIC(:,3) = 1.00000./(1.00000+exp((STATES(:,11) - CONSTANTS(:,103))./CONSTANTS(:,104)));
    ALGEBRAIC(:,53) = CONSTANTS(:,102)./cosh((STATES(:,11) - CONSTANTS(:,103))./( 2.00000.*CONSTANTS(:,104)));
    ALGEBRAIC(:,4) = 1.00000./(1.00000+exp((STATES(:,11) - CONSTANTS(:,109))./CONSTANTS(:,110)));
    ALGEBRAIC(:,54) = CONSTANTS(:,108)./cosh((STATES(:,11) - CONSTANTS(:,109))./( 2.00000.*CONSTANTS(:,110)));
    ALGEBRAIC(:,7) = 1.00000./(1.00000+exp((STATES(:,15) - CONSTANTS(:,126))./CONSTANTS(:,127)));
    ALGEBRAIC(:,56) = CONSTANTS(:,125)./cosh((STATES(:,15) - CONSTANTS(:,126))./( 2.00000.*CONSTANTS(:,127)));
    ALGEBRAIC(:,8) = 1.00000./(1.00000+exp((STATES(:,15) - CONSTANTS(:,131))./CONSTANTS(:,132)));
    ALGEBRAIC(:,57) = CONSTANTS(:,130)./cosh((STATES(:,15) - CONSTANTS(:,131))./( 2.00000.*CONSTANTS(:,132)));
    ALGEBRAIC(:,9) = 1.00000./(1.00000+exp((STATES(:,15) - CONSTANTS(:,137))./CONSTANTS(:,138)));
    ALGEBRAIC(:,58) = CONSTANTS(:,136)./cosh((STATES(:,15) - CONSTANTS(:,137))./( 2.00000.*CONSTANTS(:,138)));
    ALGEBRAIC(:,12) = 1.00000./(1.00000+exp((STATES(:,19) - CONSTANTS(:,154))./CONSTANTS(:,155)));
    ALGEBRAIC(:,60) = CONSTANTS(:,153)./cosh((STATES(:,19) - CONSTANTS(:,154))./( 2.00000.*CONSTANTS(:,155)));
    ALGEBRAIC(:,13) = 1.00000./(1.00000+exp((STATES(:,19) - CONSTANTS(:,159))./CONSTANTS(:,160)));
    ALGEBRAIC(:,61) = CONSTANTS(:,158)./cosh((STATES(:,19) - CONSTANTS(:,159))./( 2.00000.*CONSTANTS(:,160)));
    ALGEBRAIC(:,14) = 1.00000./(1.00000+exp((STATES(:,19) - CONSTANTS(:,165))./CONSTANTS(:,166)));
    ALGEBRAIC(:,62) = CONSTANTS(:,164)./cosh((STATES(:,19) - CONSTANTS(:,165))./( 2.00000.*CONSTANTS(:,166)));
    ALGEBRAIC(:,17) = 1.00000./(1.00000+exp((STATES(:,23) - CONSTANTS(:,182))./CONSTANTS(:,183)));
    ALGEBRAIC(:,64) = CONSTANTS(:,181)./cosh((STATES(:,23) - CONSTANTS(:,182))./( 2.00000.*CONSTANTS(:,183)));
    ALGEBRAIC(:,18) = 1.00000./(1.00000+exp((STATES(:,23) - CONSTANTS(:,187))./CONSTANTS(:,188)));
    ALGEBRAIC(:,65) = CONSTANTS(:,186)./cosh((STATES(:,23) - CONSTANTS(:,187))./( 2.00000.*CONSTANTS(:,188)));
    ALGEBRAIC(:,19) = 1.00000./(1.00000+exp((STATES(:,23) - CONSTANTS(:,193))./CONSTANTS(:,194)));
    ALGEBRAIC(:,66) = CONSTANTS(:,192)./cosh((STATES(:,23) - CONSTANTS(:,193))./( 2.00000.*CONSTANTS(:,194)));
    ALGEBRAIC(:,22) = 1.00000./(1.00000+exp((STATES(:,27) - CONSTANTS(:,210))./CONSTANTS(:,211)));
    ALGEBRAIC(:,68) = CONSTANTS(:,209)./cosh((STATES(:,27) - CONSTANTS(:,210))./( 2.00000.*CONSTANTS(:,211)));
    ALGEBRAIC(:,23) = 1.00000./(1.00000+exp((STATES(:,27) - CONSTANTS(:,215))./CONSTANTS(:,216)));
    ALGEBRAIC(:,69) = CONSTANTS(:,214)./cosh((STATES(:,27) - CONSTANTS(:,215))./( 2.00000.*CONSTANTS(:,216)));
    ALGEBRAIC(:,24) = 1.00000./(1.00000+exp((STATES(:,27) - CONSTANTS(:,221))./CONSTANTS(:,222)));
    ALGEBRAIC(:,70) = CONSTANTS(:,220)./cosh((STATES(:,27) - CONSTANTS(:,221))./( 2.00000.*CONSTANTS(:,222)));
    ALGEBRAIC(:,27) = 1.00000./(1.00000+exp((STATES(:,31) - CONSTANTS(:,238))./CONSTANTS(:,239)));
    ALGEBRAIC(:,72) = CONSTANTS(:,237)./cosh((STATES(:,31) - CONSTANTS(:,238))./( 2.00000.*CONSTANTS(:,239)));
    ALGEBRAIC(:,28) = 1.00000./(1.00000+exp((STATES(:,31) - CONSTANTS(:,243))./CONSTANTS(:,244)));
    ALGEBRAIC(:,73) = CONSTANTS(:,242)./cosh((STATES(:,31) - CONSTANTS(:,243))./( 2.00000.*CONSTANTS(:,244)));
    ALGEBRAIC(:,29) = 1.00000./(1.00000+exp((STATES(:,31) - CONSTANTS(:,249))./CONSTANTS(:,250)));
    ALGEBRAIC(:,74) = CONSTANTS(:,248)./cosh((STATES(:,31) - CONSTANTS(:,249))./( 2.00000.*CONSTANTS(:,250)));
    ALGEBRAIC(:,32) = 1.00000./(1.00000+exp((STATES(:,35) - CONSTANTS(:,266))./CONSTANTS(:,267)));
    ALGEBRAIC(:,76) = CONSTANTS(:,265)./cosh((STATES(:,35) - CONSTANTS(:,266))./( 2.00000.*CONSTANTS(:,267)));
    ALGEBRAIC(:,33) = 1.00000./(1.00000+exp((STATES(:,35) - CONSTANTS(:,271))./CONSTANTS(:,272)));
    ALGEBRAIC(:,77) = CONSTANTS(:,270)./cosh((STATES(:,35) - CONSTANTS(:,271))./( 2.00000.*CONSTANTS(:,272)));
    ALGEBRAIC(:,34) = 1.00000./(1.00000+exp((STATES(:,35) - CONSTANTS(:,277))./CONSTANTS(:,278)));
    ALGEBRAIC(:,78) = CONSTANTS(:,276)./cosh((STATES(:,35) - CONSTANTS(:,277))./( 2.00000.*CONSTANTS(:,278)));
    ALGEBRAIC(:,37) = 1.00000./(1.00000+exp((STATES(:,39) - CONSTANTS(:,294))./CONSTANTS(:,295)));
    ALGEBRAIC(:,80) = CONSTANTS(:,293)./cosh((STATES(:,39) - CONSTANTS(:,294))./( 2.00000.*CONSTANTS(:,295)));
    ALGEBRAIC(:,38) = 1.00000./(1.00000+exp((STATES(:,39) - CONSTANTS(:,299))./CONSTANTS(:,300)));
    ALGEBRAIC(:,81) = CONSTANTS(:,298)./cosh((STATES(:,39) - CONSTANTS(:,299))./( 2.00000.*CONSTANTS(:,300)));
    ALGEBRAIC(:,39) = 1.00000./(1.00000+exp((STATES(:,39) - CONSTANTS(:,305))./CONSTANTS(:,306)));
    ALGEBRAIC(:,82) = CONSTANTS(:,304)./cosh((STATES(:,39) - CONSTANTS(:,305))./( 2.00000.*CONSTANTS(:,306)));
    ALGEBRAIC(:,42) = 1.00000./(1.00000+exp((STATES(:,43) - CONSTANTS(:,322))./CONSTANTS(:,323)));
    ALGEBRAIC(:,84) = CONSTANTS(:,321)./cosh((STATES(:,43) - CONSTANTS(:,322))./( 2.00000.*CONSTANTS(:,323)));
    ALGEBRAIC(:,43) = 1.00000./(1.00000+exp((STATES(:,43) - CONSTANTS(:,327))./CONSTANTS(:,328)));
    ALGEBRAIC(:,85) = CONSTANTS(:,326)./cosh((STATES(:,43) - CONSTANTS(:,327))./( 2.00000.*CONSTANTS(:,328)));
    ALGEBRAIC(:,44) = 1.00000./(1.00000+exp((STATES(:,43) - CONSTANTS(:,333))./CONSTANTS(:,334)));
    ALGEBRAIC(:,86) = CONSTANTS(:,332)./cosh((STATES(:,43) - CONSTANTS(:,333))./( 2.00000.*CONSTANTS(:,334)));
    ALGEBRAIC(:,47) = 1.00000./(1.00000+exp((STATES(:,47) - CONSTANTS(:,350))./CONSTANTS(:,351)));
    ALGEBRAIC(:,88) = CONSTANTS(:,349)./cosh((STATES(:,47) - CONSTANTS(:,350))./( 2.00000.*CONSTANTS(:,351)));
    ALGEBRAIC(:,48) = 1.00000./(1.00000+exp((STATES(:,47) - CONSTANTS(:,355))./CONSTANTS(:,356)));
    ALGEBRAIC(:,89) = CONSTANTS(:,354)./cosh((STATES(:,47) - CONSTANTS(:,355))./( 2.00000.*CONSTANTS(:,356)));
    ALGEBRAIC(:,49) = 1.00000./(1.00000+exp((STATES(:,47) - CONSTANTS(:,361))./CONSTANTS(:,362)));
    ALGEBRAIC(:,90) = CONSTANTS(:,360)./cosh((STATES(:,47) - CONSTANTS(:,361))./( 2.00000.*CONSTANTS(:,362)));
    ALGEBRAIC(:,111) = 1.00000./(1.00000+exp((STATES(:,11) - CONSTANTS(:,106))./CONSTANTS(:,107)));
    ALGEBRAIC(:,121) =  CONSTANTS(:,105).*ALGEBRAIC(:,111).*STATES(:,14).*(STATES(:,11) - CONSTANTS(:,93));
    ALGEBRAIC(:,51) = 1.00000./(1.00000+exp((STATES(:,11) - CONSTANTS(:,95))./CONSTANTS(:,96)));
    ALGEBRAIC(:,91) =  CONSTANTS(:,94).*ALGEBRAIC(:,51) .^ 3.00000.*(1.00000 - STATES(:,12)).*(STATES(:,11) - CONSTANTS(:,93));
    ALGEBRAIC(:,101) =  CONSTANTS(:,100).*STATES(:,13) .^ 4.00000.*(STATES(:,11) - CONSTANTS(:,101));
    ALGEBRAIC(:,131) =  CONSTANTS(:,111).*(STATES(:,11) - CONSTANTS(:,112));
    ALGEBRAIC(:,141) =  CONSTANTS(:,114).*(STATES(:,11) - CONSTANTS(:,113));
    ALGEBRAIC(:,1) =  CONSTANTS(:,1).*STATES(:,1)+ CONSTANTS(:,2).*STATES(:,1)+ CONSTANTS(:,3).*STATES(:,1)+ CONSTANTS(:,4).*STATES(:,1)+ CONSTANTS(:,5).*STATES(:,1)+ CONSTANTS(:,6).*STATES(:,1)+ CONSTANTS(:,7).*STATES(:,1)+ CONSTANTS(:,8).*STATES(:,1)+ CONSTANTS(:,9).*STATES(:,1);
    ALGEBRAIC(:,151) =  ALGEBRAIC(:,1).*(STATES(:,11) - CONSTANTS(:,113));
    ALGEBRAIC(:,112) = 1.00000./(1.00000+exp((STATES(:,15) - CONSTANTS(:,134))./CONSTANTS(:,135)));
    ALGEBRAIC(:,122) =  CONSTANTS(:,133).*ALGEBRAIC(:,112).*STATES(:,18).*(STATES(:,15) - CONSTANTS(:,121));
    ALGEBRAIC(:,55) = 1.00000./(1.00000+exp((STATES(:,15) - CONSTANTS(:,123))./CONSTANTS(:,124)));
    ALGEBRAIC(:,92) =  CONSTANTS(:,122).*ALGEBRAIC(:,55) .^ 3.00000.*(1.00000 - STATES(:,16)).*(STATES(:,15) - CONSTANTS(:,121));
    ALGEBRAIC(:,102) =  CONSTANTS(:,128).*STATES(:,17) .^ 4.00000.*(STATES(:,15) - CONSTANTS(:,129));
    ALGEBRAIC(:,132) =  CONSTANTS(:,139).*(STATES(:,15) - CONSTANTS(:,140));
    ALGEBRAIC(:,142) =  CONSTANTS(:,142).*(STATES(:,15) - CONSTANTS(:,141));
    ALGEBRAIC(:,6) =  CONSTANTS(:,10).*STATES(:,2)+ CONSTANTS(:,11).*STATES(:,2)+ CONSTANTS(:,12).*STATES(:,2)+ CONSTANTS(:,13).*STATES(:,2)+ CONSTANTS(:,14).*STATES(:,2)+ CONSTANTS(:,15).*STATES(:,2)+ CONSTANTS(:,16).*STATES(:,2)+ CONSTANTS(:,17).*STATES(:,2)+ CONSTANTS(:,18).*STATES(:,2);
    ALGEBRAIC(:,152) =  ALGEBRAIC(:,6).*(STATES(:,15) - CONSTANTS(:,141));
    ALGEBRAIC(:,113) = 1.00000./(1.00000+exp((STATES(:,19) - CONSTANTS(:,162))./CONSTANTS(:,163)));
    ALGEBRAIC(:,123) =  CONSTANTS(:,161).*ALGEBRAIC(:,113).*STATES(:,22).*(STATES(:,19) - CONSTANTS(:,149));
    ALGEBRAIC(:,59) = 1.00000./(1.00000+exp((STATES(:,19) - CONSTANTS(:,151))./CONSTANTS(:,152)));
    ALGEBRAIC(:,93) =  CONSTANTS(:,150).*ALGEBRAIC(:,59) .^ 3.00000.*(1.00000 - STATES(:,20)).*(STATES(:,19) - CONSTANTS(:,149));
    ALGEBRAIC(:,103) =  CONSTANTS(:,156).*STATES(:,21) .^ 4.00000.*(STATES(:,19) - CONSTANTS(:,157));
    ALGEBRAIC(:,133) =  CONSTANTS(:,167).*(STATES(:,19) - CONSTANTS(:,168));
    ALGEBRAIC(:,143) =  CONSTANTS(:,170).*(STATES(:,19) - CONSTANTS(:,169));
    ALGEBRAIC(:,11) =  CONSTANTS(:,19).*STATES(:,3)+ CONSTANTS(:,20).*STATES(:,3)+ CONSTANTS(:,21).*STATES(:,3)+ CONSTANTS(:,22).*STATES(:,3)+ CONSTANTS(:,23).*STATES(:,3)+ CONSTANTS(:,24).*STATES(:,3)+ CONSTANTS(:,25).*STATES(:,3)+ CONSTANTS(:,26).*STATES(:,3)+ CONSTANTS(:,27).*STATES(:,3);
    ALGEBRAIC(:,153) =  ALGEBRAIC(:,11).*(STATES(:,19) - CONSTANTS(:,169));
    ALGEBRAIC(:,114) = 1.00000./(1.00000+exp((STATES(:,23) - CONSTANTS(:,190))./CONSTANTS(:,191)));
    ALGEBRAIC(:,124) =  CONSTANTS(:,189).*ALGEBRAIC(:,114).*STATES(:,26).*(STATES(:,23) - CONSTANTS(:,177));
    ALGEBRAIC(:,63) = 1.00000./(1.00000+exp((STATES(:,23) - CONSTANTS(:,179))./CONSTANTS(:,180)));
    ALGEBRAIC(:,94) =  CONSTANTS(:,178).*ALGEBRAIC(:,63) .^ 3.00000.*(1.00000 - STATES(:,24)).*(STATES(:,23) - CONSTANTS(:,177));
    ALGEBRAIC(:,104) =  CONSTANTS(:,184).*STATES(:,25) .^ 4.00000.*(STATES(:,23) - CONSTANTS(:,185));
    ALGEBRAIC(:,134) =  CONSTANTS(:,195).*(STATES(:,23) - CONSTANTS(:,196));
    ALGEBRAIC(:,144) =  CONSTANTS(:,198).*(STATES(:,23) - CONSTANTS(:,197));
    ALGEBRAIC(:,16) =  CONSTANTS(:,28).*STATES(:,4)+ CONSTANTS(:,29).*STATES(:,4)+ CONSTANTS(:,30).*STATES(:,4)+ CONSTANTS(:,31).*STATES(:,4)+ CONSTANTS(:,32).*STATES(:,4)+ CONSTANTS(:,33).*STATES(:,4)+ CONSTANTS(:,34).*STATES(:,4)+ CONSTANTS(:,35).*STATES(:,4)+ CONSTANTS(:,36).*STATES(:,4);
    ALGEBRAIC(:,154) =  ALGEBRAIC(:,16).*(STATES(:,23) - CONSTANTS(:,197));
    ALGEBRAIC(:,115) = 1.00000./(1.00000+exp((STATES(:,27) - CONSTANTS(:,218))./CONSTANTS(:,219)));
    ALGEBRAIC(:,125) =  CONSTANTS(:,217).*ALGEBRAIC(:,115).*STATES(:,30).*(STATES(:,27) - CONSTANTS(:,205));
    ALGEBRAIC(:,67) = 1.00000./(1.00000+exp((STATES(:,27) - CONSTANTS(:,207))./CONSTANTS(:,208)));
    ALGEBRAIC(:,95) =  CONSTANTS(:,206).*ALGEBRAIC(:,67) .^ 3.00000.*(1.00000 - STATES(:,28)).*(STATES(:,27) - CONSTANTS(:,205));
    ALGEBRAIC(:,105) =  CONSTANTS(:,212).*STATES(:,29) .^ 4.00000.*(STATES(:,27) - CONSTANTS(:,213));
    ALGEBRAIC(:,135) =  CONSTANTS(:,223).*(STATES(:,27) - CONSTANTS(:,224));
    ALGEBRAIC(:,145) =  CONSTANTS(:,226).*(STATES(:,27) - CONSTANTS(:,225));
    ALGEBRAIC(:,21) =  CONSTANTS(:,37).*STATES(:,5)+ CONSTANTS(:,38).*STATES(:,5)+ CONSTANTS(:,39).*STATES(:,5)+ CONSTANTS(:,40).*STATES(:,5)+ CONSTANTS(:,41).*STATES(:,5)+ CONSTANTS(:,42).*STATES(:,5)+ CONSTANTS(:,43).*STATES(:,5)+ CONSTANTS(:,44).*STATES(:,5)+ CONSTANTS(:,45).*STATES(:,5);
    ALGEBRAIC(:,155) =  ALGEBRAIC(:,21).*(STATES(:,27) - CONSTANTS(:,225));
    ALGEBRAIC(:,116) = 1.00000./(1.00000+exp((STATES(:,31) - CONSTANTS(:,246))./CONSTANTS(:,247)));
    ALGEBRAIC(:,126) =  CONSTANTS(:,245).*ALGEBRAIC(:,116).*STATES(:,34).*(STATES(:,31) - CONSTANTS(:,233));
    ALGEBRAIC(:,71) = 1.00000./(1.00000+exp((STATES(:,31) - CONSTANTS(:,235))./CONSTANTS(:,236)));
    ALGEBRAIC(:,96) =  CONSTANTS(:,234).*ALGEBRAIC(:,71) .^ 3.00000.*(1.00000 - STATES(:,32)).*(STATES(:,31) - CONSTANTS(:,233));
    ALGEBRAIC(:,106) =  CONSTANTS(:,240).*STATES(:,33) .^ 4.00000.*(STATES(:,31) - CONSTANTS(:,241));
    ALGEBRAIC(:,136) =  CONSTANTS(:,251).*(STATES(:,31) - CONSTANTS(:,252));
    ALGEBRAIC(:,146) =  CONSTANTS(:,254).*(STATES(:,31) - CONSTANTS(:,253));
    ALGEBRAIC(:,26) =  CONSTANTS(:,46).*STATES(:,6)+ CONSTANTS(:,47).*STATES(:,6)+ CONSTANTS(:,48).*STATES(:,6)+ CONSTANTS(:,49).*STATES(:,6)+ CONSTANTS(:,50).*STATES(:,6)+ CONSTANTS(:,51).*STATES(:,6)+ CONSTANTS(:,52).*STATES(:,6)+ CONSTANTS(:,53).*STATES(:,6)+ CONSTANTS(:,54).*STATES(:,6);
    ALGEBRAIC(:,156) =  ALGEBRAIC(:,26).*(STATES(:,31) - CONSTANTS(:,253));
    ALGEBRAIC(:,117) = 1.00000./(1.00000+exp((STATES(:,35) - CONSTANTS(:,274))./CONSTANTS(:,275)));
    ALGEBRAIC(:,127) =  CONSTANTS(:,273).*ALGEBRAIC(:,117).*STATES(:,38).*(STATES(:,35) - CONSTANTS(:,261));
    ALGEBRAIC(:,75) = 1.00000./(1.00000+exp((STATES(:,35) - CONSTANTS(:,263))./CONSTANTS(:,264)));
    ALGEBRAIC(:,97) =  CONSTANTS(:,262).*ALGEBRAIC(:,75) .^ 3.00000.*(1.00000 - STATES(:,36)).*(STATES(:,35) - CONSTANTS(:,261));
    ALGEBRAIC(:,107) =  CONSTANTS(:,268).*STATES(:,37) .^ 4.00000.*(STATES(:,35) - CONSTANTS(:,269));
    ALGEBRAIC(:,137) =  CONSTANTS(:,279).*(STATES(:,35) - CONSTANTS(:,280));
    ALGEBRAIC(:,147) =  CONSTANTS(:,282).*(STATES(:,35) - CONSTANTS(:,281));
    ALGEBRAIC(:,31) =  CONSTANTS(:,55).*STATES(:,7)+ CONSTANTS(:,56).*STATES(:,7)+ CONSTANTS(:,57).*STATES(:,7)+ CONSTANTS(:,58).*STATES(:,7)+ CONSTANTS(:,59).*STATES(:,7)+ CONSTANTS(:,60).*STATES(:,7)+ CONSTANTS(:,61).*STATES(:,7)+ CONSTANTS(:,62).*STATES(:,7)+ CONSTANTS(:,63).*STATES(:,7);
    ALGEBRAIC(:,157) =  ALGEBRAIC(:,31).*(STATES(:,35) - CONSTANTS(:,281));
    ALGEBRAIC(:,118) = 1.00000./(1.00000+exp((STATES(:,39) - CONSTANTS(:,302))./CONSTANTS(:,303)));
    ALGEBRAIC(:,128) =  CONSTANTS(:,301).*ALGEBRAIC(:,118).*STATES(:,42).*(STATES(:,39) - CONSTANTS(:,289));
    ALGEBRAIC(:,79) = 1.00000./(1.00000+exp((STATES(:,39) - CONSTANTS(:,291))./CONSTANTS(:,292)));
    ALGEBRAIC(:,98) =  CONSTANTS(:,290).*ALGEBRAIC(:,79) .^ 3.00000.*(1.00000 - STATES(:,40)).*(STATES(:,39) - CONSTANTS(:,289));
    ALGEBRAIC(:,108) =  CONSTANTS(:,296).*STATES(:,41) .^ 4.00000.*(STATES(:,39) - CONSTANTS(:,297));
    ALGEBRAIC(:,138) =  CONSTANTS(:,307).*(STATES(:,39) - CONSTANTS(:,308));
    ALGEBRAIC(:,148) =  CONSTANTS(:,310).*(STATES(:,39) - CONSTANTS(:,309));
    ALGEBRAIC(:,36) =  CONSTANTS(:,64).*STATES(:,8)+ CONSTANTS(:,65).*STATES(:,8)+ CONSTANTS(:,66).*STATES(:,8)+ CONSTANTS(:,67).*STATES(:,8)+ CONSTANTS(:,68).*STATES(:,8)+ CONSTANTS(:,69).*STATES(:,8)+ CONSTANTS(:,70).*STATES(:,8)+ CONSTANTS(:,71).*STATES(:,8)+ CONSTANTS(:,72).*STATES(:,8);
    ALGEBRAIC(:,158) =  ALGEBRAIC(:,36).*(STATES(:,39) - CONSTANTS(:,309));
    ALGEBRAIC(:,119) = 1.00000./(1.00000+exp((STATES(:,43) - CONSTANTS(:,330))./CONSTANTS(:,331)));
    ALGEBRAIC(:,129) =  CONSTANTS(:,329).*ALGEBRAIC(:,119).*STATES(:,46).*(STATES(:,43) - CONSTANTS(:,317));
    ALGEBRAIC(:,83) = 1.00000./(1.00000+exp((STATES(:,43) - CONSTANTS(:,319))./CONSTANTS(:,320)));
    ALGEBRAIC(:,99) =  CONSTANTS(:,318).*ALGEBRAIC(:,83) .^ 3.00000.*(1.00000 - STATES(:,44)).*(STATES(:,43) - CONSTANTS(:,317));
    ALGEBRAIC(:,109) =  CONSTANTS(:,324).*STATES(:,45) .^ 4.00000.*(STATES(:,43) - CONSTANTS(:,325));
    ALGEBRAIC(:,139) =  CONSTANTS(:,335).*(STATES(:,43) - CONSTANTS(:,336));
    ALGEBRAIC(:,149) =  CONSTANTS(:,338).*(STATES(:,43) - CONSTANTS(:,337));
    ALGEBRAIC(:,41) =  CONSTANTS(:,73).*STATES(:,9)+ CONSTANTS(:,74).*STATES(:,9)+ CONSTANTS(:,75).*STATES(:,9)+ CONSTANTS(:,76).*STATES(:,9)+ CONSTANTS(:,77).*STATES(:,9)+ CONSTANTS(:,78).*STATES(:,9)+ CONSTANTS(:,79).*STATES(:,9)+ CONSTANTS(:,80).*STATES(:,9)+ CONSTANTS(:,81).*STATES(:,9);
    ALGEBRAIC(:,159) =  ALGEBRAIC(:,41).*(STATES(:,43) - CONSTANTS(:,337));
    ALGEBRAIC(:,120) = 1.00000./(1.00000+exp((STATES(:,47) - CONSTANTS(:,358))./CONSTANTS(:,359)));
    ALGEBRAIC(:,130) =  CONSTANTS(:,357).*ALGEBRAIC(:,120).*STATES(:,50).*(STATES(:,47) - CONSTANTS(:,345));
    ALGEBRAIC(:,87) = 1.00000./(1.00000+exp((STATES(:,47) - CONSTANTS(:,347))./CONSTANTS(:,348)));
    ALGEBRAIC(:,100) =  CONSTANTS(:,346).*ALGEBRAIC(:,87) .^ 3.00000.*(1.00000 - STATES(:,48)).*(STATES(:,47) - CONSTANTS(:,345));
    ALGEBRAIC(:,110) =  CONSTANTS(:,352).*STATES(:,49) .^ 4.00000.*(STATES(:,47) - CONSTANTS(:,353));
    ALGEBRAIC(:,140) =  CONSTANTS(:,363).*(STATES(:,47) - CONSTANTS(:,364));
    ALGEBRAIC(:,150) =  CONSTANTS(:,366).*(STATES(:,47) - CONSTANTS(:,365));
    ALGEBRAIC(:,46) =  CONSTANTS(:,82).*STATES(:,10)+ CONSTANTS(:,83).*STATES(:,10)+ CONSTANTS(:,84).*STATES(:,10)+ CONSTANTS(:,85).*STATES(:,10)+ CONSTANTS(:,86).*STATES(:,10)+ CONSTANTS(:,87).*STATES(:,10)+ CONSTANTS(:,88).*STATES(:,10)+ CONSTANTS(:,89).*STATES(:,10)+ CONSTANTS(:,90).*STATES(:,10);
    ALGEBRAIC(:,160) =  ALGEBRAIC(:,46).*(STATES(:,47) - CONSTANTS(:,365));
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