This commit is contained in:
Kai 2021-09-22 10:33:21 +08:00
commit 8c7bc8e5f8
3 changed files with 35 additions and 10 deletions

View File

@ -605,7 +605,7 @@ namespace SolarPower.Repository.Implement
//range2 = $" DATE_FORMAT(C.TIMESTAMP,'%Y') = '{post.HistoryRange}'"; //range2 = $" DATE_FORMAT(C.TIMESTAMP,'%Y') = '{post.HistoryRange}'";
break; break;
case 3: case 3:
select = "DATE_FORMAT(V.TIMESTAMP,'%Y') AS TIMESTAMP, MAX(KWH) AS KWH, SUM(SOLARHOUR) AS SOLARHOUR, SUM(SOLARHOUR-PSValue) AS DiffSOLARHOUR, AVG(PR) AS PR, AVG(Irradiance) AS Irradiance, AVG(Temp) AS Temp"; select = "DATE_FORMAT(V.TIMESTAMP,'%Y') AS TIMESTAMP, MAX(KWH) AS KWH, SUM(SOLARHOUR) AS SOLARHOUR, SUM(SOLARHOUR-PSValue) AS DiffSOLARHOUR, AVG(PR) AS PR, AVG(Irradiance) AS Irradiance, AVG(Temp) AS Temp ,AVG(KWHKWP) AS KWHKWP ";
kwh = "C.TOTALKWH"; kwh = "C.TOTALKWH";
usedb = "power_station_history_month"; usedb = "power_station_history_month";
pyrdb = "sensor_history_month"; pyrdb = "sensor_history_month";

View File

