Data import & export
Service objects
Data sources
Storage system
This guide demonstrates how to utilise FlatPeak to optimise the operation of an energy storage device, aiming to maximise cost savings and accelerate ROI.
Design
To optimise storage system’s operation based on energy cost:
Once the customer completes the Connect flow, or if you imported their tariff:
- Charge from solar (if present) when surplus is available.
- Charge from grid when IMPORT tariff is low if solar is not sufficient.
- Supply stored energy to premises when IMPORT tariff is high and solar is not sufficient.
- Export stored surplus energy to the grid when EXPORT tariff is high.
To calculate the savings provided by the storage system:
- Find beriod of high and low electricity cost for grid IMPORT and EXPORT.
- Log the cost of energy when charging from the grid using the IMPORT tariff.
- Account charging from local generation source (e.g., solar) as “free” energy.
- Log the cost of energy when supplying from your system to the customer’s premises, using the IMPORT tariff at the time of supply.
- Apply a straightforward calculation to determine savings (details provided below).
Implementation
To get your system to charge from the grid at the lowest cost, call the Scheduling API to create an IMPORT schedule that follows a low tariff.
The example below shows that your system will require 5.3 kWh between 7 pm and 5 am the following day. The scheduling API will advise you to instruct your system to charge between 1 am and 5 am schedule.start_time
and schedule.end_time
.
curl --request POST \
--url https://api.flatpeak.com/schedules \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"location_id": "loc_641b90b758fb8e6293716e40",
"max_power": {
"units": "W",
"value": "4000"
},
"data": [
{
"device_id": "dev_664525107c44d88a37ca1ad7",
"direction": "IMPORT",
"start_time": "2024-08-01T19:00:00Z",
"end_time": "2024-08-02T05:00:00Z",
"max_power": {
"units": "W",
"value": 4000
},
"energy": {
"units": "WH",
"value": 5300
}
}
]
}'
To get your system to charge from the grid at the lowest cost, call the Scheduling API to create an IMPORT schedule that follows a low tariff.
The example below shows that your system will require 5.3 kWh between 7 pm and 5 am the following day. The scheduling API will advise you to instruct your system to charge between 1 am and 5 am schedule.start_time
and schedule.end_time
.
curl --request POST \
--url https://api.flatpeak.com/schedules \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"location_id": "loc_641b90b758fb8e6293716e40",
"max_power": {
"units": "W",
"value": "4000"
},
"data": [
{
"device_id": "dev_664525107c44d88a37ca1ad7",
"direction": "IMPORT",
"start_time": "2024-08-01T19:00:00Z",
"end_time": "2024-08-02T05:00:00Z",
"max_power": {
"units": "W",
"value": 4000
},
"energy": {
"units": "WH",
"value": 5300
}
}
]
}'
To get your system to charge from the grid at the lowest cost, you must decide how much charging time you will likely require and search for periods when the tariff is lower.
In the example below, you want your system to have an opportunity to charge for at least 5 hours during the next 24-hour window.
To create a charging schedule that provides a fixed number of daily hours when the tariff is low, call the slots-time API endpoint and use the start_time
and end_time
values of the Response object to create a daily charging schedule.
curl --request GET \
--url 'https://api.flatpeak.com/slots/time/loc_65e42ce4d3b813479b252160\
?start_time=2023-06-15T09%3A00%3A00Z \
&end_time=2023-06-16T09%3A00%3A00Z \
&direction=IMPORT \
&segment=LOW \
&duration=300 \
--header 'Authorization: Bearer <token>'
To get your system to supply the energy it previously stored when the grid import tariff is high, call the slots-threshold to obtain a list of high-peak tariff periods. Set relative=0.5
to get slots when the tariff is at the top 50% of the range.
curl --request GET \
--url 'https://api.flatpeak.com/slots/threshold/loc_65e42ce4d3b813479b252160 \
?start_time=2023-06-15T09%3A00%3A00Z \
&end_time=2023-06-16T09%3A00%3A00Z \
&direction=IMPORT \
&segment=HIGH \
&relative=0.5' \
--header 'Authorization: Bearer <token>'
If your customer has an export tariff, use the Scheduling API to create an export plan that sends energy to the grid when export tariff is high. You will need to be able to measure the amount of energy that “moves” out of the property and not just from your system into the property.
To use Scheduling API to create an export plan, you must know how much energy you will have available for export and when.
In the example below, you want to export 10kWh between 6 pm and 6 am the following day. The API suggests that you export between 6 pm and 11 pm exporting 10kWh and earning €9.28:
curl --request POST \
--url https://api.flatpeak.com/schedules \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"location_id": "loc_641b90b758fb8e6293716e40",
"data": [
{
"device_id": "dev_65e6d8334c8d715963d99db3",
"direction": "EXPORT",
"start_time": "2024-08-01T18:00:00Z",
"end_time": "2024-08-02T06:00:00Z",
"max_power": {
"units": "W",
"value": 4000
},
"energy": {
"units": "WH",
"value": 10000
}
}
]
}'
To calculate the energy cost savings provided by your system, you need to record the cost of energy stored.
Call Metering API and submit IMPORT metering (at the device level) when your system is importing the energy. Set direction=IMPORT
and tariff_rate=IMPORT
to determine what it did cost.
curl --request POST \
--url https://api.flatpeak.com/meters/interval \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"start_time": "2024-08-02T01:00:00Z",
"end_time": "2024-08-02T02:00:00Z",
"device_id": "dev_65e6d8334c8d715963d99db3",
"location_id": "loc_641b90b758fb8e6293716e40",
"direction": "IMPORT",
"tariff_rate": "IMPORT",
"units": "W",
"value": 2034
}'
tariff_rate
to LOCAL
. If you send LOCAL
and IMPORT
meter readings covering the same period, they will be summarised.When your system supplies your customer’s premises with previously stored energy, log it as if supplied directly from the grid. Call submit-meter-interval setting direction=EXPORT
and tariff_rate=IMPORT
to determine what it could have cost.
curl --request POST \
--url https://api.flatpeak.com/meters/interval \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"start_time": "2024-08-01T08:00:00Z",
"end_time": "2024-08-01T09:00:00Z",
"device_id": "dev_65e6d8334c8d715963d99db3",
"location_id": "loc_641b90b758fb8e6293716e40",
"direction": "EXPORT",
"tariff_rate": "IMPORT",
"units": "W",
"value": 1214
}'
When your system exports energy to the grid, log it using the export tariff. Call submit-meter-interval endpoint setting direction=EXPORT
and tariff_rate=EXPORT
to determine what it earned from the grid.
curl --request POST \
--url https://api.flatpeak.com/meters/interval \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"start_time": "2024-08-01T08:00:00Z",
"end_time": "2024-08-01T09:00:00Z",
"location_id": "loc_641b90b758fb8e6293716e40",
"direction": "EXPORT",
"tariff_rate": "EXPORT",
"units": "W",
"value": 2144
}'
1. To get the cost of imports: Call calculate-energy-cost-by-interval endpoint to request the cost of imported energy (note the direction=IMPORT
) for the period for which you would like to provide the report:
curl --request POST \
--url 'https://api.flatpeak.com/costs/interval/dev_65e6d8334c8d715963d99db3?direction=IMPORT' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"start_time": "2024-08-01T00:00:00Z",
"end_time": "2024-08-01T23:59:59Z"
}'
2. To get the value of energy that your system supplied to premises: Then, call calculate-energy-cost-by-interval again to request what would be the cost of energy if your device did not supply it from storage (note the direction=EXPORT
); for the same period:
curl --request POST \
--url 'https://api.flatpeak.com/costs/interval/dev_65e6d8334c8d715963d99db3?direction=EXPORT' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"start_time": "2024-08-01T00:00:00Z",
"end_time": "2024-08-01T23:59:59Z"
}'
3. To get the value of exports: If your system is exporting energy to the grid, call calculate-energy-cost-by-interval endpoint for the third time to request the value of exported energy (note use of Location ID and direction=EXPORT
):
curl --request POST \
--url 'https://api.flatpeak.com/costs/interval/loc_641b90b758fb8e6293716e40?direction=EXPORT' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"start_time": "2023-11-07T05:31:56Z",
"end_time": "2023-11-07T05:31:56Z"
}'
aggregation
parameter to get data for a week, month, or year.The difference between the tariff.value
figures in the IMPORT
and EXPORT
responses will be the savings your system has achieved.
The example below covers a day period and works out as follows:
- Imported 24,5KWh of energy at total cost of €0.94; averaging €0.04/KWh.
- Supplied 16.9KWh of energy at total cost of €1.18; averaging €0.69/KWh.
- This makes the tariff rate difference of €0.65/kWh or 178%.
- Calculate savings as
16.9KWh x €0.04/KWh = €0.676
versus16.9KWh x €0.69/KWh = €11.661
for the grand total of €11.59 saved.
The difference between the tariff.value
figures in the IMPORT
and EXPORT
responses will be the savings your system has achieved.
The example below covers a day period and works out as follows:
- Imported 24,5KWh of energy at total cost of €0.94; averaging €0.04/KWh.
- Supplied 16.9KWh of energy at total cost of €1.18; averaging €0.69/KWh.
- This makes the tariff rate difference of €0.65/kWh or 178%.
- Calculate savings as
16.9KWh x €0.04/KWh = €0.676
versus16.9KWh x €0.69/KWh = €11.661
for the grand total of €11.59 saved.
The difference between the tariff.value
figures in device-level IMPORT
and EXPORT
responses, plus location-level EXPORT
figure, will be the saving your system has achieved.
Taking into account the information you obtained in the previous steps:
- Imported 24,5KWh of energy at total cost of €0.94; averaging €0.04/KWh.
- Provided 16.9KWh of energy at total cost of €1.18; averaging €0.69/KWh.
- Exported 6.1KWh of energy at total value of €1.08; averaging €0.11/KWh.
- Calculate savings as
16.9KWh x €0.04/KWh = €0.676
versus16.9KWh x €0.69/KWh = €11.661
plus €1.08 made exporting for the grand total of €12.67 saved.
Was this page helpful?