Adu Loan Calculator

.wqi-container { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; max-width: 800px; margin: 20px auto; padding: 25px; border: 1px solid #e1e1e1; border-radius: 12px; background-color: #ffffff; box-shadow: 0 4px 6px rgba(0,0,0,0.05); } .wqi-title { color: #1a4a72; text-align: center; margin-bottom: 25px; font-size: 28px; font-weight: 700; } .wqi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 25px; } @media (max-width: 600px) { .wqi-grid { grid-template-columns: 1fr; } } .wqi-input-group { display: flex; flex-direction: column; } .wqi-input-group label { font-size: 14px; font-weight: 600; color: #444; margin-bottom: 8px; } .wqi-input-group input { padding: 12px; border: 2px solid #ddd; border-radius: 6px; font-size: 16px; transition: border-color 0.3s; } .wqi-input-group input:focus { border-color: #3498db; outline: none; } .wqi-btn { background-color: #27ae60; color: white; padding: 15px 30px; border: none; border-radius: 6px; font-size: 18px; font-weight: 600; cursor: pointer; width: 100%; transition: background-color 0.3s; } .wqi-btn:hover { background-color: #219150; } .wqi-result-box { margin-top: 30px; padding: 20px; border-radius: 8px; text-align: center; display: none; } .wqi-score { font-size: 48px; font-weight: 800; margin: 10px 0; } .wqi-status { font-size: 22px; font-weight: 600; text-transform: uppercase; } .wqi-article { margin-top: 40px; line-height: 1.6; color: #333; } .wqi-article h2 { color: #1a4a72; border-bottom: 2px solid #eee; padding-bottom: 10px; } .wqi-table { width: 100%; border-collapse: collapse; margin: 20px 0; } .wqi-table th, .wqi-table td { border: 1px solid #ddd; padding: 12px; text-align: left; } .wqi-table th { background-color: #f8f9fa; } .excellent { background-color: #d4edda; color: #155724; } .good { background-color: #e2f3ff; color: #004085; } .fair { background-color: #fff3cd; color: #856404; } .poor { background-color: #f8d7da; color: #721c24; } .very-poor { background-color: #343a40; color: #ffffff; }
Water Quality Index (WQI) Calculator
Your Water Quality Index is:
0
Unknown

Understanding the Water Quality Index (WQI)

The Water Quality Index (WQI) is a comprehensive mathematical tool used to transform complex water quality data into a single, easy-to-understand number. It provides a standardized method for reporting the health of aquatic ecosystems and the safety of water for human use.

This calculator utilizes the NSF (National Sanitation Foundation) weighted method, focusing on six critical parameters that determine the biological and chemical health of a water body.

Water Quality Rating Scale

WQI Range Quality Rating Usage Implications
91 – 100 Excellent Pristine water, supports all aquatic life.
71 – 90 Good Minor impairment, safe for most uses.
51 – 70 Fair Moderate pollution, needs treatment for drinking.
26 – 50 Poor High pollution, toxic to some aquatic life.
0 – 25 Very Poor Severe pollution, unsafe for most purposes.

Key Parameters Explained

  • pH Level: Measures how acidic or basic the water is. Most aquatic life thrives between 6.5 and 8.5.
  • Dissolved Oxygen (DO): Essential for the survival of fish and other aquatic organisms. High levels indicate a healthy, aerobic environment.
  • Turbidity: Measures water clarity. High turbidity can block sunlight for plants and clog fish gills.
  • Nitrates: High levels usually come from fertilizer runoff or sewage, leading to excessive algae growth (eutrophication).
  • TDS (Total Dissolved Solids): The concentration of dissolved inorganic salts and organic matter. High levels can affect water taste and plumbing.
  • BOD: Measures the amount of oxygen consumed by bacteria while decomposing organic matter. High BOD suggests organic pollution.

Practical Example

Imagine a local river with the following readings: pH 7.5, DO 85%, Turbidity 10 NTU, Nitrates 4.0 mg/L, TDS 300 mg/L, and BOD 2.0 mg/L. Entering these values into the calculator would yield a WQI of approximately 82, categorizing the river as "Good." While healthy, the presence of nitrates and moderate TDS suggests some agricultural runoff is present.

function calculateWQI() { // Get Input Values var ph = parseFloat(document.getElementById('ph_val').value); var doo = parseFloat(document.getElementById('do_val').value); var turb = parseFloat(document.getElementById('turb_val').value); var nit = parseFloat(document.getElementById('nit_val').value); var tds = parseFloat(document.getElementById('tds_val').value); var bod = parseFloat(document.getElementById('bod_val').value); // Validate if (isNaN(ph) || isNaN(doo) || isNaN(turb) || isNaN(nit) || isNaN(tds) || isNaN(bod)) { alert("Please enter valid numeric values for all parameters."); return; } // Sub-index calculations (Simplified NSF curves) var q_ph, q_do, q_turb, q_nit, q_tds, q_bod; // 1. pH Sub-index (Optimal around 7) if (ph >= 6.5 && ph <= 8.5) q_ph = 100; else if (ph 11) q_ph = 10; else q_ph = 100 – (Math.abs(7 – ph) * 20); // 2. DO Sub-index (Higher is better) if (doo >= 90) q_do = 100; else if (doo < 20) q_do = 10; else q_do = doo; // 3. Turbidity (Lower is better) if (turb 100) q_turb = 5; else q_turb = 100 – (turb * 0.9); // 4. Nitrates (Lower is better) if (nit 50) q_nit = 10; else q_nit = 100 – (nit * 1.8); // 5. TDS (Lower is better) if (tds 1000) q_tds = 10; else q_tds = 100 – (tds * 0.08); // 6. BOD (Lower is better) if (bod 30) q_bod = 5; else q_bod = 100 – (bod * 3); // NSF Weights (normalized for 6 parameters) // Relative importance: DO(0.20), pH(0.18), BOD(0.18), Nit(0.15), Turb(0.15), TDS(0.14) var w_ph = 0.18, w_do = 0.20, w_turb = 0.15, w_nit = 0.15, w_tds = 0.14, w_bod = 0.18; var finalWQI = (q_ph * w_ph) + (q_do * w_do) + (q_turb * w_turb) + (q_nit * w_nit) + (q_tds * w_tds) + (q_bod * w_bod); // Safety clamp finalWQI = Math.min(100, Math.max(0, finalWQI)); // Display results var resultDiv = document.getElementById('wqi_result_container'); var scoreDisp = document.getElementById('wqi_score_display'); var statusDisp = document.getElementById('wqi_status_display'); resultDiv.style.display = "block"; scoreDisp.innerText = Math.round(finalWQI); if (finalWQI > 90) { statusDisp.innerText = "Excellent"; resultDiv.style.backgroundColor = "#d4edda"; resultDiv.style.color = "#155724"; } else if (finalWQI > 70) { statusDisp.innerText = "Good"; resultDiv.style.backgroundColor = "#e2f3ff"; resultDiv.style.color = "#004085"; } else if (finalWQI > 50) { statusDisp.innerText = "Fair"; resultDiv.style.backgroundColor = "#fff3cd"; resultDiv.style.color = "#856404"; } else if (finalWQI > 25) { statusDisp.innerText = "Poor"; resultDiv.style.backgroundColor = "#f8d7da"; resultDiv.style.color = "#721c24"; } else { statusDisp.innerText = "Very Poor"; resultDiv.style.backgroundColor = "#343a40"; resultDiv.style.color = "#ffffff"; } // Smooth scroll to result resultDiv.scrollIntoView({ behavior: 'smooth', block: 'nearest' }); }

Leave a Reply

Your email address will not be published. Required fields are marked *