sarmad1995/concretestimation
0
1import streamlit as st2 3# Function to calculate concrete quantities4def calculate_concrete(length, width, height, unit, cement_ratio, sand_ratio, aggregate_ratio, cement_bag_weight):5 # Convert dimensions to feet if they are in meters6 if unit == "meters":7 length = length * 3.280848 width = width * 3.280849 height = height * 3.2808410 11 # Volume in cubic feet12 volume_cft = length * width * height13 14 # Dry volume factor15 dry_volume = volume_cft * 1.5416 17 # Total ratio18 total_ratio = cement_ratio + sand_ratio + aggregate_ratio19 20 # Material quantities in cubic feet21 cement_volume = (cement_ratio / total_ratio) * dry_volume22 sand_volume = (sand_ratio / total_ratio) * dry_volume23 aggregate_volume = (aggregate_ratio / total_ratio) * dry_volume24 25 # Cement bags required26 cement_bags = cement_volume / (cement_bag_weight / 50) # 1 bag = 1.25 cubic feet (approx)27 28 return volume_cft, dry_volume, cement_bags, cement_volume, sand_volume, aggregate_volume29 30# Streamlit App Title31st.title("Concrete Calculator")32 33# Input fields for dimensions34st.header("Input Dimensions")35length = st.number_input("Length", min_value=1.0, value=10.0, step=0.1)36width = st.number_input("Width", min_value=1.0, value=10.0, step=0.1)37height = st.number_input("Height", min_value=0.1, value=0.5, step=0.1)38 39unit = st.selectbox("Unit", ["feet", "meters"])40 41# Input fields for concrete mix ratio42st.header("Concrete Mix Ratio")43cement_ratio = st.number_input("Cement Ratio", min_value=1, value=1, step=1)44sand_ratio = st.number_input("Sand Ratio", min_value=1, value=2, step=1)45aggregate_ratio = st.number_input("Aggregate Ratio", min_value=1, value=4, step=1)46 47# Input for cement bag weight48st.header("Cement Bag Weight")49cement_bag_weight = st.number_input("Weight of one cement bag (kg)", min_value=1, value=50, step=1)50 51if st.button("Calculate"):52 # Perform calculations53 volume_cft, dry_volume, cement_bags, cement_volume, sand_volume, aggregate_volume = calculate_concrete(54 length, width, height, unit, cement_ratio, sand_ratio, aggregate_ratio, cement_bag_weight55 )56 57 # Display results58 st.subheader("Results")59 st.write(f"**Concrete Volume:** {volume_cft:.2f} CFT")60 st.write(f"**Dry Volume:** {dry_volume:.2f} CFT")61 st.write(f"**Cement Required:** {cement_bags:.2f} Bags")62 st.write(f"**Cement Volume:** {cement_volume:.2f} CFT")63 st.write(f"**Sand Volume:** {sand_volume:.2f} CFT")64 st.write(f"**Aggregate Volume:** {aggregate_volume:.2f} CFT")65 66st.info("Enter the dimensions and concrete mix ratio to calculate the quantities required.")