逆變器交叉分析-Irradiance改成IrrDay; InverterHistory新增IrrDay; 每日歸檔(小時、日、月) 新增 IrrDay

This commit is contained in:
wanling040@gmail.com 2022-07-06 13:45:48 +08:00
parent c25b0e12c0
commit 40bbbc9235
4 changed files with 29 additions and 28 deletions

View File

@ -121,7 +121,7 @@ namespace SolarPower.Controllers
analysisInverter.XAxis = inverterHistories.Select(x => x.TIMESTAMP).Distinct().ToList(); analysisInverter.XAxis = inverterHistories.Select(x => x.TIMESTAMP).Distinct().ToList();
analysisInverter.MultipleYaxes = new Dictionary<string, string>(){ analysisInverter.MultipleYaxes = new Dictionary<string, string>(){
{ "Irradiance", "日照度"}, { "IrrDay", "累積日照量"},
{ "DCKW", "直流功率 (KW)"}, { "DCKW", "直流功率 (KW)"},
{ "ACKW", "輸出功率 (KW)"}, { "ACKW", "輸出功率 (KW)"},
{ "DC1V", "直流電壓1 (V)"}, { "DC1V", "直流電壓1 (V)"},
@ -164,22 +164,22 @@ namespace SolarPower.Controllers
{ {
var temp_item = item.OrderBy(x => x.TIMESTAMP).ToList(); var temp_item = item.OrderBy(x => x.TIMESTAMP).ToList();
InverterHistoryInfo Irradiance = new InverterHistoryInfo(); InverterHistoryInfo IrrDay = new InverterHistoryInfo();
Irradiance.Name = string.Format("{0}:{1}", item.First().INVERTERName, "累積日照量"); IrrDay.Name = string.Format("{0}:{1}", item.First().INVERTERName, "累積日照量");
Irradiance.YaxesKey = "Irradiance"; IrrDay.YaxesKey = "IrrDay";
Irradiance.Values = new List<double>(); IrrDay.Values = new List<double>();
foreach (var history in temp_item) foreach (var history in temp_item)
{ {
if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1) if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1)
{ {
Irradiance.Values.Add(Math.Round(history.Irradiance, 2)); IrrDay.Values.Add(Math.Round(history.IrrDay, 2));
} }
else else
{ {
Irradiance.Values.Add(0); IrrDay.Values.Add(0);
} }
} }
series.Add(Irradiance); series.Add(IrrDay);
InverterHistoryInfo DCKW = new InverterHistoryInfo(); InverterHistoryInfo DCKW = new InverterHistoryInfo();
@ -719,7 +719,7 @@ namespace SolarPower.Controllers
analysisInverter.XAxis = inverterHistories.Select(x => x.TIMESTAMP).Distinct().ToList(); analysisInverter.XAxis = inverterHistories.Select(x => x.TIMESTAMP).Distinct().ToList();
analysisInverter.MultipleYaxes = new Dictionary<string, string>(){ analysisInverter.MultipleYaxes = new Dictionary<string, string>(){
{ "Irradiance", "日照度"}, { "IrrDay", "累積日照量"},
{ "KWH", "KWH"}, { "KWH", "KWH"},
{ "TodayKWH", "TodayKWH"}, { "TodayKWH", "TodayKWH"},
{ "TotalKWH", "TotalKWH"}, { "TotalKWH", "TotalKWH"},
@ -738,22 +738,22 @@ namespace SolarPower.Controllers
{ {
var temp_item = item.OrderBy(x => x.TIMESTAMP).ToList(); var temp_item = item.OrderBy(x => x.TIMESTAMP).ToList();
InverterHistoryInfo Irradiance = new InverterHistoryInfo(); InverterHistoryInfo IrrDay = new InverterHistoryInfo();
Irradiance.Name = string.Format("{0}:{1}", item.First().INVERTERName, "日照度"); IrrDay.Name = string.Format("{0}:{1}", item.First().INVERTERName, "累積日照量");
Irradiance.YaxesKey = "Irradiance"; IrrDay.YaxesKey = "IrrDay";
Irradiance.Values = new List<double>(); IrrDay.Values = new List<double>();
foreach (var history in temp_item) foreach (var history in temp_item)
{ {
if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1) if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1)
{ {
Irradiance.Values.Add(Math.Round(history.Irradiance, 2)); IrrDay.Values.Add(Math.Round(history.IrrDay, 2));
} }
else else
{ {
Irradiance.Values.Add(0); IrrDay.Values.Add(0);
} }
} }
series.Add(Irradiance); series.Add(IrrDay);
InverterHistoryInfo KWH = new InverterHistoryInfo(); InverterHistoryInfo KWH = new InverterHistoryInfo();
KWH.Name = string.Format("{0}:{1}", item.First().INVERTERName, "KWH"); KWH.Name = string.Format("{0}:{1}", item.First().INVERTERName, "KWH");

View File

@ -756,6 +756,7 @@ namespace SolarPower.Models.PowerStation
public string INVERTERID { get; set; } public string INVERTERID { get; set; }
public string INVERTERName { get; set; } public string INVERTERName { get; set; }
public double Irradiance { get; set; } public double Irradiance { get; set; }
public double IrrDay { get; set; }
public double AC1V { get; set; } public double AC1V { get; set; }
public double AC1A { get; set; } public double AC1A { get; set; }
public double AC1W { get; set; } public double AC1W { get; set; }

View File

@ -157,7 +157,7 @@
var default_compare_col = []; var default_compare_col = [];
var current_compare_col = []; var current_compare_col = [];
var Single_day_compare_col = [ var Single_day_compare_col = [
{ key: "Irradiance", title: "累積日照量", default: true }, { key: "IrrDay", title: "累積日照量", default: true },
{ key: "DCKW", title: "直流功率 (KW)", default: false }, { key: "DCKW", title: "直流功率 (KW)", default: false },
{ key: "ACKW", title: "輸出功率 (KW)", default: true }, { key: "ACKW", title: "輸出功率 (KW)", default: true },
{ key: "DC1V", title: "直流電壓1 (V)", default: false }, { key: "DC1V", title: "直流電壓1 (V)", default: false },
@ -189,7 +189,7 @@
{ key: "RA5", title: "RA5 (%)", default: false } { key: "RA5", title: "RA5 (%)", default: false }
] ]
var Range_compare_col = [ var Range_compare_col = [
{ key: "Irradiance", title: "累積日照量", default: true }, { key: "IrrDay", title: "累積日照量", default: true },
{ key: "KWH", title: "KWH", default: true }, { key: "KWH", title: "KWH", default: true },
{ key: "TodayKWH", title: "TodayKWH", default: false }, { key: "TodayKWH", title: "TodayKWH", default: false },
{ key: "TotalKWH", title: "TotalKWH", default: false }, { key: "TotalKWH", title: "TotalKWH", default: false },

View File

@ -349,7 +349,7 @@ namespace solarApp.Service
a.AC3V, a.AC3A, a.AC3W, a.AC3F, a.AC3WH, a.DC1V, a.DC1A, a.DC1W, a.DC1WH, a.DC2V, a.DC2A, a.DC2W, a.DC2WH, a.DC3V, a.DC3A, a.DC3W, a.AC3V, a.AC3A, a.AC3W, a.AC3F, a.AC3WH, a.DC1V, a.DC1A, a.DC1W, a.DC1WH, a.DC2V, a.DC2A, a.DC2W, a.DC2WH, a.DC3V, a.DC3A, a.DC3W,
a.DC3WH, a.DC4V, a.DC4A, a.DC4W, a.DC4WH, a.DC5V, a.DC5A, a.DC5W, a.DC5WH, a.DC3WH, a.DC4V, a.DC4A, a.DC4W, a.DC4WH, a.DC5V, a.DC5A, a.DC5W, a.DC5WH,
a.RA1, a.RA2, a.RA3, a.RA4, a.RA5, a.KWH, a.TODAYKWH, a.TOTALKWH, a.RA1, a.RA2, a.RA3, a.RA4, a.RA5, a.KWH, a.TODAYKWH, a.TOTALKWH,
IFNULL(Irradiance, 0) irr, 0 as PR, ((DC1W + DC2W + DC3W + DC4W + DC5W) / 1000) DCKW, ((AC1W + AC2W + AC3W) / 1000) ACKW, (a.KWH / i.Capacity) AS KWHKWP IFNULL(Irradiance, 0) irr, IFNULL(IrrDay, 0) IrrDay, 0 as PR, ((DC1W + DC2W + DC3W + DC4W + DC5W) / 1000) DCKW, ((AC1W + AC2W + AC3W) / 1000) ACKW, (a.KWH / i.Capacity) AS KWHKWP
from from
(-- KWH (-- KWH
SELECT concat(left(crdTime, 13), ':00:00') reportDate, INVERTERID, SELECT concat(left(crdTime, 13), ':00:00') reportDate, INVERTERID,
@ -368,7 +368,7 @@ namespace solarApp.Service
LEFT JOIN " + _siteDB + @".inverter i ON a.INVERTERID = i.InverterId LEFT JOIN " + _siteDB + @".inverter i ON a.INVERTERID = i.InverterId
-- -------------------- - -- -------------------- -
left join( left join(
select concat(DATE_FORMAT(`TIMESTAMP`, '%Y-%m-%d %H'), ':00:00') AS reportDate, Irradiance select concat(DATE_FORMAT(`TIMESTAMP`, '%Y-%m-%d %H'), ':00:00') AS reportDate, Irradiance, IrrDay
from sensor_history_hour from sensor_history_hour
where powerstationID = " + _powerStationID + @" and DATE_FORMAT(`TIMESTAMP`, '%Y-%m-%d') = @date1 where powerstationID = " + _powerStationID + @" and DATE_FORMAT(`TIMESTAMP`, '%Y-%m-%d') = @date1
)irr on a.reportDate = irr.reportDate )irr on a.reportDate = irr.reportDate
@ -386,8 +386,8 @@ namespace solarApp.Service
//# 3. insert ans //# 3. insert ans
sql = @$" sql = @$"
INSERT INTO solar_master.inverter_history_hour(`powerStationID`, `INVERTERID`, `TIMESTAMP`, `AC1V`, `AC1A`, `AC1W`, `AC1F`, `AC1WH`, `AC2V`, `AC2A`, `AC2W`, `AC2F`, `AC2WH`, `AC3V`, `AC3A`, `AC3W`, `AC3F`, `AC3WH`, `DC1V`, `DC1A`, `DC1W`, `DC1WH`, `DC2V`, `DC2A`, `DC2W`, `DC2WH`, `DC3V`, `DC3A`, `DC3W`, `DC3WH`, `DC4V`, `DC4A`, `DC4W`, `DC4WH`, `DC5V`, `DC5A`, `DC5W`, `DC5WH`, `RA1`, `RA2`, `RA3`, `RA4`, `RA5`, `KWH`, `TODAYKWH`, `TOTALKWH`, `Irradiance`, `PR`, `DCKW`, `ACKW`, `KWHKWP`) INSERT INTO solar_master.inverter_history_hour(`powerStationID`, `INVERTERID`, `TIMESTAMP`, `AC1V`, `AC1A`, `AC1W`, `AC1F`, `AC1WH`, `AC2V`, `AC2A`, `AC2W`, `AC2F`, `AC2WH`, `AC3V`, `AC3A`, `AC3W`, `AC3F`, `AC3WH`, `DC1V`, `DC1A`, `DC1W`, `DC1WH`, `DC2V`, `DC2A`, `DC2W`, `DC2WH`, `DC3V`, `DC3A`, `DC3W`, `DC3WH`, `DC4V`, `DC4A`, `DC4W`, `DC4WH`, `DC5V`, `DC5A`, `DC5W`, `DC5WH`, `RA1`, `RA2`, `RA3`, `RA4`, `RA5`, `KWH`, `TODAYKWH`, `TOTALKWH`, `Irradiance`, `PR`, `DCKW`, `ACKW`, `KWHKWP`, IrrDay)
select `powerStationID`, a.`INVERTERID`, a.`reportDate`, `AC1V`, `AC1A`, `AC1W`, `AC1F`, `AC1WH`, `AC2V`, `AC2A`, `AC2W`, `AC2F`, `AC2WH`, `AC3V`, `AC3A`, `AC3W`, `AC3F`, `AC3WH`, `DC1V`, `DC1A`, `DC1W`, `DC1WH`, `DC2V`, `DC2A`, `DC2W`, `DC2WH`, `DC3V`, `DC3A`, `DC3W`, `DC3WH`, `DC4V`, `DC4A`, `DC4W`, `DC4WH`, `DC5V`, `DC5A`, `DC5W`, `DC5WH`, `RA1`, `RA2`, `RA3`, `RA4`, `RA5`, `KWH`, `TODAYKWH`, `TOTALKWH`, `irr`, inv_pr.`PR`, `DCKW`, `ACKW`, `KWHKWP` select `powerStationID`, a.`INVERTERID`, a.`reportDate`, `AC1V`, `AC1A`, `AC1W`, `AC1F`, `AC1WH`, `AC2V`, `AC2A`, `AC2W`, `AC2F`, `AC2WH`, `AC3V`, `AC3A`, `AC3W`, `AC3F`, `AC3WH`, `DC1V`, `DC1A`, `DC1W`, `DC1WH`, `DC2V`, `DC2A`, `DC2W`, `DC2WH`, `DC3V`, `DC3A`, `DC3W`, `DC3WH`, `DC4V`, `DC4A`, `DC4W`, `DC4WH`, `DC5V`, `DC5A`, `DC5W`, `DC5WH`, `RA1`, `RA2`, `RA3`, `RA4`, `RA5`, `KWH`, `TODAYKWH`, `TOTALKWH`, `irr`, inv_pr.`PR`, `DCKW`, `ACKW`, `KWHKWP` , IrrDay
from Inv_day_" + _powerStationID + @"_s2 a left JOIN( -- PR from Inv_day_" + _powerStationID + @"_s2 a left JOIN( -- PR
SELECT concat(left(crdTime, 13), ':00:00') AS reportDate, inv.INVERTERID, inv.PR SELECT concat(left(crdTime, 13), ':00:00') AS reportDate, inv.INVERTERID, inv.PR
FROM del_Inv_day_" + _powerStationID + @"_s1 inv FROM del_Inv_day_" + _powerStationID + @"_s1 inv
@ -428,11 +428,11 @@ namespace solarApp.Service
} }
sql = @" sql = @"
INSERT INTO solar_master.inverter_history_day(PowerStationId, INVERTERID, TIMESTAMP, Irradiance, AC1V, AC1A, AC1W, AC1F, AC1WH, AC2V, AC2A, AC2W, AC2F, AC2WH, INSERT INTO solar_master.inverter_history_day(PowerStationId, INVERTERID, TIMESTAMP, Irradiance, IrrDay, AC1V, AC1A, AC1W, AC1F, AC1WH, AC2V, AC2A, AC2W, AC2F, AC2WH,
AC3V, AC3A, AC3W, AC3F, AC3WH, DC1V, DC1A, DC1W, DC1WH, DC2V, DC2A, DC2W, DC2WH, DC3V, DC3A, DC3W, AC3V, AC3A, AC3W, AC3F, AC3WH, DC1V, DC1A, DC1W, DC1WH, DC2V, DC2A, DC2W, DC2WH, DC3V, DC3A, DC3W,
DC3WH, DC4V, DC4A, DC4W, DC4WH, DC5V, DC5A, DC5W, DC5WH, PR, RA1, RA2, RA3, RA4, RA5, `DCKW`, `ACKW`, KWH, TODAYKWH, TOTALKWH, KWHKWP) DC3WH, DC4V, DC4A, DC4W, DC4WH, DC5V, DC5A, DC5W, DC5WH, PR, RA1, RA2, RA3, RA4, RA5, `DCKW`, `ACKW`, KWH, TODAYKWH, TOTALKWH, KWHKWP)
SELECT @powerStationID powerStationID, a.INVERTERID, concat(a.reportDate,' 00:00:00') reportDate, IFNULL(Irradiance, 0), a.AC1V, a.AC1A, a.AC1W, a.AC1F, a.AC1WH, a.AC2V, a.AC2A, a.AC2W, a.AC2F, a.AC2WH, SELECT @powerStationID powerStationID, a.INVERTERID, concat(a.reportDate,' 00:00:00') reportDate, IFNULL(Irradiance, 0), IFNULL(IrrDay, 0) IrrDay, a.AC1V, a.AC1A, a.AC1W, a.AC1F, a.AC1WH, a.AC2V, a.AC2A, a.AC2W, a.AC2F, a.AC2WH,
a.AC3V, a.AC3A, a.AC3W, a.AC3F, a.AC3WH, a.DC1V, a.DC1A, a.DC1W, a.DC1WH, a.DC2V, a.DC2A, a.DC2W, a.DC2WH, a.DC3V, a.DC3A, a.DC3W, a.AC3V, a.AC3A, a.AC3W, a.AC3F, a.AC3WH, a.DC1V, a.DC1A, a.DC1W, a.DC1WH, a.DC2V, a.DC2A, a.DC2W, a.DC2WH, a.DC3V, a.DC3A, a.DC3W,
a.DC3WH, a.DC4V, a.DC4A, a.DC4W, a.DC4WH, a.DC5V, a.DC5A, a.DC5W, a.DC5WH, a.PR, a.RA1, a.RA2, a.RA3, a.RA4, a.RA5, a.DC3WH, a.DC4V, a.DC4A, a.DC4W, a.DC4WH, a.DC5V, a.DC5A, a.DC5W, a.DC5WH, a.PR, a.RA1, a.RA2, a.RA3, a.RA4, a.RA5,
DCKW, ACKW, a.KWH, a.TODAYKWH, a.TOTALKWH, (a.KWH / i.Capacity) AS KWHKWP DCKW, ACKW, a.KWH, a.TODAYKWH, a.TOTALKWH, (a.KWH / i.Capacity) AS KWHKWP
@ -454,7 +454,7 @@ namespace solarApp.Service
LEFT JOIN " + _siteDB + @".inverter i ON a.INVERTERID = i.InverterId LEFT JOIN " + _siteDB + @".inverter i ON a.INVERTERID = i.InverterId
-- ---------------------- -- ----------------------
left join ( left join (
select DATE_FORMAT(a.TIMESTAMP, '%Y-%m-%d') AS reportDate, Irradiance select DATE_FORMAT(a.TIMESTAMP, '%Y-%m-%d') AS reportDate, Irradiance, IrrDay
from sensor_history_day a from sensor_history_day a
where powerstationID = @powerstationID and DATE_FORMAT(a.TIMESTAMP, '%Y-%m-%d') = @date1 and Irradiance <> 0 limit 1 where powerstationID = @powerstationID and DATE_FORMAT(a.TIMESTAMP, '%Y-%m-%d') = @date1 and Irradiance <> 0 limit 1
)irr on a.reportDate = irr.reportDate )irr on a.reportDate = irr.reportDate
@ -493,11 +493,11 @@ namespace solarApp.Service
sql = @" sql = @"
delete from inverter_history_month where powerstationID = @powerStationID and left(`TIMESTAMP`, 7) = left(@date1, 7) ; delete from inverter_history_month where powerstationID = @powerStationID and left(`TIMESTAMP`, 7) = left(@date1, 7) ;
INSERT INTO solar_master.inverter_history_month (PowerStationId, INVERTERID, TIMESTAMP, Irradiance, AC1V, AC1A, AC1W, AC1F, AC1WH, AC2V, AC2A, AC2W, AC2F, AC2WH, INSERT INTO solar_master.inverter_history_month (PowerStationId, INVERTERID, TIMESTAMP, Irradiance, IrrDay, AC1V, AC1A, AC1W, AC1F, AC1WH, AC2V, AC2A, AC2W, AC2F, AC2WH,
AC3V, AC3A, AC3W, AC3F, AC3WH, DC1V, DC1A, DC1W, DC1WH, DC2V, DC2A, DC2W, DC2WH, DC3V, DC3A, DC3W, AC3V, AC3A, AC3W, AC3F, AC3WH, DC1V, DC1A, DC1W, DC1WH, DC2V, DC2A, DC2W, DC2WH, DC3V, DC3A, DC3W,
DC3WH, DC4V, DC4A, DC4W, DC4WH, DC5V, DC5A, DC5W, DC5WH, PR, RA1, RA2, RA3, RA4, RA5, `DCKW`, `ACKW`, KWH, TODAYKWH, TOTALKWH, KWHKWP) DC3WH, DC4V, DC4A, DC4W, DC4WH, DC5V, DC5A, DC5W, DC5WH, PR, RA1, RA2, RA3, RA4, RA5, `DCKW`, `ACKW`, KWH, TODAYKWH, TOTALKWH, KWHKWP)
SELECT @powerStationID powerStationID, a.INVERTERID, concat(a.reportDate,'-01 00:00:00') reportDate, IFNULL(Irradiance, 0), a.AC1V, a.AC1A, a.AC1W, a.AC1F, a.AC1WH, a.AC2V, a.AC2A, a.AC2W, a.AC2F, a.AC2WH, SELECT @powerStationID powerStationID, a.INVERTERID, concat(a.reportDate,'-01 00:00:00') reportDate, IFNULL(Irradiance, 0), IFNULL(IrrDay, 0), a.AC1V, a.AC1A, a.AC1W, a.AC1F, a.AC1WH, a.AC2V, a.AC2A, a.AC2W, a.AC2F, a.AC2WH,
a.AC3V, a.AC3A, a.AC3W, a.AC3F, a.AC3WH, a.DC1V, a.DC1A, a.DC1W, a.DC1WH, a.DC2V, a.DC2A, a.DC2W, a.DC2WH, a.DC3V, a.DC3A, a.DC3W, a.AC3V, a.AC3A, a.AC3W, a.AC3F, a.AC3WH, a.DC1V, a.DC1A, a.DC1W, a.DC1WH, a.DC2V, a.DC2A, a.DC2W, a.DC2WH, a.DC3V, a.DC3A, a.DC3W,
a.DC3WH, a.DC4V, a.DC4A, a.DC4W, a.DC4WH, a.DC5V, a.DC5A, a.DC5W, a.DC5WH, a.PR, a.RA1, a.RA2, a.RA3, a.RA4, a.RA5, DCKW, ACKW, a.KWH, a.TODAYKWH, a.TOTALKWH, a.DC3WH, a.DC4V, a.DC4A, a.DC4W, a.DC4WH, a.DC5V, a.DC5A, a.DC5W, a.DC5WH, a.PR, a.RA1, a.RA2, a.RA3, a.RA4, a.RA5, DCKW, ACKW, a.KWH, a.TODAYKWH, a.TOTALKWH,
(a.KWH / i.Capacity) AS KWHKWP (a.KWH / i.Capacity) AS KWHKWP
@ -519,7 +519,7 @@ namespace solarApp.Service
LEFT JOIN " + _siteDB + @".inverter i ON a.INVERTERID = i.InverterId LEFT JOIN " + _siteDB + @".inverter i ON a.INVERTERID = i.InverterId
-- ---------------------- -- ----------------------
left join ( left join (
select DATE_FORMAT(a.TIMESTAMP, '%Y-%m') AS reportDate, Irradiance select DATE_FORMAT(a.TIMESTAMP, '%Y-%m') AS reportDate, Irradiance, IrrDay
from sensor_history_month a from sensor_history_month a
where powerstationID = @powerstationID and DATE_FORMAT(a.TIMESTAMP, '%Y-%m') = @date1 and Irradiance <> 0 where powerstationID = @powerstationID and DATE_FORMAT(a.TIMESTAMP, '%Y-%m') = @date1 and Irradiance <> 0
)irr on a.reportDate = irr.reportDate )irr on a.reportDate = irr.reportDate