$cmd = "runenergyplus eem_{$version}.idf /usr/local/EnergyPlus-8-0-0/WeatherData/USA_PA_Philadelphia.Intl.AP.724080_TMY3.epw";
$run = shell_exec($cmd);
# run the simulation
# add the new version EEM model to the list
$_SESSION['Model'][$version] = "eem_{$version}";
// udpate the latest version
$cur_model = "eem_{$version}";
//assign the current model
// baseline energy cost
$baselineCost = $_SESSION['newCost'][0];
// the current year from 1 to 10
$current_yr = ++$_SESSION['current_yr'];
// add a new energy simulation cost
$sql_file = "Output/{$cur_model}.sql";
$eeb = new EEB_SQLITE3("{$sql_file}");
$electric_tariff = $eeb->getValues('Tariff Report', 'BLDG101_ELECTRIC_RATE', 'Categories', '%');
$gas_tariff = $eeb->getValues('Tariff Report', 'BLDG101_GAS_RATE', 'Categories', '%');
$newCost = $_SESSION['newCost'][$current_yr] = round($electric_tariff['Total (~~$~~)'][Sum] + $gas_tariff['Total (~~$~~)'][Sum], 2);
$_SESSION['cur_model'] = "eem_{$version}";
// add a new installation cost
if ($addAirEconCost) {
    // get the air economizer data from Fans report table
    $fans = $eeb->getValues('EquipmentSummary', 'Entire Facility', 'Fans', '%');
    $airEconUnit = 0.5;
    // air economizer unit ($/CFM)
    $measureCost = $fans['FAN VARIABLE VOLUME 1']['Max Air Flow Rate'] * $airEconUnit;
    $installationCost += $measureCost;
}
if ($addCondensingBoilerCost) {
    // get the water boiler data from Central Plant report table
    $centralPlant = $eeb->getValues('EquipmentSummary', 'Entire Facility', 'Central Plant', '%');
if ($_POST['num_package'] != NULL) {
    $cur_model = $_SESSION['cur_model'] = $_POST['num_package'];
} elseif ($_POST['num_package'] == NULL && $_SESSION['cur_model'] == NULL) {
    $cur_model = $_SESSION[cur_model];
} else {
    $cur_model = $_SESSION[cur_model];
}
// baseline sql file path
if ($cur_model == $_SESSION['Model'][0]) {
    $sql_file = "ENERGYPLUS/idf/{$cur_model}/EnergyPlusPreProcess/EnergyPlus-0/eplusout.sql";
} else {
    // eem sql file path
    $sql_file = "eem/{$_SESSION['user_dir']}/Output/{$cur_model}.sql";
}
$eeb = new EEB_SQLITE3("{$sql_file}");
$total_vals = $eeb->getValues('AnnualBuildingUtilityPerformanceSummary', 'Entire Facility', 'Site and Source Energy', '%');
$site_vals = $eeb->getValues('AnnualBuildingUtilityPerformanceSummary', 'Entire Facility', 'End Uses', 'kBtu');
$source_vals = $eeb->getValues('SourceEnergyEndUseComponentsSummary', 'Entire Facility', 'Source Energy End Use Components Summary', 'kBtu');
$area_vals = $eeb->getValues('AnnualBuildingUtilityPerformanceSummary', 'Entire Facility', 'Building Area', '%');
?>

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>EEB Hub Simulation Tools: Comprehensive</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">

    <!-- Le styles -->
if ($_POST['num_package'] != NULL) {
    $cur_model = $_SESSION['cur_model'] = $_POST['num_package'];
} elseif ($_POST['num_package'] == NULL && $_SESSION['cur_model'] == NULL) {
    $cur_model = $_SESSION[cur_model];
} else {
    $cur_model = $_SESSION[cur_model];
}
// baseline sql file path
if ($cur_model == $_SESSION['Model'][0]) {
    $sql_file = "ENERGYPLUS/idf/{$cur_model}/EnergyPlusPreProcess/EnergyPlus-0/eplusout.sql";
} else {
    // eem sql file path
    $sql_file = "eem/{$_SESSION['user_dir']}/Output/{$cur_model}.sql";
}
$eeb = new EEB_SQLITE3("{$sql_file}");
$electric_tariff = $eeb->getValues('Tariff Report', 'BLDG101_ELECTRIC_RATE', 'Categories', '%');
$gas_tariff = $eeb->getValues('Tariff Report', 'BLDG101_GAS_RATE', 'Categories', '%');
function printRow($Row)
{
    foreach ($Row as $r) {
        if ($r > 0) {
            echo "<td> {$r} </td>";
        } else {
            echo "<td> 0.0 </td>";
        }
    }
}
function getRowData($Row)
{
    echo '[';
    foreach ($Row as $r) {