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

Feat/181 extend calculations for having berm as part of input profile #218

Draft
wants to merge 12 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
182 changes: 182 additions & 0 deletions koswat.log

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ class KoswatSoilSettings(KoswatConfigProtocol):

soil_surtax_factor: SurtaxFactorEnum = SurtaxFactorEnum.NORMAAL
land_purchase_surtax_factor: SurtaxFactorEnum = SurtaxFactorEnum.NORMAAL
min_berm_height: float = 0
max_berm_height_factor: float = 0
factor_increase_berm_height: float = 0
min_berm_height: float = 0.5
max_berm_height_factor: float = 0.4
factor_increase_berm_height: float = 0.05

def is_valid(self) -> bool:
return True
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
from koswat.configuration.settings.reinforcements.koswat_reinforcement_settings import (
KoswatReinforcementSettings,
)
from koswat.configuration.settings.reinforcements.koswat_soil_settings import (
KoswatSoilSettings,
)
from koswat.dike.koswat_input_profile_protocol import KoswatInputProfileProtocol
from koswat.dike.koswat_profile_protocol import KoswatProfileProtocol
from koswat.dike.profile.koswat_input_profile_base import KoswatInputProfileBase
Expand All @@ -32,64 +35,54 @@ def __init__(self) -> None:
self.base_profile = None
self.scenario = None

