2024-03-13 00:18:10 +01:00
|
|
|
#ifndef HOYMILES_H
|
|
|
|
|
#define HOYMILES_H
|
|
|
|
|
|
2024-03-13 16:54:03 +01:00
|
|
|
#include <stdint.h>
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
2024-03-13 00:18:10 +01:00
|
|
|
struct _modbus;
|
|
|
|
|
typedef _modbus modbus_t;
|
|
|
|
|
|
|
|
|
|
class Dtu{
|
|
|
|
|
private:
|
|
|
|
|
modbus_t *modbus_t;
|
|
|
|
|
|
2024-03-13 16:54:03 +01:00
|
|
|
std::vector<Microinverter> microinverters;
|
|
|
|
|
|
2024-03-13 00:18:10 +01:00
|
|
|
public:
|
|
|
|
|
Dtu(const char *ip_address, int port);
|
|
|
|
|
|
2024-03-13 16:54:03 +01:00
|
|
|
void readTest(uint16_t address, int registers);
|
2024-03-13 00:18:10 +01:00
|
|
|
|
|
|
|
|
~Dtu();
|
|
|
|
|
};
|
|
|
|
|
|
2024-03-13 16:54:03 +01:00
|
|
|
class Microinverter{
|
|
|
|
|
private:
|
|
|
|
|
uint16_t readArray[33];
|
|
|
|
|
uint16_t address;
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
const int serialNumber;
|
|
|
|
|
std::pair<int, int> portNumber;
|
|
|
|
|
|
|
|
|
|
std::pair<float, int> plantVoltage;
|
|
|
|
|
std::pair<float, int> plantCurrent;
|
|
|
|
|
|
|
|
|
|
std::pair<float, int> gridVoltage;
|
|
|
|
|
std::pair<float, int> gridFrequency;
|
|
|
|
|
|
|
|
|
|
std::pair<float, int> plantPower;
|
|
|
|
|
|
|
|
|
|
std::pair<long, int> todayProduction;
|
|
|
|
|
std::pair<long, int> totalProduction;
|
|
|
|
|
|
|
|
|
|
std::pair<int, int> temperature;
|
|
|
|
|
|
|
|
|
|
std::pair<int, int> operatingStatus;
|
|
|
|
|
std::pair<int, int> alarmCode;
|
|
|
|
|
std::pair<int, int> alarmCount;
|
|
|
|
|
|
|
|
|
|
std::pair<int, int> linkStatus;
|
|
|
|
|
|
|
|
|
|
Microinverter(uint16_t address);
|
|
|
|
|
|
|
|
|
|
void updateValues();
|
|
|
|
|
};
|
|
|
|
|
|
2024-03-13 00:18:10 +01:00
|
|
|
#endif
|