Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce a first draft for system-level metadata #106

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions battdat/schemas/common.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
"""Schemas used in multiple places"""
from typing import Literal

from pydantic import BaseModel, Field

class Dimensions(BaseModel):
"""Dimensions of a physical object"""

shape: str = Field(..., description='Overall shape of an object')
units: str = Field(..., description='Units for all dimensions')



class Cylinder(Dimensions):
"""Dimensions of a cylindrical object"""
shape: Literal['cylinder'] = 'cylinder'
radius: float = Field(..., description='Radius of the base')
height: float = Field(..., description='Length of the cylinder')


class RectangularPrism(Dimensions):
"""Dimensions of a cylindrical object"""
shape: Literal['rectangular'] = 'rectangular'
length: float = Field(..., description='Length of one axis')
width: float = Field(..., description='Radius of the base')
height: float = Field(..., description='Length of the cylinder')
35 changes: 35 additions & 0 deletions battdat/schemas/system.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
"""Metadata describing a battery system"""
from typing import Optional

from pydantic import BaseModel, Field

from .battery import BatteryDescription
from .common import Dimensions


class SystemDescription(BaseModel, allow_extras=True):
"""Metadata for a battery system which includes multiple racks of modules"""

# High-level description of the system
name: str = Field(..., description="Simple description of the battery")
rated_power: Optional[float] = Field(..., description="Nameplate power of the system (units: kVA)")
rated_energy: Optional[float] = Field(..., description="Nameplate power of the system (units: kWh)")

# Operation limits for the system
operating_temperature_min: Optional[float] = Field(..., description='Minimum suggested operation temperature. (units: C)')
operating_temperature_max: Optional[float] = Field(..., description='Maximum suggested operation temperature. (units: C)')
soc_limit_min: Optional[float] = Field(..., description='Minimum suggested state of charge. (units: %)')
soc_limit_max: Optional[float] = Field(..., description='Maximum suggested state of charge. (units: %)')


class PowerConversionSpecification(BaseModel, allow_extras=True):
"""Specification of the Power Conversion System Between Battery and external grid"""

pass


class RackSpecification(BaseModel, allow_extras=True):
cell_spec: BatteryDescription = Field(default_factory=BatteryDescription,
description='Description of individual cells within the assembly')

dimensions: Optional[Dimensions] = Field(description='Physical extent of the rack')
Loading