Getting Started¶
A five-minute walkthrough: install simses and run a simple charge/discharge cycle.
Prerequisites¶
- Python 3.12 or newer (required).
- pip or uv (recommended — faster installs and built-in virtualenv management).
Installation¶
Or with uv:
Quick import check:
from simses.model.cell.sony_lfp import SonyLFP
cell = SonyLFP() # 3 Ah, 3.2 V LFP cell (Sony/Murata US26650FTC1)
Your first simulation¶
Build a 13-series pack of SonyLFP cells starting at 50 % SOC, and discharge it at 50 W for 30 minutes.
from simses.battery import Battery
from simses.model.cell.sony_lfp import SonyLFP
battery = Battery(
cell=SonyLFP(),
circuit=(13, 1), # 13 serial, 1 parallel
initial_states={"start_soc": 0.5, "start_T": 25.0},
)
dt = 60 # seconds per step
for _ in range(30):
battery.step(-50.0, dt) # negative = discharging
s = battery.state
print(f"SOC: {s.soc:.3f}")
print(f"Terminal V: {s.v:.2f} V")
print(f"Current: {s.i:.2f} A")
print(f"Temperature: {s.T:.2f} °C")
print(f"Power: {s.power:.2f} W")
Expected output:
Sign convention
Positive power/current = charging. Negative = discharging. Applies uniformly across Battery, Converter, loss models, and every signed field of BatteryState. The -1.18 A above means the pack is actively delivering 1.18 A to the load during the last discharge step.
Common pitfalls¶
Things that catch newcomers
dtis in seconds. One minute isdt=60. Steps larger than a few minutes lose accuracy — power, SOC, and temperature dynamics need finer time resolution than that.- Sign. Passing
-5000while meaning "charge at 5 kW" will discharge the battery and pin it at the SOC floor. If the output surprises you, check the sign. - SOC pinned at a limit. If
state.socstays flat at1.0or0.0across consecutive steps, the setpoint is being rejected by the SOC hard limit — lower the power or widensoc_limits. initial_statesis required. Minimum:{"start_soc": ..., "start_T": ...}. Omitting it raisesTypeError.
What to read next¶
- Just learning the API → the full demo tutorial notebook.
- Running a study → the Concepts pages for understanding, then User Guides for applied recipes.
- Extending simses → one extension guide per subsystem: cells, converters, degradation, non-battery storage.