Code for Identify the Classification of soil Systems
import numpy as np
import matplotlib.pyplot as plt
def plot_grain_size_distribution(sieve_sizes, percent_passing):
plt.figure(figsize=(8, 6))
plt.semilogx(sieve_sizes, percent_passing, marker='o', linestyle='-')
plt.xlabel("Sieve Size (mm)")
plt.ylabel("Percent Passing (%)")
plt.title("Grain Size Distribution Curve - Sieve Analysis")
plt.grid(True, which='both', linestyle='--', linewidth = 0.5)
plt.xlim(0.01, 10) # Limit x-axis from 10^-2 to 10^1
plt.ylim(0, 105) # Limit y-axis from 0 to 100
plt.yticks(np.arange(0, 106, 10)) # Set y-axis ticks with increments of 10
plt.show()
def classify_soil(percent_passing, liquid_limit, plastic_limit):
sand_percent = percent_passing[0] + percent_passing[1]
silt_percent = percent_passing[2] + percent_passing[3] + percent_passing[4]
clay_percent = percent_passing[5] + percent_passing[6]
# Textural classification
if sand_percent > 50:
texture = "Sandy"
elif clay_percent > 40:
texture = "Clayey"
else:
texture = "Silty"
# IS 1498 Classification
if clay_percent < 50 and sand_percent > 50:
is1498 = "SC - Silty Clay"
elif clay_percent < 15 and sand_percent < = 50:
is1498 = "SM - Silty Sand"
elif 15 < = clay_percent < 45 and sand_percent > 15:
is1498 = "ML - Sandy Silt"
elif 15 < = clay_percent < 45 and sand_percent < = 15:
is1498 = "CL - Clayey Silt"
elif clay_percent > = 45:
is1498 = "CH - Clayey Sand"
else:
is1498 = "Others"
# Unified Soil Classification System (USCS)
if sand_percent > 50:
if clay_percent < 15:
uscs = "SW - Well-graded Sand"
else:
uscs = "SP - Poorly-graded Sand"
elif clay_percent > 50:
uscs = "CL - Low to Medium Plasticity Clay"
else:
if silt_percent > 50:
uscs = "ML - Inorganic Silt or Clayey Silt"
else:
uscs = "SM - Silty or Sandy Soil"
# Soil classification based on LL and PL
if liquid_limit > = 50:
soil_class = "Highly Plastic"
elif 30 < = liquid_limit < 50:
soil_class = "Medium Plastic"
else:
soil_class = "Low Plastic"
return texture, is1498, uscs, soil_class
def calculate_ip(wL, wP):
return wL - wP
def classify_fine_grained_soil(ip, wL):
# Boundary lines
A_line = 0.73 * (wL − 20)
U_line = 0.9 * (wL − 8)
if ip < 4:
return "ML"
elif ip > = 4 and ip < = 7: # CL-ML
return "CL-ML"
elif ip > 20 and ip < 3: # CI
return "CI"
elif ip > = 26 and ip < = 60: # CH
return "CH"
elif ip > 7 and wL < 35:
return "CL"
elif ip < = A_line: # Below A-line
if wL < 35:
return "ML & OL"
elif 35 < = wL < 50:
return "MI & OI"
else:
return "MH & OH"
else:
return "Unknown"
def main():
# Data provided
sieve_sizes = [4.75, 2.0, 1.0, 0.6, 0.425, 0.3, 0.15, 0.075]
weights_retained = [21, 44, 18, 15, 12, 8, 16, 3]
liquid_limit = 52 # Liquid limit value
plastic_limit = 26 # Plastic limit value
# Calculate percent passing
total_weight = sum(weights_retained)
percent_passing = [100 * (1 - sum(weights_retained[:i + 1]) / total_weight) for i in range(len(weights_retained))]
# Plot grain size distribution curve
plot_grain_size_distribution(sieve_sizes, percent_passing)
# Classify soil types
texture, is1498, uscs, soil_class = classify_soil(percent_passing, liquid_limit, plastic_limit)
# Print classification results
print("Textural Classification:", texture)
print("Unified Soil Classification System (USCS):", uscs)
print("Soil Class:", soil_class)
# Calculate plasticity index
ip = calculate_ip(liquid_limit, plastic_limit)
# Classify fine-grained soil based on plasticity chart with compressibility characteristics
fine_grained_classification = classify_fine_grained_soil(ip, liquid_limit)
# Check for dual symbols
if 'Organic' in fine_grained_classification and 'Inorganic' in fine_grained_classification:
print("Dual Symbols: {} and {}".format(fine_grained_classification.split(' - ')[0], fine_grained_classification.split(' - ')[1]))
else:
print("Classification of Fine-Grained Soil:", fine_grained_classification)
if __name__ == "__main__":
main()
The Output of the Sieve Analysis Test Code is
Soil Sample 2
Soil Sample 3