Update app.py
Browse files
app.py
CHANGED
|
@@ -1,55 +1,66 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
|
| 3 |
def calculate_mix_design(strength_psi, strength_type, workability, exposure, cement_type):
|
| 4 |
-
# Convert
|
| 5 |
if strength_type == "Cube":
|
| 6 |
f_c = strength_psi * 0.8
|
| 7 |
else:
|
| 8 |
f_c = strength_psi
|
| 9 |
|
| 10 |
-
#
|
| 11 |
-
f_avg = f_c + 1.34 * 500
|
| 12 |
-
|
| 13 |
-
# Determine water-cement ratio (w/c) based on exposure and target strength
|
| 14 |
if exposure == "Severe":
|
| 15 |
w_c_ratio = min(0.45, 0.75 - f_c / 10000)
|
| 16 |
elif exposure == "Moderate":
|
| 17 |
w_c_ratio = min(0.50, 0.75 - f_c / 10000)
|
| 18 |
-
else:
|
| 19 |
w_c_ratio = min(0.60, 0.75 - f_c / 10000)
|
| 20 |
|
| 21 |
-
#
|
| 22 |
if workability == "High":
|
| 23 |
water_content = 210
|
| 24 |
elif workability == "Medium":
|
| 25 |
water_content = 185
|
| 26 |
-
else:
|
| 27 |
water_content = 160
|
| 28 |
|
| 29 |
-
#
|
| 30 |
cement_content = water_content / w_c_ratio
|
| 31 |
|
| 32 |
-
#
|
| 33 |
-
volume = 1.0 # m³
|
| 34 |
air = 0.02
|
| 35 |
sg_cement = 3.15
|
| 36 |
sg_agg = 2.65
|
| 37 |
sg_water = 1.0
|
| 38 |
|
| 39 |
-
# Volumes
|
| 40 |
cement_vol = cement_content / (sg_cement * 1000)
|
| 41 |
water_vol = water_content / (sg_water * 1000)
|
| 42 |
-
|
| 43 |
-
agg_vol = volume - (cement_vol + water_vol + air_vol)
|
| 44 |
|
| 45 |
-
# Split aggregates
|
| 46 |
coarse_agg = agg_vol * sg_agg * 1000 * 0.6
|
| 47 |
fine_agg = agg_vol * sg_agg * 1000 * 0.4
|
| 48 |
|
| 49 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
ratio_cement = 1
|
| 51 |
-
ratio_fine =
|
| 52 |
-
ratio_coarse =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
|
| 54 |
slump_range = {
|
| 55 |
"Low": "25-50 mm",
|
|
@@ -57,7 +68,6 @@ def calculate_mix_design(strength_psi, strength_type, workability, exposure, cem
|
|
| 57 |
"High": "125-150 mm"
|
| 58 |
}[workability]
|
| 59 |
|
| 60 |
-
# Admixture recommendations
|
| 61 |
admixtures = []
|
| 62 |
if exposure in ["Moderate", "Severe"]:
|
| 63 |
admixtures.append("Retarder")
|
|
@@ -67,13 +77,12 @@ def calculate_mix_design(strength_psi, strength_type, workability, exposure, cem
|
|
| 67 |
admixtures.append("Fly Ash")
|
| 68 |
|
| 69 |
return {
|
|
|
|
| 70 |
"Exposure Condition": exposure,
|
| 71 |
"Cement Type": cement_type,
|
| 72 |
-
"Adjusted Strength for Design (f'c)": round(f_c),
|
| 73 |
-
"Target Mean Strength (f_avg)": round(f_avg),
|
| 74 |
"Water-Cement Ratio": round(w_c_ratio, 3),
|
| 75 |
"Slump Range": slump_range,
|
| 76 |
-
"Mix Ratio (by
|
| 77 |
"Cement (kg/m³)": round(cement_content),
|
| 78 |
"Water (kg/m³)": round(water_content),
|
| 79 |
"Fine Aggregate (kg/m³)": round(fine_agg),
|
|
@@ -81,19 +90,19 @@ def calculate_mix_design(strength_psi, strength_type, workability, exposure, cem
|
|
| 81 |
"Recommended Admixtures": ", ".join(admixtures) if admixtures else "None"
|
| 82 |
}
|
| 83 |
|
| 84 |
-
# Streamlit
|
| 85 |
st.set_page_config(page_title="Concrete Mix Design Assistant (ACI/ASTM)")
|
| 86 |
st.title("🧱 Concrete Mix Design Assistant")
|
| 87 |
st.subheader("Based on ACI 211.1 & ASTM Standards")
|
| 88 |
|
| 89 |
-
# Inputs
|
| 90 |
strength = st.number_input("Required Concrete Strength (PSI)", min_value=1000, max_value=10000, step=100, value=4000)
|
| 91 |
strength_type = st.selectbox("Strength Type", ["Cube", "Cylinder"])
|
| 92 |
workability = st.selectbox("Workability", ["Low", "Medium", "High"])
|
| 93 |
exposure = st.selectbox("Exposure Condition", ["Mild", "Moderate", "Severe"])
|
| 94 |
cement_type = st.selectbox("Type of Cement", ["OPC", "SRC", "PPC"])
|
| 95 |
|
| 96 |
-
#
|
| 97 |
if st.button("Generate Mix Design"):
|
| 98 |
results = calculate_mix_design(strength, strength_type, workability, exposure, cement_type)
|
| 99 |
st.success("ACI/ASTM Mix Design Calculated Successfully!")
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
|
| 3 |
def calculate_mix_design(strength_psi, strength_type, workability, exposure, cement_type):
|
| 4 |
+
# Convert Cube to Cylinder if required
|
| 5 |
if strength_type == "Cube":
|
| 6 |
f_c = strength_psi * 0.8
|
| 7 |
else:
|
| 8 |
f_c = strength_psi
|
| 9 |
|
| 10 |
+
# Water-Cement Ratio based on Exposure
|
|
|
|
|
|
|
|
|
|
| 11 |
if exposure == "Severe":
|
| 12 |
w_c_ratio = min(0.45, 0.75 - f_c / 10000)
|
| 13 |
elif exposure == "Moderate":
|
| 14 |
w_c_ratio = min(0.50, 0.75 - f_c / 10000)
|
| 15 |
+
else:
|
| 16 |
w_c_ratio = min(0.60, 0.75 - f_c / 10000)
|
| 17 |
|
| 18 |
+
# Water content (kg/m³) based on Workability
|
| 19 |
if workability == "High":
|
| 20 |
water_content = 210
|
| 21 |
elif workability == "Medium":
|
| 22 |
water_content = 185
|
| 23 |
+
else:
|
| 24 |
water_content = 160
|
| 25 |
|
| 26 |
+
# Cement content
|
| 27 |
cement_content = water_content / w_c_ratio
|
| 28 |
|
| 29 |
+
# Volume constants
|
|
|
|
| 30 |
air = 0.02
|
| 31 |
sg_cement = 3.15
|
| 32 |
sg_agg = 2.65
|
| 33 |
sg_water = 1.0
|
| 34 |
|
| 35 |
+
# Volumes of materials
|
| 36 |
cement_vol = cement_content / (sg_cement * 1000)
|
| 37 |
water_vol = water_content / (sg_water * 1000)
|
| 38 |
+
agg_vol = 1.0 - (cement_vol + water_vol + air)
|
|
|
|
| 39 |
|
| 40 |
+
# Split aggregates
|
| 41 |
coarse_agg = agg_vol * sg_agg * 1000 * 0.6
|
| 42 |
fine_agg = agg_vol * sg_agg * 1000 * 0.4
|
| 43 |
|
| 44 |
+
# Material Densities for Volume Ratio (kg/m³)
|
| 45 |
+
density_cement = 1440
|
| 46 |
+
density_fine = 1600
|
| 47 |
+
density_coarse = 1500
|
| 48 |
+
|
| 49 |
+
# Convert to volume (m³)
|
| 50 |
+
vol_cement = cement_content / density_cement
|
| 51 |
+
vol_fine = fine_agg / density_fine
|
| 52 |
+
vol_coarse = coarse_agg / density_coarse
|
| 53 |
+
|
| 54 |
+
# Normalize volumes to 1 part cement
|
| 55 |
ratio_cement = 1
|
| 56 |
+
ratio_fine = vol_fine / vol_cement
|
| 57 |
+
ratio_coarse = vol_coarse / vol_cement
|
| 58 |
+
|
| 59 |
+
# Round to nearest 0.5
|
| 60 |
+
def round_half(x):
|
| 61 |
+
return round(x * 2) / 2
|
| 62 |
+
|
| 63 |
+
mix_ratio_volume = f"1 : {round_half(ratio_fine)} : {round_half(ratio_coarse)}"
|
| 64 |
|
| 65 |
slump_range = {
|
| 66 |
"Low": "25-50 mm",
|
|
|
|
| 68 |
"High": "125-150 mm"
|
| 69 |
}[workability]
|
| 70 |
|
|
|
|
| 71 |
admixtures = []
|
| 72 |
if exposure in ["Moderate", "Severe"]:
|
| 73 |
admixtures.append("Retarder")
|
|
|
|
| 77 |
admixtures.append("Fly Ash")
|
| 78 |
|
| 79 |
return {
|
| 80 |
+
"Required Strength (PSI)": strength_psi,
|
| 81 |
"Exposure Condition": exposure,
|
| 82 |
"Cement Type": cement_type,
|
|
|
|
|
|
|
| 83 |
"Water-Cement Ratio": round(w_c_ratio, 3),
|
| 84 |
"Slump Range": slump_range,
|
| 85 |
+
"Mix Ratio (by volume)": mix_ratio_volume,
|
| 86 |
"Cement (kg/m³)": round(cement_content),
|
| 87 |
"Water (kg/m³)": round(water_content),
|
| 88 |
"Fine Aggregate (kg/m³)": round(fine_agg),
|
|
|
|
| 90 |
"Recommended Admixtures": ", ".join(admixtures) if admixtures else "None"
|
| 91 |
}
|
| 92 |
|
| 93 |
+
# Streamlit App Interface
|
| 94 |
st.set_page_config(page_title="Concrete Mix Design Assistant (ACI/ASTM)")
|
| 95 |
st.title("🧱 Concrete Mix Design Assistant")
|
| 96 |
st.subheader("Based on ACI 211.1 & ASTM Standards")
|
| 97 |
|
| 98 |
+
# User Inputs
|
| 99 |
strength = st.number_input("Required Concrete Strength (PSI)", min_value=1000, max_value=10000, step=100, value=4000)
|
| 100 |
strength_type = st.selectbox("Strength Type", ["Cube", "Cylinder"])
|
| 101 |
workability = st.selectbox("Workability", ["Low", "Medium", "High"])
|
| 102 |
exposure = st.selectbox("Exposure Condition", ["Mild", "Moderate", "Severe"])
|
| 103 |
cement_type = st.selectbox("Type of Cement", ["OPC", "SRC", "PPC"])
|
| 104 |
|
| 105 |
+
# Output
|
| 106 |
if st.button("Generate Mix Design"):
|
| 107 |
results = calculate_mix_design(strength, strength_type, workability, exposure, cement_type)
|
| 108 |
st.success("ACI/ASTM Mix Design Calculated Successfully!")
|