Skip to main content

RTBM (Real-Time Battery Modeling)

RTBM is a minimal Altergo-integrated project that demonstrates how to bootstrap a battery modeling system using Altergo settings and process local CSV data, then run via entrypoint.py.

What's in this repo

  • entrypoint.py — starts the app, wires Altergo SDK, reads data/power-profile.csv with pandas, and runs the RTBM model.
  • altergo-settings.json — declares the app name, entrypoint, type, category, and custom parameters for Altergo.
  • dev-parameters.json — local development credentials for Altergo APIs and target asset.
  • requirements.txt — dependencies (Altergo SDK + numpy/scipy/pandas/plotly).
  • data/ — expected folder for local CSV data (e.g., power-profile.csv).
  • models/rtbm/ — the RTBM model implementation and documentation.
  • simspec.json — battery specification file defining cell parameters, thermal properties, and pack architecture.

Prerequisites

  • Python 3.10+ (3.12 tested)
  • Git
  • Altergo access (API key, factory/IoT URLs) and an asset ID

Setup

Install dependencies:

pip install -r requirements.txt

Configure development credentials by editing dev-parameters.json:

{
"altergoFactoryApi": "https://demo.altergo.io",
"altergoIotApi": "https://demo.altergo.io",
"altergoUserApiKey": "<YOUR_API_KEY>",
"assetId": "<YOUR_ASSET_ID>"
}

Note: dev-parameters.json is for local runs; do not commit real secrets.

Altergo settings at runtime

RTBM uses altergo-settings.json to define app metadata and parameters and extract_altergo_parameters to load them at runtime. The entrypoint.py flow:

from altergo_sdk.api.altergo_api import Client
from altergo_sdk.tools.utils import extract_altergo_parameters
import pandas as pd

altergoArguments = extract_altergo_parameters()
altergoClient = Client(functionArguments=altergoArguments)
appParameters = altergoArguments['configurationValues']

df = pd.read_csv('data/power-profile.csv')
# Process data with RTBM model

Data

Place a CSV at data/power-profile.csv. The file will be loaded with pandas and processed by the RTBM model.

If the file is missing, create the folder and add a CSV with the following expected columns:

timestamp,current,voltage
2025-01-01T00:00:00Z,1.2,3.7
2025-01-01T00:01:00Z,1.3,3.69

The RTBM model can work with power profiles, current/voltage pairs, or power directly. See models/rtbm/README.md for detailed input requirements and preprocessing steps.

Model Documentation

For detailed information about the RTBM model, including:

  • Simulation specifications (simspec.json)
  • Data preprocessing steps
  • Configuration parameters
  • Battery state machine
  • Digital twin sensors

Please refer to models/rtbm/README.md.

Run

From the repo root:

python entrypoint.py

This will:

  • Load Altergo parameters (including config values) via the SDK
  • Initialize the Altergo client
  • Read data/power-profile.csv with pandas
  • Process the data through the RTBM model
  • Return simulation results

License / Support

Internal project. For Altergo SDK access or platform questions, contact your Altergo admin/support.