溫度
This commit is contained in:
parent
7a1fcddc3c
commit
c320e282b1
@ -520,7 +520,7 @@ namespace SolarPower.Controllers
|
|||||||
a.TIMESTAMP = Convert.ToDateTime(a.TIMESTAMP).ToString("yyyy-MM");
|
a.TIMESTAMP = Convert.ToDateTime(a.TIMESTAMP).ToString("yyyy-MM");
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
a.TOTALTIME = Convert.ToDateTime(a.TIMESTAMP).ToString("yyyy");
|
a.TOTALTIME = "";
|
||||||
a.TIMESTAMP = Convert.ToDateTime(a.TIMESTAMP).ToString("yyyy");
|
a.TIMESTAMP = Convert.ToDateTime(a.TIMESTAMP).ToString("yyyy");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1041,6 +1041,16 @@ ALTER TABLE `device`
|
|||||||
ADD COLUMN `InstallDate` timestamp NULL DEFAULT NULL COMMENT '安裝日期' AFTER `ColName`,
|
ADD COLUMN `InstallDate` timestamp NULL DEFAULT NULL COMMENT '安裝日期' AFTER `ColName`,
|
||||||
DROP COLUMN `Remark`,
|
DROP COLUMN `Remark`,
|
||||||
|
|
||||||
|
-- 新增模組溫度計溫度 20210712
|
||||||
|
ALTER TABLE `pyrheliometer_history_day`
|
||||||
|
ADD COLUMN `Temperature` DECIMAL(5,2) NULL DEFAULT NULL COMMENT '每日平均模組溫度計溫度' AFTER `Irradiance`;
|
||||||
|
|
||||||
|
ALTER TABLE `pyrheliometer_history_hour`
|
||||||
|
ADD COLUMN `Temperature` DECIMAL(5,2) NULL DEFAULT NULL COMMENT '即時模組溫度計溫度' AFTER `Irradiance`;
|
||||||
|
|
||||||
|
ALTER TABLE `pyrheliometer_history_month`
|
||||||
|
ADD COLUMN `Temperature` DECIMAL(5,2) NULL DEFAULT NULL COMMENT '每月平均模組溫度計溫度' AFTER `Irradiance`;
|
||||||
|
|
||||||
|
|
||||||
/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
|
/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
|
||||||
/*!40014 SET FOREIGN_KEY_CHECKS=IFNULL(@OLD_FOREIGN_KEY_CHECKS, 1) */;
|
/*!40014 SET FOREIGN_KEY_CHECKS=IFNULL(@OLD_FOREIGN_KEY_CHECKS, 1) */;
|
||||||
|
|||||||
@ -626,12 +626,14 @@ namespace SolarPower.Models.PowerStation
|
|||||||
public int PowerStationId { get; set; }
|
public int PowerStationId { get; set; }
|
||||||
public string Timestamp { get; set; }
|
public string Timestamp { get; set; }
|
||||||
public double Irradiance { get; set; }
|
public double Irradiance { get; set; }
|
||||||
|
public double Temperature { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class AvgPyrheliometerHistory
|
public class AvgPyrheliometerHistory
|
||||||
{
|
{
|
||||||
public int PowerStationId { get; set; }
|
public int PowerStationId { get; set; }
|
||||||
public double AvgIrradiance { get; set; }
|
public double AvgIrradiance { get; set; }
|
||||||
|
public double AvgTemperature { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class PyrheliometerHistoryDay
|
public class PyrheliometerHistoryDay
|
||||||
|
|||||||
@ -259,7 +259,8 @@ namespace SolarPower.Quartz.Jobs
|
|||||||
{
|
{
|
||||||
"PowerStationId",
|
"PowerStationId",
|
||||||
"Timestamp",
|
"Timestamp",
|
||||||
"Irradiance"
|
"Irradiance",
|
||||||
|
"Temperature"
|
||||||
};
|
};
|
||||||
//每日
|
//每日
|
||||||
await powerStationRepository.AddPyrheliometerHistoryDayList(pyrheliometerHistoryDays, pyrheliometer_history_properties);
|
await powerStationRepository.AddPyrheliometerHistoryDayList(pyrheliometerHistoryDays, pyrheliometer_history_properties);
|
||||||
|
|||||||
@ -33,6 +33,7 @@ namespace SolarPower.Quartz.Jobs
|
|||||||
|
|
||||||
List<PowerStationHistory> powerStationHistoriesHour = new List<PowerStationHistory>();
|
List<PowerStationHistory> powerStationHistoriesHour = new List<PowerStationHistory>();
|
||||||
List<PyrheliometerHistory> pyrheliometerHistoriesHour = new List<PyrheliometerHistory>();
|
List<PyrheliometerHistory> pyrheliometerHistoriesHour = new List<PyrheliometerHistory>();
|
||||||
|
List<PyrheliometerHistory> TempHistoriesHour = new List<PyrheliometerHistory>();
|
||||||
List<InverterHistory> inverterHistories = new List<InverterHistory>();
|
List<InverterHistory> inverterHistories = new List<InverterHistory>();
|
||||||
List<PowerStation> calcPowerStations = new List<PowerStation>();
|
List<PowerStation> calcPowerStations = new List<PowerStation>();
|
||||||
|
|
||||||
@ -140,12 +141,14 @@ namespace SolarPower.Quartz.Jobs
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region step2-2. 取得該電站的當前這小時的日照度歷史資料
|
#region step2-2. 取得該電站的當前這小時的日照度歷史資料
|
||||||
//1. 找出該電站所有日照計設備(包還共享
|
//1. 找出該電站所有日照計設備(包含共享
|
||||||
var deviceInfos = await powerStationRepository.GetListPyrheliometerByPowerStationId(powerStation.Id, powerStation.SiteDB);
|
var deviceInfos = await powerStationRepository.GetListPyrheliometerByPowerStationId(powerStation.Id, powerStation.SiteDB);
|
||||||
|
// 找出該電站所有溫度計設備(包含共享
|
||||||
|
var tempdeviceInfos = await powerStationRepository.GetListTempByPowerStationId(powerStation.Id, powerStation.SiteDB);
|
||||||
if (deviceInfos != null)
|
if (deviceInfos != null)
|
||||||
{
|
{
|
||||||
//2. 計算該電站所有日照計設的每小時的平均在依照日照計數量平均
|
//2. 計算該電站所有日照計設的每小時的平均在依照日照計數量平均
|
||||||
var pyrheliometerHistory = await powerStationRepository.GetPyrheliometerHistoryPerHour(dateTime, deviceInfos);
|
var pyrheliometerHistory = await powerStationRepository.GetPyrheliometerHistoryPerHour(dateTime, deviceInfos,0);
|
||||||
|
|
||||||
if (pyrheliometerHistory != null)
|
if (pyrheliometerHistory != null)
|
||||||
{
|
{
|
||||||
@ -156,6 +159,19 @@ namespace SolarPower.Quartz.Jobs
|
|||||||
pyrheliometerHistoriesHour.Add(pyrheliometerHistory);
|
pyrheliometerHistoriesHour.Add(pyrheliometerHistory);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//2. 計算該電站所有溫度計設的每小時的平均在依照溫度計數量平均
|
||||||
|
if (tempdeviceInfos != null)
|
||||||
|
{
|
||||||
|
var tempHistory = await powerStationRepository.GetPyrheliometerHistoryPerHour(dateTime, tempdeviceInfos, 1);
|
||||||
|
if (tempHistory != null)
|
||||||
|
{
|
||||||
|
tempHistory.Timestamp = Convert.ToDateTime(tempHistory.Timestamp + ":00:00").ToString("yyyy-MM-dd HH:mm:ss");
|
||||||
|
tempHistory.PowerStationId = powerStation.Id;
|
||||||
|
TempHistoriesHour.Add(tempHistory);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region step2-3. 計算該電站所有逆變器每小時值
|
#region step2-3. 計算該電站所有逆變器每小時值
|
||||||
@ -204,6 +220,15 @@ namespace SolarPower.Quartz.Jobs
|
|||||||
};
|
};
|
||||||
|
|
||||||
await powerStationRepository.AddPyrheliometerHistory(pyrheliometerHistoriesHour, pyrheliometer_history_properties);
|
await powerStationRepository.AddPyrheliometerHistory(pyrheliometerHistoriesHour, pyrheliometer_history_properties);
|
||||||
|
|
||||||
|
List<string> Temp_history_properties = new List<string>()
|
||||||
|
{
|
||||||
|
"PowerStationId",
|
||||||
|
"TIMESTAMP",
|
||||||
|
"Temperature"
|
||||||
|
};
|
||||||
|
|
||||||
|
await powerStationRepository.AddTempHistory(TempHistoriesHour, Temp_history_properties);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region step5. calcPowerStations UPDATE 到 power_station 資料表
|
#region step5. calcPowerStations UPDATE 到 power_station 資料表
|
||||||
|
|||||||
@ -527,17 +527,19 @@ namespace SolarPower.Repository.Implement
|
|||||||
(
|
(
|
||||||
SELECT DENSE_RANK() OVER(ORDER BY C.TIMESTAMP) AS ROWID
|
SELECT DENSE_RANK() OVER(ORDER BY C.TIMESTAMP) AS ROWID
|
||||||
, (DENSE_RANK() OVER(ORDER BY C.TIMESTAMP)) - 1 AS PreROWID,
|
, (DENSE_RANK() OVER(ORDER BY C.TIMESTAMP)) - 1 AS PreROWID,
|
||||||
C.TIMESTAMP,{kwh} AS KWH,C.SOLARHOUR,C.PR,P.Irradiance
|
C.TIMESTAMP,{kwh} AS KWH,C.SOLARHOUR,C.PR,P.Irradiance,P.Temperature AS Temp
|
||||||
FROM {usedb} C
|
FROM {usedb} C
|
||||||
LEFT JOIN {pyrdb} P ON DATE_FORMAT(P.TIMESTAMP,'{timeGroup}') = DATE_FORMAT(C.TIMESTAMP,'{timeGroup}') WHERE C.PowerStationId = {post.PowerstationId} GROUP BY C.TIMESTAMP ORDER BY C.TIMESTAMP
|
LEFT JOIN {pyrdb} P ON DATE_FORMAT(P.TIMESTAMP,'{timeGroup}') = DATE_FORMAT(C.TIMESTAMP,'{timeGroup}')
|
||||||
|
WHERE C.PowerStationId = {post.PowerstationId} GROUP BY C.TIMESTAMP ORDER BY C.TIMESTAMP
|
||||||
) A
|
) A
|
||||||
RIGHT OUTER JOIN
|
RIGHT OUTER JOIN
|
||||||
(
|
(
|
||||||
SELECT DENSE_RANK() OVER(ORDER BY C.TIMESTAMP) AS ROWID
|
SELECT DENSE_RANK() OVER(ORDER BY C.TIMESTAMP) AS ROWID
|
||||||
, (DENSE_RANK() OVER(ORDER BY C.TIMESTAMP)) - 1 AS PreROWID,
|
, (DENSE_RANK() OVER(ORDER BY C.TIMESTAMP)) - 1 AS PreROWID,
|
||||||
C.TIMESTAMP,{kwh} AS KWH,C.SOLARHOUR,C.PR,P.Irradiance
|
C.TIMESTAMP,{kwh} AS KWH,C.SOLARHOUR,C.PR,P.Irradiance,P.Temperature AS Temp
|
||||||
FROM {usedb} C
|
FROM {usedb} C
|
||||||
LEFT JOIN {pyrdb} P ON DATE_FORMAT(P.TIMESTAMP,'{timeGroup}') = DATE_FORMAT(C.TIMESTAMP,'{timeGroup}') WHERE C.PowerStationId = {post.PowerstationId} GROUP BY C.TIMESTAMP ORDER BY C.TIMESTAMP
|
LEFT JOIN {pyrdb} P ON DATE_FORMAT(P.TIMESTAMP,'{timeGroup}') = DATE_FORMAT(C.TIMESTAMP,'{timeGroup}')
|
||||||
|
WHERE C.PowerStationId = {post.PowerstationId} GROUP BY C.TIMESTAMP ORDER BY C.TIMESTAMP
|
||||||
) B
|
) B
|
||||||
ON A.ROWID = B.PreROWID
|
ON A.ROWID = B.PreROWID
|
||||||
) V {range}" ;
|
) V {range}" ;
|
||||||
|
|||||||
@ -2176,7 +2176,6 @@ namespace SolarPower.Repository.Implement
|
|||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<List<DeviceInfo>> GetListPyrheliometerByPowerStationId(int powerStationId, string db_name)
|
public async Task<List<DeviceInfo>> GetListPyrheliometerByPowerStationId(int powerStationId, string db_name)
|
||||||
{
|
{
|
||||||
List<DeviceInfo> result;
|
List<DeviceInfo> result;
|
||||||
@ -2203,6 +2202,7 @@ namespace SolarPower.Repository.Implement
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//(有新增)
|
||||||
public async Task<List<DeviceInfo>> GetListTempByPowerStationId(int powerStationId, string db_name)
|
public async Task<List<DeviceInfo>> GetListTempByPowerStationId(int powerStationId, string db_name)
|
||||||
{
|
{
|
||||||
List<DeviceInfo> result;
|
List<DeviceInfo> result;
|
||||||
@ -2212,12 +2212,12 @@ namespace SolarPower.Repository.Implement
|
|||||||
{
|
{
|
||||||
var sql = $@"SELECT *
|
var sql = $@"SELECT *
|
||||||
FROM {db_name}.device d
|
FROM {db_name}.device d
|
||||||
WHERE d.PowerStationId = @PowerStationId AND d.`Type` = 'PYR' AND d.Deleted = 0
|
WHERE d.PowerStationId = @PowerStationId AND d.`Type` = 'MTR' AND d.Deleted = 0
|
||||||
UNION
|
UNION
|
||||||
SELECT d.*
|
SELECT d.*
|
||||||
FROM {db_name}.sharedevice sd
|
FROM {db_name}.sharedevice sd
|
||||||
LEFT JOIN {db_name}.device d ON sd.DeviceId = d.Id
|
LEFT JOIN {db_name}.device d ON sd.DeviceId = d.Id
|
||||||
WHERE sd.PowerStationId = @PowerStationId AND d.`Type` = 'PYR' AND d.Deleted = 0
|
WHERE sd.PowerStationId = @PowerStationId AND d.`Type` = 'MTR' AND d.Deleted = 0
|
||||||
";
|
";
|
||||||
|
|
||||||
result = (await conn.QueryAsync<DeviceInfo>(sql, new { PowerStationId = powerStationId })).ToList();
|
result = (await conn.QueryAsync<DeviceInfo>(sql, new { PowerStationId = powerStationId })).ToList();
|
||||||
@ -2229,9 +2229,18 @@ namespace SolarPower.Repository.Implement
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//(有修改)
|
||||||
public async Task<PyrheliometerHistory> GetPyrheliometerHistoryPerHour(string dateTime, List<DeviceInfo> deviceInfos)
|
public async Task<PyrheliometerHistory> GetPyrheliometerHistoryPerHour(string dateTime, List<DeviceInfo> deviceInfos,int type)
|
||||||
{
|
{
|
||||||
|
var typename = "";
|
||||||
|
if(type == 1)
|
||||||
|
{
|
||||||
|
typename = "Temperature";//1為溫度計
|
||||||
|
}
|
||||||
|
else if (type == 0)
|
||||||
|
{
|
||||||
|
typename = "Irradiance";//0為日照計
|
||||||
|
}
|
||||||
PyrheliometerHistory result;
|
PyrheliometerHistory result;
|
||||||
using (IDbConnection conn = this._databaseHelper.GetConnection())
|
using (IDbConnection conn = this._databaseHelper.GetConnection())
|
||||||
{
|
{
|
||||||
@ -2249,7 +2258,7 @@ namespace SolarPower.Repository.Implement
|
|||||||
sql_per_device.Add(str);
|
sql_per_device.Add(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
var sql = @"SELECT a.TIMESTAMP, AVG(a.SENSOR) AS Irradiance FROM(" + string.Join(" UNION ", sql_per_device) + @") a GROUP BY TIMESTAMP";
|
var sql = @$"SELECT a.TIMESTAMP, AVG(a.SENSOR) AS {typename} FROM(" + string.Join(" UNION ", sql_per_device) + @") a GROUP BY TIMESTAMP";
|
||||||
|
|
||||||
result = await conn.QueryFirstOrDefaultAsync<PyrheliometerHistory>(sql, new { DateTime = dateTime });
|
result = await conn.QueryFirstOrDefaultAsync<PyrheliometerHistory>(sql, new { DateTime = dateTime });
|
||||||
}
|
}
|
||||||
@ -2291,6 +2300,37 @@ namespace SolarPower.Repository.Implement
|
|||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//(有新增)
|
||||||
|
public async Task<int> AddTempHistory(List<PyrheliometerHistory> entity, List<string> properties)
|
||||||
|
{
|
||||||
|
int count;
|
||||||
|
using (IDbConnection conn = _databaseHelper.GetConnection())
|
||||||
|
{
|
||||||
|
conn.Open();
|
||||||
|
using (var trans = conn.BeginTransaction())
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string sql = GenerateUpdateQueryWithCustomTableAndWHERE(properties, "pyrheliometer_history_hour", "PowerStationId = @PowerStationId AND TIMESTAMP = @Timestamp");
|
||||||
|
|
||||||
|
count = await conn.ExecuteAsync(sql, entity, trans);
|
||||||
|
|
||||||
|
trans.Commit();
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
trans.Rollback();
|
||||||
|
throw exception;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
conn.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public async Task<AvgPyrheliometerHistory> CalcAvgPyrheliometerHistory30day(string nowDay, int powerStationId)
|
public async Task<AvgPyrheliometerHistory> CalcAvgPyrheliometerHistory30day(string nowDay, int powerStationId)
|
||||||
{
|
{
|
||||||
@ -2329,7 +2369,8 @@ namespace SolarPower.Repository.Implement
|
|||||||
var sql = $@"SELECT
|
var sql = $@"SELECT
|
||||||
PowerStationId,
|
PowerStationId,
|
||||||
DATE_FORMAT(p.TIMESTAMP, '%Y-%m-%d') AS TIMESTAMP,
|
DATE_FORMAT(p.TIMESTAMP, '%Y-%m-%d') AS TIMESTAMP,
|
||||||
AVG(p.Irradiance) AS AvgIrradiance
|
AVG(p.Irradiance) AS Irradiance,
|
||||||
|
AVG(p.Temperature) AS Temperature
|
||||||
FROM pyrheliometer_history_hour p
|
FROM pyrheliometer_history_hour p
|
||||||
WHERE DATE_FORMAT(p.TIMESTAMP, '%Y-%m-%d') = @NowDay
|
WHERE DATE_FORMAT(p.TIMESTAMP, '%Y-%m-%d') = @NowDay
|
||||||
AND p.Irradiance != 0
|
AND p.Irradiance != 0
|
||||||
@ -2388,7 +2429,8 @@ namespace SolarPower.Repository.Implement
|
|||||||
var sql = $@"SELECT
|
var sql = $@"SELECT
|
||||||
PowerStationId,
|
PowerStationId,
|
||||||
DATE_FORMAT(p.TIMESTAMP, '%Y-%m') AS TIMESTAMP,
|
DATE_FORMAT(p.TIMESTAMP, '%Y-%m') AS TIMESTAMP,
|
||||||
AVG(p.Irradiance) AS Irradiance
|
AVG(p.Irradiance) AS Irradiance,
|
||||||
|
AVG(p.Temperature) AS Temperature
|
||||||
FROM pyrheliometer_history_hour p
|
FROM pyrheliometer_history_hour p
|
||||||
WHERE DATE_FORMAT(p.TIMESTAMP, '%Y-%m') = @Month
|
WHERE DATE_FORMAT(p.TIMESTAMP, '%Y-%m') = @Month
|
||||||
AND p.Irradiance != 0
|
AND p.Irradiance != 0
|
||||||
@ -2467,10 +2509,11 @@ namespace SolarPower.Repository.Implement
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
string sql = @"UPDATE pyrheliometer_history_month SET
|
string sql = @"UPDATE pyrheliometer_history_month SET
|
||||||
Irradiance=@Irradiance
|
Irradiance=@Irradiance,
|
||||||
|
Temperature=@Temperature
|
||||||
WHERE PowerStationId = @PowerStationId
|
WHERE PowerStationId = @PowerStationId
|
||||||
AND TIMESTAMP LIKE CONCAT(@TIMESTAMP, '%')
|
AND TIMESTAMP LIKE CONCAT(@TIMESTAMP, '%')
|
||||||
";
|
";
|
||||||
|
|
||||||
count = await conn.ExecuteAsync(sql, entity, trans);
|
count = await conn.ExecuteAsync(sql, entity, trans);
|
||||||
|
|
||||||
|
|||||||
@ -555,6 +555,30 @@ namespace SolarPower.Repository.Implement
|
|||||||
|
|
||||||
return updateQuery.ToString();
|
return updateQuery.ToString();
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 產生Update語句,可選擇自己要加入資料表,填入想要的WHERE條件
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="properties"></param>
|
||||||
|
/// <param name="table_name"></param>
|
||||||
|
/// <param name="WHERE"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
protected string GenerateUpdateQueryWithCustomTableAndWHERE(List<string> properties, string table_name,string WHERE)
|
||||||
|
{
|
||||||
|
var updateQuery = new StringBuilder($"UPDATE {table_name} SET ");
|
||||||
|
|
||||||
|
properties.ForEach(property =>
|
||||||
|
{
|
||||||
|
if (!property.Equals("Id"))
|
||||||
|
{
|
||||||
|
updateQuery.Append($"{property}=@{property},");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
updateQuery.Remove(updateQuery.Length - 1, 1); //remove last comma
|
||||||
|
updateQuery.Append($" WHERE {WHERE}");
|
||||||
|
|
||||||
|
return updateQuery.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
protected string GenerateUpdateQueryWithCustomDBNameAndTable(List<string> properties, string db_name, string table_name)
|
protected string GenerateUpdateQueryWithCustomDBNameAndTable(List<string> properties, string db_name, string table_name)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -494,7 +494,9 @@ namespace SolarPower.Repository.Interface
|
|||||||
Task<List<PowerstationOption>> GetPowerstationPyrheliometerAsync(string db_name, int stationId);
|
Task<List<PowerstationOption>> GetPowerstationPyrheliometerAsync(string db_name, int stationId);
|
||||||
|
|
||||||
Task<List<DeviceInfo>> GetListPyrheliometerByPowerStationId(int powerStationId, string db_name);
|
Task<List<DeviceInfo>> GetListPyrheliometerByPowerStationId(int powerStationId, string db_name);
|
||||||
Task<PyrheliometerHistory> GetPyrheliometerHistoryPerHour(string dateTime, List<DeviceInfo> deviceInfos);
|
Task<List<DeviceInfo>> GetListTempByPowerStationId(int powerStationId, string db_name);
|
||||||
|
Task<PyrheliometerHistory> GetPyrheliometerHistoryPerHour(string dateTime, List<DeviceInfo> deviceInfos,int Type);
|
||||||
|
Task<int> AddTempHistory(List<PyrheliometerHistory> entity, List<string> properties);
|
||||||
Task<int> AddPyrheliometerHistory(List<PyrheliometerHistory> entity, List<string> properties);
|
Task<int> AddPyrheliometerHistory(List<PyrheliometerHistory> entity, List<string> properties);
|
||||||
Task<AvgPyrheliometerHistory> CalcAvgPyrheliometerHistory30day(string nowDay, int powerStationId);
|
Task<AvgPyrheliometerHistory> CalcAvgPyrheliometerHistory30day(string nowDay, int powerStationId);
|
||||||
Task<PyrheliometerHistory> CalcPyrheliometerHistoryDayDataByPowerStationId(string nowDay, int powerStationId);
|
Task<PyrheliometerHistory> CalcPyrheliometerHistoryDayDataByPowerStationId(string nowDay, int powerStationId);
|
||||||
|
|||||||
@ -109,7 +109,7 @@ namespace SolarPower
|
|||||||
#region 計算電站日照量、PR、kWP 30日平均、(每天凌晨2點執行)
|
#region 計算電站日照量、PR、kWP 30日平均、(每天凌晨2點執行)
|
||||||
services.AddSingleton<CalcAvgPowerStationJob>();
|
services.AddSingleton<CalcAvgPowerStationJob>();
|
||||||
services.AddSingleton(
|
services.AddSingleton(
|
||||||
new JobSchedule(jobType: typeof(CalcAvgPowerStationJob), cronExpression: "0 0 2 * * ?")
|
new JobSchedule(jobType: typeof(CalcAvgPowerStationJob), cronExpression: "0 0 2 * * ?")
|
||||||
//new JobSchedule(jobType: typeof(CalcAvgPowerStationJob), cronExpression: "0/10 * * * * ?")
|
//new JobSchedule(jobType: typeof(CalcAvgPowerStationJob), cronExpression: "0/10 * * * * ?")
|
||||||
);
|
);
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@ -1985,14 +1985,19 @@
|
|||||||
var diffSOLARHOURALL = 0;
|
var diffSOLARHOURALL = 0;
|
||||||
var irradianceALL = 0;
|
var irradianceALL = 0;
|
||||||
var prALL;
|
var prALL;
|
||||||
var tempALL;
|
var tempALL = 0;
|
||||||
|
var listmonth = new Array(0);
|
||||||
|
var listkwh = new Array(0);
|
||||||
|
var listcolor = new Array(0);
|
||||||
|
var listirradiance = new Array(0);
|
||||||
|
var color = rgba(1);
|
||||||
$.each(rel.data, function (index, val) {
|
$.each(rel.data, function (index, val) {
|
||||||
TimestampALL = val.totaltime;
|
TimestampALL = val.totaltime;
|
||||||
kwhALL += val.kwh;
|
kwhALL += val.kwh;
|
||||||
diffSOLARHOURALL += val.diffSOLARHOUR;
|
diffSOLARHOURALL += val.diffSOLARHOUR;
|
||||||
irradianceALL += val.irradiance;
|
irradianceALL += val.irradiance;
|
||||||
prALL = val.pr;
|
prALL = val.pr;
|
||||||
tempALL = val.temp;
|
tempALL += val.temp;
|
||||||
if (val.length != 0) {
|
if (val.length != 0) {
|
||||||
$('#HistoryDetailTable').append('<tr>' +
|
$('#HistoryDetailTable').append('<tr>' +
|
||||||
'<td>' + val.timestamp + '</td>' +
|
'<td>' + val.timestamp + '</td>' +
|
||||||
@ -2002,8 +2007,49 @@
|
|||||||
'<td>' + val.pr + '</td>' +
|
'<td>' + val.pr + '</td>' +
|
||||||
'<td>' + val.temp + '</td>' +
|
'<td>' + val.temp + '</td>' +
|
||||||
'</tr>');
|
'</tr>');
|
||||||
|
listmonth.push(val.timestamp);
|
||||||
|
listkwh.push(val.kwh);
|
||||||
|
listcolor.push(color);
|
||||||
|
listirradiance.push(val.irradiance);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
tempALL = tempALL / rel.data.length;
|
||||||
|
$('#history-kWh-convas-div').empty();
|
||||||
|
$('#history-kWh-convas-div').append('<canvas id="history-kWh"></canvas>');
|
||||||
|
var ctx_history_kWh = document.getElementById('history-kWh').getContext('2d');
|
||||||
|
var myhistorykwh = new Chart(ctx_history_kWh, {
|
||||||
|
type: 'bar',
|
||||||
|
data: {
|
||||||
|
labels: listmonth,
|
||||||
|
datasets: [{
|
||||||
|
backgroundColor: listcolor,
|
||||||
|
borderColor: listcolor,
|
||||||
|
borderWidth: 1,
|
||||||
|
label: '發電量(kWh)',
|
||||||
|
data: listkwh
|
||||||
|
}, {
|
||||||
|
type: 'line',
|
||||||
|
label: '日照度(kWh/m2)',
|
||||||
|
fill: false,
|
||||||
|
data: listirradiance
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
options: {
|
||||||
|
title: {
|
||||||
|
display: true,
|
||||||
|
text: '發電量(kWh)'
|
||||||
|
},
|
||||||
|
legend: {
|
||||||
|
display: true,
|
||||||
|
position: 'bottom'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (rel.data.length == 0) {
|
if (rel.data.length == 0) {
|
||||||
$('#HistoryTotalTable').append('<tr>' + '<td colspan="6" style="text-align:center;">' + '無資料' + '</td>' + '</tr>');
|
$('#HistoryTotalTable').append('<tr>' + '<td colspan="6" style="text-align:center;">' + '無資料' + '</td>' + '</tr>');
|
||||||
$('#HistoryDetailTable').append('<tr>' + '<td colspan="6" style="text-align:center;">' + '無資料' + '</td>' + '</tr>');
|
$('#HistoryDetailTable').append('<tr>' + '<td colspan="6" style="text-align:center;">' + '無資料' + '</td>' + '</tr>');
|
||||||
|
|||||||
@ -25,31 +25,33 @@
|
|||||||
<div class="btn-group" id="js-demo-nesting" role="group" aria-label="Button group with nested dropdown">
|
<div class="btn-group" id="js-demo-nesting" role="group" aria-label="Button group with nested dropdown">
|
||||||
@*<button type="button" class="btn btn-secondary waves-effect waves-themed"> < </button>
|
@*<button type="button" class="btn btn-secondary waves-effect waves-themed"> < </button>
|
||||||
|
|
||||||
<div class="btn-group" role="group">
|
<div class="btn-group" role="group">
|
||||||
<button type="button" class="btn btn-secondary dropdown-toggle waves-effect waves-themed" data-toggle="dropdown">2021 五月 </button>
|
<button type="button" class="btn btn-secondary dropdown-toggle waves-effect waves-themed" data-toggle="dropdown">2021 五月 </button>
|
||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu">
|
||||||
<a class="dropdown-item" href="javascript:void(0)">2021 四月</a>
|
<a class="dropdown-item" href="javascript:void(0)">2021 四月</a>
|
||||||
<a class="dropdown-item" href="javascript:void(0)">2021 三月</a>
|
<a class="dropdown-item" href="javascript:void(0)">2021 三月</a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<button type="button" class="btn btn-secondary waves-effect waves-themed"> > </button>*@
|
<button type="button" class="btn btn-secondary waves-effect waves-themed"> > </button>*@
|
||||||
<input type="date" class="form-control" id="DateGet"/>
|
<input type="date" class="form-control" id="DateGet" />
|
||||||
|
|
||||||
<input type="month" class="form-control" id="MonthGet" style="display:none"/>
|
<input type="month" class="form-control" id="MonthGet" style="display:none" />
|
||||||
|
|
||||||
<input type="number" class="form-control" min="1900" max="2099" step="1" id="YearGet" style="display:none"/>
|
<input type="number" class="form-control" min="1900" max="2099" step="1" id="YearGet" style="display:none" />
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
@*<div class="pr-3">
|
@*<div class="pr-3">
|
||||||
<button type="button" class="btn btn-secondary waves-effect waves-themed">列印報告</button>
|
<button type="button" class="btn btn-secondary waves-effect waves-themed">列印報告</button>
|
||||||
</div>*@
|
</div>*@
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="row mb-5">
|
<div class="row mb-5">
|
||||||
<div class="card p-3 w-100">
|
<div class="card p-3 w-100">
|
||||||
<h5 class="font-weight-bold mb-3 pl-5 pb-3">總結</h5>
|
<h5 class="font-weight-bold mb-3 pl-5 pb-3">總結</h5>
|
||||||
@ -65,12 +67,15 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody id="HistoryTotalTable">
|
<tbody id="HistoryTotalTable">
|
||||||
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="history-kWh-convas-div">
|
||||||
|
<canvas id="history-kWh"></canvas>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="row mb-5">
|
<div class="row mb-5">
|
||||||
<div class="card p-3 w-100">
|
<div class="card p-3 w-100">
|
||||||
<h5 class="font-weight-bold mb-3 pl-5 pb-3">詳細資訊</h5>
|
<h5 class="font-weight-bold mb-3 pl-5 pb-3">詳細資訊</h5>
|
||||||
@ -86,7 +91,6 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody id="HistoryDetailTable">
|
<tbody id="HistoryDetailTable">
|
||||||
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user