The following javascript program calculates the potential cost savings. See the notes marked // to see what we have based these figures on.

<script language="javascript">

function doCal()
{
var number_of_compressors = document.getElementById('cmbComp').value;

var shifts_per_day = document.getElementById("selPerDay").value;
var days_per_week = document.getElementById("selPerWeek").value;
var weeks_per_year = document.getElementById("selPerYear").value;
var sel_yesno = document.getElementById("selYesNo").value;
var sel_vsd = document.getElementById("selvsd").value;

var currency_unit; // currency unit or symbol
var currency_per_kWh = document.getElementById('costPerKWH').value; // currency cost of kWh to two decimal places (eg £0.05)

var system_pressure = document.getElementById("sysPressure").value; // 0.0 to 600.0 Bar
var app_pressure = document.getElementById("applicationpressure").value;

var motor_size_comp = new Array(13), actual_W_comp = new Array(13)

// working vars
var l_comp;
var total_installed_W, utilisation_control_savings;


for (l_comp=1; l_comp <= 10; l_comp++)
{
motor_size_comp[l_comp] = (document.getElementById('selSize' + l_comp).value) * 1000;
actual_W_comp[l_comp] = (motor_size_comp[l_comp] * 1.15) + (motor_size_comp[l_comp] * 0.055)
}


// cap system pressure
if(isNaN(system_pressure))
{
alert("Enter a system pressure as a numeric value");
return;
}
if(system_pressure < 1)
{
document.getElementById("sysPressure").value = "1.0";
system_pressure = 1;
}
else if(system_pressure > 600)
{
document.getElementById("sysPressure").value = "600";
system_pressure = 600;
}

// cap app pressure
if(isNaN(app_pressure))
{
alert("Enter a application pressure as a numeric value");
return;
}
if(app_pressure < 1)
{
document.getElementById("applicationpressure").value = "1.0";
app_pressure = 1;
}
else if(app_pressure > 600)
{
document.getElementById("applicationpressure").value = "600";
app_pressure = 600;
}

for (l_comp=1, total_installed_W=0; l_comp <= number_of_compressors; l_comp++)
total_installed_W += actual_W_comp[l_comp];

// ***************************************************************************
// ** non operational hours that the system is probably shutdown *************

// assume the system is shutdown during whole non-operational weeks
var shutdown_hours = (52 - weeks_per_year) * 168;

// assume the system is shutdown on sunday unless operational
// for more than 6 days per week

if(days_per_week <= 6)
shutdown_hours = shutdown_hours + (24 * weeks_per_year);

// ***************************************************************************
// ** hours a year at utilisation ********************************************

var operational_hours_year = ((shifts_per_day * 8) * days_per_week) * weeks_per_year;
var non_operational_hours_year = (8760 - operational_hours_year) - shutdown_hours;

// ***************************************************************************
// ** nominal_average_system_kw = 70% of installed Watt **********************
var operational_system_Wh = total_installed_W * 0.7;

//***************************************************************************
// ** non operational Wh = 18% of operational kwh due to system leakage ******
// ** 18% leakage rate derived from British Compressed Air Society Figures ***
// ** Figure seems unrealistic, will use 5% APUK ***

if (sel_yesno == 0) {
var non_operational_system_Wh = (operational_system_Wh) * 0.05;
} else {
var non_operational_system_Wh = 0;
}
// ***************************************************************************
// ** existing Wh usage per year *********************************************

var existing_annual_Wh = (operational_system_Wh * operational_hours_year) + (non_operational_system_Wh * non_operational_hours_year);


// ********************************************************************************************
// ** pressure reduction savings are dependant on operating and application pressure *********
// ** reduction in pressure of 1 bar you will incur a 4% reduction in power consumption *******

var pdif;
var pdif2;

if(system_pressure >= app_pressure) {
pdif = system_pressure -app_pressure;
pdif2 = pdif * 0.04;
pressure_reduction_savings = operational_system_Wh * pdif2;
}
else{
alert("Pressure required at application must be the same or less than system pressure");
}


// **************** VSD Savings available *********************************************************
// Reference: *
// One brand, Sigma Frequency Control (SFC) rotary screw compressors from Kaeser *
// Compressors, typically saves users 20 to 35% on electricity when applied to variable loads. *
// Note *
// We will use 25% as a conservative estimate as to the potential energy savings of having a vsd *

// ** Variable speed drive savings calculations ***********************************************

if (sel_vsd == 0) {
vsd_savings = operational_system_Wh * 0.25;

} else {
vsd_savings = 0;
}

// ***************************************************************************
// * Multiple compressor controller saving possibilities *
// ** single pressure band control savings ***********************************

var aSavingFactor = new Array(0, 0.0075, 0.02, 0.0325, 0.045, 0.0575, 0.07, 0.0075, 0.02, 0.0325, 0.045, 0.0575, 0.07);
var pressure_control_savings = operational_system_Wh * aSavingFactor[number_of_compressors];



// ***************************************************************************
// ** new Wh figures *********************************************************

var new_operational_Wh = operational_system_Wh - (vsd_savings + pressure_control_savings + pressure_reduction_savings);

// ***************************************************************************
// ** total potential Wh savings *********************************************

var Wh_savings = (existing_annual_Wh - (new_operational_Wh * operational_hours_year))+ (non_operational_system_Wh * non_operational_hours_year);

// ***************************************************************************
// ** convert Wh figure to kWh ***********************************************

var kWh_savings = Wh_savings * 0.001;
// ***************************************************************************
// ** total potential currency savings ***************************************

var currency_savings = kWh_savings * currency_per_kWh;

// ***************************************************************************
// ** OUTPUT: annual kWh saving **********************************************

// string_kwh_saving = Format(kWh_savings, "0.0") & " kWh"

// ***************************************************************************
// ** OUTPUT: annual currency value saving ***********************************

// string_currency_saving = Trim(currency_unit) & " " & Format(currency_savings, "0.00")

document.getElementById("tdKWSaving").innerHTML = "Estimated Annual Enery Savings = <b>" + addCommas(Math.round(kWh_savings)) + " kWh</b>";
document.getElementById("tdCostSaving").innerHTML = "Estimated Annual Cost Savings = <b> " + document.getElementById("currencyUnits").value + formatNumber(currency_savings) + "</b>";

document.getElementById('EnergySaving').value = addCommas(Math.round(kWh_savings));
document.getElementById('CostSaving').value = formatNumber(currency_savings);

document.getElementById("reportButton").disabled = false;
}

