Spaces:
Running
Running
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Chemical Calculators</title> | |
| <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> | |
| <style> | |
| :root { | |
| --primary: #2c3e50; | |
| --secondary: #34495e; | |
| --accent: #3498db; | |
| --calculate: #27ae60; | |
| --refresh: #2980b9; | |
| --back: #e74c3c; | |
| --light: #ecf0f1; | |
| --dark: #2c3e50; | |
| } | |
| * { | |
| box-sizing: border-box; | |
| margin: 0; | |
| padding: 0; | |
| font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; | |
| } | |
| body { | |
| background-color: #f5f6fa; | |
| color: var(--dark); | |
| line-height: 1.6; | |
| } | |
| .container { | |
| max-width: 800px; | |
| margin: 0 auto; | |
| padding: 20px; | |
| } | |
| .calculator-frame { | |
| display: none; | |
| background-color: white; | |
| border-radius: 10px; | |
| box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1); | |
| padding: 30px; | |
| margin-top: 20px; | |
| animation: fadeIn 0.5s ease; | |
| } | |
| @keyframes fadeIn { | |
| from { opacity: 0; transform: translateY(20px); } | |
| to { opacity: 1; transform: translateY(0); } | |
| } | |
| .active { | |
| display: block; | |
| } | |
| h1, h2 { | |
| color: var(--primary); | |
| margin-bottom: 20px; | |
| text-align: center; | |
| } | |
| h1 { | |
| font-size: 2.2rem; | |
| border-bottom: 2px solid var(--accent); | |
| padding-bottom: 10px; | |
| } | |
| h2 { | |
| font-size: 1.8rem; | |
| margin-bottom: 25px; | |
| } | |
| .form-group { | |
| margin-bottom: 20px; | |
| } | |
| label { | |
| display: block; | |
| margin-bottom: 8px; | |
| font-weight: 600; | |
| color: var(--secondary); | |
| } | |
| input, select { | |
| width: 100%; | |
| padding: 12px; | |
| border: 1px solid #ddd; | |
| border-radius: 6px; | |
| font-size: 16px; | |
| transition: border 0.3s; | |
| } | |
| input:focus, select:focus { | |
| outline: none; | |
| border-color: var(--accent); | |
| box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2); | |
| } | |
| .btn { | |
| display: inline-block; | |
| padding: 12px 24px; | |
| border: none; | |
| border-radius: 6px; | |
| cursor: pointer; | |
| font-weight: 600; | |
| text-align: center; | |
| transition: all 0.3s; | |
| font-size: 16px; | |
| margin-right: 10px; | |
| } | |
| .btn-calculate { | |
| background-color: var(--calculate); | |
| color: white; | |
| } | |
| .btn-refresh { | |
| background-color: var(--refresh); | |
| color: white; | |
| } | |
| .btn-back { | |
| background-color: var(--back); | |
| color: white; | |
| } | |
| .btn-menu { | |
| display: block; | |
| width: 100%; | |
| margin: 10px 0; | |
| padding: 15px; | |
| background-color: var(--accent); | |
| color: white; | |
| font-size: 1.1rem; | |
| } | |
| .btn:hover { | |
| transform: translateY(-2px); | |
| box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1); | |
| opacity: 0.9; | |
| } | |
| .btn:active { | |
| transform: translateY(0); | |
| } | |
| .button-group { | |
| display: flex; | |
| justify-content: space-between; | |
| margin-top: 25px; | |
| } | |
| .result { | |
| margin-top: 25px; | |
| padding: 15px; | |
| background-color: #f8f9fa; | |
| border-radius: 6px; | |
| font-size: 18px; | |
| min-height: 60px; | |
| } | |
| .result p { | |
| margin: 10px 0; | |
| } | |
| .menu-icon { | |
| margin-right: 10px; | |
| } | |
| .error-message { | |
| color: var(--back); | |
| background-color: #fdecea; | |
| padding: 10px; | |
| border-radius: 4px; | |
| margin-top: 10px; | |
| display: none; | |
| } | |
| .disabled { | |
| background-color: #f0f0f0; | |
| color: #999; | |
| } | |
| .footer { | |
| text-align: center; | |
| margin-top: 40px; | |
| color: var(--secondary); | |
| font-size: 14px; | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <div class="container"> | |
| <h1><i class="fas fa-flask menu-icon"></i>Chemical Calculators</h1> | |
| <!-- Main Menu --> | |
| <div id="main-menu" class="calculator-frame active"> | |
| <button class="btn btn-menu" onclick="showFrame('acidity')"> | |
| <i class="fas fa-tint menu-icon"></i>Acidity Calculator | |
| </button> | |
| <button class="btn btn-menu" onclick="showFrame('dilution')"> | |
| <i class="fas fa-arrows-alt-v menu-icon"></i>Dilution Calculator | |
| </button> | |
| <button class="btn btn-menu" onclick="showFrame('p2o5')"> | |
| <i class="fas fa-atom menu-icon"></i>P2O5 Calculator | |
| </button> | |
| <button class="btn btn-menu" onclick="showFrame('p2o5-phosphate')"> | |
| <i class="fas fa-vial menu-icon"></i>P2O5 Phosphate Calculator | |
| </button> | |
| <button class="btn btn-menu" onclick="showFrame('h2so4')"> | |
| <i class="fas fa-vial menu-icon"></i>H2SO4 Conc Calculator | |
| </button> | |
| <button class="btn btn-menu" onclick="showFrame('sulfur')"> | |
| <i class="fas fa-fire menu-icon"></i>Sulfur Calculator | |
| </button> | |
| </div> | |
| <!-- Acidity Calculator --> | |
| <div id="acidity" class="calculator-frame"> | |
| <h2><i class="fas fa-tint"></i> Acidity Calculator</h2> | |
| <div class="form-group"> | |
| <label for="soda-factor">Soda Factor:</label> | |
| <input type="number" id="soda-factor" step="any" placeholder="Enter soda factor"> | |
| </div> | |
| <div class="form-group"> | |
| <label for="volume">Volume (mL):</label> | |
| <input type="number" id="volume" step="any" placeholder="Enter volume in mL"> | |
| </div> | |
| <div id="acidity-error" class="error-message"></div> | |
| <div class="button-group"> | |
| <button class="btn btn-calculate" onclick="calculateAcidity()">Calculate</button> | |
| <button class="btn btn-refresh" onclick="refreshAcidity()">Refresh</button> | |
| <button class="btn btn-back" onclick="showFrame('main-menu')">Back</button> | |
| </div> | |
| <div class="result" id="acidity-result"> | |
| Acidity Percentage: | |
| </div> | |
| </div> | |
| <!-- Dilution Calculator --> | |
| <div id="dilution" class="calculator-frame"> | |
| <h2><i class="fas fa-arrows-alt-v"></i> Dilution Calculator</h2> | |
| <div class="form-group"> | |
| <label for="variable">Select Variable:</label> | |
| <select id="variable" onchange="toggleDisabled()"> | |
| <option value="C1">C1 (Initial Concentration)</option> | |
| <option value="V1">V1 (Initial Volume)</option> | |
| <option value="C2">C2 (Final Concentration)</option> | |
| <option value="V2">V2 (Final Volume)</option> | |
| </select> | |
| </div> | |
| <div class="form-group"> | |
| <label for="C1">C1 (Initial Concentration, mol/L):</label> | |
| <input type="number" id="C1" step="any" placeholder="Enter initial concentration"> | |
| </div> | |
| <div class="form-group"> | |
| <label for="V1">V1 (Initial Volume, L):</label> | |
| <input type="number" id="V1" step="any" placeholder="Enter initial volume"> | |
| </div> | |
| <div class="form-group"> | |
| <label for="C2">C2 (Final Concentration, mol/L):</label> | |
| <input type="number" id="C2" step="any" placeholder="Enter final concentration"> | |
| </div> | |
| <div class="form-group"> | |
| <label for="V2">V2 (Final Volume, L):</label> | |
| <input type="number" id="V2" step="any" placeholder="Enter final volume"> | |
| </div> | |
| <div id="dilution-error" class="error-message"></div> | |
| <div class="button-group"> | |
| <button class="btn btn-calculate" onclick="calculateDilution()">Calculate</button> | |
| <button class="btn btn-refresh" onclick="refreshDilution()">Refresh</button> | |
| <button class="btn btn-back" onclick="showFrame('main-menu')">Back</button> | |
| </div> | |
| <div class="result" id="dilution-result"> | |
| Result: | |
| </div> | |
| </div> | |
| <!-- P2O5 Calculator --> | |
| <div id="p2o5" class="calculator-frame"> | |
| <h2><i class="fas fa-atom"></i> P2O5 Calculator</h2> | |
| <div class="form-group"> | |
| <label for="soda-factor-p2o5">Soda Factor:</label> | |
| <input type="number" id="soda-factor-p2o5" step="any" placeholder="Enter soda factor"> | |
| </div> | |
| <div class="form-group"> | |
| <label for="acid-factor-p2o5">Acid Factor:</label> | |
| <input type="number" id="acid-factor-p2o5" step="any" placeholder="Enter acid factor"> | |
| </div> | |
| <div class="form-group"> | |
| <label for="volume-p2o5">Volume (mL):</label> | |
| <input type="number" id="volume-p2o5" step="any" placeholder="Enter volume in mL"> | |
| </div> | |
| <div class="form-group"> | |
| <label for="humidity-p2o5">Humidity (%):</label> | |
| <input type="number" id="humidity-p2o5" step="any" placeholder="Enter humidity percentage (0-100)" min="0" max="100"> | |
| </div> | |
| <div id="p2o5-error" class="error-message"></div> | |
| <div class="button-group"> | |
| <button class="btn btn-calculate" onclick="calculateP2O5()">Calculate</button> | |
| <button class="btn btn-refresh" onclick="refreshP2O5()">Refresh</button> | |
| <button class="btn btn-back" onclick="showFrame('main-menu')">Back</button> | |
| </div> | |
| <div class="result" id="p2o5-result"> | |
| <p id="p2o5-dry-result">P2O5 on Dry Basis: </p> | |
| <p id="p2o5-wet-result">P2O5 on Wet Basis: </p> | |
| </div> | |
| </div> | |
| <!-- P2O5 Phosphate Calculator --> | |
| <div id="p2o5-phosphate" class="calculator-frame"> | |
| <h2><i class="fas fa-vial"></i> P2O5 Phosphate Calculator</h2> | |
| <div class="form-group"> | |
| <label for="soda-factor-p2o5-phosphate">Soda Factor:</label> | |
| <input type="number" id="soda-factor-p2o5-phosphate" step="any" placeholder="Enter soda factor"> | |
| </div> | |
| <div class="form-group"> | |
| <label for="acid-factor-p2o5-phosphate">Acid Factor:</label> | |
| <input type="number" id="acid-factor-p2o5-phosphate" step="any" placeholder="Enter acid factor"> | |
| </div> | |
| <div class="form-group"> | |
| <label for="volume-p2o5-phosphate">Volume (mL):</label> | |
| <input type="number" id="volume-p2o5-phosphate" step="any" placeholder="Enter volume in mL"> | |
| </div> | |
| <div class="form-group"> | |
| <label for="humidity-p2o5-phosphate">Humidity (%):</label> | |
| <input type="number" id="humidity-p2o5-phosphate" step="any" placeholder="Enter humidity percentage (0-100)" min="0" max="100"> | |
| </div> | |
| <div id="p2o5-phosphate-error" class="error-message"></div> | |
| <div class="button-group"> | |
| <button class="btn btn-calculate" onclick="calculateP2O5Phosphate()">Calculate</button> | |
| <button class="btn btn-refresh" onclick="refreshP2O5Phosphate()">Refresh</button> | |
| <button class="btn btn-back" onclick="showFrame('main-menu')">Back</button> | |
| </div> | |
| <div class="result" id="p2o5-phosphate-result"> | |
| <p id="p2o5-dry-result-phosphate">P2O5 on Dry Basis: </p> | |
| <p id="p2o5-wet-result-phosphate">P2O5 on Wet Basis: </p> | |
| </div> | |
| </div> | |
| <!-- H2SO4 Concentration Calculator --> | |
| <div id="h2so4" class="calculator-frame"> | |
| <h2><i class="fas fa-vial"></i> H2SO4 Conc Calculator</h2> | |
| <div class="form-group"> | |
| <label for="temp">Temperature (°C):</label> | |
| <input type="number" id="temp" step="any" placeholder="Enter temperature (10-40°C)" min="10" max="40"> | |
| </div> | |
| <div class="form-group"> | |
| <label for="sp-gr">Specific Gravity:</label> | |
| <input type="number" id="sp-gr" step="any" placeholder="Enter specific gravity"> | |
| </div> | |
| <div id="h2so4-error" class="error-message"></div> | |
| <div class="button-group"> | |
| <button class="btn btn-calculate" onclick="calculateH2SO4Conc()">Calculate</button> | |
| <button class="btn btn-refresh" onclick="refreshH2SO4()">Refresh</button> | |
| <button class="btn btn-back" onclick="showFrame('main-menu')">Back</button> | |
| </div> | |
| <div class="result" id="h2so4-result"> | |
| Equivalent Conc: | |
| </div> | |
| </div> | |
| <!-- Sulfur Calculator --> | |
| <div id="sulfur" class="calculator-frame"> | |
| <h2><i class="fas fa-fire"></i> Sulfur Calculator</h2> | |
| <div class="form-group"> | |
| <label for="weight-before-burn">Weight Before Burn:</label> | |
| <input type="number" id="weight-before-burn" step="any" placeholder="Enter weight"> | |
| </div> | |
| <div class="form-group"> | |
| <label for="weight-after-first-burn">Weight After First Burn:</label> | |
| <input type="number" id="weight-after-first-burn" step="any" placeholder="Enter weight"> | |
| </div> | |
| <div class="form-group"> | |
| <label for="weight-after-second-burn">Weight After Second Burn:</label> | |
| <input type="number" id="weight-after-second-burn" step="any" placeholder="Enter weight"> | |
| </div> | |
| <div class="form-group"> | |
| <label for="empty-crucible-weight">Empty Crucible Weight:</label> | |
| <input type="number" id="empty-crucible-weight" step="any" placeholder="Enter weight"> | |
| </div> | |
| <div class="form-group"> | |
| <label for="sample-weight">Sample Weight:</label> | |
| <input type="number" id="sample-weight" step="any" placeholder="Enter weight"> | |
| </div> | |
| <div class="form-group"> | |
| <label for="moisture-content">Moisture Content (%):</label> | |
| <input type="number" id="moisture-content" step="any" placeholder="Enter percentage"> | |
| </div> | |
| <div id="sulfur-error" class="error-message"></div> | |
| <div class="button-group"> | |
| <button class="btn btn-calculate" onclick="calculateSulfur()">Calculate</button> | |
| <button class="btn btn-refresh" onclick="refreshSulfur()">Refresh</button> | |
| <button class="btn btn-back" onclick="showFrame('main-menu')">Back</button> | |
| </div> | |
| <div class="result" id="sulfur-result"> | |
| <p id="burnt-sulfur-result">Burnt Sulfur: </p> | |
| <p id="dry-sulfur-result">Dry Sulfur: </p> | |
| <p id="organic-matter-result">Organic Matter: </p> | |
| <p id="ash-result">Ash: </p> | |
| <p id="wet-sulfur-result">Wet Sulfur: </p> | |
| </div> | |
| </div> | |
| <div class="footer"> | |
| <p>Chemical Calculators © 2023 | Designed for Laboratory Use</p> | |
| </div> | |
| </div> | |
| <script> | |
| // Show selected frame and hide others | |
| function showFrame(frameId) { | |
| const frames = document.querySelectorAll('.calculator-frame'); | |
| frames.forEach(frame => { | |
| frame.classList.remove('active'); | |
| }); | |
| document.getElementById(frameId).classList.add('active'); | |
| // Reset error messages when switching frames | |
| const errorMessages = document.querySelectorAll('.error-message'); | |
| errorMessages.forEach(error => { | |
| error.style.display = 'none'; | |
| error.textContent = ''; | |
| }); | |
| } | |
| // Show error message | |
| function showError(elementId, message) { | |
| const errorElement = document.getElementById(elementId); | |
| errorElement.textContent = message; | |
| errorElement.style.display = 'block'; | |
| } | |
| // Calculate Acidity | |
| function calculateAcidity() { | |
| const sodaFactor = parseFloat(document.getElementById('soda-factor').value); | |
| const volume = parseFloat(document.getElementById('volume').value); | |
| const errorElement = document.getElementById('acidity-error'); | |
| if (isNaN(sodaFactor) || isNaN(volume) || sodaFactor <= 0 || volume <= 0) { | |
| showError('acidity-error', 'Please enter valid positive numbers for Soda Factor and Volume'); | |
| return; | |
| } | |
| const acidity = 0.3 * sodaFactor * volume * 0.071 * 100; | |
| document.getElementById('acidity-result').textContent = `Acidity Percentage: ${acidity.toFixed(2)}%`; | |
| errorElement.style.display = 'none'; | |
| } | |
| function refreshAcidity() { | |
| document.getElementById('soda-factor').value = ''; | |
| document.getElementById('volume').value = ''; | |
| document.getElementById('acidity-result').textContent = 'Acidity Percentage: '; | |
| document.getElementById('acidity-error').style.display = 'none'; | |
| } | |
| // Dilution Calculator | |
| function toggleDisabled() { | |
| const selectedVariable = document.getElementById('variable').value; | |
| const inputs = ['C1', 'V1', 'C2', 'V2']; | |
| inputs.forEach(input => { | |
| const element = document.getElementById(input); | |
| if (input === selectedVariable) { | |
| element.disabled = true; | |
| element.classList.add('disabled'); | |
| } else { | |
| element.disabled = false; | |
| element.classList.remove('disabled'); | |
| } | |
| }); | |
| } | |
| function calculateDilution() { | |
| const selectedVariable = document.getElementById('variable').value; | |
| const C1 = parseFloat(document.getElementById('C1').value); | |
| const V1 = parseFloat(document.getElementById('V1').value); | |
| const C2 = parseFloat(document.getElementById('C2').value); | |
| const V2 = parseFloat(document.getElementById('V2').value); | |
| const errorElement = document.getElementById('dilution-error'); | |
| // Validate inputs | |
| const values = {}; | |
| let hasError = false; | |
| if (selectedVariable !== 'C1' && (isNaN(C1) || C1 <= 0)) { | |
| showError('dilution-error', 'Please enter a valid positive number for C1'); | |
| hasError = true; | |
| } else if (selectedVariable !== 'C1') { | |
| values['C1'] = C1; | |
| } | |
| if (selectedVariable !== 'V1' && (isNaN(V1) || V1 <= 0)) { | |
| showError('dilution-error', 'Please enter a valid positive number for V1'); | |
| hasError = true; | |
| } else if (selectedVariable !== 'V1') { | |
| values['V1'] = V1; | |
| } | |
| if (selectedVariable !== 'C2' && (isNaN(C2) || C2 <= 0)) { | |
| showError('dilution-error', 'Please enter a valid positive number for C2'); | |
| hasError = true; | |
| } else if (selectedVariable !== 'C2') { | |
| values['C2'] = C2; | |
| } | |
| if (selectedVariable !== 'V2' && (isNaN(V2) || V2 <= 0)) { | |
| showError('dilution-error', 'Please enter a valid positive number for V2'); | |
| hasError = true; | |
| } else if (selectedVariable !== 'V2') { | |
| values['V2'] = V2; | |
| } | |
| if (hasError) return; | |
| let result; | |
| if (selectedVariable === 'C1') { | |
| result = (values['C2'] * values['V2']) / values['V1']; | |
| document.getElementById('dilution-result').textContent = `Initial Concentration required: ${result.toFixed(2)} mol/L`; | |
| } else if (selectedVariable === 'V1') { | |
| result = (values['C2'] * values['V2']) / values['C1']; | |
| document.getElementById('dilution-result').textContent = `Initial Volume required: ${result.toFixed(2)} L`; | |
| } else if (selectedVariable === 'C2') { | |
| result = (values['C1'] * values['V1']) / values['V2']; | |
| document.getElementById('dilution-result').textContent = `Final Concentration required: ${result.toFixed(2)} mol/L`; | |
| } else if (selectedVariable === 'V2') { | |
| result = (values['C1'] * values['V1']) / values['C2']; | |
| document.getElementById('dilution-result').textContent = `Final Volume required: ${result.toFixed(2)} L`; | |
| } | |
| errorElement.style.display = 'none'; | |
| } | |
| function refreshDilution() { | |
| document.getElementById('C1').value = ''; | |
| document.getElementById('V1').value = ''; | |
| document.getElementById('C2').value = ''; | |
| document.getElementById('V2').value = ''; | |
| document.getElementById('dilution-result').textContent = 'Result: '; | |
| document.getElementById('dilution-error').style.display = 'none'; | |
| document.getElementById('variable').value = 'C1'; | |
| toggleDisabled(); | |
| } | |
| // P2O5 Calculator | |
| function calculateP2O5() { | |
| const sodaFactor = parseFloat(document.getElementById('soda-factor-p2o5').value); | |
| const acidFactor = parseFloat(document.getElementById('acid-factor-p2o5').value); | |
| const volume = parseFloat(document.getElementById('volume-p2o5').value); | |
| const humidity = parseFloat(document.getElementById('humidity-p2o5').value); | |
| const errorElement = document.getElementById('p2o5-error'); | |
| if (isNaN(sodaFactor) || isNaN(acidFactor) || isNaN(volume) || isNaN(humidity) || | |
| sodaFactor <= 0 || acidFactor <= 0 || volume <= 0 || humidity < 0 || humidity > 100) { | |
| showError('p2o5-error', 'Factors and Volume must be positive, Humidity must be 0-100'); | |
| return; | |
| } | |
| const p2o5_dry = (((sodaFactor * 25 * 3) - (acidFactor * volume)) * 0.3087 / (100 - humidity)) * 100; | |
| const p2o5_wet = (((sodaFactor * 25 * 3) - (acidFactor * volume)) * 0.3087); | |
| document.getElementById('p2o5-dry-result').textContent = `P2O5 on Dry Basis: ${p2o5_dry.toFixed(2)}%`; | |
| document.getElementById('p2o5-wet-result').textContent = `P2O5 on Wet Basis: ${p2o5_wet.toFixed(2)}%`; | |
| errorElement.style.display = 'none'; | |
| } | |
| function refreshP2O5() { | |
| document.getElementById('soda-factor-p2o5').value = ''; | |
| document.getElementById('acid-factor-p2o5').value = ''; | |
| document.getElementById('volume-p2o5').value = ''; | |
| document.getElementById('humidity-p2o5').value = ''; | |
| document.getElementById('p2o5-dry-result').textContent = 'P2O5 on Dry Basis: '; | |
| document.getElementById('p2o5-wet-result').textContent = 'P2O5 on Wet Basis: '; | |
| document.getElementById('p2o5-error').style.display = 'none'; | |
| } | |
| // P2O5 Phosphate Calculator | |
| function calculateP2O5Phosphate() { | |
| const sodaFactor = parseFloat(document.getElementById('soda-factor-p2o5-phosphate').value); | |
| const acidFactor = parseFloat(document.getElementById('acid-factor-p2o5-phosphate').value); | |
| const volume = parseFloat(document.getElementById('volume-p2o5-phosphate').value); | |
| const humidity = parseFloat(document.getElementById('humidity-p2o5-phosphate').value); | |
| const errorElement = document.getElementById('p2o5-phosphate-error'); | |
| if (isNaN(sodaFactor) || isNaN(acidFactor) || isNaN(volume) || isNaN(humidity) || | |
| sodaFactor <= 0 || acidFactor <= 0 || volume <= 0 || humidity < 0 || humidity > 100) { | |
| showError('p2o5-phosphate-error', 'Factors and Volume must be positive, Humidity must be 0-100'); | |
| return; | |
| } | |
| const p2o5_dry = ((((sodaFactor * 25 * 3) - (acidFactor * volume)) * 1.348 / (100 - humidity)) / 2.183) * 100; | |
| const p2o5_wet = (((sodaFactor * 25 * 3) - (acidFactor * volume)) * 1.348) / 2.183; | |
| document.getElementById('p2o5-dry-result-phosphate').textContent = `P2O5 on Dry Basis: ${p2o5_dry.toFixed(2)}%`; | |
| document.getElementById('p2o5-wet-result-phosphate').textContent = `P2O5 on Wet Basis: ${p2o5_wet.toFixed(2)}%`; | |
| errorElement.style.display = 'none'; | |
| } | |
| function refreshP2O5Phosphate() { | |
| document.getElementById('soda-factor-p2o5-phosphate').value = ''; | |
| document.getElementById('acid-factor-p2o5-phosphate').value = ''; | |
| document.getElementById('volume-p2o5-phosphate').value = ''; | |
| document.getElementById('humidity-p2o5-phosphate').value = ''; | |
| document.getElementById('p2o5-dry-result-phosphate').textContent = 'P2O5 on Dry Basis: '; | |
| document.getElementById('p2o5-wet-result-phosphate').textContent = 'P2O5 on Wet Basis: '; | |
| document.getElementById('p2o5-phosphate-error').style.display = 'none'; | |
| } | |
| // H2SO4 Concentration Calculator | |
| function calculateH2SO4Conc() { | |
| const temp = parseFloat(document.getElementById('temp').value); | |
| const sp_gr = parseFloat(document.getElementById('sp-gr').value); | |
| const errorElement = document.getElementById('h2so4-error'); | |
| if (isNaN(temp) || isNaN(sp_gr) || temp < 10 || temp > 40 || sp_gr <= 0) { | |
| showError('h2so4-error', 'Temperature must be 10-40°C, Specific Gravity must be positive'); | |
| return; | |
| } | |
| const data = [ | |
| {"Temperature": 10, "Temp_deduced": 45.0, "Sp_Gr_At_15C": 51.0, "H2SO4_Percentage": 93.0}, | |
| {"Temperature": 11, "Temp_deduced": 36.0, "Sp_Gr_At_15C": 63.0, "H2SO4_Percentage": 93.2}, | |
| {"Temperature": 12, "Temp_deduced": 27.0, "Sp_Gr_At_15C": 76.0, "H2SO4_Percentage": 93.4}, | |
| {"Temperature": 13, "Temp_deduced": 18.0, "Sp_Gr_At_15C": 89.0, "H2SO4_Percentage": 93.6}, | |
| {"Temperature": 14, "Temp_deduced": 9.0, "Sp_Gr_At_15C": 105.0, "H2SO4_Percentage": 93.8}, | |
| {"Temperature": 15, "Temp_deduced": 0.0, "Sp_Gr_At_15C": 120.0, "H2SO4_PPerentage": 94.0}, | |
| {"Temperature": 16, "Temp_deduced": -6.0, "Sp_Gr_At_15C": 135.0, "H2SO4_Percentage": 94.2}, | |
| {"Temperature": 17, "Temp_deduced": 15.0, "Sp_Gr_At_15C": 150.0, "H2SO4_Percentage": 94.4}, | |
| {"Temperature": 18, "Temp_deduced": 20.0, "Sp_Gr_At_15C": 166.0, "H2SO4_Percentage": 94.6}, | |
| {"Temperature": 19, "Temp_deduced": 27.0, "Sp_Gr_At_15C": 182.0, "H2SO4_Percentage": 94.8}, | |
| {"Temperature": 20, "Temp_deduced": 36.0, "Sp_Gr_At_15C": 197.0, "H2SO4_Percentage": 95.0}, | |
| {"Temperature": 21, "Temp_deduced": 45.0, "Sp_Gr_At_15C": 212.0, "H2SO4_Percentage": 95.2}, | |
| {"Temperature": 22, "Temp_deduced": 54.0, "Sp_Gr_At_15C": 225.0, "H2SO4_Percentage": 95.4}, | |
| {"Temperature": 23, "Temp_deduced": 63.0, "Sp_Gr_At_15C": 241.0, "H2SO4_Percentage": 95.6}, | |
| {"Temperature": 24, "Temp_deduced": 70.0, "Sp_Gr_At_15C": 254.0, "H2SO4_Percentage": 95.8}, | |
| {"Temperature": 25, "Temp_deduced": 76.0, "Sp_Gr_At_15C": 271.0, "H2SO4_Percentage": 96.0}, | |
| {"Temperature": 26, "Temp_deduced": 85.0, "Sp_Gr_At_15C": 286.0, "H2SO4_Percentage": 96.2}, | |
| {"Temperature": 27, "Temp_deduced": 92.0, "Sp_Gr_At_15C": 301.0, "H2SO4_Percentage": 96.4}, | |
| {"Temperature": 28, "Temp_deduced": 100.0, "Sp_Gr_At_15C": 315.0, "H2SO4_Percentage": 96.6}, | |
| {"Temperature": 29, "Temp_deduced": 108.0, "Sp_Gr_At_15C": 329.0, "H2SO4_Percentage": 96.8}, | |
| {"Temperature": 30, "Temp_deduced": 117.0, "Sp_Gr_At_15C": 344.0, "H2SO4_Percentage": 97.0}, | |
| {"Temperature": 31, "Temp_deduced": 126.0, "Sp_Gr_At_15C": 359.0, "H2SO4_Percentage": 97.2}, | |
| {"Temperature": 32, "Temp_deduced": 135.0, "Sp_Gr_At_15C": 373.0, "H2SO4_Percentage": 97.4}, | |
| {"Temperature": 33, "Temp_deduced": 144.0, "Sp_Gr_At_15C": 387.0, "H2SO4_PPerentage": 97.6}, | |
| {"Temperature": 34, "Temp_deduced": 150.0, "Sp_Gr_At_15C": 402.0, "H2SO4_Percentage": 97.8}, | |
| {"Temperature": 35, "Temp_deduced": 157.0, "Sp_Gr_At_15C": 417.0, "H2SO4_Percentage": 98.0}, | |
| {"Temperature": 36, "Temp_deduced": 166.0, "Sp_Gr_At_15C": 431.0, "H2SO4_Percentage": 98.2}, | |
| {"Temperature": 37, "Temp_deduced": 173.0, "Sp_Gr_At_15C": 443.0, "H2SO4_Percentage": 98.4}, | |
| {"Temperature": 38, "Temp_deduced": 182.0, "Sp_Gr_At_15C": 457.0, "H2SO4_Percentage": 98.6}, | |
| {"Temperature": 39, "Temp_deduced": 191.0, "Sp_Gr_At_15C": 471.0, "H2SO4_Percentage": 98.8}, | |
| {"Temperature": 40, "Temp_deduced": 198.0, "Sp_Gr_At_15C": 485.0, "H2SO4_Percentage": 99.0} | |
| ]; | |
| // Find the row for the input temperature | |
| const tempRow = data.find(row => row.Temperature === temp); | |
| if (!tempRow) { | |
| showError('h2so4-error', `No data for temperature ${temp}°C`); | |
| return; | |
| } | |
| const temp_deduced = tempRow.Temp_deduced; | |
| const equivalent_value = temp_deduced + sp_gr; | |
| // Find the row with Sp_Gr_At_15C closest to equivalent_value | |
| let closestRow = data[0]; | |
| let minDiff = Math.abs(data[0].Sp_Gr_At_15C - equivalent_value); | |
| for (let i = 1; i < data.length; i++) { | |
| const currentDiff = Math.abs(data[i].Sp_Gr_At_15C - equivalent_value); | |
| if (currentDiff < minDiff) { | |
| minDiff = currentDiff; | |
| closestRow = data[i]; | |
| } | |
| } | |
| const conc = closestRow.H2SO4_Percentage; | |
| document.getElementById('h2so4-result').textContent = `Equivalent Conc: ${conc.toFixed(2)} %H2SO4`; | |
| errorElement.style.display = 'none'; | |
| } | |
| function refreshH2SO4() { | |
| document.getElementById('temp').value = ''; | |
| document.getElementById('sp-gr').value = ''; | |
| document.getElementById('h2so4-result').textContent = 'Equivalent Conc: '; | |
| document.getElementById('h2so4-error').style.display = 'none'; | |
| } | |
| // Sulfur Calculator | |
| function calculateSulfur() { | |
| const weightBeforeBurn = parseFloat(document.getElementById('weight-before-burn').value); | |
| const weightAfterFirstBurn = parseFloat(document.getElementById('weight-after-first-burn').value); | |
| const weightAfterSecondBurn = parseFloat(document.getElementById('weight-after-second-burn').value); | |
| const emptyCrucibleWeight = parseFloat(document.getElementById('empty-crucible-weight').value); | |
| const sampleWeight = parseFloat(document.getElementById('sample-weight').value); | |
| const moistureContent = parseFloat(document.getElementById('moisture-content').value); | |
| const errorElement = document.getElementById('sulfur-error'); | |
| if (isNaN(weightBeforeBurn) || isNaN(weightAfterFirstBurn) || | |
| isNaN(weightAfterSecondBurn) || isNaN(emptyCrucibleWeight) || | |
| isNaN(sampleWeight) || isNaN(moistureContent)) { | |
| showError('sulfur-error', 'Please enter valid numeric values'); | |
| return; | |
| } | |
| const burntSulfur = weightBeforeBurn - weightAfterFirstBurn; | |
| const drySulfur = (burntSulfur / sampleWeight) * 100; | |
| const organicMatter = ((weightAfterFirstBurn - weightAfterSecondBurn) / sampleWeight) * 100; | |
| const ash = ((weightAfterSecondBurn - emptyCrucibleWeight) / sampleWeight) * 100; | |
| const wetSulfur = ((100 - moistureContent) * drySulfur) / 100; | |
| document.getElementById('burnt-sulfur-result').textContent = `Burnt Sulfur: ${burntSulfur.toFixed(4)}`; | |
| document.getElementById('dry-sulfur-result').textContent = `Dry Sulfur: ${drySulfur.toFixed(4)}%`; | |
| document.getElementById('organic-matter-result').textContent = `Organic Matter: ${organicMatter.toFixed(4)}%`; | |
| document.getElementById('ash-result').textContent = `Ash: ${ash.toFixed(4)}%`; | |
| document.getElementById('wet-sulfur-result').textContent = `Wet Sulfur: ${wetSulfur.toFixed(4)}%`; | |
| errorElement.style.display = 'none'; | |
| } | |
| function refreshSulfur() { | |
| document.getElementById('weight-before-burn').value = ''; | |
| document.getElementById('weight-after-first-burn').value = ''; | |
| document.getElementById('weight-after-second-burn').value = ''; | |
| document.getElementById('empty-crucible-weight').value = ''; | |
| document.getElementById('sample-weight').value = ''; | |
| document.getElementById('moisture-content').value = ''; | |
| document.getElementById('burnt-sulfur-result').textContent = 'Burnt Sulfur: '; | |
| document.getElementById('dry-sulfur-result').textContent = 'Dry Sulfur: '; | |
| document.getElementById('organic-matter-result').textContent = 'Organic Matter: '; | |
| document.getElementById('ash-result').textContent = 'Ash: '; | |
| document.getElementById('wet-sulfur-result').textContent = 'Wet Sulfur: '; | |
| document.getElementById('sulfur-error').style.display = 'none'; | |
| } | |
| // Initialize the page | |
| window.onload = function() { | |
| toggleDisabled(); // Initialize dilution calculator | |
| }; | |
| </script> | |
| <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: absolute; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">This website has been generated by <a href="https://enzostvs-deepsite.hf.space" style="color: #fff;" target="_blank" >DeepSite</a> <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;"></p></body> | |
| </html> |