Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for 2mppt #2

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

saschalenz
Copy link

This PR adds support for a second MPPT Like the Kodak OG10 has two MPPTs.

  • Added config point to give the number of mppts. This can currently be 1 or 2
  • Added the new values to the mqtt topic and influx

example output:

{
  "Inverter_mode":3,
  "AC_grid_voltage":233.8,
  "AC_grid_frequency":50.0,
  "AC_out_voltage":233.8,
  "AC_out_frequency":50.0,
  "Load_va":1823,
  "Load_watt":1794,
  "Load_pct":18,
  "Bus_voltage":435,
  "Battery_voltage":55.50,
  "Battery_charge_current":0,
  "Battery_capacity":99,
  "Heatsink_temperature":35,
  "PV_in_current":0.3,
  "PV_in_voltage":90.0,
  "SCC_voltage":0.0000,
  "Battery_discharge_current":0,
  "PV_in_watts":0.0,
  "Load_status_on":1,
  "SCC_charge_on":1,
  "AC_charge_on":0,
  "Battery_voltage_offset_for_fans_on":0,
  "Eeprom_version":0,
  "PV_charging_power":33,
  "Charging_to_floating_mode":1,
  "Switch_On":1,
  "Dustproof_installed":0,
  "Grid_voltage_rating":230.0,
  "Grid_current_rating":43.4,
  "Out_voltage_rating":230.0,
  "Out_freq_rating":50.0,
  "Out_current_rating":43.4,
  "Out_va_rating":43.4,
  "Out_watt_rating":43.4,
  "Battery_rating":48.0,
  "Battery_recharge_voltage":51.0,
  "Battery_under_voltage":44.8,
  "Battery_bulk_voltage":56.0,
  "Battery_float_voltage":56.0,
  "Battery_type":8,
  "Max_grid_charge_current":40,
  "Max_charge_current":100,
  "In_voltage_range":1,
  "Out_source_priority":1,
  "Charger_source_priority":2,
  "Parallel_max_num":57,
  "Machine_type":1,
  "Topology":0,
  "Out_mode":0,
  "Battery_redischarge_voltage":54.0,
  "PV2_in_voltage":89.9,
  "PV2_in_current":0.3,
  "PV2_in_watts":0.0,
  "PV2_charging_power":34,
  "PV_total_charging_power":67,
  "Warnings":"000000000000000000000000000000000000"
}

@Phalanxguard
Copy link

This would actually be incredibly helpful if this were integrated into your repo. It would be great to monitor both MPPTs!

@gobotix
Copy link

gobotix commented Jun 13, 2024

I actually just added QPIGS2 2nd MPPT myself THEN afterwards found your fork in the "pull requests" .... However, I also had to make a change to the send() command because on the /dev/hiddraw interface it not only requires data to be chunked up to 8-bytes but also requires the last byte to be padded up to 8bytes (on my OS anyway) otherwise it simply fails to write the last 1 byte of the QPIGS2 command. This might be useful to others who when testing the QPIGS2 command on the command line it fails when using the hiddraw interface.

while (remaining > 0) {
if (remaining < 8) {
// the commands need to be chunked up to 8 bytes, so if a command is 9 bytes long, it needs to be sent in chunks of 8 bytes but the last chunk must be padded up to 8 bytes when using hiddraw interface
int padcount = 8 - remaining;
for (int pad = 0; pad < padcount; pad++) {
buf[bytes_sent+remaining+pad] = 0;
}
chunk_size = 8; // force it to write a whole byte
}

ssize_t written = write(fd, &buf[bytes_sent], chunk_size);
bytes_sent += written;
if (remaining - written >= 0)
remaining -= written;
else
remaining = 0;

if (written < 0)
  lprintf("DEBUG:  Write command failed, error number %d was returned", errno);
else
  lprintf("DEBUG:  %d bytes written, %d bytes sent, %d bytes remaining", written, bytes_sent, remaining);

chunk_size = remaining;
usleep(50000);   // Sleep 50ms before sending another 8 bytes of info

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants