-
Notifications
You must be signed in to change notification settings - Fork 2
/
opq.proto
125 lines (103 loc) · 3.3 KB
/
opq.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
syntax = "proto2";
package opq.proto;
//A data structure holding a single cycle of raw data.
message Cycle{
//64 bit timestamp of when the cycle was read out.
required uint64 time = 1;
//16 bit signed data values.
repeated int32 data = 2;
//A counter stamp driven by a 10kHz clock of the last GPS PPS.
optional int32 last_gps = 3;
//Current counter stamp.
optional int32 current_count = 4;
// Cycle flags. Currently unused
optional int32 flags = 5;
}
//A data structure holding a collection of cycles from a box.
message DataMessage{
//Device ID
required int32 id = 1;
//Cycles in this message
repeated Cycle cycles = 3;
}
//A trigger message from the box to the server.
message TriggerMessage{
//Device ID
required int32 id = 1;
//64 bit timestamp of when the cycle was read out.
required uint64 time = 2;
//Frequency measurement.
required float frequency = 3;
//RMS votage measurement.
required float rms = 4;
//optional Totoal Harmonic Distortion.
optional float thd = 5;
//A counter stamp driven by a 10kHz clock of the last GPS PPS.
optional int32 last_gps = 6;
//Current counter stamp.
optional int32 current_count = 7;
//Trigger flags currently unused.
optional int32 flags = 8;
}
//A request message from the makai cloud service to the boxen.
//Also a reply message from the box to the makai service.
message RequestDataMessage{
//Request type
enum RequestType {
//ping request
PING = 1;
//pong responce
PONG = 2;
//read data
READ = 3;
//response with data
RESP = 4;
//Box could not understand the request.
ERROR = 5;
}
//Request type
required RequestType type = 1;
//Event number
required uint32 sequence_number = 2;
//device ID for response
optional uint32 boxId = 3;
//64 bit timestamp of when the message was sent out.
optional uint64 time = 4;
//64 bit timestamp. Begining of the time range for raw data.
optional uint64 back = 5;
//End of the time range
optional uint64 forward = 6;
//Number of cycles read out from the box
optional uint32 num_cycles = 7;
}
// A request from OPQMauka to OPQMakai for raw data possibly relating
// to an event of interest.
message RequestEventMessage {
enum TriggerType {
FREQUENCY_SAG = 1;
FREQUENCY_SWELL = 2;
VOLTAGE_SAG = 3;
VOLTAGE_SWELL = 4;
OTHER = 5;
}
// Start time for raw data request in ms since the epoch utc
required uint64 start_timestamp_ms_utc = 1;
// End time for raw data request in ms since the epoch utc
required uint64 end_timestamp_ms_utc = 2;
// OPQMauka's reason for requesting data from OPQMakai
required TriggerType trigger_type = 3;
// Percent value of voltage or frequency depending on event type
required double percent_magnitude = 4;
// List of OPQBoxes that may have seen the same event trigger
repeated int32 box_ids = 5;
// Which OPQMauka plugin is making the request
required string requestee = 6;
// Human readable string of request generated my OPQMauka
required string description = 7;
// Whether or not to actually request data.
// We send a request event message every time we see something interesting,
// but in order to limit multiple requests within a small window, we may not
// request data for every event, but still want to log that something
// interesting happenen
required bool request_data = 8;
}