合併電站--日照度
This commit is contained in:
parent
f52935c24f
commit
201ef52151
@ -17,6 +17,8 @@ namespace SolarPower.Models
|
|||||||
public double All_PR { get; set; }//總平均PR
|
public double All_PR { get; set; }//總平均PR
|
||||||
public double Now_Carbon { get; set; }//現減炭
|
public double Now_Carbon { get; set; }//現減炭
|
||||||
public double All_Carbon { get; set; }//總減炭
|
public double All_Carbon { get; set; }//總減炭
|
||||||
|
public double All_irradiance { get; set; }
|
||||||
|
public double Now_irradiance { get; set; }
|
||||||
}
|
}
|
||||||
public class ChartInput
|
public class ChartInput
|
||||||
{
|
{
|
||||||
|
|||||||
@ -17,6 +17,8 @@ namespace SolarPower.Repository.Implement
|
|||||||
tableName = "power_station";
|
tableName = "power_station";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public async Task<AnalysisStationCombine> GetPowerStationInfoList(ChartInput post)
|
public async Task<AnalysisStationCombine> GetPowerStationInfoList(ChartInput post)
|
||||||
{
|
{
|
||||||
var a = new AnalysisStationCombine();
|
var a = new AnalysisStationCombine();
|
||||||
@ -32,7 +34,26 @@ namespace SolarPower.Repository.Implement
|
|||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
string timerange = Convert.ToDateTime(post.Timerange).ToString("yyyy-MM-dd");
|
string timerange = Convert.ToDateTime(post.Timerange).ToString("yyyy-MM-dd");
|
||||||
sql = $@"SELECT m.*,n.*,o.* FROM
|
var today = "";
|
||||||
|
if(timerange == DateTime.Now.ToString("yyyy-MM-dd"))
|
||||||
|
{
|
||||||
|
today = @$" SELECT
|
||||||
|
AVG(a.today_irradiance) AS Now_irradiance
|
||||||
|
FROM
|
||||||
|
power_station a
|
||||||
|
WHERE a.Id IN @ids ";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
today = $@" SELECT
|
||||||
|
AVG(a.Irradiance) AS Now_irradiance
|
||||||
|
FROM
|
||||||
|
sensor_history_day a
|
||||||
|
WHERE a.PowerStationId IN @ids AND DATE_FORMAT(a.TIMESTAMP,'%Y-%m-%d') = '{timerange}'";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sql = $@"SELECT m.*,n.*,o.*,p.* FROM
|
||||||
(
|
(
|
||||||
SELECT
|
SELECT
|
||||||
SUM(TOTALMONEY) AS All_money,
|
SUM(TOTALMONEY) AS All_money,
|
||||||
@ -60,15 +81,40 @@ namespace SolarPower.Repository.Implement
|
|||||||
(
|
(
|
||||||
SELECT
|
SELECT
|
||||||
AVG(avg_kwhkwp) AS All_KWH_KWP,
|
AVG(avg_kwhkwp) AS All_KWH_KWP,
|
||||||
AVG(avg_PR) AS All_PR
|
AVG(avg_PR) AS All_PR,
|
||||||
|
AVG(avg_irradiance) as All_irradiance
|
||||||
from power_station
|
from power_station
|
||||||
WHERE Id IN @ids
|
WHERE Id IN @ids
|
||||||
)
|
)
|
||||||
AS o";
|
AS o,
|
||||||
|
(
|
||||||
|
{today}
|
||||||
|
) AS p";
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
var time = post.Timerange.Split('-');
|
var time = post.Timerange.Split('-');
|
||||||
sql = $@"SELECT m.*,n.*,o.* FROM
|
var ttot = "";
|
||||||
|
if(time[1].Replace(" ","") == DateTime.Now.ToString("yyyy/MM/dd"))
|
||||||
|
{
|
||||||
|
ttot = @$"SELECT
|
||||||
|
AVG(c.Now_irradiance) AS Now_irradiance
|
||||||
|
FROM
|
||||||
|
(SELECT AVG(a.today_irradiance) AS Now_irradiance FROM power_station a WHERE a.Id IN (1)
|
||||||
|
UNION
|
||||||
|
SELECT AVG(b.Irradiance) AS Now_irradiance FROM sensor_history_day b
|
||||||
|
WHERE b.PowerStationId IN (1) AND DATE_FORMAT(b.TIMESTAMP, '%Y/%m/%d') BETWEEN '{time[0].Replace(" ", "")}' AND '{Convert.ToDateTime(time[1].Replace(" ", "")).AddDays(-1).ToString("yyyy/MM/dd")}') c";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ttot = @$" SELECT
|
||||||
|
AVG(a.Irradiance) AS Now_irradiance
|
||||||
|
FROM
|
||||||
|
sensor_history_day a
|
||||||
|
WHERE a.PowerStationId IN @ids AND DATE_FORMAT(a.TIMESTAMP, '%Y/%m/%d') BETWEEN '{time[0].Replace(" ", "")}' AND '{time[1].Replace(" ", "")}'";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sql = $@"SELECT m.*,n.*,o.*,p.* FROM
|
||||||
(
|
(
|
||||||
SELECT
|
SELECT
|
||||||
SUM(TOTALMONEY) AS All_money,
|
SUM(TOTALMONEY) AS All_money,
|
||||||
@ -92,14 +138,18 @@ namespace SolarPower.Repository.Implement
|
|||||||
(
|
(
|
||||||
SELECT
|
SELECT
|
||||||
AVG(avg_kwhkwp) AS All_KWH_KWP,
|
AVG(avg_kwhkwp) AS All_KWH_KWP,
|
||||||
AVG(avg_PR) AS All_PR
|
AVG(avg_PR) AS All_PR,
|
||||||
|
AVG(avg_irradiance) as All_irradiance
|
||||||
from power_station
|
from power_station
|
||||||
WHERE Id IN @ids
|
WHERE Id IN @ids
|
||||||
)
|
)
|
||||||
AS o";
|
AS o,
|
||||||
|
(
|
||||||
|
{ttot}
|
||||||
|
) AS p";
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
sql = $@"SELECT m.*,n.*,o.* FROM
|
sql = $@"SELECT m.*,n.*,o.*,p.* FROM
|
||||||
(
|
(
|
||||||
SELECT
|
SELECT
|
||||||
SUM(TOTALMONEY) AS All_money,
|
SUM(TOTALMONEY) AS All_money,
|
||||||
@ -123,14 +173,21 @@ namespace SolarPower.Repository.Implement
|
|||||||
(
|
(
|
||||||
SELECT
|
SELECT
|
||||||
AVG(avg_kwhkwp) AS All_KWH_KWP,
|
AVG(avg_kwhkwp) AS All_KWH_KWP,
|
||||||
AVG(avg_PR) AS All_PR
|
AVG(avg_PR) AS All_PR,
|
||||||
|
AVG(avg_irradiance) as All_irradiance
|
||||||
from power_station
|
from power_station
|
||||||
WHERE Id IN @ids
|
WHERE Id IN @ids
|
||||||
)
|
)
|
||||||
AS o";
|
AS o,
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
AVG(a.Irradiance) AS Now_irradiance
|
||||||
|
from sensor_history_month a
|
||||||
|
WHERE PowerStationId IN @ids AND DATE_FORMAT(TIMESTAMP, '%Y-%m') = '{post.Timerange}'
|
||||||
|
) AS p";
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
sql = $@"SELECT m.*,n.*,o.* FROM
|
sql = $@"SELECT m.*,n.*,o.*,p.* FROM
|
||||||
(
|
(
|
||||||
SELECT
|
SELECT
|
||||||
SUM(TOTALMONEY) AS All_money,
|
SUM(TOTALMONEY) AS All_money,
|
||||||
@ -155,11 +212,18 @@ namespace SolarPower.Repository.Implement
|
|||||||
(
|
(
|
||||||
SELECT
|
SELECT
|
||||||
AVG(avg_kwhkwp) AS All_KWH_KWP,
|
AVG(avg_kwhkwp) AS All_KWH_KWP,
|
||||||
AVG(avg_PR) AS All_PR
|
AVG(avg_PR) AS All_PR,
|
||||||
|
AVG(avg_irradiance) as All_irradiance
|
||||||
from power_station
|
from power_station
|
||||||
WHERE Id IN @ids
|
WHERE Id IN @ids
|
||||||
)
|
)
|
||||||
AS o";
|
AS o,
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
AVG(a.Irradiance) AS Now_irradiance
|
||||||
|
from sensor_history_month a
|
||||||
|
WHERE PowerStationId IN @ids AND DATE_FORMAT(TIMESTAMP, '%Y') = '{post.Timerange}'
|
||||||
|
) AS p";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -111,6 +111,25 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header bg-fusion-25 pr-3 d-flex align-items-center flex-wrap">
|
||||||
|
<h4 class="mb-0 font-weight-bold"><span class="fal fa-sun mr-1"></span> 日照度</h4>
|
||||||
|
<div class="ml-auto">k W/m<sup>2</sup></div>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="d-flex justify-content-between">
|
||||||
|
<p id="today_irradiance_label">當日日照度</p>
|
||||||
|
<p><span class="color-info-700 fs-xl font-weight-bold" id="today_irradiance">0.00</span></p>
|
||||||
|
</div>
|
||||||
|
<div class="d-flex justify-content-between">
|
||||||
|
<p>平均日照度(30天)</p>
|
||||||
|
<p><span class="color-info-700 fs-xl font-weight-bold" id="total_irradiance">0.00</span></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-header bg-fusion-25 pr-3 d-flex align-items-center flex-wrap">
|
<div class="card-header bg-fusion-25 pr-3 d-flex align-items-center flex-wrap">
|
||||||
<h4 class="mb-0 font-weight-bold"><span class="fal fa-bolt mr-1"></span> PR值</h4>
|
<h4 class="mb-0 font-weight-bold"><span class="fal fa-bolt mr-1"></span> PR值</h4>
|
||||||
@ -309,7 +328,7 @@
|
|||||||
$("#today_kwhkwp_label").html(timename + "有效日照時數");
|
$("#today_kwhkwp_label").html(timename + "有效日照時數");
|
||||||
$("#today_PR_label").html(timename + "PR值");
|
$("#today_PR_label").html(timename + "PR值");
|
||||||
$("#today_carbon_label").html(timename + "減碳量");
|
$("#today_carbon_label").html(timename + "減碳量");
|
||||||
|
$("#today_irradiance_label").html(timename + "日照度");
|
||||||
|
|
||||||
if (type == 1) {
|
if (type == 1) {
|
||||||
timerange = $('#DateGettext').val();
|
timerange = $('#DateGettext').val();
|
||||||
@ -411,7 +430,7 @@
|
|||||||
$('#total_kwhkwp').html(rel.data.all_KWH_KWP.toFixed(2));
|
$('#total_kwhkwp').html(rel.data.all_KWH_KWP.toFixed(2));
|
||||||
$('#total_PR').html(rel.data.all_PR.toFixed(2));
|
$('#total_PR').html(rel.data.all_PR.toFixed(2));
|
||||||
$('#total_carbon').html(rel.data.all_Carbon.toFixed(2));
|
$('#total_carbon').html(rel.data.all_Carbon.toFixed(2));
|
||||||
$('#total_irradiance').html(rel.data.all_Carbon.toFixed(2));
|
$('#total_irradiance').html(rel.data.all_irradiance.toFixed(2));
|
||||||
|
|
||||||
|
|
||||||
$('#today_kwh').html(rel.data.now_kwh.toFixed(2));
|
$('#today_kwh').html(rel.data.now_kwh.toFixed(2));
|
||||||
@ -419,7 +438,7 @@
|
|||||||
$('#today_kwhkwp').html(rel.data.now_KWH_KWP.toFixed(2));
|
$('#today_kwhkwp').html(rel.data.now_KWH_KWP.toFixed(2));
|
||||||
$('#today_PR').html(rel.data.now_PR.toFixed(2));
|
$('#today_PR').html(rel.data.now_PR.toFixed(2));
|
||||||
$('#today_carbon').html(rel.data.now_Carbon.toFixed(2));
|
$('#today_carbon').html(rel.data.now_Carbon.toFixed(2));
|
||||||
$('#today_irradiance').html(rel.data.now_Carbon.toFixed(2));
|
$('#today_irradiance').html(rel.data.now_irradiance.toFixed(2));
|
||||||
chart();
|
chart();
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@ -36,7 +36,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="d-flex justify-content-between">
|
<div class="d-flex justify-content-between">
|
||||||
<p>即時平均日照度</p>
|
<p>即時日照度</p>
|
||||||
<p><span class="color-info-700 fs-xl font-weight-bold" id="today_irradiance">0.00</span></p>
|
<p><span class="color-info-700 fs-xl font-weight-bold" id="today_irradiance">0.00</span></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="d-flex justify-content-between">
|
<div class="d-flex justify-content-between">
|
||||||
@ -52,7 +52,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="d-flex justify-content-between">
|
<div class="d-flex justify-content-between">
|
||||||
<p>即時平均 PR 值</p>
|
<p>今日 PR 值</p>
|
||||||
<p><span class="color-info-700 fs-xl font-weight-bold" id="today_PR">0.00</span></p>
|
<p><span class="color-info-700 fs-xl font-weight-bold" id="today_PR">0.00</span></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="d-flex justify-content-between">
|
<div class="d-flex justify-content-between">
|
||||||
@ -68,7 +68,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="d-flex justify-content-between">
|
<div class="d-flex justify-content-between">
|
||||||
<p>即時平均有效日照時數</p>
|
<p>今日有效日照時數(kwh/kwp)</p>
|
||||||
<p><span class="color-info-700 fs-xl font-weight-bold" id="today_kwhkwp">0.00</span></p>
|
<p><span class="color-info-700 fs-xl font-weight-bold" id="today_kwhkwp">0.00</span></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="d-flex justify-content-between">
|
<div class="d-flex justify-content-between">
|
||||||
@ -279,8 +279,8 @@
|
|||||||
'<div class="row">' +
|
'<div class="row">' +
|
||||||
'<div class="col-12">' +
|
'<div class="col-12">' +
|
||||||
'<div>今日發電量(kW h):' + item.today_kWh + '</div>'+
|
'<div>今日發電量(kW h):' + item.today_kWh + '</div>'+
|
||||||
'<div>今日日照度(k W/m<sup>2</sup>):' + item.today_irradiance + '</div>'+
|
'<div>即時日照度(k W/m<sup>2</sup>):' + item.today_irradiance + '</div>'+
|
||||||
'<div>今日發電小時(hr):' + item.solarHour + '</div>' +
|
'<div>有效日照時數(kwh/kwp):' + item.today_kwhkwp.toFixed(2) + '</div>' +
|
||||||
'<div>裝置容量(kWp):' + item.generatingCapacity.toFixed(3) + '</div>' +
|
'<div>裝置容量(kWp):' + item.generatingCapacity.toFixed(3) + '</div>' +
|
||||||
'<div>掛錶日期:' + item.electricityMeterAt + '</div>' +
|
'<div>掛錶日期:' + item.electricityMeterAt + '</div>' +
|
||||||
'<div>天氣:' + item.wx + '</div>'+
|
'<div>天氣:' + item.wx + '</div>'+
|
||||||
|
|||||||
@ -94,7 +94,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="d-flex justify-content-between">
|
<div class="d-flex justify-content-between">
|
||||||
<p>即時平均日照度</p>
|
<p>即時日照度</p>
|
||||||
<p><span class="color-info-700 fs-xl font-weight-bold" id="today_irradiance">0.00</span></p>
|
<p><span class="color-info-700 fs-xl font-weight-bold" id="today_irradiance">0.00</span></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="d-flex justify-content-between">
|
<div class="d-flex justify-content-between">
|
||||||
|
|||||||
@ -39,7 +39,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="d-flex justify-content-between">
|
<div class="d-flex justify-content-between">
|
||||||
<p>即時平均日照度</p>
|
<p>即時日照度</p>
|
||||||
<p><span class="color-info-700 fs-xl font-weight-bold" id="today_irradiance">0.00</span></p>
|
<p><span class="color-info-700 fs-xl font-weight-bold" id="today_irradiance">0.00</span></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="d-flex justify-content-between">
|
<div class="d-flex justify-content-between">
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user