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 =62;
end
% There are a total of 5 entries in each of the rate and state variable arrays.
% There are a total of 584 entries in the constant variable array.
%

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

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

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

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

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

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

function [LEGEND_STATES, LEGEND_ALGEBRAIC, LEGEND_VOI, LEGEND_CONSTANTS] = createLegends()
    LEGEND_STATES = ''; LEGEND_ALGEBRAIC = ''; LEGEND_VOI = ''; LEGEND_CONSTANTS = '';
    LEGEND_CONSTANTS(:,1) = strpad('ANU in component input_values (dimensionless)');
    LEGEND_CONSTANTS(:,2) = strpad('ADHMV in component input_values (dimensionless)');
    LEGEND_CONSTANTS(:,3) = strpad('PAMK in component input_values (dimensionless)');
    LEGEND_CONSTANTS(:,4) = strpad('ATRRFB in component input_values (dimensionless)');
    LEGEND_CONSTANTS(:,5) = strpad('MYOGRS in component input_values (dimensionless)');
    LEGEND_CONSTANTS(:,6) = strpad('ARM in component input_values (dimensionless)');
    LEGEND_CONSTANTS(:,7) = strpad('VIM in component input_values (dimensionless)');
    LEGEND_CONSTANTS(:,8) = strpad('AVE in component input_values (dimensionless)');
    LEGEND_CONSTANTS(:,9) = strpad('ANUVN in component input_values (dimensionless)');
    LEGEND_CONSTANTS(:,10) = strpad('PC in component input_values (mmHg)');
    LEGEND_CONSTANTS(:,11) = strpad('RBF in component input_values (L_per_minute)');
    LEGEND_CONSTANTS(:,12) = strpad('VVR in component input_values (litre)');
    LEGEND_CONSTANTS(:,13) = strpad('VV6 in component input_values (litre)');
    LEGEND_CONSTANTS(:,14) = strpad('VV7 in component input_values (litre)');
    LEGEND_CONSTANTS(:,15) = strpad('ATRVFB in component input_values (litre)');
    LEGEND_CONSTANTS(:,16) = strpad('VP in component input_values (litre)');
    LEGEND_CONSTANTS(:,17) = strpad('VRC in component input_values (litre)');
    LEGEND_CONSTANTS(:,18) = strpad('HPR in component input_values (dimensionless)');
    LEGEND_CONSTANTS(:,19) = strpad('HMD in component input_values (dimensionless)');
    LEGEND_CONSTANTS(:,20) = strpad('AUH in component input_values (dimensionless)');
    LEGEND_CONSTANTS(:,21) = strpad('OSA in component input_values (dimensionless)');
    LEGEND_CONSTANTS(:,22) = strpad('HPL in component input_values (dimensionless)');
    LEGEND_CONSTANTS(:,23) = strpad('AMM in component input_values (dimensionless)');
    LEGEND_CONSTANTS(:,24) = strpad('AUM in component input_values (dimensionless)');
    LEGEND_CONSTANTS(:,25) = strpad('AU in component input_values (dimensionless)');
    LEGEND_VOI = strpad('time in component environment (minute)');
    LEGEND_CONSTANTS(:,26) = strpad('A1K in component parameter_values (minute)');
    LEGEND_CONSTANTS(:,27) = strpad('A2K in component parameter_values (minute)');
    LEGEND_CONSTANTS(:,28) = strpad('A3K in component parameter_values (minute)');
    LEGEND_CONSTANTS(:,29) = strpad('A4K in component parameter_values (minute)');
    LEGEND_CONSTANTS(:,30) = strpad('A4K2 in component parameter_values (minute)');
    LEGEND_CONSTANTS(:,31) = strpad('AARK in component parameter_values (mmHg_minute_per_L)');
    LEGEND_CONSTANTS(:,32) = strpad('AARLL in component parameter_values (mmHg_minute_per_L)');
    LEGEND_CONSTANTS(:,33) = strpad('ADHINF in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,34) = strpad('ADHKLL in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,35) = strpad('ADHKUL in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,36) = strpad('ADHPAM in component parameter_values (per_mmHg2)');
    LEGEND_CONSTANTS(:,37) = strpad('ADHPUL in component parameter_values (mmHg)');
    LEGEND_CONSTANTS(:,38) = strpad('ADHTC in component parameter_values (minute)');
    LEGEND_CONSTANTS(:,39) = strpad('ADHVLL in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,40) = strpad('ADHVUL in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,41) = strpad('AH10 in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,42) = strpad('AH11 in component parameter_values (minute)');
    LEGEND_CONSTANTS(:,43) = strpad('AH9 in component parameter_values (per_mmHg)');
    LEGEND_CONSTANTS(:,44) = strpad('AHMNAR in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,45) = strpad('AHTHM in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,46) = strpad('ALCLK in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,47) = strpad('ALDINF in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,48) = strpad('ALDKNS in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,49) = strpad('ALDMM in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,50) = strpad('AM1LL in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,51) = strpad('AM1UL in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,52) = strpad('AMCSNS in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,53) = strpad('AMKM in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,54) = strpad('AMKMUL in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,55) = strpad('AMM1LM in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,56) = strpad('AMM4 in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,57) = strpad('AMNALL in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,58) = strpad('AMNAM in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,59) = strpad('AMNAUL in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,60) = strpad('AMT in component parameter_values (minute)');
    LEGEND_CONSTANTS(:,61) = strpad('ANCSNS in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,62) = strpad('ANGINF in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,63) = strpad('ANGKNS in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,64) = strpad('ANMALD in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,65) = strpad('ANMAM in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,66) = strpad('ANMARL in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,67) = strpad('ANMEM in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,68) = strpad('ANMKEL in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,69) = strpad('ANMKEM in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,70) = strpad('ANMLL in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,71) = strpad('ANMNAM in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,72) = strpad('ANMSLT in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,73) = strpad('ANMTM in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,74) = strpad('ANMUL in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,75) = strpad('ANPTC in component parameter_values (minute)');
    LEGEND_CONSTANTS(:,76) = strpad('ANPXAF in component parameter_values (mmHg_minute_per_L)');
    LEGEND_CONSTANTS(:,77) = strpad('ANPXUL in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,78) = strpad('ANT in component parameter_values (minute)');
    LEGEND_CONSTANTS(:,79) = strpad('ANULL in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,80) = strpad('ANUM in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,81) = strpad('ANUVM in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,82) = strpad('ANV in component parameter_values (minute)');
    LEGEND_CONSTANTS(:,83) = strpad('ANXM in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,84) = strpad('ANY in component parameter_values (litre)');
    LEGEND_CONSTANTS(:,85) = strpad('AR1LM in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,86) = strpad('AR2LM in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,87) = strpad('ARF in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,88) = strpad('AUC1 in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,89) = strpad('AUDMP in component parameter_values (minute)');
    LEGEND_CONSTANTS(:,90) = strpad('AUK in component parameter_values (per_minute)');
    LEGEND_CONSTANTS(:,91) = strpad('AUL in component parameter_values (litre)');
    LEGEND_CONSTANTS(:,92) = strpad('AULPM in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,93) = strpad('AUM1 in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,94) = strpad('AUM2 in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,95) = strpad('AUMAX in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,96) = strpad('AUMIN in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,97) = strpad('AUMK1 in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,98) = strpad('AUN1 in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,99) = strpad('AURG in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,100) = strpad('AUS in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,101) = strpad('AUSLP in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,102) = strpad('AUTO in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,103) = strpad('AUTOGN in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,104) = strpad('AUTOSN in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,105) = strpad('AUX in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,106) = strpad('BAROTC in component parameter_values (minute)');
    LEGEND_CONSTANTS(:,107) = strpad('CFC in component parameter_values (L_per_minute_per_mmHg)');
    LEGEND_CONSTANTS(:,108) = strpad('CKEEX in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,109) = strpad('CMPTSS in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,110) = strpad('CN2 in component parameter_values (per_mmHg)');
    LEGEND_CONSTANTS(:,111) = strpad('CN7 in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,112) = strpad('CNR in component parameter_values (monovalent_mEq_per_litre)');
    LEGEND_CONSTANTS(:,113) = strpad('CPF in component parameter_values (L_per_minute_per_mmHg)');
    LEGEND_CONSTANTS(:,114) = strpad('CPK in component parameter_values (L_per_minute_per_mmHg)');
    LEGEND_CONSTANTS(:,115) = strpad('CPR in component parameter_values (gram_per_L)');
    LEGEND_CONSTANTS(:,116) = strpad('CV in component parameter_values (L_per_mmHg)');
    LEGEND_CONSTANTS(:,117) = strpad('CRRFLX in component parameter_values (mmHg)');
    LEGEND_CONSTANTS(:,118) = strpad('DIURET in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,119) = strpad('DHDTR in component parameter_values (per_mmHg_per_minute)');
    LEGEND_CONSTANTS(:,120) = strpad('DTNAR in component parameter_values (monovalent_mEq_per_minute)');
    LEGEND_CONSTANTS(:,121) = strpad('DTNARL in component parameter_values (monovalent_mEq_per_minute)');
    LEGEND_CONSTANTS(:,122) = strpad('EARK in component parameter_values (mmHg_minute_per_L)');
    LEGEND_CONSTANTS(:,123) = strpad('EARLL in component parameter_values (mmHg_minute_per_L)');
    LEGEND_CONSTANTS(:,124) = strpad('EFAFR in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,125) = strpad('EXC in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,126) = strpad('EXCML in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,127) = strpad('EXCXP in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,128) = strpad('EXCXP2 in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,129) = strpad('EXE in component parameter_values (mmHg)');
    LEGEND_CONSTANTS(:,130) = strpad('GCOPF in component parameter_values (per_mmHg)');
    LEGEND_CONSTANTS(:,131) = strpad('GFLC in component parameter_values (L_per_minute_per_mmHg)');
    LEGEND_CONSTANTS(:,132) = strpad('GFNDMP in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,133) = strpad('GFNLL in component parameter_values (L_per_minute)');
    LEGEND_CONSTANTS(:,134) = strpad('GPPD in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,135) = strpad('HM6 in component parameter_values (mmHg)');
    LEGEND_CONSTANTS(:,136) = strpad('HM8 in component parameter_values (L_per_minute_per_mmHg)');
    LEGEND_CONSTANTS(:,137) = strpad('HTAUML in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,138) = strpad('KORGN in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,139) = strpad('KORNER in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,140) = strpad('KORREN in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,141) = strpad('KORTC in component parameter_values (minute)');
    LEGEND_CONSTANTS(:,142) = strpad('LPDE in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,143) = strpad('LPK in component parameter_values (L_per_minute)');
    LEGEND_CONSTANTS(:,144) = strpad('LPPR in component parameter_values (gram_per_minute)');
    LEGEND_CONSTANTS(:,145) = strpad('MDFL1 in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,146) = strpad('MDFLKM in component parameter_values (monovalent_mEq_per_litre)');
    LEGEND_CONSTANTS(:,147) = strpad('MDFLW2 in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,148) = strpad('MDFLWX in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,149) = strpad('MDMP in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,150) = strpad('O2A in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,151) = strpad('O2CHMO in component parameter_values (per_mmHg)');
    LEGEND_CONSTANTS(:,152) = strpad('OMM in component parameter_values (mL_per_minute)');
    LEGEND_CONSTANTS(:,153) = strpad('PA4 in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,154) = strpad('PAEX in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,155) = strpad('PCE in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,156) = strpad('PCR in component parameter_values (mmHg)');
    LEGEND_CONSTANTS(:,157) = strpad('PR1LL in component parameter_values (mmHg)');
    LEGEND_CONSTANTS(:,158) = strpad('PGHF in component parameter_values (L_mmHg_per_gram)');
    LEGEND_CONSTANTS(:,159) = strpad('PK2 in component parameter_values (mmHg_per_mL)');
    LEGEND_CONSTANTS(:,160) = strpad('PL2 in component parameter_values (L_mL_per_minute_per_mmHg)');
    LEGEND_CONSTANTS(:,161) = strpad('PLDF in component parameter_values (mmHg)');
    LEGEND_CONSTANTS(:,162) = strpad('PM5 in component parameter_values (per_mmHg)');
    LEGEND_CONSTANTS(:,163) = strpad('PO2ADV in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,164) = strpad('POK in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,165) = strpad('POM in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,166) = strpad('POM2 in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,167) = strpad('PON in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,168) = strpad('POR in component parameter_values (mmHg)');
    LEGEND_CONSTANTS(:,169) = strpad('POZ in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,170) = strpad('PXTP in component parameter_values (mmHg)');
    LEGEND_CONSTANTS(:,171) = strpad('QAOLM in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,172) = strpad('QRF in component parameter_values (L_per_minute)');
    LEGEND_CONSTANTS(:,173) = strpad('RABSC in component parameter_values (per_mmHg)');
    LEGEND_CONSTANTS(:,174) = strpad('RAM in component parameter_values (mmHg_minute_per_L)');
    LEGEND_CONSTANTS(:,175) = strpad('RAPRSP in component parameter_values (mmHg)');
    LEGEND_CONSTANTS(:,176) = strpad('RAR in component parameter_values (mmHg_minute_per_L)');
    LEGEND_CONSTANTS(:,177) = strpad('RCDFDP in component parameter_values (minute)');
    LEGEND_CONSTANTS(:,178) = strpad('RCDFPC in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,179) = strpad('REK in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,180) = strpad('RFABKM in component parameter_values (monovalent_mEq_per_minute)');
    LEGEND_CONSTANTS(:,181) = strpad('RFABDM in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,182) = strpad('RFABDP in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,183) = strpad('RFCDFT in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,184) = strpad('RKC in component parameter_values (per_minute)');
    LEGEND_CONSTANTS(:,185) = strpad('RNAGTC in component parameter_values (minute)');
    LEGEND_CONSTANTS(:,186) = strpad('RNAUAD in component parameter_values (per_minute)');
    LEGEND_CONSTANTS(:,187) = strpad('RPS in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,188) = strpad('RTPPR in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,189) = strpad('RTPPRS in component parameter_values (mmHg)');
    LEGEND_CONSTANTS(:,190) = strpad('RTSPRS in component parameter_values (mmHg)');
    LEGEND_CONSTANTS(:,191) = strpad('RVRS in component parameter_values (mmHg_minute_per_L)');
    LEGEND_CONSTANTS(:,192) = strpad('RVSM in component parameter_values (mmHg_minute_per_L)');
    LEGEND_CONSTANTS(:,193) = strpad('SR in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,194) = strpad('SR2 in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,195) = strpad('SRK in component parameter_values (minute)');
    LEGEND_CONSTANTS(:,196) = strpad('SRK2 in component parameter_values (minute)');
    LEGEND_CONSTANTS(:,197) = strpad('STA in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,198) = strpad('TENSGN in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,199) = strpad('TENSTC in component parameter_values (minute)');
    LEGEND_CONSTANTS(:,200) = strpad('TIMETR in component parameter_values (minute)');
    LEGEND_CONSTANTS(:,201) = strpad('TRNSFS in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,202) = strpad('TRPL in component parameter_values (L_per_minute)');
    LEGEND_CONSTANTS(:,203) = strpad('TSSLML in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,204) = strpad('TSSLTC in component parameter_values (per_minute)');
    LEGEND_CONSTANTS(:,205) = strpad('TVDDL in component parameter_values (minute)');
    LEGEND_CONSTANTS(:,206) = strpad('U in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,207) = strpad('VID1 in component parameter_values (L_per_minute)');
    LEGEND_CONSTANTS(:,208) = strpad('VIDML in component parameter_values (litre2_per_monovalent_mEq_per_minute)');
    LEGEND_CONSTANTS(:,209) = strpad('VNTSTM in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,210) = strpad('VP1 in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,211) = strpad('VPTISS in component parameter_values (litre)');
    LEGEND_CONSTANTS(:,212) = strpad('VTSF in component parameter_values (litre)');
    LEGEND_CONSTANTS(:,213) = strpad('VV9 in component parameter_values (litre)');
    LEGEND_CONSTANTS(:,214) = strpad('X in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,215) = strpad('Z in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,216) = strpad('Z4 in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,217) = strpad('Z5 in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,218) = strpad('Z6 in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,219) = strpad('Z7 in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,220) = strpad('Z10 in component parameter_values (mmHg)');
    LEGEND_CONSTANTS(:,221) = strpad('Z11 in component parameter_values (per_mmHg2)');
    LEGEND_CONSTANTS(:,222) = strpad('Z12 in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,223) = strpad('Z13 in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,224) = strpad('Z14 in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,225) = strpad('Z16 in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,226) = strpad('Z18 in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,227) = strpad('Z19 in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,228) = strpad('KID in component parameter_values (monovalent_mEq_per_minute)');
    LEGEND_CONSTANTS(:,229) = strpad('URFORM in component parameter_values (mOsm_per_minute)');
    LEGEND_CONSTANTS(:,230) = strpad('AUV in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,231) = strpad('AUY in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,232) = strpad('O2M in component parameter_values (mL_per_minute)');
    LEGEND_CONSTANTS(:,233) = strpad('NID in component parameter_values (monovalent_mEq_per_minute)');
    LEGEND_CONSTANTS(:,234) = strpad('ATRFBM in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,235) = strpad('GBL in component parameter_values (mmHg)');
    LEGEND_CONSTANTS(:,236) = strpad('RNAUGN in component parameter_values (minute_per_L)');
    LEGEND_CONSTANTS(:,237) = strpad('RNAULL in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,238) = strpad('RNAUUL in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,239) = strpad('HSR in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,240) = strpad('HSL in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,241) = strpad('HMK in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,242) = strpad('PO2AMB in component parameter_values (mmHg)');
    LEGEND_CONSTANTS(:,243) = strpad('HKM in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,244) = strpad('DR in component parameter_values (L_per_minute)');
    LEGEND_CONSTANTS(:,245) = strpad('ANPKNS in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,246) = strpad('RMULT1 in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,247) = strpad('GLPCA in component parameter_values (mmHg)');
    LEGEND_CONSTANTS(:,248) = strpad('RFN in component parameter_values (L_per_minute)');
    LEGEND_CONSTANTS(:,249) = strpad('RFABX in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,250) = strpad('ANPINF in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,251) = strpad('FIS in component parameter_values (L_per_minute_per_mmHg)');
    LEGEND_CONSTANTS(:,252) = strpad('CPPD in component parameter_values (gram_per_L)');
    LEGEND_CONSTANTS(:,253) = strpad('TRRBC in component parameter_values (L_per_minute)');
    LEGEND_CONSTANTS(:,254) = strpad('HYL in component parameter_values (gram)');
    LEGEND_CONSTANTS(:,255) = strpad('ATRVM in component parameter_values (litre)');
    LEGEND_CONSTANTS(:,256) = strpad('ADHC_init in component state_variables (dimensionless)');
    LEGEND_CONSTANTS(:,257) = strpad('AHY_init in component state_variables (dimensionless)');
    LEGEND_CONSTANTS(:,258) = strpad('AMC_init in component state_variables (dimensionless)');
    LEGEND_CONSTANTS(:,259) = strpad('AMM1T_init in component state_variables (dimensionless)');
    LEGEND_CONSTANTS(:,260) = strpad('AMM2_init in component state_variables (dimensionless)');
    LEGEND_CONSTANTS(:,261) = strpad('ANC_init in component state_variables (dimensionless)');
    LEGEND_CONSTANTS(:,262) = strpad('ANPC_init in component state_variables (dimensionless)');
    LEGEND_CONSTANTS(:,263) = strpad('ANX1_init in component state_variables (dimensionless)');
    LEGEND_CONSTANTS(:,264) = strpad('AR1T_init in component state_variables (dimensionless)');
    LEGEND_CONSTANTS(:,265) = strpad('AR2T_init in component state_variables (dimensionless)');
    LEGEND_CONSTANTS(:,266) = strpad('AR3T_init in component state_variables (dimensionless)');
    LEGEND_CONSTANTS(:,267) = strpad('AU1_init in component state_variables (dimensionless)');
    LEGEND_CONSTANTS(:,268) = strpad('AU4_init in component state_variables (dimensionless)');
    LEGEND_CONSTANTS(:,269) = strpad('AU6_init in component state_variables (dimensionless)');
    LEGEND_CONSTANTS(:,270) = strpad('DTKA_init in component state_variables (monovalent_mEq_per_minute)');
    LEGEND_CONSTANTS(:,271) = strpad('HMD1_init in component state_variables (dimensionless)');
    LEGEND_CONSTANTS(:,272) = strpad('HPL_init in component state_variables (dimensionless)');
    LEGEND_CONSTANTS(:,273) = strpad('HPR_init in component state_variables (dimensionless)');
    LEGEND_CONSTANTS(:,274) = strpad('KTOT_init in component state_variables (monovalent_mEq)');
    LEGEND_CONSTANTS(:,275) = strpad('NAE_init in component state_variables (monovalent_mEq)');
    LEGEND_CONSTANTS(:,276) = strpad('O2VAD1_init in component state_variables (dimensionless)');
    LEGEND_CONSTANTS(:,277) = strpad('OSV_init in component state_variables (dimensionless)');
    LEGEND_CONSTANTS(:,278) = strpad('OVA_init in component state_variables (mL_per_L)');
    LEGEND_CONSTANTS(:,279) = strpad('OVS_init in component state_variables (dimensionless)');
    LEGEND_CONSTANTS(:,280) = strpad('PAR1_init in component state_variables (mmHg)');
    LEGEND_CONSTANTS(:,281) = strpad('PC_init in component state_variables (mmHg)');
    LEGEND_CONSTANTS(:,282) = strpad('PLUR_init in component state_variables (mOsm)');
    LEGEND_CONSTANTS(:,283) = strpad('PPR1_init in component state_variables (gram)');
    LEGEND_CONSTANTS(:,284) = strpad('PRP_init in component state_variables (gram)');
    LEGEND_CONSTANTS(:,285) = strpad('QO2T_init in component state_variables (mL)');
    LEGEND_CONSTANTS(:,286) = strpad('QOM1_init in component state_variables (mL)');
    LEGEND_CONSTANTS(:,287) = strpad('RNAUG3_init in component state_variables (dimensionless)');
    LEGEND_CONSTANTS(:,288) = strpad('TSP_init in component state_variables (gram)');
    LEGEND_CONSTANTS(:,289) = strpad('TVD_init in component state_variables (L_per_minute)');
    LEGEND_CONSTANTS(:,290) = strpad('VAS1_init in component state_variables (litre)');
    LEGEND_CONSTANTS(:,291) = strpad('VIC_init in component state_variables (litre)');
    LEGEND_CONSTANTS(:,292) = strpad('VLA1_init in component state_variables (litre)');
    LEGEND_CONSTANTS(:,293) = strpad('VPA1_init in component state_variables (litre)');
    LEGEND_CONSTANTS(:,294) = strpad('VPF1_init in component state_variables (litre)');
    LEGEND_CONSTANTS(:,295) = strpad('VP_init in component state_variables (litre)');
    LEGEND_CONSTANTS(:,296) = strpad('VRA1_init in component state_variables (litre)');
    LEGEND_CONSTANTS(:,297) = strpad('VRC_init in component state_variables (litre)');
    LEGEND_CONSTANTS(:,298) = strpad('VTS2_init in component state_variables (litre)');
    LEGEND_CONSTANTS(:,299) = strpad('VTW_init in component state_variables (litre)');
    LEGEND_CONSTANTS(:,300) = strpad('VV6_init in component state_variables (litre)');
    LEGEND_CONSTANTS(:,301) = strpad('VV7_init in component state_variables (litre)');
    LEGEND_CONSTANTS(:,302) = strpad('VVS1_init in component state_variables (litre)');
    LEGEND_ALGEBRAIC(:,55) = strpad('BFM in component blood_flow_through_M_tissues (L_per_minute)');
    LEGEND_ALGEBRAIC(:,56) = strpad('BFN in component blood_flow_through_NM_NR_tissues (L_per_minute)');
    LEGEND_ALGEBRAIC(:,37) = strpad('PA in component arterial_pressure_and_pressure_gradient (mmHg)');
    LEGEND_ALGEBRAIC(:,18) = strpad('PLA in component left_atrial_pressure (mmHg)');
    LEGEND_ALGEBRAIC(:,9) = strpad('PPA in component pulmonary_vasculature_pressure (mmHg)');
    LEGEND_ALGEBRAIC(:,4) = strpad('PRA in component right_atrial_pressure (mmHg)');
    LEGEND_ALGEBRAIC(:,30) = strpad('PVS in component venous_average_pressure (mmHg)');
    LEGEND_ALGEBRAIC(:,59) = strpad('QAO in component systemic_blood_flow (L_per_minute)');
    LEGEND_ALGEBRAIC(:,42) = strpad('QLO in component left_ventricular_output (L_per_minute)');
    LEGEND_ALGEBRAIC(:,46) = strpad('QRO in component right_ventricular_output (L_per_minute)');
    LEGEND_ALGEBRAIC(:,15) = strpad('RPA in component pulmonary_arterial_resistance (mmHg_minute_per_L)');
    LEGEND_ALGEBRAIC(:,20) = strpad('RPV in component pulmonary_venous_resistance (mmHg_minute_per_L)');
    LEGEND_CONSTANTS(:,583) = strpad('RVS in component venous_resistance (mmHg_minute_per_L)');
    LEGEND_ALGEBRAIC(:,28) = strpad('VVE in component venous_excess_volume (litre)');
    LEGEND_CONSTANTS(:,303) = strpad('A1K in component parameter_values (minute)');
    LEGEND_CONSTANTS(:,304) = strpad('A2K in component parameter_values (minute)');
    LEGEND_CONSTANTS(:,305) = strpad('A3K in component parameter_values (minute)');
    LEGEND_CONSTANTS(:,306) = strpad('A4K in component parameter_values (minute)');
    LEGEND_CONSTANTS(:,307) = strpad('A4K2 in component parameter_values (minute)');
    LEGEND_CONSTANTS(:,308) = strpad('AARK in component parameter_values (mmHg_minute_per_L)');
    LEGEND_CONSTANTS(:,309) = strpad('AARLL in component parameter_values (mmHg_minute_per_L)');
    LEGEND_CONSTANTS(:,310) = strpad('ADHINF in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,311) = strpad('ADHKLL in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,312) = strpad('ADHKUL in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,313) = strpad('ADHPAM in component parameter_values (per_mmHg2)');
    LEGEND_CONSTANTS(:,314) = strpad('ADHPUL in component parameter_values (mmHg)');
    LEGEND_CONSTANTS(:,315) = strpad('ADHTC in component parameter_values (minute)');
    LEGEND_CONSTANTS(:,316) = strpad('ADHVLL in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,317) = strpad('ADHVUL in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,318) = strpad('AH10 in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,319) = strpad('AH11 in component parameter_values (minute)');
    LEGEND_CONSTANTS(:,320) = strpad('AH9 in component parameter_values (per_mmHg)');
    LEGEND_CONSTANTS(:,321) = strpad('AHMNAR in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,322) = strpad('AHTHM in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,323) = strpad('ALCLK in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,324) = strpad('ALDINF in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,325) = strpad('ALDKNS in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,326) = strpad('ALDMM in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,327) = strpad('AM1LL in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,328) = strpad('AM1UL in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,329) = strpad('AMCSNS in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,330) = strpad('AMKM in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,331) = strpad('AMKMUL in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,332) = strpad('AMM1LM in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,333) = strpad('AMM4 in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,334) = strpad('AMNALL in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,335) = strpad('AMNAM in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,336) = strpad('AMNAUL in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,337) = strpad('AMT in component parameter_values (minute)');
    LEGEND_CONSTANTS(:,338) = strpad('ANCSNS in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,339) = strpad('ANGINF in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,340) = strpad('ANGKNS in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,341) = strpad('ANMALD in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,342) = strpad('ANMAM in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,343) = strpad('ANMARL in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,344) = strpad('ANMEM in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,345) = strpad('ANMKEL in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,346) = strpad('ANMKEM in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,347) = strpad('ANMLL in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,348) = strpad('ANMNAM in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,349) = strpad('ANMSLT in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,350) = strpad('ANMTM in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,351) = strpad('ANMUL in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,352) = strpad('ANPTC in component parameter_values (minute)');
    LEGEND_CONSTANTS(:,353) = strpad('ANPXAF in component parameter_values (mmHg_minute_per_L)');
    LEGEND_CONSTANTS(:,354) = strpad('ANPXUL in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,355) = strpad('ANT in component parameter_values (minute)');
    LEGEND_CONSTANTS(:,356) = strpad('ANULL in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,357) = strpad('ANUM in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,358) = strpad('ANUVM in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,359) = strpad('ANV in component parameter_values (minute)');
    LEGEND_CONSTANTS(:,360) = strpad('ANXM in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,361) = strpad('ANY in component parameter_values (litre)');
    LEGEND_CONSTANTS(:,362) = strpad('AR1LM in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,363) = strpad('AR2LM in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,364) = strpad('ARF in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,365) = strpad('AUC1 in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,366) = strpad('AUDMP in component parameter_values (minute)');
    LEGEND_CONSTANTS(:,367) = strpad('AUK in component parameter_values (per_minute)');
    LEGEND_CONSTANTS(:,368) = strpad('AUL in component parameter_values (litre)');
    LEGEND_CONSTANTS(:,369) = strpad('AULPM in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,370) = strpad('AUM1 in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,371) = strpad('AUM2 in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,372) = strpad('AUMAX in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,373) = strpad('AUMIN in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,374) = strpad('AUMK1 in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,375) = strpad('AUN1 in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,376) = strpad('AURG in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,377) = strpad('AUS in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,378) = strpad('AUSLP in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,379) = strpad('AUTO in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,380) = strpad('AUTOGN in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,381) = strpad('AUTOSN in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,382) = strpad('AUX in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,383) = strpad('BAROTC in component parameter_values (minute)');
    LEGEND_CONSTANTS(:,384) = strpad('CFC in component parameter_values (L_per_minute_per_mmHg)');
    LEGEND_CONSTANTS(:,385) = strpad('CKEEX in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,386) = strpad('CMPTSS in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,387) = strpad('CN2 in component parameter_values (per_mmHg)');
    LEGEND_CONSTANTS(:,388) = strpad('CN7 in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,389) = strpad('CNR in component parameter_values (monovalent_mEq_per_litre)');
    LEGEND_CONSTANTS(:,390) = strpad('CPF in component parameter_values (L_per_minute_per_mmHg)');
    LEGEND_CONSTANTS(:,391) = strpad('CPK in component parameter_values (L_per_minute_per_mmHg)');
    LEGEND_CONSTANTS(:,392) = strpad('CPR in component parameter_values (gram_per_L)');
    LEGEND_CONSTANTS(:,393) = strpad('CV in component parameter_values (L_per_mmHg)');
    LEGEND_CONSTANTS(:,394) = strpad('CRRFLX in component parameter_values (mmHg)');
    LEGEND_CONSTANTS(:,395) = strpad('DIURET in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,396) = strpad('DHDTR in component parameter_values (per_mmHg_per_minute)');
    LEGEND_CONSTANTS(:,397) = strpad('DTNAR in component parameter_values (monovalent_mEq_per_minute)');
    LEGEND_CONSTANTS(:,398) = strpad('DTNARL in component parameter_values (monovalent_mEq_per_minute)');
    LEGEND_CONSTANTS(:,399) = strpad('EARK in component parameter_values (mmHg_minute_per_L)');
    LEGEND_CONSTANTS(:,400) = strpad('EARLL in component parameter_values (mmHg_minute_per_L)');
    LEGEND_CONSTANTS(:,401) = strpad('EFAFR in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,402) = strpad('EXC in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,403) = strpad('EXCML in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,404) = strpad('EXCXP in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,405) = strpad('EXCXP2 in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,406) = strpad('EXE in component parameter_values (mmHg)');
    LEGEND_CONSTANTS(:,407) = strpad('GCOPF in component parameter_values (per_mmHg)');
    LEGEND_CONSTANTS(:,408) = strpad('GFLC in component parameter_values (L_per_minute_per_mmHg)');
    LEGEND_CONSTANTS(:,409) = strpad('GFNDMP in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,410) = strpad('GFNLL in component parameter_values (L_per_minute)');
    LEGEND_CONSTANTS(:,411) = strpad('GPPD in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,412) = strpad('HM6 in component parameter_values (mmHg)');
    LEGEND_CONSTANTS(:,413) = strpad('HM8 in component parameter_values (L_per_minute_per_mmHg)');
    LEGEND_CONSTANTS(:,414) = strpad('HTAUML in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,415) = strpad('KORGN in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,416) = strpad('KORNER in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,417) = strpad('KORREN in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,418) = strpad('KORTC in component parameter_values (minute)');
    LEGEND_CONSTANTS(:,419) = strpad('LPDE in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,420) = strpad('LPK in component parameter_values (L_per_minute)');
    LEGEND_CONSTANTS(:,421) = strpad('LPPR in component parameter_values (gram_per_minute)');
    LEGEND_CONSTANTS(:,422) = strpad('MDFL1 in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,423) = strpad('MDFLKM in component parameter_values (monovalent_mEq_per_litre)');
    LEGEND_CONSTANTS(:,424) = strpad('MDFLW2 in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,425) = strpad('MDFLWX in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,426) = strpad('MDMP in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,427) = strpad('O2A in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,428) = strpad('O2CHMO in component parameter_values (per_mmHg)');
    LEGEND_CONSTANTS(:,429) = strpad('OMM in component parameter_values (mL_per_minute)');
    LEGEND_CONSTANTS(:,430) = strpad('PA4 in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,431) = strpad('PAEX in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,432) = strpad('PCE in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,433) = strpad('PCR in component parameter_values (mmHg)');
    LEGEND_CONSTANTS(:,434) = strpad('PR1LL in component parameter_values (mmHg)');
    LEGEND_CONSTANTS(:,435) = strpad('PGHF in component parameter_values (L_mmHg_per_gram)');
    LEGEND_CONSTANTS(:,436) = strpad('PK2 in component parameter_values (mmHg_per_mL)');
    LEGEND_CONSTANTS(:,437) = strpad('PL2 in component parameter_values (L_mL_per_minute_per_mmHg)');
    LEGEND_CONSTANTS(:,438) = strpad('PLDF in component parameter_values (mmHg)');
    LEGEND_CONSTANTS(:,439) = strpad('PM5 in component parameter_values (per_mmHg)');
    LEGEND_CONSTANTS(:,440) = strpad('PO2ADV in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,441) = strpad('POK in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,442) = strpad('POM in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,443) = strpad('POM2 in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,444) = strpad('PON in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,445) = strpad('POR in component parameter_values (mmHg)');
    LEGEND_CONSTANTS(:,446) = strpad('POZ in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,447) = strpad('PXTP in component parameter_values (mmHg)');
    LEGEND_CONSTANTS(:,448) = strpad('QAOLM in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,449) = strpad('QRF in component parameter_values (L_per_minute)');
    LEGEND_CONSTANTS(:,450) = strpad('RABSC in component parameter_values (per_mmHg)');
    LEGEND_CONSTANTS(:,451) = strpad('RAM in component parameter_values (mmHg_minute_per_L)');
    LEGEND_CONSTANTS(:,452) = strpad('RAPRSP in component parameter_values (mmHg)');
    LEGEND_CONSTANTS(:,453) = strpad('RAR in component parameter_values (mmHg_minute_per_L)');
    LEGEND_CONSTANTS(:,454) = strpad('RCDFDP in component parameter_values (minute)');
    LEGEND_CONSTANTS(:,455) = strpad('RCDFPC in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,456) = strpad('REK in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,457) = strpad('RFABKM in component parameter_values (monovalent_mEq_per_minute)');
    LEGEND_CONSTANTS(:,458) = strpad('RFABDM in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,459) = strpad('RFABDP in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,460) = strpad('RFCDFT in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,461) = strpad('RKC in component parameter_values (per_minute)');
    LEGEND_CONSTANTS(:,462) = strpad('RNAGTC in component parameter_values (minute)');
    LEGEND_CONSTANTS(:,463) = strpad('RNAUAD in component parameter_values (per_minute)');
    LEGEND_CONSTANTS(:,464) = strpad('RPS in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,465) = strpad('RTPPR in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,466) = strpad('RTPPRS in component parameter_values (mmHg)');
    LEGEND_CONSTANTS(:,467) = strpad('RTSPRS in component parameter_values (mmHg)');
    LEGEND_CONSTANTS(:,468) = strpad('RVRS in component parameter_values (mmHg_minute_per_L)');
    LEGEND_CONSTANTS(:,469) = strpad('RVSM in component parameter_values (mmHg_minute_per_L)');
    LEGEND_CONSTANTS(:,470) = strpad('SR in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,471) = strpad('SR2 in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,472) = strpad('SRK in component parameter_values (minute)');
    LEGEND_CONSTANTS(:,473) = strpad('SRK2 in component parameter_values (minute)');
    LEGEND_CONSTANTS(:,474) = strpad('STA in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,475) = strpad('TENSGN in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,476) = strpad('TENSTC in component parameter_values (minute)');
    LEGEND_CONSTANTS(:,477) = strpad('TIMETR in component parameter_values (minute)');
    LEGEND_CONSTANTS(:,478) = strpad('TRNSFS in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,479) = strpad('TRPL in component parameter_values (L_per_minute)');
    LEGEND_CONSTANTS(:,480) = strpad('TSSLML in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,481) = strpad('TSSLTC in component parameter_values (per_minute)');
    LEGEND_CONSTANTS(:,482) = strpad('TVDDL in component parameter_values (minute)');
    LEGEND_CONSTANTS(:,483) = strpad('U in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,484) = strpad('VID1 in component parameter_values (L_per_minute)');
    LEGEND_CONSTANTS(:,485) = strpad('VIDML in component parameter_values (litre2_per_monovalent_mEq_per_minute)');
    LEGEND_CONSTANTS(:,486) = strpad('VNTSTM in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,487) = strpad('VP1 in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,488) = strpad('VPTISS in component parameter_values (litre)');
    LEGEND_CONSTANTS(:,489) = strpad('VTSF in component parameter_values (litre)');
    LEGEND_CONSTANTS(:,490) = strpad('VV9 in component parameter_values (litre)');
    LEGEND_CONSTANTS(:,491) = strpad('X in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,492) = strpad('Z in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,493) = strpad('Z4 in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,494) = strpad('Z5 in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,495) = strpad('Z6 in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,496) = strpad('Z7 in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,497) = strpad('Z10 in component parameter_values (mmHg)');
    LEGEND_CONSTANTS(:,498) = strpad('Z11 in component parameter_values (per_mmHg2)');
    LEGEND_CONSTANTS(:,499) = strpad('Z12 in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,500) = strpad('Z13 in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,501) = strpad('Z14 in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,502) = strpad('Z16 in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,503) = strpad('Z18 in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,504) = strpad('Z19 in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,505) = strpad('KID in component parameter_values (monovalent_mEq_per_minute)');
    LEGEND_CONSTANTS(:,506) = strpad('URFORM in component parameter_values (mOsm_per_minute)');
    LEGEND_CONSTANTS(:,507) = strpad('AUV in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,508) = strpad('AUY in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,509) = strpad('O2M in component parameter_values (mL_per_minute)');
    LEGEND_CONSTANTS(:,510) = strpad('NID in component parameter_values (monovalent_mEq_per_minute)');
    LEGEND_CONSTANTS(:,511) = strpad('ATRFBM in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,512) = strpad('GBL in component parameter_values (mmHg)');
    LEGEND_CONSTANTS(:,513) = strpad('RNAUGN in component parameter_values (minute_per_L)');
    LEGEND_CONSTANTS(:,514) = strpad('RNAULL in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,515) = strpad('RNAUUL in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,516) = strpad('HSR in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,517) = strpad('HSL in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,518) = strpad('HMK in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,519) = strpad('PO2AMB in component parameter_values (mmHg)');
    LEGEND_CONSTANTS(:,520) = strpad('HKM in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,521) = strpad('DR in component parameter_values (L_per_minute)');
    LEGEND_CONSTANTS(:,522) = strpad('ANPKNS in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,523) = strpad('RMULT1 in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,524) = strpad('GLPCA in component parameter_values (mmHg)');
    LEGEND_CONSTANTS(:,525) = strpad('RFN in component parameter_values (L_per_minute)');
    LEGEND_CONSTANTS(:,526) = strpad('RFABX in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,527) = strpad('ANPINF in component parameter_values (dimensionless)');
    LEGEND_CONSTANTS(:,528) = strpad('FIS in component parameter_values (L_per_minute_per_mmHg)');
    LEGEND_CONSTANTS(:,529) = strpad('CPPD in component parameter_values (gram_per_L)');
    LEGEND_CONSTANTS(:,530) = strpad('TRRBC in component parameter_values (L_per_minute)');
    LEGEND_CONSTANTS(:,531) = strpad('HYL in component parameter_values (gram)');
    LEGEND_CONSTANTS(:,532) = strpad('ATRVM in component parameter_values (litre)');
    LEGEND_CONSTANTS(:,533) = strpad('ADHC_init in component state_variables (dimensionless)');
    LEGEND_CONSTANTS(:,534) = strpad('AHY_init in component state_variables (dimensionless)');
    LEGEND_CONSTANTS(:,535) = strpad('AMC_init in component state_variables (dimensionless)');
    LEGEND_CONSTANTS(:,536) = strpad('AMM1T_init in component state_variables (dimensionless)');
    LEGEND_CONSTANTS(:,537) = strpad('AMM2_init in component state_variables (dimensionless)');
    LEGEND_CONSTANTS(:,538) = strpad('ANC_init in component state_variables (dimensionless)');
    LEGEND_CONSTANTS(:,539) = strpad('ANPC_init in component state_variables (dimensionless)');
    LEGEND_CONSTANTS(:,540) = strpad('ANX1_init in component state_variables (dimensionless)');
    LEGEND_CONSTANTS(:,541) = strpad('AR1T_init in component state_variables (dimensionless)');
    LEGEND_CONSTANTS(:,542) = strpad('AR2T_init in component state_variables (dimensionless)');
    LEGEND_CONSTANTS(:,543) = strpad('AR3T_init in component state_variables (dimensionless)');
    LEGEND_CONSTANTS(:,544) = strpad('AU1_init in component state_variables (dimensionless)');
    LEGEND_CONSTANTS(:,545) = strpad('AU4_init in component state_variables (dimensionless)');
    LEGEND_CONSTANTS(:,546) = strpad('AU6_init in component state_variables (dimensionless)');
    LEGEND_CONSTANTS(:,547) = strpad('DTKA_init in component state_variables (monovalent_mEq_per_minute)');
    LEGEND_CONSTANTS(:,548) = strpad('HMD1_init in component state_variables (dimensionless)');
    LEGEND_CONSTANTS(:,549) = strpad('HPL_init in component state_variables (dimensionless)');
    LEGEND_CONSTANTS(:,550) = strpad('HPR_init in component state_variables (dimensionless)');
    LEGEND_CONSTANTS(:,551) = strpad('KTOT_init in component state_variables (monovalent_mEq)');
    LEGEND_CONSTANTS(:,552) = strpad('NAE_init in component state_variables (monovalent_mEq)');
    LEGEND_CONSTANTS(:,553) = strpad('O2VAD1_init in component state_variables (dimensionless)');
    LEGEND_CONSTANTS(:,554) = strpad('OSV_init in component state_variables (dimensionless)');
    LEGEND_CONSTANTS(:,555) = strpad('OVA_init in component state_variables (mL_per_L)');
    LEGEND_CONSTANTS(:,556) = strpad('OVS_init in component state_variables (dimensionless)');
    LEGEND_CONSTANTS(:,557) = strpad('PAR1_init in component state_variables (mmHg)');
    LEGEND_CONSTANTS(:,558) = strpad('PC_init in component state_variables (mmHg)');
    LEGEND_CONSTANTS(:,559) = strpad('PLUR_init in component state_variables (mOsm)');
    LEGEND_CONSTANTS(:,560) = strpad('PPR1_init in component state_variables (gram)');
    LEGEND_CONSTANTS(:,561) = strpad('PRP_init in component state_variables (gram)');
    LEGEND_CONSTANTS(:,562) = strpad('QO2T_init in component state_variables (mL)');
    LEGEND_CONSTANTS(:,563) = strpad('QOM1_init in component state_variables (mL)');
    LEGEND_CONSTANTS(:,564) = strpad('RNAUG3_init in component state_variables (dimensionless)');
    LEGEND_CONSTANTS(:,565) = strpad('TSP_init in component state_variables (gram)');
    LEGEND_CONSTANTS(:,566) = strpad('TVD_init in component state_variables (L_per_minute)');
    LEGEND_CONSTANTS(:,567) = strpad('VAS1_init in component state_variables (litre)');
    LEGEND_CONSTANTS(:,568) = strpad('VIC_init in component state_variables (litre)');
    LEGEND_CONSTANTS(:,569) = strpad('VLA1_init in component state_variables (litre)');
    LEGEND_CONSTANTS(:,570) = strpad('VPA1_init in component state_variables (litre)');
    LEGEND_CONSTANTS(:,571) = strpad('VPF1_init in component state_variables (litre)');
    LEGEND_CONSTANTS(:,572) = strpad('VP_init in component state_variables (litre)');
    LEGEND_CONSTANTS(:,573) = strpad('VRA1_init in component state_variables (litre)');
    LEGEND_CONSTANTS(:,574) = strpad('VRC_init in component state_variables (litre)');
    LEGEND_CONSTANTS(:,575) = strpad('VTS2_init in component state_variables (litre)');
    LEGEND_CONSTANTS(:,576) = strpad('VTW_init in component state_variables (litre)');
    LEGEND_CONSTANTS(:,577) = strpad('VV6_init in component state_variables (litre)');
    LEGEND_CONSTANTS(:,578) = strpad('VV7_init in component state_variables (litre)');
    LEGEND_CONSTANTS(:,579) = strpad('VVS1_init in component state_variables (litre)');
    LEGEND_STATES(:,1) = strpad('VVS1 in component venous_blood_volume (litre)');
    LEGEND_STATES(:,2) = strpad('VAS1 in component arterial_blood_volume (litre)');
    LEGEND_STATES(:,3) = strpad('VLA1 in component left_atrial_blood_volume (litre)');
    LEGEND_STATES(:,4) = strpad('VPA1 in component pulmonary_vasculature_blood_volume (litre)');
    LEGEND_STATES(:,5) = strpad('VRA1 in component right_atrial_blood_volume (litre)');
    LEGEND_ALGEBRAIC(:,1) = strpad('VBD in component total_blood_volume_change (litre)');
    LEGEND_ALGEBRAIC(:,34) = strpad('QVO in component rate_of_blood_flow_from_veins_to_right_atrium (L_per_minute)');
    LEGEND_ALGEBRAIC(:,2) = strpad('VRA in component right_atrial_blood_volume (litre)');
    LEGEND_ALGEBRAIC(:,48) = strpad('DRA in component right_atrial_blood_volume (L_per_minute)');
    LEGEND_ALGEBRAIC(:,3) = strpad('VRE in component right_atrial_pressure (litre)');
    LEGEND_ALGEBRAIC(:,5) = strpad('PRA1 in component autonomic_stimulation_effect_on_right_atrial_pressure (mmHg)');
    LEGEND_ALGEBRAIC(:,11) = strpad('RVM in component pressure_effect_on_right_ventricular_pumping (dimensionless)');
    LEGEND_ALGEBRAIC(:,10) = strpad('PP2 in component pressure_effect_on_right_ventricular_pumping (mmHg)');
    LEGEND_ALGEBRAIC(:,25) = strpad('QLN in component left_ventricular_output (L_per_minute)');
    LEGEND_ALGEBRAIC(:,43) = strpad('HPEF in component pumping_effectiveness_of_right_ventricle (L_per_minute)');
    LEGEND_ALGEBRAIC(:,6) = strpad('QRN in component right_ventricular_output (dimensionless)');
    LEGEND_ALGEBRAIC(:,23) = strpad('QPO in component rate_of_blood_flow_from_pulmonary_veins_to_left_atrium (L_per_minute)');
    LEGEND_ALGEBRAIC(:,7) = strpad('VPA in component pulmonary_vasculature_blood_volume (litre)');
    LEGEND_ALGEBRAIC(:,49) = strpad('DPA in component pulmonary_vasculature_blood_volume (L_per_minute)');
    LEGEND_ALGEBRAIC(:,8) = strpad('VPE in component pulmonary_vasculature_pressure (litre)');
    LEGEND_ALGEBRAIC(:,12) = strpad('PP1T in component pulmonary_arterial_resistance (L_per_minute_per_mmHg)');
    LEGEND_ALGEBRAIC(:,13) = strpad('PP1 in component pulmonary_arterial_resistance (L_per_minute_per_mmHg)');
    LEGEND_ALGEBRAIC(:,14) = strpad('CPA in component pulmonary_arterial_resistance (L_per_minute_per_mmHg)');
    LEGEND_ALGEBRAIC(:,19) = strpad('PL1 in component pulmonary_venous_resistance (mmHg)');
    LEGEND_ALGEBRAIC(:,21) = strpad('RPT in component total_pulmonary_vascular_resistance (mmHg_minute_per_L)');
    LEGEND_ALGEBRAIC(:,22) = strpad('PGL in component pressure_gradient_through_the_lungs (mmHg)');
    LEGEND_ALGEBRAIC(:,16) = strpad('VLA in component left_atrial_blood_volume (litre)');
    LEGEND_ALGEBRAIC(:,44) = strpad('DLA in component left_atrial_blood_volume (L_per_minute)');
    LEGEND_ALGEBRAIC(:,17) = strpad('VLE in component left_atrial_pressure (litre)');
    LEGEND_ALGEBRAIC(:,24) = strpad('PLA1 in component autonomic_stimulation_effect_on_left_atrial_pressure (mmHg)');
    LEGEND_ALGEBRAIC(:,39) = strpad('LVM in component pumping_effectiveness_of_left_ventricle (dimensionless)');
    LEGEND_ALGEBRAIC(:,38) = strpad('PA2 in component pumping_effectiveness_of_left_ventricle (mmHg)');
    LEGEND_ALGEBRAIC(:,40) = strpad('QLOT in component left_ventricular_output (L_per_minute)');
    LEGEND_ALGEBRAIC(:,41) = strpad('QLO1 in component left_ventricular_output (L_per_minute)');
    LEGEND_ALGEBRAIC(:,26) = strpad('VVS in component venous_blood_volume (litre)');
    LEGEND_ALGEBRAIC(:,60) = strpad('DVS in component venous_blood_volume (L_per_minute)');
    LEGEND_CONSTANTS(:,580) = strpad('VVA in component angiotensin_induced_venous_constriction (litre)');
    LEGEND_ALGEBRAIC(:,27) = strpad('VVE1 in component venous_excess_volume (litre)');
    LEGEND_ALGEBRAIC(:,29) = strpad('PVS1 in component venous_average_pressure (mmHg)');
    LEGEND_ALGEBRAIC(:,31) = strpad('PR1 in component venous_outflow_pressure_into_heart (mmHg)');
    LEGEND_ALGEBRAIC(:,32) = strpad('RVG in component resistance_from_veins_to_right_atrium (mmHg_minute_per_L)');
    LEGEND_ALGEBRAIC(:,33) = strpad('PGV in component rate_of_blood_flow_from_veins_to_right_atrium (mmHg)');
    LEGEND_CONSTANTS(:,581) = strpad('CN3 in component venous_resistance (dimensionless)');
    LEGEND_CONSTANTS(:,582) = strpad('RV1 in component venous_resistance (mmHg_minute_per_L)');
    LEGEND_CONSTANTS(:,584) = strpad('NNRVR in component NM_NR_venous_resistance (mmHg_minute_per_L)');
    LEGEND_ALGEBRAIC(:,35) = strpad('VAS in component arterial_blood_volume (litre)');
    LEGEND_ALGEBRAIC(:,61) = strpad('DAS in component arterial_blood_volume (L_per_minute)');
    LEGEND_ALGEBRAIC(:,45) = strpad('PAG in component arterial_pressure_and_pressure_gradient (mmHg)');
    LEGEND_ALGEBRAIC(:,36) = strpad('VAE in component arterial_pressure_and_pressure_gradient (litre)');
    LEGEND_ALGEBRAIC(:,47) = strpad('PAM in component pressure_effect_on_arterial_distention (dimensionless)');
    LEGEND_ALGEBRAIC(:,50) = strpad('R1 in component non_renal_systemic_arterial_resistance_multiplier (dimensionless)');
    LEGEND_ALGEBRAIC(:,51) = strpad('NNRAR in component NM_NR_arterial_resistance (mmHg_minute_per_L)');
    LEGEND_ALGEBRAIC(:,52) = strpad('PGS in component pressure_gradient_from_arteries_to_veins (mmHg)');
    LEGEND_ALGEBRAIC(:,53) = strpad('RSM in component M_systemic_resistance (mmHg_minute_per_L)');
    LEGEND_ALGEBRAIC(:,54) = strpad('RSN in component total_NM_NR_systemic_resistance (mmHg_minute_per_L)');
    LEGEND_ALGEBRAIC(:,57) = strpad('FISFLO in component blood_flow_through_AV_fistulas (L_per_minute)');
    LEGEND_ALGEBRAIC(:,58) = strpad('SYSFLO in component systemic_blood_flow (L_per_minute)');
    LEGEND_ALGEBRAIC(:,62) = strpad('RTP in component total_peripheral_resistance (mmHg_minute_per_L)');
    LEGEND_RATES(:,5) = strpad('d/dt VRA1 in component right_atrial_blood_volume (litre)');
    LEGEND_RATES(:,4) = strpad('d/dt VPA1 in component pulmonary_vasculature_blood_volume (litre)');
    LEGEND_RATES(:,3) = strpad('d/dt VLA1 in component left_atrial_blood_volume (litre)');
    LEGEND_RATES(:,1) = strpad('d/dt VVS1 in component venous_blood_volume (litre)');
    LEGEND_RATES(:,2) = strpad('d/dt VAS1 in component arterial_blood_volume (litre)');
    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.925271;
    CONSTANTS(:,2) = 1.0;
    CONSTANTS(:,3) = 1.0;
    CONSTANTS(:,4) = 1.0;
    CONSTANTS(:,5) = 1.0;
    CONSTANTS(:,6) = 1.16463;
    CONSTANTS(:,7) = 1.00076;
    CONSTANTS(:,8) = 1.0;
    CONSTANTS(:,9) = 1.0;
    CONSTANTS(:,10) = 16.9144;
    CONSTANTS(:,11) = 1.22057;
    CONSTANTS(:,12) = 2.50967;
    CONSTANTS(:,13) = 0.0101913;
    CONSTANTS(:,14) = 0.00366525;
    CONSTANTS(:,15) = 0.0;
    CONSTANTS(:,16) = 3.00449;
    CONSTANTS(:,17) = 2.00439;
    CONSTANTS(:,18) = 1.00237;
    CONSTANTS(:,19) = 1.0;
    CONSTANTS(:,20) = 1.00012;
    CONSTANTS(:,21) = 0.97287;
    CONSTANTS(:,22) = 1.00163;
    CONSTANTS(:,23) = 1.0;
    CONSTANTS(:,24) = 1.00066;
    CONSTANTS(:,25) = 1.00022;
    CONSTANTS(:,26) = 0.5;
    CONSTANTS(:,27) = 60;
    CONSTANTS(:,28) = 40000;
    CONSTANTS(:,29) = 0.1;
    CONSTANTS(:,30) = 40000;
    CONSTANTS(:,31) = 1;
    CONSTANTS(:,32) = 4;
    CONSTANTS(:,33) = 0;
    CONSTANTS(:,34) = 0.2;
    CONSTANTS(:,35) = 5;
    CONSTANTS(:,36) = 0.3;
    CONSTANTS(:,37) = 85;
    CONSTANTS(:,38) = 15;
    CONSTANTS(:,39) = 0.93617;
    CONSTANTS(:,40) = 2.5;
    CONSTANTS(:,41) = 0.333;
    CONSTANTS(:,42) = 1000;
    CONSTANTS(:,43) = 1;
    CONSTANTS(:,44) = 0.3;
    CONSTANTS(:,45) = 2;
    CONSTANTS(:,46) = 0.3;
    CONSTANTS(:,47) = 0;
    CONSTANTS(:,48) = 0;
    CONSTANTS(:,49) = 2.5;
    CONSTANTS(:,50) = 0;
    CONSTANTS(:,51) = 5;
    CONSTANTS(:,52) = 0.65;
    CONSTANTS(:,53) = 0.5;
    CONSTANTS(:,54) = 12;
    CONSTANTS(:,55) = 0.005;
    CONSTANTS(:,56) = 0.005;
    CONSTANTS(:,57) = 0.04;
    CONSTANTS(:,58) = 0.8;
    CONSTANTS(:,59) = 15;
    CONSTANTS(:,60) = 60;
    CONSTANTS(:,61) = 0.4;
    CONSTANTS(:,62) = 0;
    CONSTANTS(:,63) = 0;
    CONSTANTS(:,64) = 2.5;
    CONSTANTS(:,65) = 1.4;
    CONSTANTS(:,66) = 0.86;
    CONSTANTS(:,67) = 1.6;
    CONSTANTS(:,68) = 0.3;
    CONSTANTS(:,69) = 2;
    CONSTANTS(:,70) = 0.7;
    CONSTANTS(:,71) = 1;
    CONSTANTS(:,72) = 2;
    CONSTANTS(:,73) = 1.5;
    CONSTANTS(:,74) = 1.8;
    CONSTANTS(:,75) = 4;
    CONSTANTS(:,76) = 1.5;
    CONSTANTS(:,77) = 10;
    CONSTANTS(:,78) = 12;
    CONSTANTS(:,79) = 0.8;
    CONSTANTS(:,80) = 6;
    CONSTANTS(:,81) = 0;
    CONSTANTS(:,82) = 5000;
    CONSTANTS(:,83) = 0;
    CONSTANTS(:,84) = -0.2;
    CONSTANTS(:,85) = 0.005;
    CONSTANTS(:,86) = 0.005;
    CONSTANTS(:,87) = 0.5;
    CONSTANTS(:,88) = 0.3;
    CONSTANTS(:,89) = 0.3;
    CONSTANTS(:,90) = 0.004;
    CONSTANTS(:,91) = 1.5;
    CONSTANTS(:,92) = 0;
    CONSTANTS(:,93) = 3;
    CONSTANTS(:,94) = 1;
    CONSTANTS(:,95) = 5.0;
    CONSTANTS(:,96) = 0.4;
    CONSTANTS(:,97) = 0.3;
    CONSTANTS(:,98) = 0.5;
    CONSTANTS(:,99) = 1.0;
    CONSTANTS(:,100) = 1;
    CONSTANTS(:,101) = 1.5;
    CONSTANTS(:,102) = 0;
    CONSTANTS(:,103) = 7;
    CONSTANTS(:,104) = 0.9;
    CONSTANTS(:,105) = 1;
    CONSTANTS(:,106) = 0.16;
    CONSTANTS(:,107) = 0.01167;
    CONSTANTS(:,108) = 4;
    CONSTANTS(:,109) = 2;
    CONSTANTS(:,110) = 0.0212;
    CONSTANTS(:,111) = 0.2;
    CONSTANTS(:,112) = 139;
    CONSTANTS(:,113) = 0.0003;
    CONSTANTS(:,114) = 0.000253;
    CONSTANTS(:,115) = 40;
    CONSTANTS(:,116) = 0.1;
    CONSTANTS(:,117) = 0;
    CONSTANTS(:,118) = 1;
    CONSTANTS(:,119) = 0.05;
    CONSTANTS(:,120) = 0.675;
    CONSTANTS(:,121) = 1e-06;
    CONSTANTS(:,122) = 1;
    CONSTANTS(:,123) = 24;
    CONSTANTS(:,124) = 0;
    CONSTANTS(:,125) = 1;
    CONSTANTS(:,126) = 0.01;
    CONSTANTS(:,127) = 1.0;
    CONSTANTS(:,128) = 0.17;
    CONSTANTS(:,129) = 0;
    CONSTANTS(:,130) = 0.8092;
    CONSTANTS(:,131) = 0.0208333;
    CONSTANTS(:,132) = 3;
    CONSTANTS(:,133) = 0.001;
    CONSTANTS(:,134) = 1.0;
    CONSTANTS(:,135) = 1850;
    CONSTANTS(:,136) = 4.714e-08;
    CONSTANTS(:,137) = 0.4;
    CONSTANTS(:,138) = 1;
    CONSTANTS(:,139) = 0;
    CONSTANTS(:,140) = 0;
    CONSTANTS(:,141) = 10000;
    CONSTANTS(:,142) = 8;
    CONSTANTS(:,143) = 2.728e-14;
    CONSTANTS(:,144) = 0.03;
    CONSTANTS(:,145) = 10;
    CONSTANTS(:,146) = 0.667;
    CONSTANTS(:,147) = 0.005;
    CONSTANTS(:,148) = 0.01;
    CONSTANTS(:,149) = 0;
    CONSTANTS(:,150) = 0.1;
    CONSTANTS(:,151) = 0.01;
    CONSTANTS(:,152) = 57.1;
    CONSTANTS(:,153) = 1;
    CONSTANTS(:,154) = 2;
    CONSTANTS(:,155) = 1;
    CONSTANTS(:,156) = 15;
    CONSTANTS(:,157) = 0;
    CONSTANTS(:,158) = -2;
    CONSTANTS(:,159) = 0.79167;
    CONSTANTS(:,160) = 1.8;
    CONSTANTS(:,161) = 4.2;
    CONSTANTS(:,162) = 30;
    CONSTANTS(:,163) = 0.001;
    CONSTANTS(:,164) = 0.1;
    CONSTANTS(:,165) = 0.04;
    CONSTANTS(:,166) = 2;
    CONSTANTS(:,167) = 0.1;
    CONSTANTS(:,168) = 35;
    CONSTANTS(:,169) = 2;
    CONSTANTS(:,170) = 8;
    CONSTANTS(:,171) = 0.2;
    CONSTANTS(:,172) = 0.15;
    CONSTANTS(:,173) = 0.5;
    CONSTANTS(:,174) = 96.3;
    CONSTANTS(:,175) = 0;
    CONSTANTS(:,176) = 30.52;
    CONSTANTS(:,177) = 2000;
    CONSTANTS(:,178) = 0;
    CONSTANTS(:,179) = 1;
    CONSTANTS(:,180) = 0.03;
    CONSTANTS(:,181) = 0.3;
    CONSTANTS(:,182) = 1;
    CONSTANTS(:,183) = 0;
    CONSTANTS(:,184) = 5.8e-06;
    CONSTANTS(:,185) = 15;
    CONSTANTS(:,186) = 0;
    CONSTANTS(:,187) = 0;
    CONSTANTS(:,188) = 0.9;
    CONSTANTS(:,189) = 15.2;
    CONSTANTS(:,190) = 6;
    CONSTANTS(:,191) = 19.167;
    CONSTANTS(:,192) = 1;
    CONSTANTS(:,193) = 1;
    CONSTANTS(:,194) = 1;
    CONSTANTS(:,195) = 5;
    CONSTANTS(:,196) = 10000;
    CONSTANTS(:,197) = 0;
    CONSTANTS(:,198) = 0;
    CONSTANTS(:,199) = 0.05;
    CONSTANTS(:,200) = 0;
    CONSTANTS(:,201) = 0;
    CONSTANTS(:,202) = 0;
    CONSTANTS(:,203) = 0.15;
    CONSTANTS(:,204) = 0.005;
    CONSTANTS(:,205) = 30;
    CONSTANTS(:,206) = 4;
    CONSTANTS(:,207) = 0.01;
    CONSTANTS(:,208) = 0.01;
    CONSTANTS(:,209) = 1;
    CONSTANTS(:,210) = 0.01;
    CONSTANTS(:,211) = 0.0175;
    CONSTANTS(:,212) = 6;
    CONSTANTS(:,213) = 2.51;
    CONSTANTS(:,214) = 4;
    CONSTANTS(:,215) = 1;
    CONSTANTS(:,216) = 0.5;
    CONSTANTS(:,217) = 0.3;
    CONSTANTS(:,218) = 20;
    CONSTANTS(:,219) = 5;
    CONSTANTS(:,220) = 45;
    CONSTANTS(:,221) = 0.01;
    CONSTANTS(:,222) = 5;
    CONSTANTS(:,223) = 0.625;
    CONSTANTS(:,224) = 5;
    CONSTANTS(:,225) = 5;
    CONSTANTS(:,226) = 5;
    CONSTANTS(:,227) = 5;
    CONSTANTS(:,228) = 0.08;
    CONSTANTS(:,229) = 0.24;
    CONSTANTS(:,230) = 0.55;
    CONSTANTS(:,231) = 0;
    CONSTANTS(:,232) = 164;
    CONSTANTS(:,233) = 0.1;
    CONSTANTS(:,234) = 0;
    CONSTANTS(:,235) = 0;
    CONSTANTS(:,236) = 0.6;
    CONSTANTS(:,237) = 0.3;
    CONSTANTS(:,238) = 10;
    CONSTANTS(:,239) = 1;
    CONSTANTS(:,240) = 1;
    CONSTANTS(:,241) = 90;
    CONSTANTS(:,242) = 150;
    CONSTANTS(:,243) = 0.53333;
    CONSTANTS(:,244) = 0;
    CONSTANTS(:,245) = 0;
    CONSTANTS(:,246) = 1;
    CONSTANTS(:,247) = 1.0;
    CONSTANTS(:,248) = 1.22057;
    CONSTANTS(:,249) = 0.8;
    CONSTANTS(:,250) = 0;
    CONSTANTS(:,251) = 0;
    CONSTANTS(:,252) = 31.9719;
    CONSTANTS(:,253) = 0;
    CONSTANTS(:,254) = 60;
    CONSTANTS(:,255) = 0;
    CONSTANTS(:,256) = 1.0;
    CONSTANTS(:,257) = 0.301963;
    CONSTANTS(:,258) = 1.0;
    CONSTANTS(:,259) = 1.00269;
    CONSTANTS(:,260) = 1.09071;
    CONSTANTS(:,261) = 0.859476;
    CONSTANTS(:,262) = 1.0;
    CONSTANTS(:,263) = 0;
    CONSTANTS(:,264) = 1.02127;
    CONSTANTS(:,265) = 1.01179;
    CONSTANTS(:,266) = 1.1448;
    CONSTANTS(:,267) = 1.00007;
    CONSTANTS(:,268) = -0.060024;
    CONSTANTS(:,269) = 1.00132;
    CONSTANTS(:,270) = 0.0367573;
    CONSTANTS(:,271) = 1;
    CONSTANTS(:,272) = 1.00163;
    CONSTANTS(:,273) = 1.00237;
    CONSTANTS(:,274) = 3622.54;
    CONSTANTS(:,275) = 2109.91;
    CONSTANTS(:,276) = 2.368e-07;
    CONSTANTS(:,277) = 0.694163;
    CONSTANTS(:,278) = 204.497;
    CONSTANTS(:,279) = 0.699673;
    CONSTANTS(:,280) = 103.525;
    CONSTANTS(:,281) = 16.9144;
    CONSTANTS(:,282) = 159.549;
    CONSTANTS(:,283) = 0.419998;
    CONSTANTS(:,284) = 216.243;
    CONSTANTS(:,285) = 72.2362;
    CONSTANTS(:,286) = 48.0839;
    CONSTANTS(:,287) = 0;
    CONSTANTS(:,288) = 279.945;
    CONSTANTS(:,289) = 0.000980838;
    CONSTANTS(:,290) = 0.862514;
    CONSTANTS(:,291) = 25.0404;
    CONSTANTS(:,292) = 0.379883;
    CONSTANTS(:,293) = 0.38131;
    CONSTANTS(:,294) = 0.0123238;
    CONSTANTS(:,295) = 3.00449;
    CONSTANTS(:,296) = 0.100043;
    CONSTANTS(:,297) = 2.00439;
    CONSTANTS(:,298) = 0;
    CONSTANTS(:,299) = 39.8952;
    CONSTANTS(:,300) = 0.0101913;
    CONSTANTS(:,301) = 0.00366525;
    CONSTANTS(:,302) = 3.28246;
    CONSTANTS(:,303) = 0.5;
    CONSTANTS(:,304) = 60;
    CONSTANTS(:,305) = 40000;
    CONSTANTS(:,306) = 0.1;
    CONSTANTS(:,307) = 40000;
    CONSTANTS(:,308) = 1;
    CONSTANTS(:,309) = 4;
    CONSTANTS(:,310) = 0;
    CONSTANTS(:,311) = 0.2;
    CONSTANTS(:,312) = 5;
    CONSTANTS(:,313) = 0.3;
    CONSTANTS(:,314) = 85;
    CONSTANTS(:,315) = 15;
    CONSTANTS(:,316) = 0.93617;
    CONSTANTS(:,317) = 2.5;
    CONSTANTS(:,318) = 0.333;
    CONSTANTS(:,319) = 1000;
    CONSTANTS(:,320) = 1;
    CONSTANTS(:,321) = 0.3;
    CONSTANTS(:,322) = 2;
    CONSTANTS(:,323) = 0.3;
    CONSTANTS(:,324) = 0;
    CONSTANTS(:,325) = 0;
    CONSTANTS(:,326) = 2.5;
    CONSTANTS(:,327) = 0;
    CONSTANTS(:,328) = 5;
    CONSTANTS(:,329) = 0.65;
    CONSTANTS(:,330) = 0.5;
    CONSTANTS(:,331) = 12;
    CONSTANTS(:,332) = 0.005;
    CONSTANTS(:,333) = 0.005;
    CONSTANTS(:,334) = 0.04;
    CONSTANTS(:,335) = 0.8;
    CONSTANTS(:,336) = 15;
    CONSTANTS(:,337) = 60;
    CONSTANTS(:,338) = 0.4;
    CONSTANTS(:,339) = 0;
    CONSTANTS(:,340) = 0;
    CONSTANTS(:,341) = 2.5;
    CONSTANTS(:,342) = 1.4;
    CONSTANTS(:,343) = 0.86;
    CONSTANTS(:,344) = 1.6;
    CONSTANTS(:,345) = 0.3;
    CONSTANTS(:,346) = 2;
    CONSTANTS(:,347) = 0.7;
    CONSTANTS(:,348) = 1;
    CONSTANTS(:,349) = 2;
    CONSTANTS(:,350) = 1.5;
    CONSTANTS(:,351) = 1.8;
    CONSTANTS(:,352) = 4;
    CONSTANTS(:,353) = 1.5;
    CONSTANTS(:,354) = 10;
    CONSTANTS(:,355) = 12;
    CONSTANTS(:,356) = 0.8;
    CONSTANTS(:,357) = 6;
    CONSTANTS(:,358) = 0;
    CONSTANTS(:,359) = 5000;
    CONSTANTS(:,360) = 0;
    CONSTANTS(:,361) = -0.2;
    CONSTANTS(:,362) = 0.005;
    CONSTANTS(:,363) = 0.005;
    CONSTANTS(:,364) = 0.5;
    CONSTANTS(:,365) = 0.3;
    CONSTANTS(:,366) = 0.3;
    CONSTANTS(:,367) = 0.004;
    CONSTANTS(:,368) = 1.5;
    CONSTANTS(:,369) = 0;
    CONSTANTS(:,370) = 3;
    CONSTANTS(:,371) = 1;
    CONSTANTS(:,372) = 5.0;
    CONSTANTS(:,373) = 0.4;
    CONSTANTS(:,374) = 0.3;
    CONSTANTS(:,375) = 0.5;
    CONSTANTS(:,376) = 1.0;
    CONSTANTS(:,377) = 1;
    CONSTANTS(:,378) = 1.5;
    CONSTANTS(:,379) = 0;
    CONSTANTS(:,380) = 7;
    CONSTANTS(:,381) = 0.9;
    CONSTANTS(:,382) = 1;
    CONSTANTS(:,383) = 0.16;
    CONSTANTS(:,384) = 0.01167;
    CONSTANTS(:,385) = 4;
    CONSTANTS(:,386) = 2;
    CONSTANTS(:,387) = 0.0212;
    CONSTANTS(:,388) = 0.2;
    CONSTANTS(:,389) = 139;
    CONSTANTS(:,390) = 0.0003;
    CONSTANTS(:,391) = 0.000253;
    CONSTANTS(:,392) = 40;
    CONSTANTS(:,393) = 0.1;
    CONSTANTS(:,394) = 0;
    CONSTANTS(:,395) = 1;
    CONSTANTS(:,396) = 0.05;
    CONSTANTS(:,397) = 0.675;
    CONSTANTS(:,398) = 1e-06;
    CONSTANTS(:,399) = 1;
    CONSTANTS(:,400) = 24;
    CONSTANTS(:,401) = 0;
    CONSTANTS(:,402) = 1;
    CONSTANTS(:,403) = 0.01;
    CONSTANTS(:,404) = 1.0;
    CONSTANTS(:,405) = 0.17;
    CONSTANTS(:,406) = 0;
    CONSTANTS(:,407) = 0.8092;
    CONSTANTS(:,408) = 0.0208333;
    CONSTANTS(:,409) = 3;
    CONSTANTS(:,410) = 0.001;
    CONSTANTS(:,411) = 1.0;
    CONSTANTS(:,412) = 1850;
    CONSTANTS(:,413) = 4.714e-08;
    CONSTANTS(:,414) = 0.4;
    CONSTANTS(:,415) = 1;
    CONSTANTS(:,416) = 0;
    CONSTANTS(:,417) = 0;
    CONSTANTS(:,418) = 10000;
    CONSTANTS(:,419) = 8;
    CONSTANTS(:,420) = 2.728e-14;
    CONSTANTS(:,421) = 0.03;
    CONSTANTS(:,422) = 10;
    CONSTANTS(:,423) = 0.667;
    CONSTANTS(:,424) = 0.005;
    CONSTANTS(:,425) = 0.01;
    CONSTANTS(:,426) = 0;
    CONSTANTS(:,427) = 0.1;
    CONSTANTS(:,428) = 0.01;
    CONSTANTS(:,429) = 57.1;
    CONSTANTS(:,430) = 1;
    CONSTANTS(:,431) = 2;
    CONSTANTS(:,432) = 1;
    CONSTANTS(:,433) = 15;
    CONSTANTS(:,434) = 0;
    CONSTANTS(:,435) = -2;
    CONSTANTS(:,436) = 0.79167;
    CONSTANTS(:,437) = 1.8;
    CONSTANTS(:,438) = 4.2;
    CONSTANTS(:,439) = 30;
    CONSTANTS(:,440) = 0.001;
    CONSTANTS(:,441) = 0.1;
    CONSTANTS(:,442) = 0.04;
    CONSTANTS(:,443) = 2;
    CONSTANTS(:,444) = 0.1;
    CONSTANTS(:,445) = 35;
    CONSTANTS(:,446) = 2;
    CONSTANTS(:,447) = 8;
    CONSTANTS(:,448) = 0.2;
    CONSTANTS(:,449) = 0.15;
    CONSTANTS(:,450) = 0.5;
    CONSTANTS(:,451) = 96.3;
    CONSTANTS(:,452) = 0;
    CONSTANTS(:,453) = 30.52;
    CONSTANTS(:,454) = 2000;
    CONSTANTS(:,455) = 0;
    CONSTANTS(:,456) = 1;
    CONSTANTS(:,457) = 0.03;
    CONSTANTS(:,458) = 0.3;
    CONSTANTS(:,459) = 1;
    CONSTANTS(:,460) = 0;
    CONSTANTS(:,461) = 5.8e-06;
    CONSTANTS(:,462) = 15;
    CONSTANTS(:,463) = 0;
    CONSTANTS(:,464) = 0;
    CONSTANTS(:,465) = 0.9;
    CONSTANTS(:,466) = 15.2;
    CONSTANTS(:,467) = 6;
    CONSTANTS(:,468) = 19.167;
    CONSTANTS(:,469) = 1;
    CONSTANTS(:,470) = 1;
    CONSTANTS(:,471) = 1;
    CONSTANTS(:,472) = 5;
    CONSTANTS(:,473) = 10000;
    CONSTANTS(:,474) = 0;
    CONSTANTS(:,475) = 0;
    CONSTANTS(:,476) = 0.05;
    CONSTANTS(:,477) = 0;
    CONSTANTS(:,478) = 0;
    CONSTANTS(:,479) = 0;
    CONSTANTS(:,480) = 0.15;
    CONSTANTS(:,481) = 0.005;
    CONSTANTS(:,482) = 30;
    CONSTANTS(:,483) = 4;
    CONSTANTS(:,484) = 0.01;
    CONSTANTS(:,485) = 0.01;
    CONSTANTS(:,486) = 1;
    CONSTANTS(:,487) = 0.01;
    CONSTANTS(:,488) = 0.0175;
    CONSTANTS(:,489) = 6;
    CONSTANTS(:,490) = 2.51;
    CONSTANTS(:,491) = 4;
    CONSTANTS(:,492) = 1;
    CONSTANTS(:,493) = 0.5;
    CONSTANTS(:,494) = 0.3;
    CONSTANTS(:,495) = 20;
    CONSTANTS(:,496) = 5;
    CONSTANTS(:,497) = 45;
    CONSTANTS(:,498) = 0.01;
    CONSTANTS(:,499) = 5;
    CONSTANTS(:,500) = 0.625;
    CONSTANTS(:,501) = 5;
    CONSTANTS(:,502) = 5;
    CONSTANTS(:,503) = 5;
    CONSTANTS(:,504) = 5;
    CONSTANTS(:,505) = 0.08;
    CONSTANTS(:,506) = 0.24;
    CONSTANTS(:,507) = 0.55;
    CONSTANTS(:,508) = 0;
    CONSTANTS(:,509) = 164;
    CONSTANTS(:,510) = 0.1;
    CONSTANTS(:,511) = 0;
    CONSTANTS(:,512) = 0;
    CONSTANTS(:,513) = 0.6;
    CONSTANTS(:,514) = 0.3;
    CONSTANTS(:,515) = 10;
    CONSTANTS(:,516) = 1;
    CONSTANTS(:,517) = 1;
    CONSTANTS(:,518) = 90;
    CONSTANTS(:,519) = 150;
    CONSTANTS(:,520) = 0.53333;
    CONSTANTS(:,521) = 0;
    CONSTANTS(:,522) = 0;
    CONSTANTS(:,523) = 1;
    CONSTANTS(:,524) = 1.0;
    CONSTANTS(:,525) = 1.22057;
    CONSTANTS(:,526) = 0.8;
    CONSTANTS(:,527) = 0;
    CONSTANTS(:,528) = 0;
    CONSTANTS(:,529) = 31.9719;
    CONSTANTS(:,530) = 0;
    CONSTANTS(:,531) = 60;
    CONSTANTS(:,532) = 0;
    CONSTANTS(:,533) = 1.0;
    CONSTANTS(:,534) = 0.301963;
    CONSTANTS(:,535) = 1.0;
    CONSTANTS(:,536) = 1.00269;
    CONSTANTS(:,537) = 1.09071;
    CONSTANTS(:,538) = 0.859476;
    CONSTANTS(:,539) = 1.0;
    CONSTANTS(:,540) = 0;
    CONSTANTS(:,541) = 1.02127;
    CONSTANTS(:,542) = 1.01179;
    CONSTANTS(:,543) = 1.1448;
    CONSTANTS(:,544) = 1.00007;
    CONSTANTS(:,545) = -0.060024;
    CONSTANTS(:,546) = 1.00132;
    CONSTANTS(:,547) = 0.0367573;
    CONSTANTS(:,548) = 1;
    CONSTANTS(:,549) = 1.00163;
    CONSTANTS(:,550) = 1.00237;
    CONSTANTS(:,551) = 3622.54;
    CONSTANTS(:,552) = 2109.91;
    CONSTANTS(:,553) = 2.368e-07;
    CONSTANTS(:,554) = 0.694163;
    CONSTANTS(:,555) = 204.497;
    CONSTANTS(:,556) = 0.699673;
    CONSTANTS(:,557) = 103.525;
    CONSTANTS(:,558) = 16.9144;
    CONSTANTS(:,559) = 159.549;
    CONSTANTS(:,560) = 0.419998;
    CONSTANTS(:,561) = 216.243;
    CONSTANTS(:,562) = 72.2362;
    CONSTANTS(:,563) = 48.0839;
    CONSTANTS(:,564) = 0;
    CONSTANTS(:,565) = 279.945;
    CONSTANTS(:,566) = 0.000980838;
    CONSTANTS(:,567) = 0.862514;
    CONSTANTS(:,568) = 25.0404;
    CONSTANTS(:,569) = 0.379883;
    CONSTANTS(:,570) = 0.38131;
    CONSTANTS(:,571) = 0.0123238;
    CONSTANTS(:,572) = 3.00449;
    CONSTANTS(:,573) = 0.100043;
    CONSTANTS(:,574) = 2.00439;
    CONSTANTS(:,575) = 0;
    CONSTANTS(:,576) = 39.8952;
    CONSTANTS(:,577) = 0.0101913;
    CONSTANTS(:,578) = 0.00366525;
    CONSTANTS(:,579) = 3.28246;
    CONSTANTS(:,580) =  (CONSTANTS(:,1) - 1.00000).*CONSTANTS(:,361);
    CONSTANTS(:,581) =  ( (CONSTANTS(:,10) - 17.0000).*CONSTANTS(:,388)+17.0000).*CONSTANTS(:,387);
    CONSTANTS(:,582) = CONSTANTS(:,469)./CONSTANTS(:,581);
    CONSTANTS(:,583) =  CONSTANTS(:,8).*CONSTANTS(:,582).*CONSTANTS(:,7).*CONSTANTS(:,9);
    CONSTANTS(:,584) =  CONSTANTS(:,583).*1.79000;
    STATES(:,1) = CONSTANTS(:,579);
    STATES(:,2) = CONSTANTS(:,567);
    STATES(:,3) = CONSTANTS(:,569);
    STATES(:,4) = CONSTANTS(:,570);
    STATES(:,5) = CONSTANTS(:,573);
    if (isempty(STATES)), warning('Initial values for states not set');, end
end

function [RATES, ALGEBRAIC] = computeRates(VOI, STATES, CONSTANTS)
    global algebraicVariableCount;
    statesSize = size(STATES);
    statesColumnCount = statesSize(2);
    if ( statesColumnCount == 1)
        STATES = STATES';
        ALGEBRAIC = zeros(1, algebraicVariableCount);
        utilOnes = 1;
    else
        statesRowCount = statesSize(1);
        ALGEBRAIC = zeros(statesRowCount, algebraicVariableCount);
        RATES = zeros(statesRowCount, statesColumnCount);
        utilOnes = ones(statesRowCount, 1);
    end
    ALGEBRAIC(:,1) = ((((((CONSTANTS(:,16)+CONSTANTS(:,17)) - STATES(:,1)) - STATES(:,2)) - STATES(:,3)) - STATES(:,4)) - STATES(:,5))./2.00000;
    ALGEBRAIC(:,16) = STATES(:,3)+ ALGEBRAIC(:,1).*0.128000;
    ALGEBRAIC(:,17) = ALGEBRAIC(:,16) - 0.380000;
    ALGEBRAIC(:,18) = ALGEBRAIC(:,17)./0.0100000;
    ALGEBRAIC(:,24) =  (ALGEBRAIC(:,18)+4.00000).*( CONSTANTS(:,414).*(CONSTANTS(:,25) - 1.00000)+1.00000) - 4.00000;
    ALGEBRAIC(:,25) = piecewise({ALGEBRAIC(:,24)<= - 2.00000, 0.0100000 , ALGEBRAIC(:,24)> - 2.00000&ALGEBRAIC(:,24)<=1.00000, 0.0100000+( (3.60000 - 0.0100000).*(ALGEBRAIC(:,24) -  - 2.00000))./(1.00000 -  - 2.00000) , ALGEBRAIC(:,24)>1.00000&ALGEBRAIC(:,24)<=5.00000, 3.60000+( (9.40000 - 3.60000).*(ALGEBRAIC(:,24) - 1.00000))./(5.00000 - 1.00000) , ALGEBRAIC(:,24)>5.00000&ALGEBRAIC(:,24)<=8.00000, 9.40000+( (11.6000 - 9.40000).*(ALGEBRAIC(:,24) - 5.00000))./(8.00000 - 5.00000) , ALGEBRAIC(:,24)>8.00000&ALGEBRAIC(:,24)<=12.0000, 11.6000+( (13.5000 - 11.6000).*(ALGEBRAIC(:,24) - 8.00000))./(12.0000 - 8.00000) }, 13.5000);
    ALGEBRAIC(:,35) = STATES(:,2)+ ALGEBRAIC(:,1).*0.261000;
    ALGEBRAIC(:,36) = ALGEBRAIC(:,35) - 0.495000;
    ALGEBRAIC(:,37) = ALGEBRAIC(:,36)./0.00355000;
    ALGEBRAIC(:,38) = ALGEBRAIC(:,37)./( CONSTANTS(:,20).*CONSTANTS(:,21));
    ALGEBRAIC(:,39) = piecewise({ALGEBRAIC(:,38)<=0.00000, 1.04000 , ALGEBRAIC(:,38)>0.00000&ALGEBRAIC(:,38)<=60.0000, 1.04000+( (1.02500 - 1.04000).*(ALGEBRAIC(:,38) - 0.00000))./(60.0000 - 0.00000) , ALGEBRAIC(:,38)>60.0000&ALGEBRAIC(:,38)<=125.000, 1.02500+( (0.970000 - 1.02500).*(ALGEBRAIC(:,38) - 60.0000))./(125.000 - 60.0000) , ALGEBRAIC(:,38)>125.000&ALGEBRAIC(:,38)<=160.000, 0.970000+( (0.880000 - 0.970000).*(ALGEBRAIC(:,38) - 125.000))./(160.000 - 125.000) , ALGEBRAIC(:,38)>160.000&ALGEBRAIC(:,38)<=200.000, 0.880000+( (0.590000 - 0.880000).*(ALGEBRAIC(:,38) - 160.000))./(200.000 - 160.000) , ALGEBRAIC(:,38)>200.000&ALGEBRAIC(:,38)<=240.000, 0.590000+( (0.00000 - 0.590000).*(ALGEBRAIC(:,38) - 200.000))./(240.000 - 200.000) }, 0.00000);
    ALGEBRAIC(:,40) =  ALGEBRAIC(:,39).*ALGEBRAIC(:,25).*CONSTANTS(:,20).*CONSTANTS(:,517).*CONSTANTS(:,19).*CONSTANTS(:,22);
    ALGEBRAIC(:,41) = (ALGEBRAIC(:,18) - ALGEBRAIC(:,37))./3.00000;
    ALGEBRAIC(:,42) = piecewise({ALGEBRAIC(:,41)>0.00000, ALGEBRAIC(:,40)+ALGEBRAIC(:,41) }, ALGEBRAIC(:,40));
    ALGEBRAIC(:,7) = STATES(:,4)+ ALGEBRAIC(:,1).*0.155000;
    ALGEBRAIC(:,8) = ALGEBRAIC(:,7) - 0.306250;
    ALGEBRAIC(:,9) = ALGEBRAIC(:,8)./0.00480000;
    ALGEBRAIC(:,12) =  0.0260000.*ALGEBRAIC(:,9);
    ALGEBRAIC(:,13) = piecewise({ALGEBRAIC(:,12)<1.00000e-05, 1.00000e-05 }, ALGEBRAIC(:,12));
    ALGEBRAIC(:,14) = power(ALGEBRAIC(:,13), 0.500000);
    ALGEBRAIC(:,15) = 1.00000./ALGEBRAIC(:,14);
    ALGEBRAIC(:,19) = ALGEBRAIC(:,18)+18.0000;
    ALGEBRAIC(:,20) = 1.00000./( ALGEBRAIC(:,19).*0.0357000);
    ALGEBRAIC(:,21) = ALGEBRAIC(:,20)+ALGEBRAIC(:,15);
    ALGEBRAIC(:,22) = ALGEBRAIC(:,9) - ALGEBRAIC(:,18);
    ALGEBRAIC(:,23) = ALGEBRAIC(:,22)./ALGEBRAIC(:,21);
    ALGEBRAIC(:,44) = ALGEBRAIC(:,23) - ALGEBRAIC(:,42);
    RATES(:,3) = ALGEBRAIC(:,44);
    ALGEBRAIC(:,10) = (ALGEBRAIC(:,9)./CONSTANTS(:,20))./CONSTANTS(:,21);
    ALGEBRAIC(:,11) = piecewise({ALGEBRAIC(:,10)<=0.00000, 1.06000 , ALGEBRAIC(:,10)>0.00000&ALGEBRAIC(:,10)<=32.0000, 1.06000+( (0.970000 - 1.06000).*(ALGEBRAIC(:,10) - 0.00000))./(32.0000 - 0.00000) , ALGEBRAIC(:,10)>32.0000&ALGEBRAIC(:,10)<=38.4000, 0.970000+( (0.930000 - 0.970000).*(ALGEBRAIC(:,10) - 32.0000))./(38.4000 - 32.0000) , ALGEBRAIC(:,10)>38.4000&ALGEBRAIC(:,10)<=48.0000, 0.930000+( (0.800000 - 0.930000).*(ALGEBRAIC(:,10) - 38.4000))./(48.0000 - 38.4000) , ALGEBRAIC(:,10)>48.0000&ALGEBRAIC(:,10)<=60.8000, 0.800000+( (0.460000 - 0.800000).*(ALGEBRAIC(:,10) - 48.0000))./(60.8000 - 48.0000) , ALGEBRAIC(:,10)>60.8000&ALGEBRAIC(:,10)<=72.0000, 0.460000+( (0.00000 - 0.460000).*(ALGEBRAIC(:,10) - 60.8000))./(72.0000 - 60.8000) }, 0.00000);
    ALGEBRAIC(:,43) =  (1.00000 - CONSTANTS(:,449)).*CONSTANTS(:,20).*ALGEBRAIC(:,11).*CONSTANTS(:,516).*CONSTANTS(:,19).*CONSTANTS(:,18)+( CONSTANTS(:,449).*ALGEBRAIC(:,42))./ALGEBRAIC(:,25);
    ALGEBRAIC(:,2) = STATES(:,5)+ ALGEBRAIC(:,1).*0.0574000;
    ALGEBRAIC(:,3) = ALGEBRAIC(:,2) - 0.100000;
    ALGEBRAIC(:,4) = ALGEBRAIC(:,3)./0.00500000;
    ALGEBRAIC(:,5) =  (ALGEBRAIC(:,4)+8.00000).*( CONSTANTS(:,414).*(CONSTANTS(:,25) - 1.00000)+1.00000) - 8.00000;
    ALGEBRAIC(:,6) = piecewise({ALGEBRAIC(:,5)<= - 8.00000, 0.00000 , ALGEBRAIC(:,5)> - 8.00000&ALGEBRAIC(:,5)<= - 6.00000, 0.00000+( (0.750000 - 0.00000).*(ALGEBRAIC(:,5) -  - 8.00000))./( - 6.00000 -  - 8.00000) , ALGEBRAIC(:,5)> - 6.00000&ALGEBRAIC(:,5)<= - 2.00000, 0.750000+( (2.60000 - 0.750000).*(ALGEBRAIC(:,5) -  - 6.00000))./( - 2.00000 -  - 6.00000) , ALGEBRAIC(:,5)> - 2.00000&ALGEBRAIC(:,5)<=4.00000, 2.60000+( (9.80000 - 2.60000).*(ALGEBRAIC(:,5) -  - 2.00000))./(4.00000 -  - 2.00000) , ALGEBRAIC(:,5)>4.00000&ALGEBRAIC(:,5)<=12.0000, 9.80000+( (13.5000 - 9.80000).*(ALGEBRAIC(:,5) - 4.00000))./(12.0000 - 4.00000) }, 13.5000);
    ALGEBRAIC(:,46) =  ALGEBRAIC(:,6).*ALGEBRAIC(:,43);
    ALGEBRAIC(:,26) = STATES(:,1)+ ALGEBRAIC(:,1).*0.398600;
    ALGEBRAIC(:,27) = ((((ALGEBRAIC(:,26) - CONSTANTS(:,12)) - CONSTANTS(:,580)) - CONSTANTS(:,14)) - CONSTANTS(:,13)) - CONSTANTS(:,15);
    ALGEBRAIC(:,28) = piecewise({ALGEBRAIC(:,27)<0.000100000, 0.000100000 }, ALGEBRAIC(:,27));
    ALGEBRAIC(:,29) = 3.70000+(ALGEBRAIC(:,28) - 0.740000)./CONSTANTS(:,393);
    ALGEBRAIC(:,30) = piecewise({ALGEBRAIC(:,29)<0.000100000, 0.000100000 }, ALGEBRAIC(:,29));
    ALGEBRAIC(:,32) = 0.740000./power(ALGEBRAIC(:,30)./( CONSTANTS(:,7).*3.70000), 0.500000);
    ALGEBRAIC(:,31) = piecewise({ALGEBRAIC(:,4)<CONSTANTS(:,434), CONSTANTS(:,434) }, ALGEBRAIC(:,4));
    ALGEBRAIC(:,33) = ALGEBRAIC(:,30) - ALGEBRAIC(:,31);
    ALGEBRAIC(:,34) = ALGEBRAIC(:,33)./ALGEBRAIC(:,32);
    ALGEBRAIC(:,48) = ALGEBRAIC(:,34) - ALGEBRAIC(:,46);
    RATES(:,5) = ALGEBRAIC(:,48);
    ALGEBRAIC(:,49) = ALGEBRAIC(:,46) - ALGEBRAIC(:,23);
    RATES(:,4) = ALGEBRAIC(:,49);
    ALGEBRAIC(:,45) = ALGEBRAIC(:,37) - ALGEBRAIC(:,4);
    ALGEBRAIC(:,57) =  ALGEBRAIC(:,45).*CONSTANTS(:,528);
    ALGEBRAIC(:,52) = ALGEBRAIC(:,37) - ALGEBRAIC(:,30);
    ALGEBRAIC(:,47) = power(ALGEBRAIC(:,37)./100.000, CONSTANTS(:,431));
    ALGEBRAIC(:,50) = (( CONSTANTS(:,1).*CONSTANTS(:,2).*CONSTANTS(:,24).*CONSTANTS(:,7).*CONSTANTS(:,3))./ALGEBRAIC(:,47))./CONSTANTS(:,4);
    ALGEBRAIC(:,53) =  CONSTANTS(:,451).*CONSTANTS(:,23).*ALGEBRAIC(:,50).*CONSTANTS(:,5).*CONSTANTS(:,523);
    ALGEBRAIC(:,55) = ALGEBRAIC(:,52)./ALGEBRAIC(:,53);
    ALGEBRAIC(:,51) =  CONSTANTS(:,453).*CONSTANTS(:,6).*ALGEBRAIC(:,50).*CONSTANTS(:,5).*CONSTANTS(:,523);
    ALGEBRAIC(:,54) = ALGEBRAIC(:,51)+CONSTANTS(:,584);
    ALGEBRAIC(:,56) = ALGEBRAIC(:,52)./ALGEBRAIC(:,54);
    ALGEBRAIC(:,58) = ALGEBRAIC(:,55)+ALGEBRAIC(:,56)+CONSTANTS(:,11);
    ALGEBRAIC(:,59) = ALGEBRAIC(:,58)+ALGEBRAIC(:,57);
    ALGEBRAIC(:,60) = ALGEBRAIC(:,59) - ALGEBRAIC(:,34);
    RATES(:,1) = ALGEBRAIC(:,60);
    ALGEBRAIC(:,61) = ALGEBRAIC(:,42) - ALGEBRAIC(:,59);
    RATES(:,2) = ALGEBRAIC(:,61);
   RATES = RATES';
end

% Calculate algebraic variables
function ALGEBRAIC = computeAlgebraic(ALGEBRAIC, CONSTANTS, STATES, VOI)
    statesSize = size(STATES);
    statesColumnCount = statesSize(2);
    if ( statesColumnCount == 1)
        STATES = STATES';
        utilOnes = 1;
    else
        statesRowCount = statesSize(1);
        utilOnes = ones(statesRowCount, 1);
    end
    ALGEBRAIC(:,1) = ((((((CONSTANTS(:,16)+CONSTANTS(:,17)) - STATES(:,1)) - STATES(:,2)) - STATES(:,3)) - STATES(:,4)) - STATES(:,5))./2.00000;
    ALGEBRAIC(:,16) = STATES(:,3)+ ALGEBRAIC(:,1).*0.128000;
    ALGEBRAIC(:,17) = ALGEBRAIC(:,16) - 0.380000;
    ALGEBRAIC(:,18) = ALGEBRAIC(:,17)./0.0100000;
    ALGEBRAIC(:,24) =  (ALGEBRAIC(:,18)+4.00000).*( CONSTANTS(:,414).*(CONSTANTS(:,25) - 1.00000)+1.00000) - 4.00000;
    ALGEBRAIC(:,25) = piecewise({ALGEBRAIC(:,24)<= - 2.00000, 0.0100000 , ALGEBRAIC(:,24)> - 2.00000&ALGEBRAIC(:,24)<=1.00000, 0.0100000+( (3.60000 - 0.0100000).*(ALGEBRAIC(:,24) -  - 2.00000))./(1.00000 -  - 2.00000) , ALGEBRAIC(:,24)>1.00000&ALGEBRAIC(:,24)<=5.00000, 3.60000+( (9.40000 - 3.60000).*(ALGEBRAIC(:,24) - 1.00000))./(5.00000 - 1.00000) , ALGEBRAIC(:,24)>5.00000&ALGEBRAIC(:,24)<=8.00000, 9.40000+( (11.6000 - 9.40000).*(ALGEBRAIC(:,24) - 5.00000))./(8.00000 - 5.00000) , ALGEBRAIC(:,24)>8.00000&ALGEBRAIC(:,24)<=12.0000, 11.6000+( (13.5000 - 11.6000).*(ALGEBRAIC(:,24) - 8.00000))./(12.0000 - 8.00000) }, 13.5000);
    ALGEBRAIC(:,35) = STATES(:,2)+ ALGEBRAIC(:,1).*0.261000;
    ALGEBRAIC(:,36) = ALGEBRAIC(:,35) - 0.495000;
    ALGEBRAIC(:,37) = ALGEBRAIC(:,36)./0.00355000;
    ALGEBRAIC(:,38) = ALGEBRAIC(:,37)./( CONSTANTS(:,20).*CONSTANTS(:,21));
    ALGEBRAIC(:,39) = piecewise({ALGEBRAIC(:,38)<=0.00000, 1.04000 , ALGEBRAIC(:,38)>0.00000&ALGEBRAIC(:,38)<=60.0000, 1.04000+( (1.02500 - 1.04000).*(ALGEBRAIC(:,38) - 0.00000))./(60.0000 - 0.00000) , ALGEBRAIC(:,38)>60.0000&ALGEBRAIC(:,38)<=125.000, 1.02500+( (0.970000 - 1.02500).*(ALGEBRAIC(:,38) - 60.0000))./(125.000 - 60.0000) , ALGEBRAIC(:,38)>125.000&ALGEBRAIC(:,38)<=160.000, 0.970000+( (0.880000 - 0.970000).*(ALGEBRAIC(:,38) - 125.000))./(160.000 - 125.000) , ALGEBRAIC(:,38)>160.000&ALGEBRAIC(:,38)<=200.000, 0.880000+( (0.590000 - 0.880000).*(ALGEBRAIC(:,38) - 160.000))./(200.000 - 160.000) , ALGEBRAIC(:,38)>200.000&ALGEBRAIC(:,38)<=240.000, 0.590000+( (0.00000 - 0.590000).*(ALGEBRAIC(:,38) - 200.000))./(240.000 - 200.000) }, 0.00000);
    ALGEBRAIC(:,40) =  ALGEBRAIC(:,39).*ALGEBRAIC(:,25).*CONSTANTS(:,20).*CONSTANTS(:,517).*CONSTANTS(:,19).*CONSTANTS(:,22);
    ALGEBRAIC(:,41) = (ALGEBRAIC(:,18) - ALGEBRAIC(:,37))./3.00000;
    ALGEBRAIC(:,42) = piecewise({ALGEBRAIC(:,41)>0.00000, ALGEBRAIC(:,40)+ALGEBRAIC(:,41) }, ALGEBRAIC(:,40));
    ALGEBRAIC(:,7) = STATES(:,4)+ ALGEBRAIC(:,1).*0.155000;
    ALGEBRAIC(:,8) = ALGEBRAIC(:,7) - 0.306250;
    ALGEBRAIC(:,9) = ALGEBRAIC(:,8)./0.00480000;
    ALGEBRAIC(:,12) =  0.0260000.*ALGEBRAIC(:,9);
    ALGEBRAIC(:,13) = piecewise({ALGEBRAIC(:,12)<1.00000e-05, 1.00000e-05 }, ALGEBRAIC(:,12));
    ALGEBRAIC(:,14) = power(ALGEBRAIC(:,13), 0.500000);
    ALGEBRAIC(:,15) = 1.00000./ALGEBRAIC(:,14);
    ALGEBRAIC(:,19) = ALGEBRAIC(:,18)+18.0000;
    ALGEBRAIC(:,20) = 1.00000./( ALGEBRAIC(:,19).*0.0357000);
    ALGEBRAIC(:,21) = ALGEBRAIC(:,20)+ALGEBRAIC(:,15);
    ALGEBRAIC(:,22) = ALGEBRAIC(:,9) - ALGEBRAIC(:,18);
    ALGEBRAIC(:,23) = ALGEBRAIC(:,22)./ALGEBRAIC(:,21);
    ALGEBRAIC(:,44) = ALGEBRAIC(:,23) - ALGEBRAIC(:,42);
    ALGEBRAIC(:,10) = (ALGEBRAIC(:,9)./CONSTANTS(:,20))./CONSTANTS(:,21);
    ALGEBRAIC(:,11) = piecewise({ALGEBRAIC(:,10)<=0.00000, 1.06000 , ALGEBRAIC(:,10)>0.00000&ALGEBRAIC(:,10)<=32.0000, 1.06000+( (0.970000 - 1.06000).*(ALGEBRAIC(:,10) - 0.00000))./(32.0000 - 0.00000) , ALGEBRAIC(:,10)>32.0000&ALGEBRAIC(:,10)<=38.4000, 0.970000+( (0.930000 - 0.970000).*(ALGEBRAIC(:,10) - 32.0000))./(38.4000 - 32.0000) , ALGEBRAIC(:,10)>38.4000&ALGEBRAIC(:,10)<=48.0000, 0.930000+( (0.800000 - 0.930000).*(ALGEBRAIC(:,10) - 38.4000))./(48.0000 - 38.4000) , ALGEBRAIC(:,10)>48.0000&ALGEBRAIC(:,10)<=60.8000, 0.800000+( (0.460000 - 0.800000).*(ALGEBRAIC(:,10) - 48.0000))./(60.8000 - 48.0000) , ALGEBRAIC(:,10)>60.8000&ALGEBRAIC(:,10)<=72.0000, 0.460000+( (0.00000 - 0.460000).*(ALGEBRAIC(:,10) - 60.8000))./(72.0000 - 60.8000) }, 0.00000);
    ALGEBRAIC(:,43) =  (1.00000 - CONSTANTS(:,449)).*CONSTANTS(:,20).*ALGEBRAIC(:,11).*CONSTANTS(:,516).*CONSTANTS(:,19).*CONSTANTS(:,18)+( CONSTANTS(:,449).*ALGEBRAIC(:,42))./ALGEBRAIC(:,25);
    ALGEBRAIC(:,2) = STATES(:,5)+ ALGEBRAIC(:,1).*0.0574000;
    ALGEBRAIC(:,3) = ALGEBRAIC(:,2) - 0.100000;
    ALGEBRAIC(:,4) = ALGEBRAIC(:,3)./0.00500000;
    ALGEBRAIC(:,5) =  (ALGEBRAIC(:,4)+8.00000).*( CONSTANTS(:,414).*(CONSTANTS(:,25) - 1.00000)+1.00000) - 8.00000;
    ALGEBRAIC(:,6) = piecewise({ALGEBRAIC(:,5)<= - 8.00000, 0.00000 , ALGEBRAIC(:,5)> - 8.00000&ALGEBRAIC(:,5)<= - 6.00000, 0.00000+( (0.750000 - 0.00000).*(ALGEBRAIC(:,5) -  - 8.00000))./( - 6.00000 -  - 8.00000) , ALGEBRAIC(:,5)> - 6.00000&ALGEBRAIC(:,5)<= - 2.00000, 0.750000+( (2.60000 - 0.750000).*(ALGEBRAIC(:,5) -  - 6.00000))./( - 2.00000 -  - 6.00000) , ALGEBRAIC(:,5)> - 2.00000&ALGEBRAIC(:,5)<=4.00000, 2.60000+( (9.80000 - 2.60000).*(ALGEBRAIC(:,5) -  - 2.00000))./(4.00000 -  - 2.00000) , ALGEBRAIC(:,5)>4.00000&ALGEBRAIC(:,5)<=12.0000, 9.80000+( (13.5000 - 9.80000).*(ALGEBRAIC(:,5) - 4.00000))./(12.0000 - 4.00000) }, 13.5000);
    ALGEBRAIC(:,46) =  ALGEBRAIC(:,6).*ALGEBRAIC(:,43);
    ALGEBRAIC(:,26) = STATES(:,1)+ ALGEBRAIC(:,1).*0.398600;
    ALGEBRAIC(:,27) = ((((ALGEBRAIC(:,26) - CONSTANTS(:,12)) - CONSTANTS(:,580)) - CONSTANTS(:,14)) - CONSTANTS(:,13)) - CONSTANTS(:,15);
    ALGEBRAIC(:,28) = piecewise({ALGEBRAIC(:,27)<0.000100000, 0.000100000 }, ALGEBRAIC(:,27));
    ALGEBRAIC(:,29) = 3.70000+(ALGEBRAIC(:,28) - 0.740000)./CONSTANTS(:,393);
    ALGEBRAIC(:,30) = piecewise({ALGEBRAIC(:,29)<0.000100000, 0.000100000 }, ALGEBRAIC(:,29));
    ALGEBRAIC(:,32) = 0.740000./power(ALGEBRAIC(:,30)./( CONSTANTS(:,7).*3.70000), 0.500000);
    ALGEBRAIC(:,31) = piecewise({ALGEBRAIC(:,4)<CONSTANTS(:,434), CONSTANTS(:,434) }, ALGEBRAIC(:,4));
    ALGEBRAIC(:,33) = ALGEBRAIC(:,30) - ALGEBRAIC(:,31);
    ALGEBRAIC(:,34) = ALGEBRAIC(:,33)./ALGEBRAIC(:,32);
    ALGEBRAIC(:,48) = ALGEBRAIC(:,34) - ALGEBRAIC(:,46);
    ALGEBRAIC(:,49) = ALGEBRAIC(:,46) - ALGEBRAIC(:,23);
    ALGEBRAIC(:,45) = ALGEBRAIC(:,37) - ALGEBRAIC(:,4);
    ALGEBRAIC(:,57) =  ALGEBRAIC(:,45).*CONSTANTS(:,528);
    ALGEBRAIC(:,52) = ALGEBRAIC(:,37) - ALGEBRAIC(:,30);
    ALGEBRAIC(:,47) = power(ALGEBRAIC(:,37)./100.000, CONSTANTS(:,431));
    ALGEBRAIC(:,50) = (( CONSTANTS(:,1).*CONSTANTS(:,2).*CONSTANTS(:,24).*CONSTANTS(:,7).*CONSTANTS(:,3))./ALGEBRAIC(:,47))./CONSTANTS(:,4);
    ALGEBRAIC(:,53) =  CONSTANTS(:,451).*CONSTANTS(:,23).*ALGEBRAIC(:,50).*CONSTANTS(:,5).*CONSTANTS(:,523);
    ALGEBRAIC(:,55) = ALGEBRAIC(:,52)./ALGEBRAIC(:,53);
    ALGEBRAIC(:,51) =  CONSTANTS(:,453).*CONSTANTS(:,6).*ALGEBRAIC(:,50).*CONSTANTS(:,5).*CONSTANTS(:,523);
    ALGEBRAIC(:,54) = ALGEBRAIC(:,51)+CONSTANTS(:,584);
    ALGEBRAIC(:,56) = ALGEBRAIC(:,52)./ALGEBRAIC(:,54);
    ALGEBRAIC(:,58) = ALGEBRAIC(:,55)+ALGEBRAIC(:,56)+CONSTANTS(:,11);
    ALGEBRAIC(:,59) = ALGEBRAIC(:,58)+ALGEBRAIC(:,57);
    ALGEBRAIC(:,60) = ALGEBRAIC(:,59) - ALGEBRAIC(:,34);
    ALGEBRAIC(:,61) = ALGEBRAIC(:,42) - ALGEBRAIC(:,59);
    ALGEBRAIC(:,62) = ALGEBRAIC(:,45)./ALGEBRAIC(:,59);
end

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

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