# Energy Management ## 流程 ![](https://i.imgur.com/yRS7TtY.png) https://drive.google.com/file/d/1DunmvVdr5M1moSFG5AhpGGFkcGJCp9WH/view ## API 1. server url: v2g.westus2.cloudapp.azure.com:8080 2. 已建立一筆 Energy Request 資料,可利用 "id=1" 來測試 "預估可調度供電API" 和 "實際調度電量API" ```json= { "id": 1, "time_start": "2021-10-11 23:30:00", "time_end": "2021-10-12 23:30:00", "addr_zip": "100", "demand": 300.0, "estimated_supply": 0.0, "real_supply": 0.0, "created_at": "2021-10-05 15:11:21", "updated_at": null } ``` ## 預估可調度供電API 1. Request: Name | Description ----------- | -------- | URL | POST /v1/taipower/predict/ Authorization | None Content Type | application/json 2. Body: Name | Required | Type | Description ----------- | -------- |-------- | ------------- id | v | int | request_id electricity | v | float | 本次新增的可調度電力 3. Response: - success ```json { "message": "success", "data": { "id": 1, "time_start": "YYYY-MM-DD HH:MM:SS", "time_end": "YYYY-MM-DD HH:MM:SS", "addr_zip": "100", "demand": 300.0, "estimated_supply": 50.0, "real_supply": 0.0, "created_at": "YYYY-MM-DD HH:MM:SS", "updated_at": "YYYY-MM-DD HH:MM:SS" } } ``` - failed ```json { "message": "xxx", } ``` ```json { "message": "User error: The estimated dispatchable power (60.0) is already greater than the actual demand(57.0)", } ``` 4. Example: - 假設雲高在 6:00 的時候向YesEnergy 提出 8:00 ~ 9:00 300kw 的電力調度需求,則YesEnergy 可在接收到此需求之後開始回覆雲高 8:00 ~ 9:00 可提供的總電力 (目前設定在需求時間的前十分鐘作為最後結算的可提供電力 - ex: 7:50, 或已達到 300kw) - ex: 6:15 - Body: ```json { "id": 1, "electricity": 50 } ``` - Response: ```json { "message": "success", "data": { "id": 1, "time_start": "2021-09-29 08:00:00", "time_end": "2021-09-29 09:00:00", "addr_zip": "100", "demand": 300.0, "estimated_supply": 50.0, "real_supply": 0.0, "created_at": "2021-09-29 06:00:37", "updated_at": "2021-09-29 06:15:03" } } ``` - ex: 6:27 - Body: ```json { "id": 1, "electricity": 33 } ``` - Response: ```json { "message": "success", "data": { "id": 1, "time_start": "2021-09-29 08:00:00", "time_end": "2021-09-29 09:00:00", "addr_zip": "100", "demand": 300.0, "estimated_supply": 83.0, "real_supply": 0.0, "created_at": "2021-09-29 06:00:37", "updated_at": "2021-09-29 06:27:48" } } ``` - ... 5. Note: - 目前是設定同一時間(需求開始時間 & 需求結束時間) & 地點 只能有一個電力調度的需求 - 若預估可調度電量已超過需求,則無法再更新預估可調度電量 ## 實際調度電量API 1. Request: Name | Description ----------- | -------- | URL | POST /v1/taipower/provide/ Authorization | None Content Type | application/json 2. Body: Name | Required | Type | Description ----------- | -------- |-------- | ------------- id | v | int | request_id electricity | v | float | 本次抽取的電力 3. Response: - success ```json { "message": "success", "data": { "id": 1, "time_start": "YYYY-MM-DD HH:MM:SS", "time_end": "YYYY-MM-DD HH:MM:SS", "addr_zip": "100", "demand": 300.0, "estimated_supply": 50.0, "real_supply": 0.0, "created_at": "YYYY-MM-DD HH:MM:SS", "updated_at": "YYYY-MM-DD HH:MM:SS" } } ``` - failed ```json { "message": "xxx", } ``` ```json { "message": "User error: The real dispatchable power (60.0) is already greater than the actual demand(57.0)", } ```