Skip to main content

Foundation Design


from simplex.foundation import *
from simplex.materials import *
from simplex.geometry import *

if __name__ == "__main__":
info = ProjectInfo(
project="Test Project",
name="Test Name",
description="This is a test project.",
location="Test Location",
company="Test Company",
signature="Test Signature",
comments="Test comments."
)

# --- Reinforcement ---
top_reinf_1 = ReinfLayer(diameter=10, spacing=100, concrete_cover=50, zone=Zone.TOP, material=Reinforcement.B500B())
top_reinf_2 = ReinfLayer(diameter=10, spacing=100, concrete_cover=60, zone=Zone.TOP, material=Reinforcement.B500B())
bottom_reinf_1 = ReinfLayer(diameter=10, spacing=100, concrete_cover=50, zone=Zone.BOTTOM, material=Reinforcement.B500B())
bottom_reinf_2 = ReinfLayer(diameter=10, spacing=100, concrete_cover=60, zone=Zone.BOTTOM, material=Reinforcement.B500B())

reinf = Rebars(
x_direction=[top_reinf_1, bottom_reinf_1],
y_direction=[bottom_reinf_2, top_reinf_2]
)

# --- Foundation ---
fnd = RectangularFoundation(
lx_bottom=1.0,
ly_bottom=1.0,
lx_top=0.3,
ly_top=0.3,
height=0.4,
eccentricity_x=0.0,
eccentricity_y=0.0,
material=Concrete.C25_30(),
reinforcement=reinf,
top_of_footing=0.0,
position=Point2d(0.0, 0.0),
)

# --- Loads ---
loading = [
PointFoundationLoading(
name="Loadcomb ULS",
type=LoadType.ULTIMATE,
hx=50.0, hy=10.0, n=-700.0,
mx=0.0, my=12.0, sw=1.0
),
PointFoundationLoading(
name="Loadcomb SLS",
type=LoadType.CHARACTERISTIC,
hx=0.0, hy=0.0, n=-600.0,
mx=0.0, my=0.0, sw=1.0
),
]

soil_material_1 = SoilMaterial.drained(
name="Silty Clay",
phik=35,
ck=0,
gamma=18.0,
gamma_eff=10.0,
m0=20000
)

soil_material_2 = SoilMaterial.undrained(
name="Clay",
cuk=100,
gamma=18.0,
gamma_eff=10.0,
m0=20000
)

soil_material_3 = SoilMaterial.combined(
name="Silty Sand",
phik=0,
ck=0,
cuk=40,
gamma=16.0,
gamma_eff=8.0,
m0=5000
)

soil_material_4 = SoilMaterial.rock(
name="Granite",
rk=500,
gamma=20.0,
gamma_eff=10.0,
m0=50000
)

borehole = Borehole(
soil_materials=[soil_material_1, soil_material_2, soil_material_3, soil_material_4],
top_of_layers=[0.0, -0.4, -1.0, -2.0],
)

soil_complex = SoilComplex(
borehole=borehole,
depth_limit=-4.0,
ground_water=-1.5
)

soil_simple = SoilSimple(
allowed_soil_pressure_uls=150.0,
allowed_soil_pressure_sls=100.0,
friction_coefficient=0.35)

my_soil = soil_simple


# --- Settings ---
code_settings = CodeSettings(
annex=Annex.ANNEX_COMMON,
consequence=Consequence.CONSEQUENCE_CLASS_2,
reliability=Reliability.RELIABILITY_CLASS_1
)

concrete_settings = ConcreteSettings(
crack=0.001,
distribution=FoundationDistribution.FOUNDATION_DISTRIBUTION_PLASTIC,
fabrication=Fabrication.FABRICATION_IN_SITU,
low_strength_variation=False,
consider_min_reinforcement=True,
exposure_class=Exposure.EXPOSURE_CLASS_XC2,
life_category=LifeCategory.LIFE_CATEGORY_L100,
critical_element=False,
inspection_level=InspectionLevel.INSPECTION_LEVEL_TIGHTENED
)

soil_settings = SoilSettings(
des_appr=DesignApproach.DESIGN_APPROACH_3,
geo_cat=GeotechnicalCategory.GEOTECHNICAL_CATEGORY_2,
check_settl=True,
abs_sttl=20.0,
punching=SoilPunchingType.SOIL_PUNCHING_TYPE_1_2
)

sett = Settings(
code=code_settings,
concrete_sett=concrete_settings,
soil_sett=soil_settings
)

concrete_design = ConcreteDesign(
rnfr_dia=[16],
spacing_limits=Interval(100, 300),
step=25
)

foundation_design = FoundationDesign(
step=0.5,
width=Interval(0.5, 4.0),
length=Interval(0.5, 4.0),
height=Interval(0.2, 1.0),
equal_length_width=False
)

design_settings = DesignSettings(limit_utilisation=0.8, foundation_settings=foundation_design, concrete_settings=concrete_design)

# --- Full Project ---
prj = Project(
project_info= info,
foundation= fnd,
loading= loading,
soil= my_soil,
settings= sett,
design_settings= design_settings
)

design_type = DesignType.FOUNDATION_GEOMETRY
results_foundation_design, results_reinforcement_design = prj.run_foundation_design(design_type=design_type)


if(design_type == DesignType.FOUNDATION_GEOMETRY):
width = results_foundation_design.width
length = results_foundation_design.length
height = results_foundation_design.height
volume = results_foundation_design.volume
co2 = results_foundation_design.CO_2_emission

print("Foundation Design Results:")
print(f"Width: {width}, Length: {length}, Height: {height}, Volume: {volume}, CO2 Emission: {co2}")

if(design_type == DesignType.REINFORCEMENT):
print("Reinforcement Design Results:")
print( results_reinforcement_design.reinforcement_x )
print( results_reinforcement_design.reinforcement_y )