function clearResults()
{
document.getElementById("tdKWSaving").innerHTML = "Estimated Annual Enery Savings = <b> xxx kWh</b>";
document.getElementById("tdCostSaving").innerHTML = "Estimated Annual Cost Savings = <b>" + document.getElementById("currencyUnits").value + " xxx</b>";
document.getElementById("reportButton").disabled = true;
// showcomp()
}

function formatNumber(fVal)
{
var l_dec;
l_dec = fVal.toFixed(2)

return addCommas(l_dec)
}

function addCommas(nStr)
{
nStr += '';
x = nStr.split('.');
x1 = x[0];
x2 = x.length > 1 ? '.' + x[1] : '';
var rgx = /(\d+)(\d{3})/;
while (rgx.test(x1)) {
x1 = x1.replace(rgx, '$1' + ',' + '$2');
}
return x1 + x2;
}

function showComp()
{
var idx;
var oTr2, oTdMotor;
var l_noComp = document.getElementById('cmbComp').value;

for(idx=1; idx<=10; idx++)
{
oTdMotor = document.getElementById('tdComp' + idx);
if(l_noComp >= idx)
oTdMotor.style.visibility="visible";
else
oTdMotor.style.visibility="hidden";
}
oTr2 = document.getElementById('tr2');
//if (cmbComp.value < 6) tr2.height = "10";
//else tr2.height="150"
clearResults();
}



</script>