Repository navigation
Expand file tree
/
Copy pathdata.h
More file actions
55 lines (48 loc) · 1.54 KB
/
Copy pathdata.h
File metadata and controls
55 lines (48 loc) · 1.54 KB
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
#ifndef __DATA_H__
#define __DATA_H__
#include <stdbool.h>
#include "hex.h"
typedef struct
{
int BatteryVoltage; // mV
int PanelVoltage; // mV
int PanelPower; // W
int LoadCurrent; // mA
int LoadOn; // true/false
int OffReasonId; // Index
int YieldTotal; // 0.01 kWh
int YieldToday; // 0.01 kWh
int MaximumPowerToday; // W
int YieldYesterday; // 0.01 kWh
int MaximumPowerYesterday; // W
int ErrorCode; // Index
int StateOfOperationId; // Index
char FirmwareVersion[8]; // Firmware Version
int ProductId; // Id
int DaySequenceNumber; // 0-364
int TrackerOperationModeId; // Index
char SerialNumber[12]; // LLYYMMSSSSS
// Processed Info
const char *DeviceName;
const char *ErrorMsg;
const char *OffReason;
const char *LoadState;
const char *StateOfOperation;
const char *TrackerOperationMode;
bool IsMPPT;
HistoryTotalRecord TotalRecord;
HistoryDayRecord DailyRecord[31];
} VictronData;
void data_update(VictronData *data);
void data_get(VictronData *data);
double get_battery_volts(VictronData *data);
double get_pv_volts(VictronData *data);
double get_pv_watts(VictronData *data);
double get_pv_amps(VictronData *data);
double get_load_amps(VictronData *data);
double get_load_watts(VictronData *data);
int get_yield_total_wh(VictronData *data);
int get_yield_today_wh(VictronData *data);
int get_yield_yesterday_wh(VictronData *data);
const char *format_fw_version(const char *in);
#endif