diff --git a/geolib/models/dsheetpiling/constructions.py b/geolib/models/dsheetpiling/constructions.py index d64138a3..46efb793 100644 --- a/geolib/models/dsheetpiling/constructions.py +++ b/geolib/models/dsheetpiling/constructions.py @@ -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 from geolib.models.dsheetpiling.settings import SheetPilingElementMaterialType @@ -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, + ) diff --git a/geolib/models/dsheetpiling/dsheetpiling_model.py b/geolib/models/dsheetpiling/dsheetpiling_model.py index b6effe2a..f5aafe0b 100644 --- a/geolib/models/dsheetpiling/dsheetpiling_model.py +++ b/geolib/models/dsheetpiling/dsheetpiling_model.py @@ -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 @@ -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[ diff --git a/geolib/models/dsheetpiling/internal.py b/geolib/models/dsheetpiling/internal.py index 598098a6..f8378fc8 100644 --- a/geolib/models/dsheetpiling/internal.py +++ b/geolib/models/dsheetpiling/internal.py @@ -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 @@ -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 @@ -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() diff --git a/geolib/models/dsheetpiling/templates/input.shi.j2 b/geolib/models/dsheetpiling/templates/input.shi.j2 index 42c55fd6..e9df118d 100644 --- a/geolib/models/dsheetpiling/templates/input.shi.j2 +++ b/geolib/models/dsheetpiling/templates/input.shi.j2 @@ -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] diff --git a/tests/models/dsheetpiling/test_dsheetpiling_acceptance.py b/tests/models/dsheetpiling/test_dsheetpiling_acceptance.py index e0ebf57f..99b604fe 100644 --- a/tests/models/dsheetpiling/test_dsheetpiling_acceptance.py +++ b/tests/models/dsheetpiling/test_dsheetpiling_acceptance.py @@ -24,6 +24,7 @@ SheetPileModelPlasticCalculationProperties, SheetPileProperties, WoodenSheetPileProperties, + VerticalBalance, ) from geolib.models.dsheetpiling.dsheetpiling_model import ( DiaphragmModelType, @@ -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")) diff --git a/tests/models/dsheetpiling/test_dsheetpiling_model.py b/tests/models/dsheetpiling/test_dsheetpiling_model.py index a6b964e5..2b422616 100644 --- a/tests/models/dsheetpiling/test_dsheetpiling_model.py +++ b/tests/models/dsheetpiling/test_dsheetpiling_model.py @@ -15,6 +15,7 @@ PileProperties, Sheet, SheetPileProperties, + VerticalBalance, ) from geolib.models.dsheetpiling.dsheetpiling_model import ( DiaphragmModelType, @@ -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 + 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