Duct Size Calculator App

Duct Size Calculator App – Calculate Optimal HVAC Duct Dimensions :root { –primary-color: #004a99; –success-color: #28a745; –background-color: #f8f9fa; –text-color: #333; –border-color: #ccc; –card-background: #fff; –shadow: 0 4px 8px rgba(0,0,0,0.1); } body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background-color: var(–background-color); color: var(–text-color); line-height: 1.6; margin: 0; padding: 0; display: flex; flex-direction: column; align-items: center; } .container { width: 100%; max-width: 960px; margin: 20px auto; padding: 20px; background-color: var(–card-background); border-radius: 8px; box-shadow: var(–shadow); } header { background-color: var(–primary-color); color: white; padding: 20px 0; text-align: center; width: 100%; } header h1 { margin: 0; font-size: 2.5em; } main { width: 100%; } section { margin-bottom: 30px; padding: 20px; background-color: var(–card-background); border-radius: 8px; box-shadow: var(–shadow); } h2, h3 { color: var(–primary-color); margin-top: 0; } .loan-calc-container { background-color: var(–card-background); padding: 25px; border-radius: 8px; box-shadow: var(–shadow); margin-bottom: 30px; } .input-group { margin-bottom: 20px; text-align: left; } .input-group label { display: block; margin-bottom: 8px; font-weight: bold; color: var(–primary-color); } .input-group input[type="number"], .input-group select { width: calc(100% – 22px); padding: 10px; border: 1px solid var(–border-color); border-radius: 4px; font-size: 1em; box-sizing: border-box; } .input-group .helper-text { font-size: 0.85em; color: #666; margin-top: 5px; display: block; } .error-message { color: red; font-size: 0.85em; margin-top: 5px; display: block; min-height: 1.2em; /* Prevent layout shifts */ } .button-group { display: flex; justify-content: space-between; margin-top: 25px; gap: 10px; } button { padding: 12px 20px; border: none; border-radius: 5px; cursor: pointer; font-size: 1em; font-weight: bold; transition: background-color 0.3s ease; } .btn-primary { background-color: var(–primary-color); color: white; } .btn-primary:hover { background-color: #003366; } .btn-secondary { background-color: #6c757d; color: white; } .btn-secondary:hover { background-color: #5a6268; } .btn-success { background-color: var(–success-color); color: white; } .btn-success:hover { background-color: #218838; } #results { margin-top: 30px; padding: 20px; background-color: var(–primary-color); color: white; border-radius: 8px; box-shadow: var(–shadow); text-align: center; } #results h3 { color: white; margin-top: 0; margin-bottom: 15px; } .result-item { margin-bottom: 10px; } .result-label { font-weight: bold; display: block; margin-bottom: 5px; } .result-value { font-size: 1.8em; font-weight: bold; } .intermediate-results { display: flex; flex-wrap: wrap; justify-content: center; gap: 20px; margin-top: 20px; } .intermediate-result-card { background-color: #e9ecef; padding: 15px; border-radius: 5px; text-align: center; min-width: 150px; } .intermediate-result-label { font-size: 0.9em; color: #555; margin-bottom: 5px; } .intermediate-result-value { font-size: 1.4em; font-weight: bold; color: var(–primary-color); } .formula-explanation { margin-top: 20px; font-size: 0.9em; color: #555; border-top: 1px solid #eee; padding-top: 15px; } table { width: 100%; border-collapse: collapse; margin-top: 20px; box-shadow: var(–shadow); } th, td { padding: 12px; text-align: left; border-bottom: 1px solid #ddd; } thead { background-color: var(–primary-color); color: white; } tbody tr:nth-child(even) { background-color: #f2f2f2; } caption { font-size: 1.1em; font-weight: bold; color: var(–primary-color); margin-bottom: 10px; caption-side: top; text-align: left; } #chartContainer { margin-top: 30px; padding: 20px; background-color: var(–card-background); border-radius: 8px; box-shadow: var(–shadow); text-align: center; } #chartContainer canvas { max-width: 100%; height: auto; } .chart-caption { font-size: 0.9em; color: #555; margin-top: 10px; } .article-content { margin-top: 30px; padding: 20px; background-color: var(–card-background); border-radius: 8px; box-shadow: var(–shadow); text-align: left; } .article-content h2, .article-content h3 { color: var(–primary-color); margin-top: 25px; margin-bottom: 15px; } .article-content p { margin-bottom: 15px; } .article-content ul, .article-content ol { margin-left: 20px; margin-bottom: 15px; } .article-content li { margin-bottom: 8px; } .faq-item { margin-bottom: 15px; border-bottom: 1px dashed #eee; padding-bottom: 10px; } .faq-item:last-child { border-bottom: none; } .faq-question { font-weight: bold; color: var(–primary-color); cursor: pointer; display: block; margin-bottom: 5px; } .faq-answer { display: none; margin-left: 15px; font-size: 0.95em; color: #555; } .internal-links { margin-top: 30px; padding: 20px; background-color: var(–card-background); border-radius: 8px; box-shadow: var(–shadow); } .internal-links h3 { margin-top: 0; margin-bottom: 15px; } .internal-links ul { list-style: none; padding: 0; } .internal-links li { margin-bottom: 10px; } .internal-links a { color: var(–primary-color); text-decoration: none; font-weight: bold; } .internal-links a:hover { text-decoration: underline; } .internal-links p { font-size: 0.9em; color: #555; margin-top: 5px; } footer { text-align: center; padding: 20px; margin-top: 30px; width: 100%; font-size: 0.9em; color: #777; } @media (max-width: 768px) { .container { margin: 10px; padding: 15px; } header h1 { font-size: 1.8em; } button { padding: 10px 15px; font-size: 0.95em; } .result-value { font-size: 1.5em; } .intermediate-result-value { font-size: 1.2em; } }

Duct Size Calculator App

HVAC Duct Sizing Calculator

Cubic Feet per Minute (CFM) your system needs to deliver.
Feet per Minute (FPM). Typical values range from 400-900 FPM for residential.
Round Rectangular Select the shape of your ductwork.
The width of the rectangular duct.
The height of the rectangular duct.

Your Optimal Duct Size

Required Duct Area:
sq. inches
Duct Shape
Airflow (CFM)
Max Velocity (FPM)
Formula Used: Duct Area (sq. in.) = (Airflow (CFM) * 144) / Maximum Air Velocity (FPM). For round ducts, Diameter (in.) = sqrt(4 * Area / PI). For rectangular ducts, the calculated area is achieved by adjusting width and height.
Comparison of Required Area vs. Velocity for a Fixed Airflow
Duct Shape Required Area (sq. in.) Equivalent Round Diameter (in.) Example Rectangular (W x H, in.)
Calculate results to populate table.
Duct Size Options for Calculated Requirements

What is a Duct Size Calculator App?

A duct size calculator app is a specialized online tool designed to help homeowners, HVAC technicians, and building professionals determine the appropriate dimensions for their heating, ventilation, and air conditioning (HVAC) ductwork. Proper duct sizing is crucial for ensuring that an HVAC system operates efficiently, delivers the correct amount of conditioned air to each room, and maintains optimal indoor air quality and comfort. This duct size calculator app simplifies the complex calculations involved, making it accessible to a wider audience.

Who Should Use a Duct Size Calculator App?

Several groups can benefit significantly from using a duct size calculator app:

  • Homeowners: When installing a new HVAC system, replacing old ductwork, or troubleshooting comfort issues (e.g., rooms that are too hot or too cold), homeowners can use this tool to get an idea of the required duct sizes.
  • HVAC Contractors: Professionals use duct sizing calculators as a quick reference tool during system design and installation to verify calculations or provide estimates.
  • Building Designers & Architects: For new constructions or major renovations, these professionals rely on accurate duct sizing to ensure the HVAC system meets building codes and performance standards.
  • DIY Enthusiasts: Individuals undertaking HVAC projects themselves can use the calculator to guide their material purchases and installation efforts.

Common Misconceptions about Duct Sizing

Several myths surround duct sizing:

  • "Bigger is always better": Oversized ducts can lead to reduced air velocity, poor air mixing, and potential noise issues.
  • "Standard sizes fit all": HVAC systems vary greatly in their heating/cooling load and airflow requirements, necessitating custom or carefully selected duct sizes.
  • "Duct material is the only factor": While material affects insulation and durability, the physical dimensions (cross-sectional area and shape) are paramount for airflow dynamics.
  • "Any shape works": While round ducts are generally more efficient due to less friction, rectangular ducts are often used for space constraints, but their sizing requires careful consideration of aspect ratios.

Understanding these points highlights the importance of using a precise duct size calculator app.

Duct Size Calculator App Formula and Mathematical Explanation

The core principle behind duct sizing is maintaining an optimal balance between airflow volume and air velocity. The duct size calculator app uses fundamental fluid dynamics principles. The primary formula relates airflow (CFM), air velocity (FPM), and the cross-sectional area of the duct (square feet).

The Fundamental Formula

The relationship is expressed as:

Airflow (CFM) = Area (sq. ft.) × Velocity (FPM)

To find the required duct area in square inches, we rearrange the formula and convert units:

Area (sq. in.) = (Airflow (CFM) × 144) / Velocity (FPM)

The factor 144 comes from converting square feet to square inches (1 sq. ft. = 144 sq. in.).

Calculating Diameter for Round Ducts

For a round duct, the area is given by Area = π × (Diameter/2)². Rearranging to solve for the diameter:

Diameter (in.) = sqrt(4 × Area (sq. in.) / π)

Where π (pi) is approximately 3.14159.

Sizing Rectangular Ducts

For rectangular ducts, the calculated required area must be achieved by the product of its width and height (Area = Width × Height). Often, HVAC professionals use equivalent round duct diameters or aspect ratio charts to determine suitable width and height dimensions that approximate the required area while considering space limitations and airflow efficiency. The duct size calculator app provides the target area, and users or professionals then select appropriate width and height dimensions.

Variables Table

Variable Meaning Unit Typical Range
CFM Required Airflow Cubic Feet per Minute 100 – 2000+ (depending on system size)
FPM Maximum Air Velocity Feet per Minute 400 – 900 (residential); 700 – 1500+ (commercial)
Area Cross-sectional Area of Duct Square Inches (sq. in.) Varies widely based on CFM and FPM
Diameter Diameter of Round Duct Inches (in.) Varies widely
Width Width of Rectangular Duct Inches (in.) Varies widely
Height Height of Rectangular Duct Inches (in.) Varies widely

Practical Examples (Real-World Use Cases)

Example 1: Sizing a Main Supply Duct for a Living Room

A homeowner is installing a new central air conditioning system and needs to determine the size for the main supply duct feeding the living room. The HVAC designer specifies a required airflow of 1200 CFM for this zone, with a recommended maximum air velocity of 750 FPM to minimize noise.

  • Inputs:
    • Required Airflow (CFM): 1200
    • Maximum Air Velocity (FPM): 750
    • Duct Shape: Round
  • Calculation:
    • Required Area = (1200 CFM * 144) / 750 FPM = 230.4 sq. in.
    • Equivalent Round Diameter = sqrt(4 * 230.4 / π) ≈ 17.1 inches
  • Results: The duct size calculator app would recommend a duct with a cross-sectional area of approximately 230.4 sq. in. For a round duct, this translates to a diameter of about 17.1 inches.
  • Interpretation: A 17-inch round duct is needed. If a rectangular duct is required due to space constraints, the installer would need to find dimensions (e.g., 24 inches wide x 9.6 inches high) that yield an area of at least 230.4 sq. in., while considering aspect ratio guidelines.

Example 2: Sizing a Return Air Duct for a Bedroom Zone

For a bedroom zone requiring a return air duct, the system design calls for 400 CFM. To ensure adequate air return without excessive noise, a maximum velocity of 600 FPM is targeted.

  • Inputs:
    • Required Airflow (CFM): 400
    • Maximum Air Velocity (FPM): 600
    • Duct Shape: Rectangular
  • Calculation:
    • Required Area = (400 CFM * 144) / 600 FPM = 96 sq. in.
  • Results: The duct size calculator app indicates a required duct area of 96 sq. in.
  • Interpretation: For a rectangular duct, common dimensions that provide this area might be 12 inches wide by 8 inches high (12 * 8 = 96 sq. in.). This size ensures sufficient airflow for the return while keeping velocity within the acceptable range.

How to Use This Duct Size Calculator App

Using this duct size calculator app is straightforward:

  1. Input Required Airflow (CFM): Determine the CFM needed for the specific area or zone. This is often calculated based on the room's square footage, insulation levels, window area, and the HVAC system's capacity. Consult your HVAC professional if unsure.
  2. Input Maximum Air Velocity (FPM): Select the desired maximum air velocity. Lower velocities (e.g., 400-600 FPM) are quieter and suitable for living spaces or return ducts. Higher velocities (e.g., 700-900 FPM) can be used in main supply trunks or where noise is less critical, allowing for smaller duct sizes.
  3. Select Duct Shape: Choose whether the duct will be round or rectangular.
  4. Enter Rectangular Dimensions (if applicable): If you selected "Rectangular," input the desired width and height in inches. The calculator will use these to determine the actual area and compare it to the required area. Note: The calculator primarily calculates the *required area*. For rectangular ducts, you'll need to select width and height dimensions that meet or exceed this area.
  5. Click "Calculate Duct Size": The app will process your inputs.

How to Read Results

  • Required Duct Area: This is the minimum cross-sectional area your duct needs to have to achieve the specified airflow at the target velocity.
  • Duct Shape, Airflow, Velocity: These confirm the input parameters used in the calculation.
  • Dynamic Dimensions: For round ducts, this shows the calculated diameter. For rectangular ducts, it might show an example dimension pair or the calculated area based on your inputs.

Decision-Making Guidance

Use the results to select the most appropriate duct size. Consider space constraints when choosing between round and rectangular ducts. Always aim to meet or slightly exceed the calculated required area. If using rectangular ducts, pay attention to the aspect ratio (width-to-height ratio) – excessively high ratios can lead to poor airflow distribution.

Key Factors That Affect Duct Size Results

Several factors influence the required duct size, impacting HVAC efficiency and comfort:

  1. Heating and Cooling Load: The primary driver. Larger homes, poorly insulated spaces, or areas with high solar gain require higher CFM, thus larger ducts. This is the most critical input for any duct size calculator app.
  2. Air Velocity Limits: As discussed, higher velocities allow for smaller ducts but increase noise and friction. Lower velocities are quieter but require larger ducts. The choice depends on the application (supply vs. return, main trunk vs. branch).
  3. Duct Material and Smoothness: Smooth metal ducts have less friction than flexible ducts or rough-surfaced materials. Less friction means air can flow more easily, potentially allowing for slightly smaller ducts or lower fan energy consumption.
  4. Duct Length and Fittings: Longer duct runs and numerous bends, elbows, and transitions (fittings) create more resistance (static pressure). This resistance can reduce actual airflow. Longer runs or complex layouts might necessitate slightly larger ducts or a more powerful fan.
  5. System Static Pressure: The total resistance in the duct system and air handler. A system with high static pressure requires careful duct sizing to ensure the fan can deliver the designed airflow. This is a key consideration for HVAC professionals.
  6. Desired Airflow Balance: Ensuring each room receives the correct amount of air is vital. Zoning systems and balancing dampers are used in conjunction with proper duct sizing to achieve this. An improperly sized duct can starve a room of air or deliver too much.
  7. Noise Considerations: High air velocity is a primary source of HVAC noise. Selecting appropriate velocity limits, especially in living areas, is crucial for occupant comfort.
  8. Available Space: Often, the physical space available for ductwork dictates whether round or rectangular ducts are used, and their maximum dimensions. This can sometimes force compromises in optimal sizing, requiring careful design adjustments.

Frequently Asked Questions (FAQ)

What is the difference between CFM and FPM in duct sizing?
CFM (Cubic Feet per Minute) measures the volume of air moved by the HVAC system. FPM (Feet per Minute) measures the speed at which that air is traveling through the duct. The duct size calculator app uses both to determine the necessary duct cross-sectional area.
Can I use a standard duct size like 6-inch or 8-inch round?
While standard sizes exist, they are only appropriate if they match the calculated requirements for your specific airflow (CFM) and desired velocity (FPM). Using a standard size without calculation can lead to inefficient operation or comfort issues. This duct size calculator app helps verify if standard sizes are suitable.
What is the ideal aspect ratio for rectangular ducts?
The ideal aspect ratio (width divided by height, or vice versa) for rectangular ducts is generally considered to be close to 1:1 (a square duct) or up to 4:1. Ratios significantly higher than this can lead to uneven airflow distribution and increased static pressure.
How does duct insulation affect sizing?
Duct insulation primarily affects thermal efficiency (reducing heat loss or gain) and condensation control. It doesn't directly change the required *airflow* or *velocity* calculations for sizing, but it's crucial for overall system performance and energy savings.
What happens if my ducts are too small?
If ducts are too small, they restrict airflow. This leads to reduced air delivery to rooms, uneven temperatures, increased strain on the HVAC system's fan motor (potentially causing premature failure), higher energy bills, and inadequate heating or cooling.
What happens if my ducts are too large?
Oversized ducts can cause air velocity to drop too low. This can lead to poor air circulation and mixing within rooms, potentially causing stratification (hot air rising, cold air settling). It can also lead to noise issues if the fan has to work harder to compensate, and the larger ducts themselves might be more costly and difficult to install.
Do I need a different calculation for supply and return ducts?
Yes, generally. Return ducts often require a larger cross-sectional area than supply ducts for the same CFM because lower velocities are typically desired for return air to minimize noise and ensure efficient air capture from rooms. The duct size calculator app allows you to input different CFM and velocity targets for each.
Can this calculator be used for commercial HVAC systems?
While the fundamental formulas apply, commercial systems often have much higher CFM requirements, different velocity standards (higher FPM is common), and more complex duct layouts. This duct size calculator app is primarily geared towards residential applications but can provide a starting point for commercial calculations. Professional HVAC design software or engineers are recommended for complex commercial projects.

Related Tools and Internal Resources

  • Duct Size Calculator App

    Instantly calculate optimal HVAC duct dimensions based on airflow and velocity requirements.

  • HVAC Efficiency Guide

    Learn how proper installation, maintenance, and insulation contribute to your HVAC system's overall efficiency.

  • Air Filter Replacement Calculator

    Determine the ideal schedule for replacing your HVAC air filters to maintain airflow and system health.

  • Home Energy Audit Checklist

    A comprehensive checklist to identify energy leaks and inefficiencies in your home, including ductwork.

  • Thermostat Placement Guide

    Understand how thermostat location impacts temperature readings and HVAC system performance.

  • CFM Calculator

    Estimate the required airflow (CFM) for different rooms based on their size and purpose.

© 2023 Your Company Name. All rights reserved.

function validateInput(id, errorId, min, max) { var input = document.getElementById(id); var errorSpan = document.getElementById(errorId); var value = parseFloat(input.value); errorSpan.textContent = "; // Clear previous error if (isNaN(value)) { errorSpan.textContent = 'Please enter a valid number.'; return false; } if (value <= 0) { errorSpan.textContent = 'Value must be positive.'; return false; } if (min !== undefined && value max) { errorSpan.textContent = 'Value is too high.'; return false; } return true; } function updateRectangularVisibility() { var shapeSelect = document.getElementById('ductShape'); var rectDimsDiv = document.getElementById('rectangularDims'); if (shapeSelect.value === 'rectangular') { rectDimsDiv.style.display = 'block'; } else { rectDimsDiv.style.display = 'none'; } } function calculateDuctSize() { var airflow = document.getElementById('airflow').value; var velocity = document.getElementById('velocity').value; var ductShape = document.getElementById('ductShape').value; var rectWidth = document.getElementById('rectWidth').value; var rectHeight = document.getElementById('rectHeight').value; var airflowError = document.getElementById('airflowError'); var velocityError = document.getElementById('velocityError'); var rectWidthError = document.getElementById('rectWidthError'); var rectHeightError = document.getElementById('rectHeightError'); var isValid = true; if (!validateInput('airflow', 'airflowError', 1)) isValid = false; if (!validateInput('velocity', 'velocityError', 1)) isValid = false; if (ductShape === 'rectangular') { if (!validateInput('rectWidth', 'rectWidthError', 1)) isValid = false; if (!validateInput('rectHeight', 'rectHeightError', 1)) isValid = false; } if (!isValid) { document.getElementById('results').style.display = 'none'; return; } airflow = parseFloat(airflow); velocity = parseFloat(velocity); rectWidth = parseFloat(rectWidth); rectHeight = parseFloat(rectHeight); var requiredArea = (airflow * 144) / velocity; var resultShapeText = ductShape === 'round' ? 'Round' : 'Rectangular'; var dynamicDimLabel = "; var dynamicDimValue = '–'; var equivalentRoundDiameter = '–'; var exampleRectangular = '–'; if (ductShape === 'round') { dynamicDimLabel = 'Equivalent Round Diameter (in.):'; equivalentRoundDiameter = Math.sqrt((4 * requiredArea) / Math.PI).toFixed(1); dynamicDimValue = equivalentRoundDiameter; } else { dynamicDimLabel = 'Calculated Rectangular Area (sq. in.):'; var actualRectArea = (rectWidth * rectHeight); dynamicDimValue = actualRectArea.toFixed(1); exampleRectangular = rectWidth + ' x ' + rectHeight; if (actualRectArea maxArea) maxArea = calculatedArea; var scaleY = chartAreaHeight / maxArea; // Find max velocity for scaling X-axis var maxVelocity = Math.max.apply(null, velocities); if (currentVelocity > maxVelocity) maxVelocity = currentVelocity; var scaleX = chartAreaWidth / maxVelocity; ctx.font = '12px Arial'; ctx.fillStyle = '#333'; // Draw Axes ctx.beginPath(); ctx.moveTo(padding, padding); ctx.lineTo(padding, chartHeight – padding); // Y-axis ctx.lineTo(chartWidth – padding, chartHeight – padding); // X-axis ctx.strokeStyle = '#333'; ctx.stroke(); // Y-axis labels and ticks ctx.textAlign = 'right'; ctx.fillText(maxArea.toFixed(0), padding – 5, padding); ctx.fillText((maxArea / 2).toFixed(0), padding – 5, chartHeight / 2); ctx.fillText('0', padding – 5, chartHeight – padding); ctx.fillText('Area (sq. in.)', padding – 30, chartHeight / 2); // X-axis labels and ticks ctx.textAlign = 'center'; velocities.forEach(function(v) { var x = padding + (v / maxVelocity) * chartAreaWidth; ctx.fillText(v.toString(), x, chartHeight – padding + 15); }); ctx.fillText('Velocity (FPM)', chartWidth / 2, chartHeight – 5); // Draw Data Series 1: Areas for different velocities ctx.beginPath(); ctx.strokeStyle = 'var(–primary-color)'; ctx.lineWidth = 2; areasForVelocities.forEach(function(area, index) { var x = padding + (velocities[index] / maxVelocity) * chartAreaWidth; var y = chartHeight – padding – (area / maxArea) * chartAreaHeight; if (index === 0) { ctx.moveTo(x, y); } else { ctx.lineTo(x, y); } }); ctx.stroke(); // Draw Data Series 2: Calculated point ctx.beginPath(); ctx.fillStyle = 'var(–success-color)'; ctx.strokeStyle = 'var(–success-color)'; ctx.lineWidth = 1; var currentX = padding + (currentVelocity / maxVelocity) * chartAreaWidth; var currentY = chartHeight – padding – (calculatedArea / maxArea) * chartAreaHeight; ctx.moveTo(currentX, currentY); ctx.lineTo(currentX, chartHeight – padding); // Vertical line to X-axis ctx.lineTo(padding, currentY); // Horizontal line to Y-axis ctx.stroke(); ctx.beginPath(); ctx.arc(currentX, currentY, 5, 0, Math.PI * 2); // Circle marker ctx.fill(); // Add legend ctx.textAlign = 'left'; ctx.fillStyle = '#333'; ctx.fillText('Required Area vs. Velocity', padding, padding + 15); ctx.fillStyle = 'var(–primary-color)'; ctx.fillRect(padding, padding + 25, 15, 10); ctx.fillStyle = '#333'; ctx.fillText('Trend Line', padding + 20, padding + 30); ctx.fillStyle = 'var(–success-color)'; ctx.fillRect(padding, padding + 40, 15, 10); ctx.fillStyle = '#333'; ctx.fillText('Your Calculated Point', padding + 20, padding + 45); } function resetCalculator() { document.getElementById('airflow').value = '1000'; document.getElementById('velocity').value = '700'; document.getElementById('ductShape').value = 'round'; document.getElementById('rectWidth').value = '12'; document.getElementById('rectHeight').value = '8'; document.getElementById('airflowError').textContent = "; document.getElementById('velocityError').textContent = "; document.getElementById('rectWidthError').textContent = "; document.getElementById('rectHeightError').textContent = "; document.getElementById('results').style.display = 'none'; updateRectangularVisibility(); // Clear chart and table var canvas = document.getElementById('ductSizeChart'); var ctx = canvas.getContext('2d'); ctx.clearRect(0, 0, canvas.width, canvas.height); document.getElementById('ductTableBody').innerHTML = 'Calculate results to populate table.'; } function copyResults() { var requiredArea = document.getElementById('requiredArea').textContent; var resultShape = document.getElementById('resultShape').textContent; var resultAirflow = document.getElementById('resultAirflow').textContent; var resultVelocity = document.getElementById('resultVelocity').textContent; var dynamicDimLabel = document.getElementById('dynamicDimLabel').textContent; var dynamicDimValue = document.getElementById('dynamicDimValue').textContent; var formula = "Duct Area (sq. in.) = (Airflow (CFM) * 144) / Velocity (FPM)."; var resultsText = "— Duct Size Calculation Results —\n\n"; resultsText += "Required Duct Area: " + requiredArea + " sq. inches\n"; resultsText += "Duct Shape: " + resultShape + "\n"; resultsText += "Airflow: " + resultAirflow + " CFM\n"; resultsText += "Max Velocity: " + resultVelocity + " FPM\n"; resultsText += dynamicDimLabel + " " + dynamicDimValue + "\n\n"; resultsText += "Formula Used: " + formula + "\n"; resultsText += "Assumptions: Based on inputs provided."; // Use a temporary textarea to copy text var textArea = document.createElement("textarea"); textArea.value = resultsText; textArea.style.position = "fixed"; textArea.style.left = "-9999px"; document.body.appendChild(textArea); textArea.focus(); textArea.select(); try { var successful = document.execCommand('copy'); var msg = successful ? 'Results copied to clipboard!' : 'Failed to copy results.'; // Optionally show a temporary message to the user console.log(msg); } catch (err) { console.error('Unable to copy', err); } document.body.removeChild(textArea); } // Initialize event listeners and visibility document.getElementById('ductShape').addEventListener('change', updateRectangularVisibility); document.addEventListener('DOMContentLoaded', function() { updateRectangularVisibility(); // Set canvas dimensions var canvas = document.getElementById('ductSizeChart'); canvas.width = 500; // Default width canvas.height = 300; // Default height // Initial calculation on load if default values are present calculateDuctSize(); }); // FAQ toggles var faqQuestions = document.querySelectorAll('.faq-question'); faqQuestions.forEach(function(question) { question.addEventListener('click', function() { var answer = this.nextElementSibling; if (answer.style.display === 'block') { answer.style.display = 'none'; } else { answer.style.display = 'block'; } }); });

Leave a Comment