From c243f2d6c33fe66a3d8c10d5d600944034922c13 Mon Sep 17 00:00:00 2001 From: Devdutt Shenoi Date: Thu, 16 Nov 2023 09:13:46 +0530 Subject: [PATCH] feat: add health penalty for driving too fast --- uplink/src/collector/simulator/data/driver.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/uplink/src/collector/simulator/data/driver.rs b/uplink/src/collector/simulator/data/driver.rs index d73eb73dc..dcf6bd497 100644 --- a/uplink/src/collector/simulator/data/driver.rs +++ b/uplink/src/collector/simulator/data/driver.rs @@ -74,7 +74,11 @@ impl ElectricVehicle { self.state = "Running".to_string(); if self.soc < 0.2 { - self.soh -= HEALTH_PENALTY; // penalty for driving on low battery + self.soh -= HEALTH_PENALTY * TIME_PERIOD; // penalty for driving on low battery + } + + if self.speed < 65.0 { + self.soh -= HEALTH_PENALTY * TIME_PERIOD; // penalty for driving too fast } }