2024-03-16 21:15:15 +01:00
|
|
|
#ifndef MICROINVERTER_H
|
|
|
|
|
#define MICROINVERTER_H
|
|
|
|
|
|
2024-03-17 21:33:21 +01:00
|
|
|
#include <memory>
|
2024-03-20 11:28:43 +01:00
|
|
|
#include <string>
|
2024-03-20 19:55:36 +01:00
|
|
|
#include <vector>
|
2024-03-16 21:15:15 +01:00
|
|
|
|
2024-03-19 16:59:41 +01:00
|
|
|
#include "modbus.h"
|
2024-03-20 19:55:36 +01:00
|
|
|
#include "port.h"
|
2024-03-29 21:40:50 +01:00
|
|
|
#include "sunspec.h"
|
2024-03-16 21:15:15 +01:00
|
|
|
|
|
|
|
|
class Microinverter {
|
|
|
|
|
private:
|
2024-04-09 12:21:21 +02:00
|
|
|
modbus_t *modbus;
|
2024-03-19 16:59:41 +01:00
|
|
|
|
2024-04-18 18:27:31 +02:00
|
|
|
// Sunspec sunspec;
|
2024-03-29 21:40:50 +01:00
|
|
|
|
2024-03-28 19:44:54 +01:00
|
|
|
int startAddress;
|
|
|
|
|
|
2024-04-06 00:32:49 +02:00
|
|
|
int statusStartAddress;
|
|
|
|
|
|
2024-03-16 21:15:15 +01:00
|
|
|
public:
|
2024-04-09 12:21:21 +02:00
|
|
|
Microinverter(modbus_t *modbus, int startAddress, long long serialNumber);
|
2024-03-18 22:49:32 +01:00
|
|
|
|
2024-03-20 16:39:25 +01:00
|
|
|
long long serialNumber;
|
2024-03-18 22:49:32 +01:00
|
|
|
|
2024-03-28 19:44:54 +01:00
|
|
|
int age;
|
|
|
|
|
|
2024-03-18 22:49:32 +01:00
|
|
|
std::vector<Port> ports;
|
2024-03-16 21:15:15 +01:00
|
|
|
|
2024-03-28 19:44:54 +01:00
|
|
|
// void updatePorts(std::vector<std::string> ¶metersToGet, bool allParameters);
|
|
|
|
|
|
|
|
|
|
void updateParameters(std::vector<std::string> ¶metersToGet, bool allParameters);
|
2024-03-20 11:28:43 +01:00
|
|
|
|
2024-04-06 00:32:49 +02:00
|
|
|
void updateStatusParameters();
|
|
|
|
|
|
2024-03-20 20:17:15 +01:00
|
|
|
void printPorts(std::vector<std::string> ¶metersToGet, bool allParameters, bool shortNames);
|
2024-03-18 23:48:37 +01:00
|
|
|
|
2024-03-20 19:55:36 +01:00
|
|
|
long long getTodayProduction();
|
2024-03-20 11:28:43 +01:00
|
|
|
|
2024-03-20 19:55:36 +01:00
|
|
|
long long getTotalProduction();
|
2024-04-06 00:32:49 +02:00
|
|
|
|
|
|
|
|
void setStatus(std::vector<std::pair<int, uint16_t>> portsToSet, std::string statusName);
|
2024-04-06 16:29:02 +02:00
|
|
|
|
|
|
|
|
void setStatusWholeMicroinverter(uint16_t value, std::string statusName);
|
2024-04-18 18:27:31 +02:00
|
|
|
|
|
|
|
|
float getCurrentPower();
|
|
|
|
|
|
|
|
|
|
int getCurrentOnOff();
|
2024-03-16 21:15:15 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif
|