// BhoomiBandhan – Foundation Type Recommender // Rule-based foundation selection based on soil properties and loading conditions interface SoilProperties { type: 'clay' | 'sand' | 'loam' | 'silt' | 'gravel' | 'rock'; bearing_capacity?: number; // kN/m² plasticity_index?: number; moisture_content?: number; density?: number; // kg/m³ } interface LoadRequirement { total_load: number; // kN load_type: 'light' | 'medium' | 'heavy' | 'very_heavy'; structure_type: 'residential' | 'commercial' | 'industrial' | 'bridge' | 'tower'; safety_factor?: number; } interface FoundationRecommendation { foundation_type: 'shallow' | 'deep' | 'pile' | 'raft' | 'caisson' | 'mat'; sub_type: string; depth_recommendation: string; width_recommendation: string; reinforcement_needed: boolean; estimated_cost_range: string; construction_considerations: string[]; is_standards: string[]; confidence: number; warnings: string[]; } class FoundationRecommender { private soilBearingCapacity = new Map([ ['clay', { soft: 50, medium: 150, hard: 300 }], ['sand', { loose: 100, medium: 200, dense: 400 }], ['loam', { soft: 75, medium: 175, hard: 350 }], ['silt', { soft: 40, medium: 120, hard: 250 }], ['gravel', { loose: 200, medium: 400, dense: 600 }], ['rock', { soft: 1000, medium: 3000, hard: 10000 }] ]); private loadCategories = new Map([ ['light', { min: 0, max: 500 }], // kN ['medium', { min: 500, max: 2000 }], ['heavy', { min: 2000, max: 10000 }], ['very_heavy', { min: 10000, max: 100000 }] ]); recommendFoundation(soil: SoilProperties, load: LoadRequirement): FoundationRecommendation { try { // Input validation this.validateInputs(soil, load); // Determine soil bearing capacity const bearingCapacity = this.determineBearingCapacity(soil); // Calculate required foundation area const safetyFactor = load.safety_factor || 2.5; const requiredArea = (load.total_load * safetyFactor) / bearingCapacity; // Apply foundation selection logic const recommendation = this.selectFoundationType(soil, load, bearingCapacity, requiredArea); // Add IS code references and construction considerations recommendation.is_standards = this.getRelevantISCodes(recommendation.foundation_type); recommendation.construction_considerations = this.getConstructionConsiderations(soil, recommendation); return recommendation; } catch (error) { throw new Error(`Foundation recommendation failed: ${error instanceof Error ? error.message : 'Unknown error'}`); } } private validateInputs(soil: SoilProperties, load: LoadRequirement): void { if (!soil.type || !['clay', 'sand', 'loam', 'silt', 'gravel', 'rock'].includes(soil.type)) { throw new Error('Invalid soil type. Must be one of: clay, sand, loam, silt, gravel, rock'); } if (!load.total_load || load.total_load <= 0) { throw new Error('Total load must be a positive number'); } if (!load.load_type || !['light', 'medium', 'heavy', 'very_heavy'].includes(load.load_type)) { throw new Error('Invalid load type. Must be one of: light, medium, heavy, very_heavy'); } if (!load.structure_type || !['residential', 'commercial', 'industrial', 'bridge', 'tower'].includes(load.structure_type)) { throw new Error('Invalid structure type'); } if (load.safety_factor && (load.safety_factor < 1.5 || load.safety_factor > 5.0)) { throw new Error('Safety factor must be between 1.5 and 5.0'); } } private determineBearingCapacity(soil: SoilProperties): number { if (soil.bearing_capacity && soil.bearing_capacity > 0) { return soil.bearing_capacity; } const capacityRange = this.soilBearingCapacity.get(soil.type); if (!capacityRange) { throw new Error(`Unknown soil type: ${soil.type}`); } // Determine soil consistency based on properties let consistency: 'soft' | 'medium' | 'hard' = 'medium'; if (soil.type === 'clay') { if (soil.plasticity_index) { if (soil.plasticity_index < 15) consistency = 'soft'; else if (soil.plasticity_index > 30) consistency = 'hard'; } } else if (soil.type === 'sand' || soil.type === 'gravel') { if (soil.density) { if (soil.density < 1600) consistency = 'soft'; else if (soil.density > 1800) consistency = 'hard'; } } return capacityRange[consistency]; } private selectFoundationType( soil: SoilProperties, load: LoadRequirement, bearingCapacity: number, requiredArea: number ): FoundationRecommendation { const warnings: string[] = []; let confidence = 85; // Foundation selection logic based on multiple criteria if (load.total_load < 500 && bearingCapacity > 150) { // Light loads on good soil - Shallow foundations return this.getShallowFoundationRecommendation(soil, load, requiredArea, warnings, confidence); } if (requiredArea > 100 || load.structure_type === 'industrial') { // Large area required or industrial structure - Consider raft/mat return this.getRaftFoundationRecommendation(soil, load, requiredArea, warnings, confidence); } if (bearingCapacity < 100 || soil.type === 'clay' && (soil.plasticity_index || 0) > 25) { // Poor soil conditions - Deep foundations return this.getDeepFoundationRecommendation(soil, load, warnings, confidence); } if (load.total_load > 10000 || load.structure_type === 'bridge' || load.structure_type === 'tower') { // Heavy loads or special structures - Pile foundations return this.getPileFoundationRecommendation(soil, load, warnings, confidence); } // Default to shallow with detailed analysis return this.getShallowFoundationRecommendation(soil, load, requiredArea, warnings, confidence); } private getShallowFoundationRecommendation( soil: SoilProperties, load: LoadRequirement, requiredArea: number, warnings: string[], confidence: number ): FoundationRecommendation { const width = Math.sqrt(requiredArea); let subType = 'isolated_footing'; if (width > 3) { subType = 'combined_footing'; warnings.push('Large footing size may require combined or continuous footings'); } if (soil.type === 'clay' && (soil.moisture_content || 0) > 25) { warnings.push('High moisture content in clay may cause settlement issues'); confidence -= 10; } return { foundation_type: 'shallow', sub_type: subType, depth_recommendation: `Minimum ${Math.max(1.0, width / 6).toFixed(1)}m depth, below frost line`, width_recommendation: `${width.toFixed(1)}m x ${width.toFixed(1)}m (Area: ${requiredArea.toFixed(1)}m²)`, reinforcement_needed: width > 1.5, estimated_cost_range: `₹${(requiredArea * 3000).toLocaleString()} - ₹${(requiredArea * 5000).toLocaleString()}`, construction_considerations: [], is_standards: [], confidence, warnings }; } private getRaftFoundationRecommendation( soil: SoilProperties, load: LoadRequirement, requiredArea: number, warnings: string[], confidence: number ): FoundationRecommendation { warnings.push('Raft foundation recommended due to large load distribution requirement'); if (soil.type === 'clay') { warnings.push('Monitor for differential settlement in clay soils'); confidence -= 5; } return { foundation_type: 'raft', sub_type: 'reinforced_concrete_raft', depth_recommendation: `${Math.max(1.5, requiredArea / 50).toFixed(1)}m thick slab`, width_recommendation: `Full building footprint with ${requiredArea.toFixed(1)}m² effective area`, reinforcement_needed: true, estimated_cost_range: `₹${(requiredArea * 8000).toLocaleString()} - ₹${(requiredArea * 12000).toLocaleString()}`, construction_considerations: [], is_standards: [], confidence, warnings }; } private getDeepFoundationRecommendation( soil: SoilProperties, load: LoadRequirement, warnings: string[], confidence: number ): FoundationRecommendation { warnings.push('Deep foundation required due to poor surface soil conditions'); const depth = soil.type === 'clay' ? 8 : 6; return { foundation_type: 'deep', sub_type: 'drilled_shaft', depth_recommendation: `${depth}m to ${depth + 4}m depth to reach competent soil`, width_recommendation: `${Math.sqrt(load.total_load / 500).toFixed(1)}m diameter shafts`, reinforcement_needed: true, estimated_cost_range: `₹${(load.total_load * 15).toLocaleString()} - ₹${(load.total_load * 25).toLocaleString()}`, construction_considerations: [], is_standards: [], confidence, warnings }; } private getPileFoundationRecommendation( soil: SoilProperties, load: LoadRequirement, warnings: string[], confidence: number ): FoundationRecommendation { const pileCapacity = soil.type === 'sand' ? 800 : soil.type === 'clay' ? 600 : 1000; const numberOfPiles = Math.ceil(load.total_load / pileCapacity); warnings.push(`${numberOfPiles} piles required for load distribution`); if (load.structure_type === 'bridge') { warnings.push('Consider seismic and lateral load requirements for bridge foundations'); } return { foundation_type: 'pile', sub_type: 'driven_concrete_pile', depth_recommendation: `12m to 20m depth depending on soil profile`, width_recommendation: `${numberOfPiles} piles of 400mm diameter in ${Math.ceil(Math.sqrt(numberOfPiles))}x${Math.ceil(numberOfPiles/Math.ceil(Math.sqrt(numberOfPiles)))} grid`, reinforcement_needed: true, estimated_cost_range: `₹${(numberOfPiles * 50000).toLocaleString()} - ₹${(numberOfPiles * 80000).toLocaleString()}`, construction_considerations: [], is_standards: [], confidence, warnings }; } private getRelevantISCodes(foundationType: string): string[] { const codes: string[] = ['IS 1904-1986 (Code of Practice for Design and Construction of Foundations)']; switch (foundationType) { case 'shallow': codes.push('IS 6403-1981 (Code of Practice for Determination of Bearing Capacity of Shallow Foundations)'); break; case 'pile': codes.push('IS 2911-2010 (Code of Practice for Design and Construction of Pile Foundations)'); break; case 'raft': codes.push('IS 456-2000 (Plain and Reinforced Concrete Code of Practice)'); break; case 'deep': codes.push('IS 4968-1976 (Code of Practice for Subsurface Investigation for Foundations)'); break; } codes.push('IS 1893-2016 (Criteria for Earthquake Resistant Design of Structures)'); return codes; } private getConstructionConsiderations(soil: SoilProperties, recommendation: FoundationRecommendation): string[] { const considerations: string[] = []; if (soil.type === 'clay') { considerations.push('Protect excavation from water infiltration'); considerations.push('Monitor for swelling/shrinkage during construction'); considerations.push('Consider dewatering if groundwater is encountered'); } if (soil.type === 'sand') { considerations.push('Maintain stable excavation slopes'); considerations.push('Consider temporary shoring for deep excavations'); } if (recommendation.foundation_type === 'pile') { considerations.push('Conduct pile load tests as per IS 2911'); considerations.push('Monitor for pile driving vibrations affecting nearby structures'); } considerations.push('Conduct soil investigation as per IS 1892'); considerations.push('Ensure proper concrete quality control as per IS 456'); considerations.push('Implement safety measures as per IS 14846'); return considerations; } // Helper method to get foundation suitability matrix getFoundationSuitabilityMatrix(): Record> { return { 'clay': { 'light': 'Shallow footings with proper drainage', 'medium': 'Raft or deep foundations depending on plasticity', 'heavy': 'Pile foundations or deep caissons', 'very_heavy': 'Large diameter piles or caisson groups' }, 'sand': { 'light': 'Shallow strip or pad footings', 'medium': 'Combined footings or shallow raft', 'heavy': 'Driven piles or drilled shafts', 'very_heavy': 'Large pile groups with pile caps' }, 'loam': { 'light': 'Shallow footings with standard reinforcement', 'medium': 'Reinforced footings or small raft', 'heavy': 'Deep foundations or pile groups', 'very_heavy': 'Engineered pile foundations' }, 'rock': { 'light': 'Direct bearing on rock surface', 'medium': 'Shallow foundations on rock', 'heavy': 'Rock anchored foundations', 'very_heavy': 'Rock socketed caissons' } }; } // Export recommendation as detailed report generateDetailedReport(recommendation: FoundationRecommendation, soil: SoilProperties, load: LoadRequirement): string { const report = ` FOUNDATION DESIGN RECOMMENDATION REPORT ===================================== PROJECT DETAILS: - Structure Type: ${load.structure_type} - Total Load: ${load.total_load} kN - Load Category: ${load.load_type} - Safety Factor: ${load.safety_factor || 2.5} SOIL CONDITIONS: - Soil Type: ${soil.type} - Bearing Capacity: ${soil.bearing_capacity || 'Estimated'} kN/m² - Plasticity Index: ${soil.plasticity_index || 'Not specified'} - Moisture Content: ${soil.moisture_content || 'Not specified'}% RECOMMENDED FOUNDATION: - Type: ${recommendation.foundation_type} - Sub-type: ${recommendation.sub_type} - Depth: ${recommendation.depth_recommendation} - Dimensions: ${recommendation.width_recommendation} - Reinforcement Required: ${recommendation.reinforcement_needed ? 'Yes' : 'No'} - Estimated Cost: ${recommendation.estimated_cost_range} CONSTRUCTION CONSIDERATIONS: ${recommendation.construction_considerations.map(c => `- ${c}`).join('\n')} APPLICABLE IS CODES: ${recommendation.is_standards.map(code => `- ${code}`).join('\n')} WARNINGS AND NOTES: ${recommendation.warnings.map(w => `- ${w}`).join('\n')} Confidence Level: ${recommendation.confidence}% Generated by Prithvi Guardian AI - BhoomiBandhan Module Report Date: ${new Date().toLocaleDateString('en-IN')} `; return report; } } export const foundationRecommender = new FoundationRecommender(); export { SoilProperties, LoadRequirement, FoundationRecommendation };