Fórum | MyPower.CZ | Obnovitelné zdroje energie - energetická soběstačnost | Poslední návštěva: čtv bře 04, 2021 3:46 am
vlkazajac píše:Vypočítanú hodnotu absorpcie 28,62 V by som pre istotu znížil o 0,2 V. Tu je tá kritická doba, kedy VRLA vysychajú .....
Serial.println("Reading Tracer");
myserial.write(start, sizeof(start));
myserial.write(id);
myserial.write(cmd, sizeof(cmd));
int read = 0;
for (int i = 0; i < 255; i++){
if (myserial.available()) {
buff[read] = myserial.read();
read++;
}
}
Serial.print("Read "); Serial.print(read); Serial.println(" bytes");
for (int i = 0; i < read; i++){
Serial.print(buff[i], HEX);
Serial.print(" ");
}
Serial.println();
battery = to_float(buff, 9);
pv = to_float(buff, 11);
//13-14 reserved
load_current = to_float(buff, 15);
over_discharge = to_float(buff, 17);
battery_max = to_float(buff, 19);
// 21 load on/off // 22 overload yes/no // 23 load short yes/no // 24 reserved // 25 battery overload
// 26 over discharge yes/no
full = buff[27];
charging = buff[28];
battery_temp = buff[29] - 30;
charge_current = to_float(buff, 30);
Serial.print("Load is ");
Serial.println(buff[21] ? "on" : "off");
Serial.print("Load current: ");
Serial.println(load_current);
Serial.print("Battery level: ");
Serial.print(battery);
Serial.print("/");
Serial.println(battery_max);
Serial.print("Battery full: ");
Serial.println(full ? "yes " : "no" );
Serial.print("Battery temperature: ");
Serial.println(battery_temp);
Serial.print("PV voltage: ");
Serial.println(pv);
Serial.print("Charging: ");
Serial.println(charging ? "yes" : "no" );
Serial.print("Charge current: ");
Serial.println(charge_current);
if ( charge_current < 42.0 )
{
ch_curr_arr [ch_arr_index] = charge_current;
ch_arr_index = ch_arr_index + 1;
ch_arr_index = ch_arr_index % buffer_max;
}
float avr_current = 6.0;
if ( ch_arr_index == buffer_max - 1 )
{
float sum = 0;
for ( int i = 0; i < buffer_max ; i++ )
{
sum = sum + ch_curr_arr [i];
}
avr_current = sum / float ( buffer_max );
if ( ( pv > 55.0 ) && ( pv < 73.0) )
{
if ( ( avr_current > 11.9 ) && ( avr_current < 39.0) )
{
if ( ( LED_state[3] == 0 ) && ( ( battery / battery_max ) < 1.0 ) )
{
LED_state[3] = 1; // save LED state
digitalWrite(8, LOW);
off_intervall = millis ();
}
}
}
}
if ( ch_arr_index == buffer_max - 1 )
{
if ( ( pv > 50.0 ) && ( pv < 69.0) )
{
if ( ( avr_current > 0.2 ) && ( avr_current < 3.0) )
{
if ( ( LED_state[3] == 1 ) && ( ( battery / battery_max ) < 1.1 ) )
{
if ( ( LED_state[4] == 1 ) )
{
LED_state[3] = 0; // save LED state
digitalWrite(8, HIGH);
}
}
}
}
}
if ( ch_arr_index == buffer_max - 1 )
{
if ( ( pv > 60.0 ) || ( pv < 18.0) )
{
if ( ( avr_current > 0.5 ) && ( avr_current < 3.0) )
{
if ( ( LED_state[3] == 1 ) && ( ( battery / battery_max ) < 1.1 ) )
{
if ( ( LED_state[4] == 1 ) )
{
LED_state[3] = 0; // save LED state
digitalWrite(8, HIGH);
}
}
}
}
}
if ( ch_arr_index == buffer_max - 1 )
{
if ( ( pv > 5.0 ) && ( pv < 15.0) )
{
if ( ( avr_current > 0.01 ) && ( avr_current < 1.0) )
{
if ( ( LED_state[0] == 0 ) && ( ( battery / battery_max ) < 1.1 ) )
{
if ( ( LED_state[4] == 1 ) )
{
LED_state[0] = 1; // save LED state
digitalWrite(5, LOW);
}
}
}
}
}
if ( ch_arr_index == buffer_max - 1 )
{
if ( ( pv > 51.0 ) && ( pv < 71.0) )
{
if ( ( avr_current > 0.5 ) && ( avr_current < 1.2) )
{
if ( ( LED_state[0] == 1 ) && ( ( battery / battery_max ) < 1.1 ) )
{
if ( ( LED_state[4] == 1 ) )
{
LED_state[0] = 0; // save LED state
digitalWrite(5, HIGH);
}
}
}
}
}
String dataString = "";
Uživatelé procházející toto fórum: CC [Bot] a 0 návštevníků