.mode line
.headers on

------------------------------------ssd
.open aiox.db
select  min(dt), max(dt), count(dt) as '#', avg(Ppv1),  avg(OP_Watt),  avg(ACChr_Watt),  avg(AC_InWatt), (avg(Bat_Watt))  from ir where dt > (select datetime(max(dt), '-1 day') from ir) ;

select  min(dt), max(dt), count(dt) as '#', min(Ppv1),  min(OP_Watt),  min(ACChr_Watt),  min(AC_InWatt), (min(Bat_Watt))  from ir where dt > (select datetime(max(dt), '-1 day') from ir) ;

select  min(dt), max(dt), count(dt) as '#', max(Ppv1),  max(OP_Watt),  max(ACChr_Watt),  max(AC_InWatt), (max(Bat_Watt))  from ir where dt > (select datetime(max(dt), '-1 day') from ir) ;

-------------------------------------Solve for P11=ACChargeCurr
select  min(dt), max(dt), count(dt) as '#', avg(OP_Watt),  avg(Ppv1), avg(ACChr_Watt), avg(Bat_Watt), (max(0,  avg(Bat_Watt) / 27)) as P11, max(BatVolt) from ir where dt > (select datetime(max(dt), '-1 day') from ir) ;
--------------------------------------------------------------------------
------------------------------------ram
.open ramdisk/aiox.db
select  min(dt), max(dt), count(dt) as '#', avg(Ppv1),  avg(OP_Watt),  avg(ACChr_Watt),  avg(AC_InWatt), (avg(Bat_Watt))  from ir where dt > (select datetime(max(dt), '-1 day') from ir) ;

select  min(dt), max(dt), count(dt) as '#', min(Ppv1),  min(OP_Watt),  min(ACChr_Watt),  min(AC_InWatt), (min(Bat_Watt))  from ir where dt > (select datetime(max(dt), '-1 day') from ir) ;

select  min(dt), max(dt), count(dt) as '#', max(Ppv1),  max(OP_Watt),  max(ACChr_Watt),  max(AC_InWatt), (max(Bat_Watt))  from ir where dt > (select datetime(max(dt), '-1 day') from ir) ;

-------------------------------------Solve for P11=ACChargeCurr
select  min(dt), max(dt), count(dt) as '#', avg(OP_Watt),  avg(Ppv1), avg(ACChr_Watt), avg(Bat_Watt), (max(0,  avg(Bat_Watt) / 27)) as P11, max(BatVolt) from ir where dt > (select datetime(max(dt), '-1 day') from ir) ;