def _calculate_new_crest_height(
def _calculate_new_waterside_slope(
self, base_data: KoswatInputProfileBase, scenario: KoswatScenario
) -> float:
return base_data.crest_height + scenario.d_h
_operand = (
base_data.crest_height - base_data.waterside_ground_level
) * base_data.waterside_slope
_dividend = (
base_data.crest_height - base_data.waterside_ground_level + scenario.d_h
)
return _operand / _dividend

def _calculate_new_polderside_slope(
def _calculate_new_polderside_berm_height(
self, base_data: KoswatInputProfileBase, scenario: KoswatScenario
) -> float:
"""
( Kruin_Breedte_Oud
+ (Kruin_Hoogte_Oud-Binnen_Maaiveld_Oud)
*Binnen_Talud_Oud-Kruin_Breedte_Nieuw)
/(Kruin_Hoogte_Oud+dH)
"""
_mid_operand = base_data.polderside_slope * (
base_data.crest_height - base_data.polderside_ground_level
_dike_height_old = base_data.crest_height - base_data.polderside_ground_level
_berm_height_old = (
base_data.polderside_berm_height - base_data.polderside_ground_level
)
_operand = base_data.crest_width + _mid_operand - scenario.crest_width
_dividend = (
base_data.crest_height - base_data.polderside_ground_level + scenario.d_h
)
return _operand / _dividend
_berm_factor_old = _berm_height_old / _dike_height_old
return base_data.polderside_berm_height + _berm_factor_old * scenario.d_h

def _calculate_new_waterside_slope(
def _calculate_new_polderside_slope(
self, base_data: KoswatInputProfileBase, scenario: KoswatScenario
) -> float:
"""
Kruin_Hoogte_Oud*Buiten_Talud_Oud
/(Kruin_Hoogte_Oud+dH)
"""
_operand = (
base_data.crest_height - base_data.waterside_ground_level
) * base_data.waterside_slope
base_data.crest_height - base_data.polderside_ground_level
) * base_data.polderside_slope
_dividend = (
base_data.crest_height - base_data.waterside_ground_level + scenario.d_h
base_data.crest_height - base_data.polderside_ground_level + scenario.d_h
)
return _operand / _dividend

def _calculate_length_cofferdam(
self,
old_data: KoswatInputProfileProtocol,
cofferdam_settings: KoswatCofferdamSettings,
soil_polderside_berm_width: float,
seepage_length: float,
new_crest_height: float,
) -> float:
"""
Identical to calculation of Stability wall
"""
if soil_polderside_berm_width == 0:
_length_stability = (new_crest_height - 0.5) - (old_data.pleistocene - 1)
if seepage_length == 0:
# Length of wall is not determined by piping.
_length_piping = 0.0
else:
_length_piping = (
(soil_polderside_berm_width / 6)
+ (new_crest_height - 0.5)
- old_data.aquifer
(seepage_length / 6) + (new_crest_height - 0.5) - old_data.aquifer
)
_length_stability = (new_crest_height - 0.5) - (old_data.pleistocene - 1)

return round(
min(
max(
Expand All @@ -114,42 +107,49 @@ def _determine_construction_type(
def _calculate_new_input_profile(
self,
base_data: KoswatInputProfileBase,
soil_settings: KoswatSoilSettings,
cofferdam_settings: KoswatCofferdamSettings,
scenario: KoswatScenario,
) -> CofferDamInputProfile:
_new_data = CofferDamInputProfile()
_new_data.dike_section = base_data.dike_section
_new_data.waterside_ground_level = base_data.waterside_ground_level
_new_data.waterside_berm_width = (
base_data.waterside_berm_width
) # maintain current berm waterside
_new_data.waterside_berm_height = (
self._calculate_soil_new_waterside_berm_height(base_data, scenario)
)
_new_data.waterside_slope = self._calculate_new_waterside_slope(
base_data, scenario
)
_new_data.waterside_berm_height = base_data.waterside_berm_height
_new_data.waterside_berm_width = base_data.waterside_berm_width
_new_data.crest_height = self._calculate_new_crest_height(base_data, scenario)
_new_data.crest_width = scenario.crest_width
_new_data.polderside_slope = self._calculate_new_polderside_slope(
_new_data.crest_height = self._calculate_soil_new_crest_height(
base_data, scenario
)
_new_data.polderside_berm_width = 0
_new_data.polderside_berm_height = base_data.polderside_ground_level
_new_data.crest_width = base_data.crest_width # no widening of crest allowed
_new_data.polderside_ground_level = base_data.polderside_ground_level
_soil_polderside_berm_width = self._calculate_soil_polderside_berm_width(
base_data, _new_data, scenario
_new_data.polderside_berm_width = (
base_data.polderside_berm_width
) # maintain current berm polderside
_new_data.polderside_berm_height = self._calculate_new_polderside_berm_height(
base_data, scenario
)
_new_data.ground_price_builtup = base_data.ground_price_builtup
_new_data.ground_price_unbuilt = base_data.ground_price_unbuilt
_new_data.factor_settlement = base_data.factor_settlement
_new_data.pleistocene = base_data.pleistocene
_new_data.aquifer = base_data.aquifer
_new_data.polderside_slope = self._calculate_new_polderside_slope(
base_data, scenario
)

_seepage_length = scenario.d_p
_new_data.construction_length = self._calculate_length_cofferdam(
base_data,
cofferdam_settings,
_soil_polderside_berm_width,
_new_data.crest_height,
base_data, cofferdam_settings, _seepage_length, _new_data.crest_height
)
_new_data.construction_type = self._determine_construction_type(
_new_data.construction_length
)
_new_data.ground_price_builtup = base_data.ground_price_builtup
_new_data.ground_price_unbuilt = base_data.ground_price_unbuilt
_new_data.factor_settlement = base_data.factor_settlement
_new_data.pleistocene = base_data.pleistocene
_new_data.aquifer = base_data.aquifer
_new_data.soil_surtax_factor = cofferdam_settings.soil_surtax_factor
_new_data.constructive_surtax_factor = (
cofferdam_settings.constructive_surtax_factor
Expand All @@ -160,6 +160,7 @@ def _calculate_new_input_profile(
def build(self) -> CofferDamInputProfile:
return self._calculate_new_input_profile(
self.base_profile.input_data,
self.reinforcement_settings.soil_settings,
self.reinforcement_settings.cofferdam_settings,
self.scenario,
)
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
from koswat.configuration.settings.reinforcements.koswat_reinforcement_settings import (
KoswatReinforcementSettings,
)
from koswat.configuration.settings.reinforcements.koswat_soil_settings import (
KoswatSoilSettings,
)
from koswat.dike.koswat_profile_protocol import KoswatProfileProtocol
from koswat.dike.profile.koswat_input_profile_base import KoswatInputProfileBase
from koswat.dike_reinforcements.input_profile.piping_wall.piping_wall_input_profile import (
Expand Down Expand Up @@ -35,13 +38,13 @@ def _calculate_length_piping_wall(
self,
old_data: KoswatInputProfileBase,
piping_wall_settings: KoswatPipingWallSettings,
soil_polderside_berm_width: float,
seepage_length: float,
) -> float:
if soil_polderside_berm_width == 0:
if seepage_length == 0:
# No wall is needed.
return 0
_length_piping = (
(soil_polderside_berm_width / 6)
(seepage_length / 6)
+ (old_data.polderside_ground_level - old_data.aquifer)
+ 1
)
Expand All @@ -56,37 +59,6 @@ def _calculate_length_piping_wall(
1,
)

def _calculate_new_crest_height(
self, base_data: KoswatInputProfileBase, scenario: KoswatScenario
) -> float:
return base_data.crest_height + scenario.d_h

def _calculate_new_polderside_slope(
self, base_data: KoswatInputProfileBase, scenario: KoswatScenario
) -> float:
"""
MAX(
Binnen_Talud_Oud,
(
dS
-dH*Buiten_Talud_Nieuw
-(Kruin_Breedte_Nieuw-Kruin_Breedte_Oud)
+(Kruin_Hoogte_Oud-Binnen_Maaiveld_Oud)*Binnen_Talud_Oud)
/(Kruin_Hoogte_Oud-Binnen_Maaiveld_Oud+dH))
"""
_first_part = scenario.d_h * scenario.waterside_slope
_second_part = scenario.crest_width - base_data.crest_width
_third_parth = (
base_data.crest_height - base_data.polderside_ground_level
) * base_data.polderside_slope
_dividend = (
base_data.crest_height - base_data.polderside_ground_level + scenario.d_h
)
_right_side = (
scenario.d_s - _first_part - _second_part + _third_parth
) / _dividend
return max(base_data.polderside_slope, _right_side)

def _determine_construction_type(
self, overgang: float, construction_length: float
) -> ConstructionTypeEnum | None:
Expand All @@ -100,33 +72,118 @@ def _determine_construction_type(
def _calculate_new_input_profile(
self,
base_data: KoswatInputProfileBase,
soil_settings: KoswatSoilSettings,
piping_wall_settings: KoswatPipingWallSettings,
scenario: KoswatScenario,
) -> PipingWallInputProfile:
_new_data = PipingWallInputProfile()
_new_data.dike_section = base_data.dike_section
_new_data.waterside_ground_level = base_data.waterside_ground_level
_new_data.polderside_ground_level = base_data.polderside_ground_level
_new_data.waterside_slope = scenario.waterside_slope
_new_data.waterside_berm_height = base_data.waterside_berm_height
_new_data.waterside_berm_height = (
self._calculate_soil_new_waterside_berm_height(base_data, scenario)
)
_new_data.waterside_berm_width = base_data.waterside_berm_width
_new_data.crest_height = self._calculate_new_crest_height(base_data, scenario)
_new_data.crest_width = scenario.crest_width
_new_data.polderside_slope = self._calculate_new_polderside_slope(
_new_data.crest_height = self._calculate_soil_new_crest_height(
base_data, scenario
)
_new_data.polderside_berm_height = base_data.polderside_ground_level
_new_data.polderside_berm_width = 0
_new_data.polderside_ground_level = base_data.polderside_ground_level
_soil_polderside_berm_width = self._calculate_soil_polderside_berm_width(
base_data, _new_data, scenario
_new_data.crest_width = scenario.crest_width

_dike_height_old = base_data.crest_height - base_data.polderside_ground_level
_berm_height_old = (
base_data.polderside_berm_height - base_data.polderside_ground_level
)
_berm_factor_old = _berm_height_old / _dike_height_old

if _berm_factor_old > soil_settings.max_berm_height_factor:
_berm_old_is_stability = True
else:
_berm_old_is_stability = False

_dikebase_stability_old = (
base_data.crest_width
+ _dike_height_old * base_data.polderside_slope
+ _berm_old_is_stability * base_data.polderside_berm_width
)
_dikebase_piping_old = (
base_data.crest_width
+ _dike_height_old * base_data.polderside_slope
+ base_data.polderside_berm_width
)

_dike_height_new = _new_data.crest_height - _new_data.polderside_ground_level
_dikebase_heigth_new = (
scenario.d_h * _new_data.waterside_slope
+ _new_data.crest_width
+ _dike_height_new * base_data.polderside_slope
)
_dikebase_stability_new = _dikebase_stability_old + scenario.d_s
_dikebase_piping_new = max(
_dikebase_piping_old, _dikebase_heigth_new, _dikebase_stability_new
)
_dikebase_piping_needed = _dikebase_piping_old + scenario.d_p
_seepage_length = max(_dikebase_piping_needed - _dikebase_piping_new, 0)

# Is a berm for piping neccesary --> Maybe there was an old one??
if _dikebase_piping_new > max(_dikebase_heigth_new, _dikebase_stability_new):
_new_data.polderside_berm_width = _dikebase_piping_new - max(
_dikebase_heigth_new, _dikebase_stability_new
)
_new_data.polderside_slope = self._calculate_soil_new_polderside_slope(
base_data, scenario, _dikebase_heigth_new, _dikebase_stability_new
)
# extend existing berm?
if base_data.polderside_berm_width > 0 and _dikebase_piping_old > max(
_dikebase_heigth_new, _dikebase_stability_new
):
_new_data.polderside_berm_height = (
self._calculate_soil_new_polderside_berm_height_piping(
base_data, _new_data, scenario, soil_settings, True
)
)
else:
_new_data.polderside_berm_height = (
self._calculate_soil_new_polderside_berm_height_piping(
base_data, _new_data, scenario, soil_settings, False
)
)
else:
# Is measure for stability neccesary?
if _dikebase_stability_new > _dikebase_heigth_new:
# in case of existing stab berm
if _berm_old_is_stability:
_new_data.polderside_berm_width = (
_dikebase_stability_new - _dikebase_heigth_new
)
_new_data.polderside_berm_height = (
_berm_factor_old * _dike_height_new
+ _new_data.polderside_ground_level
)
_new_data.polderside_slope = base_data.polderside_slope
else:
_new_data.polderside_berm_width = 0
_new_data.polderside_berm_height = base_data.polderside_ground_level
_new_data.polderside_slope = (
self._calculate_soil_new_polderside_slope(
base_data,
scenario,
_dikebase_heigth_new,
_dikebase_stability_new,
)
)
else:
_new_data.polderside_berm_width = 0
_new_data.polderside_berm_height = base_data.polderside_ground_level
_new_data.polderside_slope = base_data.polderside_slope

_new_data.ground_price_builtup = base_data.ground_price_builtup
_new_data.ground_price_unbuilt = base_data.ground_price_unbuilt
_new_data.factor_settlement = base_data.factor_settlement
_new_data.pleistocene = base_data.pleistocene
_new_data.aquifer = base_data.aquifer
_new_data.construction_length = self._calculate_length_piping_wall(
base_data, piping_wall_settings, _soil_polderside_berm_width
base_data, piping_wall_settings, _seepage_length
)
_new_data.construction_type = self._determine_construction_type(
piping_wall_settings.transition_cbwall_sheetpile,
Expand All @@ -144,6 +201,7 @@ def _calculate_new_input_profile(
def build(self) -> PipingWallInputProfile:
return self._calculate_new_input_profile(
self.base_profile.input_data,
self.reinforcement_settings.soil_settings,
self.reinforcement_settings.piping_wall_settings,
self.scenario,
)
Loading