-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.proto
482 lines (416 loc) · 10.5 KB
/
schema.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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
syntax = "proto3";
import "nanopb.proto";
option go_package = ".;pb";
message Wrapper {
enum DataType {
SPEED = 0;
FORCE = 1;
IMU = 2;
POWER = 3;
TEMPERATURE = 4;
WIND = 5;
VESC = 6;
SETPOINT = 7;
BLADE = 8;
TURBINECONTROL = 9;
ACC = 10;
ACCGYRO = 11;
HUMIDITYTEMP = 12;
WINDDIR = 13;
VESC2 = 14;
HALLROTOR = 15;
SUPERVISOR = 16;
PITCH = 17;
COMMONBLADE = 18;
ALIVE = 19;
UPDATEFREQUENCY = 20;
ACCMAX = 21;
WINDSONIC = 22;
ROTORVEL = 23;
DEBUG = 24;
STEPPERFEEDBACK = 25;
FAULT = 26;
DCDC = 27;
FAULTSTATUS = 28;
IP = 29;
BLADEZOFFSET = 30;
TURBINEPITCHPIDTUNING = 31;
FORCEARRAY = 32;
FILAMENTDRY = 33;
ROTORVELAERO = 34;
WINDSTATS = 35;
DEVICEINFO = 36;
TURBINESTATS = 37;
IMU6 = 38;
HEADING = 39;
MAGNETOMETER = 40;
}
DataType type = 1;
bytes data = 2 [(nanopb).max_size = 92];
string target = 3 [(nanopb).max_size = 6];
}
message Speed {
int64 time = 1; // millis since epoch
float RPM = 2; // rev/min
}
message Force {
int64 time = 1;
float force = 2; // N
int32 id = 3; // with multiple strain gauges; could consider an enum
}
message Power { // could later include a measurement point
int64 time = 1;
float current = 2;
float voltage = 3;
}
message Imu {
int64 time = 1;
Vector3 acc = 2; // m/ss
Vector3 gyro = 3; // rad/s
Quaternion orientation = 4;
}
message Acc {
uint64 time = 1;
Vector3 acc = 2; // m/ss
}
message AccGyro {
uint64 time = 1;
Vector3 acc = 2; // m/ss
Vector3 gyro = 3; // rad/s
}
message HumidityTemperature {
int64 time = 1;
float humidity = 2; // %
float temperature = 3; // %
}
message Temperature {
int64 time = 1;
float temperature = 2;
}
message Wind {
int64 time = 1;
float speed = 2;
float direction = 3;
}
message Vector3 {
float x = 1;
float y = 2;
float z = 3;
}
message Quaternion { // needs a definition
float x = 1;
float y = 2;
float z = 3;
float w = 4;
}
message Vesc {
int64 time = 1;
float avgMotorCurrent = 2;
float avgInputCurrent = 3;
float dutyCycleNow = 4;
int32 rpm = 5;
float inpVoltage = 6;
float ampHours = 7;
float ampHoursCharged = 8;
int32 tachometer = 9;
int32 tachometerAbs = 10;
}
message Vesc2 {
// // Local VESC FET temperature
// // Local VESC Motor temperature
// // Local VESC average Motor current
// // Local VESC average Input current
// // Local VESC ERPM
// // Local VESC input voltage
// // Local VESC fault status
// // Local VESC PID position
// mask made by KiteX, Andreas Okholm 10 april 2020.
int64 time = 1;
float tempFET = 2;
float tempMotor = 3;
float avgMotorCurrent = 4;
float avgInputCurrent = 5;
int32 rpm = 6;
float inpVoltage = 7;
int32 fault = 8;
float pidPosNow = 9;
int32 tachometer = 10;
float currentSP = 11;
}
message Setpoint {
int64 time = 1;
float RPM = 2;
float current = 3;
enum Origin {
WEB = 0;
ESP = 1;
}
Origin origin = 4;
}
message BladeControl {
int64 time = 1;
float pitch1 = 2;
float pitch2 = 3;
float pitch3 = 4;
float collectivePitch = 5;
float pitchP = 6;
float pitchI = 7;
}
message CommonBladeControl {
int64 time = 1;
float pitchSP = 2;
float pitchEstimate = 3;
float pitchI = 4;
}
enum TurbineTopLevelMode {
Storage = 0; // Not implemented yet - shuts off the VESC and ESP
Idle = 1; // VESC is turned off. Wifi enabled. Clibrate; when entered from Storage. Pitch to 90 degree. Turn Servo off.
Hold = 2; // Temporary locking the rotation of the turbine
Operation = 3; // Normal power producing operation.
ManualOperationMode = 4; // Manual overwrite send TurbineControl Commands.
ManualTurbineControlMode = 5; // Manual overwrite send TurbineControl Commands.
ManualPitchCalibrateMode = 6; // Recalibrate pitch
ShowMode = 7; // spin at low speed and pitch back and forth.
TorqueTestMode = 8; // Load the gearbox up to rated torque.
OperationStall = 9; // Stall operation mode.
Calibration = 10; // Used to calibrate the blade (indoor)
};
enum OperationMode {
Hunting = 0; // When there is not enough wind to sustain operation. Pitch up and wait for activity. Current = 0
Generation = 1; // In automatic mode; Default mode.
AboveCutout = 2; // When the blade pitch hits ~25 degree sustained; then go to 80 degree and set the maximum breaking torque to
ComsumePower = 3; // Go to pitch 90 degree and rotate -20 RPM backwards.
GenerationStall = 4; // Stall default operation mode.
PitchCalibration = 5; // if a pitch system fault has been detected - this mode can be used for recalibration
PreOperationWarning = 6; // A alarm state before operation begins.
};
message TurbineSupervisorControl {
TurbineTopLevelMode topLevelMode = 1;
OperationMode operationMode = 2;
TurbineControlLight turbControl = 3;
}
message Pitch {
float offsetDistance = 1;
float offsetAngle = 2;
bool overwrite = 3;
}
message TurbineControl {
int64 time = 1;
float value = 2;
enum Command {
Stop = 0; // Sets duty cycle = 0.
Auto = 1; // Automatic turbine control as defined on the ESP
Speed = 2; // RPM
Pos = 3; // Position relative to position when first set
Current = 4; // winding current negative is breaking
}
Command command = 3;
BladeControl blade = 4;
}
message TurbineControlLight {
enum Command {
Stop = 0; // Sets duty cycle = 0.
Auto = 1; // Automatic turbine control as defined on the ESP
Speed = 2; // RPM
Pos = 3; // Position relative to position when first set
Current = 4; // winding current negative is breaking
Cutout = 5; // load reduction, but still producing power enought power to keep the turbine powered.
AutoStall = 6; // Use rpm based algorithm to apply correct torque for stall control.
}
Command command = 1;
float value = 2;
float collective = 3;
}
message WindDirection {
int64 time = 1;
float direction = 2;
}
message HallRotor {
int64 time = 1;
bool on = 2;
}
message ServoState {
enum State {
Operational = 0; // calibrated
Calibrating = 1; // Uncalibrated
}
State state = 1; // the state of affairs
float pitch = 2; // pitch angle can only be trusted once it's calibrated.
}
message Alive {
int64 time = 1;
string id = 2 [(nanopb).max_size = 6]; // 6 chars.
}
message UpdateFrequency {
uint32 rateLimitImu = 1;
uint32 rateLimitAccGyro = 2;
uint32 rateLimitAcc = 3;
uint32 rateLimitWindDir = 4;
uint32 rateLimitVesc = 5;
uint32 rateLimitCommonBladeControl = 6;
uint32 rateLimitRotorVel = 7;
uint32 rateLimitStepperFeedback = 8;
uint32 rateLimitDebug = 9;
}
message AccMax {
uint64 time = 1;
Vector3 accmax = 2; // m/ss
}
message WindSonic {
uint64 time = 1;
float speed = 2; // m/s
float zVel = 3; // m/s
float direction = 4; // deg
float temp = 5; // degC
}
message RotorVel {
uint64 time = 1;
float genVel = 2;
float gearVel = 3;
float avgMotorCurrent = 4;
}
message DebugMessage {
uint64 time = 1;
float param1 = 2;
float param2 = 3;
float param3 = 4;
float param4 = 5;
float param5 = 6;
float param6 = 7;
float param7 = 8;
float param8 = 9;
}
message StepperFeedback {
uint64 time = 1;
float current1 = 2;
float current2 = 3;
float collective = 4;
float cyclic = 5;
float turbinePitchAngle = 6;
float accX = 7;
float accY = 8;
float gyroZ = 9;
uint32 status = 10 [(nanopb).int_size = IS_8];
float accZ = 11;
float temp = 12;
}
message Fault {
enum Type {
AccX = 0;
AccY = 1;
GyroZ = 2;
RotorOverspeed = 3;
StepperCurrent1 = 4;
StepperCurrent2 = 5;
Cyclic = 6;
RotorSpeedChance = 7;
None = 8;
PitchCutout = 9;
InputOverVoltage = 10;
VescTimeout = 11;
StepTimeout = 12;
ImuTimeout = 13;
InputDisconnect = 14;
Step_EncoderError1 = 15;
Step_EncoderError2 = 16;
Step_CalTimeout = 17;
Step_DriverFault = 18;
Step_ImuFault = 19;
Step_HighCurSP = 20;
BoomAngle = 21;
Step_EncoderCal = 22;
BeltSkip = 23;
}
enum Severity {
Recalibrate = 0; // medium
Stop = 1; // high
Cutout = 2; // low
}
uint64 time = 1;
Type faultType = 2;
Severity severity = 3;
float value = 4;
}
message FaultStatus {
uint64 time = 1;
uint64 cutoutFlags = 2;
uint64 recalFlags = 3;
uint64 stopFlags = 4;
}
message DCDC {
uint64 time = 1;
float Uin = 2;
float Uout = 3;
float IOut = 4;
float temp = 5;
float pwm = 6;
}
message IP {
uint64 time = 1;
uint32 ip = 2;
}
message BladeZOffset {
float offset = 1;
}
message TurbinePitchPIDTuning {
float KPadjustment = 1;
float KIadjustment = 2;
float KDadjustment = 3;
float betaFilterAdjustment = 5;
float betaGain1 = 6;
float betaGain2 = 7;
float speedFilterRatio = 8;
float betaFilterRatio = 9;
}
message ForceArray {
int64 time = 1;
repeated float force = 2 [packed = true, (nanopb).max_count = 4]; // N
}
message FilamentDry {
uint64 time = 1;
float tempIn = 2;
float tempOut = 3;
float humIn = 4;
float humOut = 5;
bool relayTemp = 6;
bool relayHum = 7;
}
message RotorVelAero {
uint64 time = 1;
float TAero = 2;
float TSR = 3;
float windSpeed = 4;
}
message WindStats {
uint64 time = 1;
float mean = 2;
float std = 3;
float TI = 4;
int32 seconds = 5;
}
message DeviceInfo {
uint64 time = 1;
uint32 hardVers = 2;
uint32 softVers = 3;
bytes gitHash = 4 [(nanopb).max_size = 20];
}
message TurbineStats {
uint64 time = 1;
uint32 runTime = 2;
uint32 energy = 3;
uint32 revs = 4;
uint32 pitch = 5;
}
message Imu6 {
int64 time = 1;
Vector3 acc = 2; // m/ss
Vector3 gyro = 3; // rad/s
}
message Heading {
uint64 time = 1;
float heading = 2;
}
message Magnetometer {
uint64 time = 1;
Vector3 mag = 2;
}