Skip to content

Commit eb29555

Browse files
committed
Add pathsim-batt to docs
1 parent 54effbd commit eb29555

6 files changed

Lines changed: 121 additions & 2 deletions

File tree

scripts/lib/config.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,18 @@
3737
"pathsim_chem",
3838
],
3939
},
40+
"batt": {
41+
"repo": ROOT_DIR / "pathsim-batt",
42+
"source": ROOT_DIR / "pathsim-batt" / "src",
43+
"notebooks": ROOT_DIR / "pathsim-batt" / "docs" / "source" / "examples",
44+
"figures": ROOT_DIR / "pathsim-batt" / "docs" / "source" / "examples" / "figures",
45+
"display_name": "PathSim-Batt",
46+
"griffe_package": "pathsim_batt",
47+
"github_repo": "pathsim/pathsim-batt",
48+
"root_modules": [
49+
"pathsim_batt",
50+
],
51+
},
4052
"vehicle": {
4153
"repo": ROOT_DIR / "pathsim-vehicle",
4254
"source": ROOT_DIR / "pathsim-vehicle" / "src",
@@ -80,6 +92,7 @@
8092
MIN_SUPPORTED_VERSIONS = {
8193
"pathsim": "0.7",
8294
"chem": "0.1",
95+
"batt": "0.1",
8396
"vehicle": "0.1",
8497
"flight": "0.1",
8598
"rf": "0.1",

src/lib/config/packages.ts

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export const external = {
1111
consulting: 'https://milanrother.com/#services'
1212
};
1313

14-
export type PackageId = 'pathsim' | 'chem' | 'vehicle' | 'flight' | 'rf';
14+
export type PackageId = 'pathsim' | 'chem' | 'batt' | 'vehicle' | 'flight' | 'rf';
1515

1616
export interface Feature {
1717
title: string;
@@ -190,6 +190,56 @@ scope.plot()`,
190190
{ pip: 'pathsim-chem', import: 'pathsim_chem', pre: true }
191191
]
192192
},
193+
batt: {
194+
id: 'batt',
195+
name: 'PathSim-Batt',
196+
shortName: 'batt',
197+
description: 'Battery cell blocks with PyBaMM integration for coupled electrothermal simulation.',
198+
logo: 'pathsim_batt_logo.png',
199+
docs: 'batt',
200+
api: 'batt/api',
201+
examples: null,
202+
pypi: `${external.pypi}/pathsim-batt`,
203+
conda: null,
204+
github: `${external.github}/pathsim-batt`,
205+
features: [
206+
{ title: 'PyBaMM Backend', description: 'Wraps SPM and SPMe lithium-ion models behind the PathSim block interface' },
207+
{ title: 'Electrothermal Coupling', description: 'CellElectrothermal integrates electrical and thermal dynamics in one block' },
208+
{ title: 'External Thermal', description: 'CellElectrical + LumpedThermal for multi-cell packs and custom cooling models' },
209+
{ title: 'Parameter Sets', description: 'Use any PyBaMM ParameterValues — defaults to Chen2020' }
210+
],
211+
installation: [
212+
{ name: 'pip', command: 'pip install pathsim-batt' }
213+
],
214+
quickstart: {
215+
description: 'PathSim-Batt cell blocks plug into PathSim simulations. Drive the cell with a current source and observe terminal voltage.',
216+
code: `from pathsim import Simulation, Connection
217+
from pathsim.blocks import Source, Scope
218+
from pathsim_batt import CellElectrothermal
219+
220+
# Default Chen2020 parameter set, SPMe model
221+
cell = CellElectrothermal(initial_soc=0.8)
222+
223+
# Constant 2 A discharge
224+
i_src = Source(func=lambda t: 2.0)
225+
scope = Scope()
226+
227+
sim = Simulation(
228+
[i_src, cell, scope],
229+
[Connection(i_src, cell), Connection(cell, scope)]
230+
)
231+
sim.run(1800)
232+
scope.plot()`,
233+
title: 'Example'
234+
},
235+
apiModules: [
236+
{ name: 'pathsim_batt', description: 'Cell blocks (CellElectrothermal, CellElectrical, LumpedThermal)' }
237+
],
238+
pyodidePackages: [
239+
{ pip: 'pathsim', import: 'pathsim', pre: true },
240+
{ pip: 'pathsim-batt', import: 'pathsim_batt', pre: true }
241+
]
242+
},
193243
vehicle: {
194244
id: 'vehicle',
195245
name: 'PathSim-Vehicle',
@@ -274,7 +324,7 @@ scope.plot()`,
274324
};
275325

276326
// Ordered list for tabs/navigation
277-
export const packageOrder: PackageId[] = ['pathsim', 'chem', 'vehicle', 'flight', 'rf'];
327+
export const packageOrder: PackageId[] = ['pathsim', 'chem', 'batt', 'vehicle', 'flight', 'rf'];
278328

279329
// Sidebar navigation (auto-generated from package config)
280330
export interface SidebarItem {

src/routes/batt/+layout.svelte

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<script lang="ts">
2+
import { DocLayout } from '$lib/components/layout';
3+
import type { Snippet } from 'svelte';
4+
import type { LayoutData } from './$types';
5+
6+
interface Props {
7+
data: LayoutData;
8+
children: Snippet;
9+
}
10+
11+
let { data, children }: Props = $props();
12+
</script>
13+
14+
<DocLayout packageId="batt" manifest={data.manifest} currentTag={data.selectedTag}>
15+
{@render children()}
16+
</DocLayout>

src/routes/batt/+layout.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import type { LayoutLoad } from './$types';
2+
import { getPackageManifest } from '$lib/api/versions';
3+
import { versionStore } from '$lib/stores/versionStore';
4+
5+
const PACKAGE_ID = 'batt';
6+
7+
/**
8+
* Load manifest for the batt package overview.
9+
* This allows the version selector to appear in the sidebar.
10+
*/
11+
export const load: LayoutLoad = async ({ fetch }) => {
12+
try {
13+
const manifest = await getPackageManifest(PACKAGE_ID, fetch);
14+
15+
// Get stored version or use latest
16+
const storedVersion = versionStore.getVersionSync(PACKAGE_ID);
17+
const selectedTag = storedVersion || manifest.latestTag;
18+
19+
return {
20+
packageId: PACKAGE_ID,
21+
manifest,
22+
selectedTag
23+
};
24+
} catch (e) {
25+
// Manifest not available, continue without version selector
26+
return {
27+
packageId: PACKAGE_ID,
28+
manifest: undefined,
29+
selectedTag: undefined
30+
};
31+
}
32+
};

src/routes/batt/+page.svelte

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<script lang="ts">
2+
import { PackageOverview } from '$lib/components/pages';
3+
import type { PageData } from './$types';
4+
5+
let { data }: { data: PageData } = $props();
6+
</script>
7+
8+
<PackageOverview packageId="batt" manifest={data.manifest} selectedTag={data.selectedTag} />

static/pathsim_batt_logo.png

17.1 KB
Loading

0 commit comments

Comments
 (0)