Skip to content
Merged
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
7 changes: 6 additions & 1 deletion pythrust/battery/rate_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,12 @@ def _point_from_cell_state(

@staticmethod
def _clip_dod(dod: float) -> float:
return min(1.0, max(0.0, float(dod)))
clipped = min(1.0, max(0.0, float(dod)))
if math.isclose(clipped, 0.0, rel_tol=0.0, abs_tol=1e-12):
return 0.0
if math.isclose(clipped, 1.0, rel_tol=0.0, abs_tol=1e-12):
return 1.0
return clipped

def _reversible_energy_wh(self, dod_initial: float, dod_final: float, *, samples: int) -> float:
dod_values = np.linspace(dod_initial, dod_final, samples)
Expand Down
Loading