@ -2398,6 +2398,12 @@
var listpr = new Array(0); var listpr = new Array(0);
var color = rgba(1); var color = rgba(1);
var color2 = rgba(2); var color2 = rgba(2);
var listkwhkwp = new Array(0);
var times = 1;
var ALLkwhkwp = 0;
var kwhkwp = 0;
$.each(rel.data, function (index, val) { $.each(rel.data, function (index, val) {
TimestampALL = val.totaltime; TimestampALL = val.totaltime;
kwhALL += val.kwh; kwhALL += val.kwh;
@ -2405,16 +2411,25 @@
irradianceALL += val.irradiance; irradianceALL += val.irradiance;
prALL = val.pr; prALL = val.pr;
tempALL += val.temp; tempALL += val.temp;
//暫時先執行到這--->取kwhkwp
if (val.length != 0) { if (val.length != 0) {
if (groupType != 6) { if (groupType != 6) {
if (groupType == 0 && kwhkwp < val.kwhkwp.toFixed(2)) {
kwhkwp = val.kwhkwp.toFixed(2);
}
if (groupType != 0) {
ALLkwhkwp += val.kwhkwp;
kwhkwp = (ALLkwhkwp / times).toFixed(2);
times++;
}
diffSOLARHOURALL = val.solarhour; diffSOLARHOURALL = val.solarhour;
$('#HistoryDetailTable').append('<tr>' + $('#HistoryDetailTable').append('<tr>' +
'<td>' + val.timestamp + '</td>' + '<td>' + val.timestamp + '</td>' +
'<td>' + val.kwh.toFixed(2) + '</td>' + '<td>' + val.kwh.toFixed(2) + '</td>' +
'<td>' + val.solarhour.toFixed(2) + '</td>' + '<td>' + val.kwhkwp.toFixed(2) + '</td>' +
'<td>' + val.irradiance.toFixed(2) + '</td>' + '<td>' + val.irradiance.toFixed(2) + '</td>' +
'<td>' + val.pr.toFixed(2) + '</td>' + '<td>' + val.pr.toFixed(2) + '</td>' +
@ -2428,14 +2443,23 @@
listtemperature.push(val.temp.toFixed(2)); listtemperature.push(val.temp.toFixed(2));
listsolarhour.push(val.solarhour.toFixed(2)); listsolarhour.push(val.solarhour.toFixed(2));
listpr.push(val.pr.toFixed(2)); listpr.push(val.pr.toFixed(2));
listkwhkwp.push(val.kwhkwp.toFixed(2));
} }
else else
{ {
if (groupType == 0 && kwhkwp < val.kwhkwp.toFixed(2)) {
kwhkwp = val.kwhkwp.toFixed(2);
}
if (groupType != 0) {
ALLkwhkwp += val.kwhkwp;
kwhkwp = (ALLkwhkwp / times).toFixed(2);
times++;
}
diffSOLARHOURALL += val.diffSOLARHOUR; diffSOLARHOURALL += val.diffSOLARHOUR;
$('#HistoryDetailTable').append('<tr>' + $('#HistoryDetailTable').append('<tr>' +
'<td>' + val.timestamp + '</td>' + '<td>' + val.timestamp + '</td>' +
'<td>' + val.kwh.toFixed(2) + '</td>' + '<td>' + val.kwh.toFixed(2) + '</td>' +
'<td>' + val.diffSOLARHOUR.toFixed(2) + '</td>' + '<td>' + val.kwhkwp.toFixed(2) + '</td>' +
'<td>' + val.irradiance.toFixed(2) + '</td>' + '<td>' + val.irradiance.toFixed(2) + '</td>' +
'<td>' + val.pr.toFixed(2) + '</td>' + '<td>' + val.pr.toFixed(2) + '</td>' +
@ -2449,6 +2473,7 @@
listtemperature.push(val.temp.toFixed(2)); listtemperature.push(val.temp.toFixed(2));
listsolarhour.push(val.solarhour.toFixed(2)); listsolarhour.push(val.solarhour.toFixed(2));
listpr.push(val.pr.toFixed(2)); listpr.push(val.pr.toFixed(2));
listkwhkwp.push(val.kwhkwp.toFixed(2));
} }
@ -2502,11 +2527,11 @@
data: listpr data: listpr
},{ },{
type: 'bar', type: 'bar',
label: '發電小時', label: '有效日照時數',
yAxisID: 'C', yAxisID: 'C',
backgroundColor: 'rgba(165, 165, 165)', backgroundColor: 'rgba(165, 165, 165)',
borderWidth: 1, borderWidth: 1,
data: listsolarhour data: listkwhkwp
},{ },{
type: 'bar', type: 'bar',
backgroundColor: 'rgba(103, 180, 172, 1)', backgroundColor: 'rgba(103, 180, 172, 1)',
@ -2597,7 +2622,7 @@
$('#HistoryTotalTable').append('<tr>' + $('#HistoryTotalTable').append('<tr>' +
'<td>' + TimestampALL + '</td>' + '<td>' + TimestampALL + '</td>' +
'<td>' + kwhALL.toFixed(2) + '</td>' + '<td>' + kwhALL.toFixed(2) + '</td>' +
'<td>' + diffSOLARHOURALL.toFixed(2) + '</td>' + '<td>' + kwhkwp + '</td>' +
'<td>' + irradianceALL.toFixed(2) + '</td>' + '<td>' + irradianceALL.toFixed(2) + '</td>' +
'<td>' + prALL.toFixed(2) + '</td>' + '<td>' + prALL.toFixed(2) + '</td>' +
'<td>' + tempALL.toFixed(2) + '</td>' + '<td>' + tempALL.toFixed(2) + '</td>' +

View File

@ -60,7 +60,7 @@
<tr> <tr>
<th>時間</th> <th>時間</th>
<th>發電量(kWh)</th> <th>發電量(kWh)</th>
<th>發電小時</th> <th>有效日照時數</th>
<th>日照度(kWh/m2)</th> <th>日照度(kWh/m2)</th>
<th>PR(%)</th> <th>PR(%)</th>
<th>溫度(℃)</th> <th>溫度(℃)</th>
@ -84,7 +84,7 @@
<tr> <tr>
<th>時間</th> <th>時間</th>
<th>發電量(kWh)</th> <th>發電量(kWh)</th>
<th>發電小時</th> <th>有效日照時數</th>
<th>日照度(kWh/m2)</th> <th>日照度(kWh/m2)</th>
<th>PR(%)</th> <th>PR(%)</th>
<th>溫度(℃)</th> <th>溫度(℃)</th>