Skip to content

Commit

Permalink
fix: corrected berm width calculations (#114)
Browse files Browse the repository at this point in the history
* fix: corrected berm width calculations

* test: fix failing unittest
  • Loading branch information
ArdtK authored Oct 26, 2023
1 parent f7dbbcf commit 6410bab
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,21 @@ def _calculate_soil_binnen_berm_breedte(
new_data: KoswatInputProfileBase,
scenario: KoswatScenario,
) -> float:
_c1 = scenario.buiten_talud + new_data.binnen_talud
_c2 = old_data.kruin_hoogte + scenario.d_h
_c3 = old_data.buiten_talud + old_data.binnen_talud
_c4 = new_data.buiten_berm_breedte - old_data.buiten_berm_breedte
_c5 = _c3 * old_data.kruin_hoogte + old_data.kruin_breedte - _c4
_c6 = _c1 * _c2 + new_data.kruin_breedte - _c5
_c7 = old_data.binnen_berm_breedte + scenario.d_p - _c6
return max(_c7, 0)
_dikebase_old = (
(old_data.kruin_hoogte - old_data.buiten_maaiveld) * old_data.buiten_talud
+ old_data.buiten_berm_breedte
+ old_data.kruin_breedte
+ old_data.binnen_berm_breedte
+ (old_data.kruin_hoogte - old_data.binnen_maaiveld) * old_data.binnen_talud
)
_dikebase_new = (
(new_data.kruin_hoogte - new_data.buiten_maaiveld) * new_data.buiten_talud
+ new_data.buiten_berm_breedte
+ new_data.kruin_breedte
+ (new_data.kruin_hoogte - new_data.binnen_maaiveld) * new_data.binnen_talud
)
_berm = scenario.d_p - (_dikebase_new - _dikebase_old)
return max(_berm, 0)

def _calculate_length_piping_wall(self, soil_binnen_berm_breedte: float) -> float:
return (soil_binnen_berm_breedte / 6) + 1.5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,21 @@ def _calculate_new_binnen_berm_breedte(
new_data: KoswatInputProfileBase,
scenario: KoswatScenario,
) -> float:
_c1 = scenario.buiten_talud + new_data.binnen_talud
_c2 = old_data.kruin_hoogte - old_data.binnen_maaiveld + scenario.d_h
_c3 = old_data.buiten_talud + old_data.binnen_talud
_c4 = new_data.buiten_berm_breedte - old_data.buiten_berm_breedte
_c5 = (
_c3 * (old_data.kruin_hoogte - old_data.binnen_maaiveld)
_dikebase_old = (
(old_data.kruin_hoogte - old_data.buiten_maaiveld) * old_data.buiten_talud
+ old_data.buiten_berm_breedte
+ old_data.kruin_breedte
- _c4
+ old_data.binnen_berm_breedte
+ (old_data.kruin_hoogte - old_data.binnen_maaiveld) * old_data.binnen_talud
)
_c6 = _c1 * _c2 + new_data.kruin_breedte - _c5
_c7 = old_data.binnen_berm_breedte + scenario.d_p - _c6
return max(_c7, 0)
_dikebase_new = (
(new_data.kruin_hoogte - new_data.buiten_maaiveld) * new_data.buiten_talud
+ new_data.buiten_berm_breedte
+ new_data.kruin_breedte
+ (new_data.kruin_hoogte - new_data.binnen_maaiveld) * new_data.binnen_talud
)
_berm = scenario.d_p - (_dikebase_new - _dikebase_old)
return max(_berm, 0)

def _calculate_new_kruin_hoogte(
self, base_data: KoswatInputProfileBase, scenario: KoswatScenario
Expand All @@ -99,16 +102,16 @@ def _calculate_new_input_profile(
_new_data.buiten_talud = scenario.buiten_talud
_new_data.buiten_berm_hoogte = base_data.buiten_berm_hoogte
_new_data.buiten_berm_breedte = base_data.buiten_berm_breedte
_new_data.kruin_hoogte = self._calculate_new_kruin_hoogte(base_data, scenario)
_new_data.kruin_breedte = scenario.kruin_breedte
_new_data.binnen_maaiveld = base_data.binnen_maaiveld
_new_data.kruin_hoogte = self._calculate_new_kruin_hoogte(base_data, scenario)
_new_data.binnen_talud = self._calculate_new_binnen_talud(base_data, scenario)
_new_data.binnen_berm_breedte = self._calculate_new_binnen_berm_breedte(
base_data, _new_data, scenario
)
_new_data.binnen_berm_hoogte = self._calculate_new_binnen_berm_hoogte(
base_data, _new_data, scenario
)
_new_data.binnen_maaiveld = base_data.binnen_maaiveld
return _new_data

def build(self) -> SoilInputProfile:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,13 @@ def test_calculate_new_binnen_berm_breedte(self):
_old_profile.binnen_berm_breedte = 0
_old_profile.binnen_maaiveld = 0
_new_profile = KoswatInputProfileBase()
_new_profile.binnen_talud = 3.5714
_new_profile.buiten_maaiveld = 0
_new_profile.buiten_talud = 3
_new_profile.buiten_berm_breedte = 0
_new_profile.kruin_breedte = 5
_new_profile.kruin_hoogte = 7
_new_profile.binnen_talud = 3.5714
_new_profile.binnen_maaiveld = 0

# 2. Run test
_new_binnen_berm_breedte = (
Expand Down

0 comments on commit 6410bab

Please sign in to comment.