From 40bbbc9235a6a3055ea993254045ea63710f8a2b Mon Sep 17 00:00:00 2001 From: "wanling040@gmail.com" Date: Wed, 6 Jul 2022 13:45:48 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=86=E8=AE=8A=E5=99=A8=E4=BA=A4=E5=8F=89?= =?UTF-8?q?=E5=88=86=E6=9E=90-Irradiance=E6=94=B9=E6=88=90IrrDay;=20Invert?= =?UTF-8?q?erHistory=E6=96=B0=E5=A2=9EIrrDay;=20=E6=AF=8F=E6=97=A5?= =?UTF-8?q?=E6=AD=B8=E6=AA=94(=E5=B0=8F=E6=99=82=E3=80=81=E6=97=A5?= =?UTF-8?q?=E3=80=81=E6=9C=88)=20=E6=96=B0=E5=A2=9E=20IrrDay?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/AnalysisInverterController.cs | 32 +++++++++---------- SolarPower/Models/PowerStation.cs | 1 + .../Views/AnalysisInverter/Index.cshtml | 4 +-- solarApp/Service/procInvSvc.cs | 20 ++++++------ 4 files changed, 29 insertions(+), 28 deletions(-) diff --git a/SolarPower/Controllers/AnalysisInverterController.cs b/SolarPower/Controllers/AnalysisInverterController.cs index 4ec49d4..9167117 100644 --- a/SolarPower/Controllers/AnalysisInverterController.cs +++ b/SolarPower/Controllers/AnalysisInverterController.cs @@ -121,7 +121,7 @@ namespace SolarPower.Controllers analysisInverter.XAxis = inverterHistories.Select(x => x.TIMESTAMP).Distinct().ToList(); analysisInverter.MultipleYaxes = new Dictionary(){ - { "Irradiance", "日照度"}, + { "IrrDay", "累積日照量"}, { "DCKW", "直流功率 (KW)"}, { "ACKW", "輸出功率 (KW)"}, { "DC1V", "直流電壓1 (V)"}, @@ -164,22 +164,22 @@ namespace SolarPower.Controllers { var temp_item = item.OrderBy(x => x.TIMESTAMP).ToList(); - InverterHistoryInfo Irradiance = new InverterHistoryInfo(); - Irradiance.Name = string.Format("{0}:{1}", item.First().INVERTERName, "累積日照量"); - Irradiance.YaxesKey = "Irradiance"; - Irradiance.Values = new List(); + InverterHistoryInfo IrrDay = new InverterHistoryInfo(); + IrrDay.Name = string.Format("{0}:{1}", item.First().INVERTERName, "累積日照量"); + IrrDay.YaxesKey = "IrrDay"; + IrrDay.Values = new List(); foreach (var history in temp_item) { if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1) { - Irradiance.Values.Add(Math.Round(history.Irradiance, 2)); + IrrDay.Values.Add(Math.Round(history.IrrDay, 2)); } else { - Irradiance.Values.Add(0); + IrrDay.Values.Add(0); } } - series.Add(Irradiance); + series.Add(IrrDay); InverterHistoryInfo DCKW = new InverterHistoryInfo(); @@ -719,7 +719,7 @@ namespace SolarPower.Controllers analysisInverter.XAxis = inverterHistories.Select(x => x.TIMESTAMP).Distinct().ToList(); analysisInverter.MultipleYaxes = new Dictionary(){ - { "Irradiance", "日照度"}, + { "IrrDay", "累積日照量"}, { "KWH", "KWH"}, { "TodayKWH", "TodayKWH"}, { "TotalKWH", "TotalKWH"}, @@ -738,22 +738,22 @@ namespace SolarPower.Controllers { var temp_item = item.OrderBy(x => x.TIMESTAMP).ToList(); - InverterHistoryInfo Irradiance = new InverterHistoryInfo(); - Irradiance.Name = string.Format("{0}:{1}", item.First().INVERTERName, "日照度"); - Irradiance.YaxesKey = "Irradiance"; - Irradiance.Values = new List(); + InverterHistoryInfo IrrDay = new InverterHistoryInfo(); + IrrDay.Name = string.Format("{0}:{1}", item.First().INVERTERName, "累積日照量"); + IrrDay.YaxesKey = "IrrDay"; + IrrDay.Values = new List(); foreach (var history in temp_item) { if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1) { - Irradiance.Values.Add(Math.Round(history.Irradiance, 2)); + IrrDay.Values.Add(Math.Round(history.IrrDay, 2)); } else { - Irradiance.Values.Add(0); + IrrDay.Values.Add(0); } } - series.Add(Irradiance); + series.Add(IrrDay); InverterHistoryInfo KWH = new InverterHistoryInfo(); KWH.Name = string.Format("{0}:{1}", item.First().INVERTERName, "KWH"); diff --git a/SolarPower/Models/PowerStation.cs b/SolarPower/Models/PowerStation.cs index d4367f6..78d421a 100644 --- a/SolarPower/Models/PowerStation.cs +++ b/SolarPower/Models/PowerStation.cs @@ -756,6 +756,7 @@ namespace SolarPower.Models.PowerStation public string INVERTERID { get; set; } public string INVERTERName { get; set; } public double Irradiance { get; set; } + public double IrrDay { get; set; } public double AC1V { get; set; } public double AC1A { get; set; } public double AC1W { get; set; } diff --git a/SolarPower/Views/AnalysisInverter/Index.cshtml b/SolarPower/Views/AnalysisInverter/Index.cshtml index b18e707..ea7c280 100644 --- a/SolarPower/Views/AnalysisInverter/Index.cshtml +++ b/SolarPower/Views/AnalysisInverter/Index.cshtml @@ -157,7 +157,7 @@ var default_compare_col = []; var current_compare_col = []; var Single_day_compare_col = [ - { key: "Irradiance", title: "累積日照量", default: true }, + { key: "IrrDay", title: "累積日照量", default: true }, { key: "DCKW", title: "直流功率 (KW)", default: false }, { key: "ACKW", title: "輸出功率 (KW)", default: true }, { key: "DC1V", title: "直流電壓1 (V)", default: false }, @@ -189,7 +189,7 @@ { key: "RA5", title: "RA5 (%)", default: false } ] var Range_compare_col = [ - { key: "Irradiance", title: "累積日照量", default: true }, + { key: "IrrDay", title: "累積日照量", default: true }, { key: "KWH", title: "KWH", default: true }, { key: "TodayKWH", title: "TodayKWH", default: false }, { key: "TotalKWH", title: "TotalKWH", default: false }, diff --git a/solarApp/Service/procInvSvc.cs b/solarApp/Service/procInvSvc.cs index 1348781..6648938 100644 --- a/solarApp/Service/procInvSvc.cs +++ b/solarApp/Service/procInvSvc.cs @@ -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.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, - 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 (-- 取得該時間區間的KWH 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( - 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 where powerstationID = " + _powerStationID + @" and DATE_FORMAT(`TIMESTAMP`, '%Y-%m-%d') = @date1 )irr on a.reportDate = irr.reportDate @@ -386,8 +386,8 @@ namespace solarApp.Service //# 3. insert ans 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`) - 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` + 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` , IrrDay from Inv_day_" + _powerStationID + @"_s2 a left JOIN( -- 取得整點值PR SELECT concat(left(crdTime, 13), ':00:00') AS reportDate, inv.INVERTERID, inv.PR FROM del_Inv_day_" + _powerStationID + @"_s1 inv @@ -428,11 +428,11 @@ namespace solarApp.Service } 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, 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.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 @@ -454,7 +454,7 @@ namespace solarApp.Service LEFT JOIN " + _siteDB + @".inverter i ON a.INVERTERID = i.InverterId -- 取日照度 ---------------------- 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 where powerstationID = @powerstationID and DATE_FORMAT(a.TIMESTAMP, '%Y-%m-%d') = @date1 and Irradiance <> 0 limit 1 )irr on a.reportDate = irr.reportDate @@ -493,11 +493,11 @@ namespace solarApp.Service sql = @" 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, 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.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 @@ -519,7 +519,7 @@ namespace solarApp.Service LEFT JOIN " + _siteDB + @".inverter i ON a.INVERTERID = i.InverterId -- 取日照度 ---------------------- 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 where powerstationID = @powerstationID and DATE_FORMAT(a.TIMESTAMP, '%Y-%m') = @date1 and Irradiance <> 0 )irr on a.reportDate = irr.reportDate