MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / BatteryState

Class BatteryState

examples/CAN Bus Example/ecu_simulator.py:166–178  ·  view source on GitHub ↗

Battery Management System state (for EV/Hybrid).

Source from the content-addressed store, hash-verified

164
165@dataclass
166class BatteryState:
167 """Battery Management System state (for EV/Hybrid)."""
168
169 pack_voltage: float = 400.0 # Total pack voltage V
170 pack_current: float = 0.0 # Pack current A (negative = charging)
171 soc: float = 80.0 # State of charge %
172 pack_temp: float = 25.0 # Average pack temperature °C
173 cell_voltages: List[float] = None # Individual cell voltages
174
175 def __post_init__(self):
176 if self.cell_voltages is None:
177 # Simulate 96 cells in series (typical EV)
178 self.cell_voltages = [4.1] * 8 # We'll send 8 sample cells
179
180
181@dataclass

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected