Skip to content
This repository has been archived by the owner on Oct 18, 2022. It is now read-only.

Commit

Permalink
adds profile schema
Browse files Browse the repository at this point in the history
  • Loading branch information
rithviknishad committed Jul 17, 2022
1 parent 053a782 commit b0472bd
Show file tree
Hide file tree
Showing 2 changed files with 106 additions and 0 deletions.
80 changes: 80 additions & 0 deletions profile_schema.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
from dataclasses import dataclass
from datetime import time


@dataclass
class Location:
latitude: float
longitude: float


@dataclass
class Base:
vp_address: str
category: str


@dataclass
class Streetlight(Base):
@dataclass
class CategoryMeta:
type: str
control_api_endpoint: bool
fixture_installed_power: float
pv_capacity: float
storage_capacity: float
on_time: time
off_time: time

locations: list[Location]
category_meta: CategoryMeta

@classmethod
def fromJson(cls, json: dict[str, any]):
meta = cls.CategoryMeta(**json.pop("category_meta"))
return Streetlight(**json, category_meta=meta)


@dataclass
class _Generation:
technology: str
installed_kw: float
export_price: float
profile: str


@dataclass
class _Load:
profile: str


@dataclass
class _Storage:
technology: str
max_capacity: float
usable_capacity: float
max_charge_rate: float
max_discharge_rate: float
charge_efficiency: float
discharge_efficiency: float
export_price: 10


@dataclass
class Residential(Base):
location: str
generations: list[_Generation]
loads: list[_Load]
storages: list[_Storage]

@classmethod
def fromJson(cls, json: dict[str, any]):
generations = json.pop("generations")
loads = json.pop("loads")
storages = json.pop("storages")

generations = [_Generation(**props) for props in generations]
loads = [_Load(**props) for props in loads]
storages = [_Storage(**props) for props in storages]

return Residential(**json, generations=generations, loads=loads, storages=storages)
26 changes: 26 additions & 0 deletions samples/residential.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# This file was auto-generated on 2022-06-19 20:50:41.442367. Do not modify by hand.

vp_address: 1001

location: 11.849511185435802,75.4845924125684

category: RESIDENTIAL

generations:
- technology: Renewables - Photo Voltaic
installed_kw: 3
export_price: 5.1
profile: "0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.09490642041449988,0.2992364307024624,0.3096975555303636,0.7858463583800118,0.8795595184709823,1.0554384231709317,1.0350949740590356,1.2864732975791744,1.6689576502432488,1.6442752641256577,1.9217520170087523,1.9599267779092446,1.9544628146041045,1.9264778681598325,1.8518208235647942,1.7495082469693801,1.601467232721764,1.4164619246103756,1.1561428603372839,0.7003220423223906,0.6724865042129731,0.28594445231241755,0.022706352698047876,0.03120470997713439,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0"

loads:
- profile: "2.3685558352482223,2.173099971189343,1.9586247656310307,1.7963653099864332,1.8367883667624811,1.6998709586921776,1.5923810083494607,1.5388048314623086,1.7137639740142294,1.4348688134767695,1.856801740681179,1.7646104715872624,1.7648371056812548,1.8380356849738886,2.0157905134960927,2.4922708711571766,2.5302115646499903,2.5430995099880587,2.2819567351058505,2.8881402224160038,3.0588243062492007,3.3373881834881307,2.789030371607483,2.9739010356760143,3.3037032997517906,3.2272285481772967,2.8729672568556683,2.8322737617141813,3.105455509430806,2.539830212521439,2.8413807384075636,2.8558976761710064,3.0737477075403206,3.1086144403570652,3.820633696144845,4.231196507431062,4.811990512859682,4.707784445299918,4.638178873932388,4.7916761841514885,4.466025107865955,4.622743504651537,3.940304095043877,4.308446289100408,3.793666291785321,3.4951347309126426,2.984493746229682,2.447083792089339"

storages:
- technology: Li-Ion
max_capacity: 20
usable_capacity: 18
max_charge_rate: 1
max_discharge_rate: 10000
charge_efficiency: 0.90
discharge_efficiency: 0.92
export_price: 10

0 comments on commit b0472bd

Please # to comment.