Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'set_vertical_balance' method to DSheetPilingModel #182

Merged
merged 13 commits into from
Dec 4, 2024
Merged
20 changes: 20 additions & 0 deletions geolib/models/dsheetpiling/constructions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from geolib.models import BaseDataClass
from geolib.models.dsheetpiling.internal import SheetPileElement
from geolib.models.dsheetpiling.internal import VerticalBalance as InternalVerticalBalance
VirginieTrompille marked this conversation as resolved.
Show resolved Hide resolved
from geolib.models.dsheetpiling.settings import SheetPilingElementMaterialType


Expand Down Expand Up @@ -378,3 +379,22 @@ def to_internal(self) -> SheetPileElement:
diaphragmwallnegeielastoplastic2=self.plastic_properties.eI_branch_3_negative,
diaphragmwallnegmomelastoplastic=self.plastic_properties.moment_point_2_negative,
)


class VerticalBalance(BaseDataClass):
"""
Vertical Balance parameters

Arguments:
max_point_resistance: Maximum point resistance (bearing capacity) at the pile point
xi_factor: Statistic factor related to the number of CPT's used for derivation of the maximum point resistance
"""

max_point_resistance: Optional[float] = None
xi_factor: Optional[float] = None

def to_internal(self) -> InternalVerticalBalance:
return InternalVerticalBalance(
sheetpilingqcrep=self.max_point_resistance,
sheetpilingxi=self.xi_factor,
)
14 changes: 13 additions & 1 deletion geolib/models/dsheetpiling/dsheetpiling_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from pydantic import FilePath, PositiveFloat

from geolib.models import BaseDataClass, BaseModel
from geolib.models.dsheetpiling.constructions import DiaphragmWall, Pile, Sheet
from geolib.models.dsheetpiling.constructions import DiaphragmWall, Pile, Sheet, VerticalBalance
from geolib.models.meta import CONSOLE_RUN_BATCH_FLAG
from geolib.soils import Soil

Expand Down Expand Up @@ -391,6 +391,18 @@ def set_construction(
top_level=top_level, elements=[element.to_internal() for element in elements]
)

def set_vertical_balance(self, vertical_balance: VerticalBalance) -> None:
"""Sets the vertical balance parameters

The parameters are set in [VERTICAL BALANCE]

Args:
vertical_balance: VerticalBalance, holds the vertical balance parameters
"""
self.datastructure.input_data.set_vertical_balance(
vertical_balance=vertical_balance.to_internal()
)

def add_load(
self,
load: Union[
Expand Down
15 changes: 9 additions & 6 deletions geolib/models/dsheetpiling/internal.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,11 @@ class SheetPiling(DSeriesStructureCollection):
lengthsheetpiling: Annotated[float, Field(gt=0)] = 10


class VerticalBalance(DSeriesInlineMappedProperties):
sheetpilingqcrep: Optional[Annotated[float, Field(ge=0)]] = 0.001
sheetpilingxi: Optional[Annotated[float, Field(ge=0.1)]] = 1.39


class Anchor(DSheetpilingTableEntry):
name: Annotated[str, StringConstraints(min_length=1, max_length=50)]
level: float = 0
Expand Down Expand Up @@ -712,12 +717,7 @@ class DSheetPilingInputStructure(DSeriesStructure):
)
sheet_piling: Union[str, SheetPiling] = SheetPiling()
combined_wall: str = ""
vertical_balance: str = cleandoc(
"""
SheetPilingQcRep=0.000
SheetPilingXi=1.39
"""
)
vertical_balance: VerticalBalance = VerticalBalance()
settlement_by_vibration_params: str = cleandoc(
"""
SheetPilingNumberOfPilesDrilled=2
Expand Down Expand Up @@ -1061,6 +1061,9 @@ def add_element_in_sheet_piling(
self.sheet_piling.sheetpiling.append(sheet)
self.sheet_piling.update_length_of_sheet_pile()

def set_vertical_balance(self, vertical_balance: VerticalBalance):
self.vertical_balance = vertical_balance

def add_anchor(self, stage_id: int, anchor: Anchor, pre_tension: float) -> None:
if not isinstance(self.anchors, Anchors):
self.anchors = Anchors()
Expand Down
3 changes: 2 additions & 1 deletion geolib/models/dsheetpiling/templates/input.shi.j2
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ WoodenSheetPilingElementKModE={{ element.woodensheetpilingelementkmode }}
[END OF COMBINED WALL]

[VERTICAL BALANCE]
{{ vertical_balance }}
SheetPilingQcRep={{ "%.3f"|format(vertical_balance.sheetpilingqcrep) }}
SheetPilingXi={{ "%.2f"|format(vertical_balance.sheetpilingxi) }}
[END OF VERTICAL BALANCE]

[SETTLEMENT BY VIBRATION PARAMS]
Expand Down
5 changes: 5 additions & 0 deletions tests/models/dsheetpiling/test_dsheetpiling_acceptance.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
SheetPileModelPlasticCalculationProperties,
SheetPileProperties,
WoodenSheetPileProperties,
VerticalBalance,
)
from geolib.models.dsheetpiling.dsheetpiling_model import (
DiaphragmModelType,
Expand Down Expand Up @@ -172,6 +173,10 @@ def test_run_sheet_model_acceptance_different_calculation_types(
top_level=level_top, elements=[sheet_element_1, sheet_element_2]
)

# Add vertical balance properties
vertical_balance = VerticalBalance(max_point_resistance=0.5, xi_factor=1.24)
model.set_vertical_balance(vertical_balance=vertical_balance)

# Add soil
# Set clay material
soil_clay = Soil(name="Clay", color=Color("green"))
Expand Down
13 changes: 13 additions & 0 deletions tests/models/dsheetpiling/test_dsheetpiling_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
PileProperties,
Sheet,
SheetPileProperties,
VerticalBalance,
)
from geolib.models.dsheetpiling.dsheetpiling_model import (
DiaphragmModelType,
Expand Down Expand Up @@ -872,3 +873,15 @@ def test_duplicate_loads(self, model: DSheetPilingModel):
error_message = "New SurchargeLoad load name is duplicated. Please change the name of the load."
with pytest.raises(ValueError, match=error_message):
model.add_surcharge_load(load=testload, side=Side.LEFT, stage_id=0)

@pytest.mark.unittest
def test_set_vertical_balance(self, model: DSheetPilingModel):
# Set up vertical balance
VirginieTrompille marked this conversation as resolved.
Show resolved Hide resolved
vertical_balance = VerticalBalance(max_point_resistance=1, xi_factor=2)

# Call the test function
model.set_vertical_balance(vertical_balance=vertical_balance)

# Assert
assert model.datastructure.input_data.vertical_balance.sheetpilingqcrep == 1
assert model.datastructure.input_data.vertical_balance.sheetpilingxi == 2