1- // Frequenz Dispatch API
1+ // protolint:disable MAX_LINE_LENGTH
2+
3+ // Frequenz Dispatch Automation API
4+ //
5+ // Overview:
6+ // The API serves to automate the process of electricity dispatches for microgrids.
7+ // In the context of the energy industry, a 'dispatch' refers to the act of routing electrical power
8+ // between different components within a microgrid or between a microgrid and the main grid.
9+ // This could be for the purpose of supply (sending electricity to the grid or components within the microgrid),
10+ // or demand (drawing electricity from the grid or from other components like batteries and solar arrays).
11+ //
12+ // Objective:
13+ // The primary objective of this API is to streamline and automate the complex task of electricity dispatching,
14+ // making it easier to manage local electricity supply and demand efficiently.
215//
3- // Frequenz gRPC API to propagate dispatches to microgrids
16+ // Key Features:
17+ // - Dispatching Electricity: Comprehensive CRUD operations for dispatching microgrid components.
18+ // - Automation: Support for one-time as well as recurring dispatches based on flexible recurrence rules.
19+ // - Fine-grained control: Dispatch individual microgrid components or entire component categories.
20+ //
21+ // Example Use Cases:
22+ // - Charging or discharging a battery based on optimal time-of-use rates.
23+ // - Limiting the output of a Photovoltaic (PV) array during periods of low demand.
24+ // - Invoking Frequency Containment Reserves (FCR) or Automatic Frequency Restoration Reserves (aFRR) to
25+ // support grid operations.
26+ // - Adjusting the output of electric vehicle charging stations to match grid availability or to avoid peak pricing.
27+ //
28+ // Target Audience:
29+ // This API is designed for application developers in the energy sector who focus on the tasks of optimizing microgrid
30+ // electricity flows. Its design aims to be as developer-friendly as possible, requiring no prior knowledge in
31+ // electrical engineering and systems.
432//
533// Copyright:
634// Copyright 2022 Frequenz Energy-as-a-Service GmbH
735//
836// License:
937// MIT
1038
11- // protolint:disable MAX_LINE_LENGTH
12-
1339syntax = "proto3" ;
1440
1541package frequenz.dispatch.v1 ;
@@ -22,24 +48,27 @@ import "google/protobuf/timestamp.proto";
2248import "frequenz/api/common/components.proto" ;
2349
2450// Service providing operations related to dispatching microgrid components.
25- service DispatchService {
51+ service MicrogridDispatchService {
2652 // Returns a list of all dispatches
27- rpc ListDispatches (DispatchListRequest ) returns (DispatchList );
53+ rpc ListMicrogridDispatches (DispatchListRequest ) returns (DispatchList );
2854
2955 // Create a new dispatch
30- rpc CreateDispatch (DispatchCreateRequest ) returns (google .protobuf .Empty );
56+ rpc CreateMicrogridDispatch (DispatchCreateRequest ) returns (google .protobuf .Empty );
3157
3258 // Update a dispatch
33- rpc UpdateDispatch (DispatchUpdateRequest ) returns (google .protobuf .Empty );
59+ rpc UpdateMicrogridDispatch (DispatchUpdateRequest ) returns (google .protobuf .Empty );
3460
3561 // Get a single dispatch
36- rpc GetDispatch (DispatchGetRequest ) returns (Dispatch );
62+ rpc GetMicrogridDispatch (DispatchGetRequest ) returns (Dispatch );
3763
3864 // Delete a given dispatch
39- rpc DeleteDispatch (DispatchDeleteRequest ) returns (google .protobuf .Empty );
65+ rpc DeleteMicrogridDispatch (DispatchDeleteRequest ) returns (google .protobuf .Empty );
4066}
4167
42- // Message representing one dispatch
68+ // Message representing one dispatch.
69+ //
70+ // Timezone Note: Timestamps are in UTC. It is the responsibility of each microgrid to translate UTC
71+ // to its local timezone.
4372message Dispatch {
4473 // The dispatch identifier
4574 uint64 id = 1 ;
@@ -53,27 +82,37 @@ message Dispatch {
5382 // understanding and processing this field.
5483 string type = 3 ;
5584
56- // The creation time
85+ // The creation time in UTC
5786 // This is set when a dispatch is created via the create request message
5887 google.protobuf.Timestamp create_time = 4 ;
5988
60- // The update time
89+ // The update time in UTC
6190 // This is set when a dispatch is modified via the update request message
6291 google.protobuf.Timestamp update_time = 5 ;
6392
64- // The start time
93+ // The start time in UTC
6594 google.protobuf.Timestamp start_time = 6 ;
6695
67- // The end time
96+ // The end time in UTC
6897 google.protobuf.Timestamp end_time = 7 ;
6998
7099 // The component selector
71- DispatchComponentSelector selector = 8 ;
100+ ComponentSelector selector = 8 ;
72101
73102 // The "active" status
103+ // An active dispatch is eligible for processing, either immediately or at a scheduled
104+ // time in the future, including recurring dispatches. If a dispatch is set to
105+ // inactive, it won't be processed even if it matches all other conditions, allowing
106+ // for temporary disabling of dispatches without deletion.
74107 bool is_active = 9 ;
75108
76109 // The "dry run" status
110+ // A dry run dispatch is executed for logging and monitoring purposes
111+ // without affecting the microgrid components. This is useful, for example,
112+ // in scenarios where a user may want to test dispatch behavior without
113+ // actually affecting any component states.
114+ // Notably, a dispatch can be both "dry run" and "active," allowing for
115+ // the system to generate logs and observe behavior without making actual changes.
77116 bool is_dry_run = 10 ;
78117
79118 // The dispatch payload
@@ -100,23 +139,26 @@ message TimeIntervalFilter {
100139
101140// Parameter for controlling which components a dispatch applies to
102141// Either a set of component IDs, or all components belonging to a category
103- message DispatchComponentSelector {
142+ message ComponentSelector {
104143 oneof selector {
105144 // Set of component IDs
106- DispatchComponentIDs dispatch_component_ids = 1 ;
145+ ComponentIDs component_ids = 1 ;
107146
108147 // Component category
109- frequenz.api.common.components.ComponentCategory dispatch_component_category = 2 ;
148+ frequenz.api.common.components.ComponentCategory component_category = 2 ;
110149 }
111150}
112151
113152// Wrapper for controlling dispatches with a set of component IDs
114- message DispatchComponentIDs {
153+ message ComponentIDs {
115154 // Set of component IDs
116155 repeated uint64 component_ids = 1 ;
117156}
118157
119- // Ruleset governing when and how a dispatch should re-occur
158+ // Ruleset governing when and how a dispatch should re-occur.
159+ //
160+ // Timezone Note: Timestamps are in UTC. It is the responsibility of each microgrid to translate UTC
161+ // to its local timezone.
120162//
121163// This definition tries to adhere closely to the iCalendar specification (RFC 5545),
122164// particularly for recurrence rules. For advanced use-cases or further clarifications,
@@ -220,12 +262,20 @@ message DispatchListRequest {
220262// Parameters for filtering the dispatch list
221263message DispatchFilter {
222264 // Filter by component ID or category
223- repeated DispatchComponentSelector selectors = 1 ;
265+ repeated ComponentSelector selectors = 1 ;
224266
225267 // Filter by time interval
226268 // If no interval is provided, all dispatches starting from the
227269 // current timestamp will be included.
228270 TimeIntervalFilter time_interval = 2 ;
271+
272+ // Filter by active status
273+ // If this field is not set, dispatches of any active status will be included.
274+ optional bool is_active = 3 ;
275+
276+ // Filter by dry run status
277+ // If this field is not set, dispatches of any dry run status will be included.
278+ optional bool is_dry_run = 4 ;
229279}
230280
231281// A list of dispatches
@@ -252,7 +302,7 @@ message DispatchCreateRequest {
252302 google.protobuf.Timestamp end_time = 4 ;
253303
254304 // The component selector
255- DispatchComponentSelector selector = 5 ;
305+ ComponentSelector selector = 5 ;
256306
257307 // The "active" status
258308 bool is_active = 6 ;
@@ -282,7 +332,7 @@ message DispatchUpdateRequest {
282332 google.protobuf.Timestamp end_time = 3 ;
283333
284334 // The component selector
285- DispatchComponentSelector selector = 4 ;
335+ ComponentSelector selector = 4 ;
286336
287337 // The "active" status
288338 optional bool is_active = 5 ;
0 commit comments