The C-rate is a measure of the rate at which a battery is discharged or charged relative to its capacity. A 1C rate means the battery will discharge its full rated capacity in 1 hour. A 2C rate means it will discharge in 30 minutes, and a 0.5C rate means it will discharge in 2 hours.
function calculateCRate() {
var dischargeCurrent = parseFloat(document.getElementById("dischargeCurrent").value);
var batteryCapacity = parseFloat(document.getElementById("batteryCapacity").value);
var resultDiv = document.getElementById("result");
if (isNaN(dischargeCurrent) || isNaN(batteryCapacity) || batteryCapacity === 0) {
resultDiv.innerHTML = "Please enter valid numbers for Discharge Current and Battery Capacity. Battery Capacity cannot be zero.";
return;
}
var cRate = dischargeCurrent / batteryCapacity;
resultDiv.innerHTML = "