Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit d8529ac
Author: Ardt Klapwijk <[email protected]>
Date:   Mon Dec 16 15:38:54 2024 +0100

    test: update reference data

commit da17886
Merge: 5710c6f 2d92a4c
Author: Ardt Klapwijk <[email protected]>
Date:   Mon Dec 16 15:34:50 2024 +0100

    Merge branch 'master' into feat/181-extend-calculations-for-having-berm-as-part-of-input-profile

commit 5710c6f
Author: Peter de Grave <[email protected]>
Date:   Mon Dec 16 11:08:39 2024 +0100

    Added test cases to reproduce bugs #233 and #235

commit 5083940
Author: peterdgr <[email protected]>
Date:   Mon Dec 9 15:35:27 2024 +0100

    feat: 181 extend calculations for having berm as part of input profile

    Enhancements for stability wall input profile

commit 044f4d9
Author: peterdgr <[email protected]>
Date:   Mon Dec 9 15:34:56 2024 +0100

    feat: 181 extend calculations for having berm as part of input profile

    Use unbuild ground price for VPS

commit 78e5459
Author: peterdgr <[email protected]>
Date:   Mon Dec 9 15:34:23 2024 +0100

    feat: 181 extend calculations for having berm as part of input profile

    Include dikesection names in export

commit 850914a
Author: peterdgr <[email protected]>
Date:   Mon Dec 9 15:33:19 2024 +0100

    feat: 181 extend calculations for having berm as part of input profile

    Prevent error at export of shapefile

commit f393ff4
Merge: e60ed60 3ab9c75
Author: Ardt Klapwijk <[email protected]>
Date:   Wed Nov 13 11:36:15 2024 +0100

    Merge branch 'master' into feat/181-extend-calculations-for-having-berm-as-part-of-input-profile

commit e60ed60
Merge: 356764e 5450a2c
Author: Ardt Klapwijk <[email protected]>
Date:   Wed Nov 13 10:56:49 2024 +0100

    Merge branch 'master' into feat/181-extend-calculations-for-having-berm-as-part-of-input-profile

commit 356764e
Merge: fbbe933 d942e77
Author: Carles S. Soriano Pérez <[email protected]>
Date:   Mon Nov 11 11:44:57 2024 +0100

    Merge branch 'master' into feat/181-extend-calculations-for-having-berm-as-part-of-input-profile

commit fbbe933
Merge: 93e31c3 b05ad5e
Author: Carles S. Soriano Pérez <[email protected]>
Date:   Mon Nov 11 09:22:17 2024 +0100

    Merge branch 'master' into feat/181-extend-calculations-for-having-berm-as-part-of-input-profile

commit 93e31c3
Author: Carles S. Soriano Pérez <[email protected]>
Date:   Fri Nov 8 12:48:03 2024 +0100

    fix: 220 last row error in strategy buffering and clustering

commit 2469306
Author: Ardt Klapwijk <[email protected]>
Date:   Wed Nov 6 15:06:22 2024 +0100

    chore: fix cofferdam bug

commit 68991a7
Author: Ardt Klapwijk <[email protected]>
Date:   Wed Nov 6 14:57:28 2024 +0100

    chore: fix vps bug

commit c367b7e
Author: Ardt Klapwijk <[email protected]>
Date:   Wed Nov 6 14:49:02 2024 +0100

    chore: fix bugs

commit 36c3e42
Merge: 56816c8 b672c7b
Author: Ardt Klapwijk <[email protected]>
Date:   Wed Nov 6 12:25:29 2024 +0100

    Merge branch 'master' into feat/181-extend-calculations-for-having-berm-as-part-of-input-profile

commit 56816c8
Author: peterdgr <[email protected]>
Date:   Wed Nov 6 11:11:28 2024 +0100

    feat: 181 extend calculations for having berm as part of input profile

    Update scenario cases and base profiles

commit 16b8dda
Author: peterdgr <[email protected]>
Date:   Fri Nov 1 09:49:47 2024 +0100

    feat: 181 extend calculations for having berm as part of input profile

    Extend calculations for having berm as part of input profile. Added stability Wall and CofferDam.

commit accfc5b
Author: peterdgr <[email protected]>
Date:   Wed Oct 30 17:53:24 2024 +0100

    feat: 181 extend calculations for having berm as part of input profile

    Improve input profile calculations to accommodate dikes with existing berms at polderside
  • Loading branch information
Carsopre committed Dec 17, 2024
1 parent 2d92a4c commit 636c036
Show file tree
Hide file tree
Showing 181 changed files with 1,108 additions and 517 deletions.
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

0 comments on commit 636c036

Please sign in to comment.