Explorar o código

(Modify/add) data load & insert

Kanggu Park %!s(int64=4) %!d(string=hai) anos
pai
achega
861245d5fe

+ 1 - 1
RealTimeSimulator_HeatStorageSystem.py

@@ -1353,7 +1353,7 @@ if __name__ == "__main__" :
 		
 		
 		row = cursor.fetchone()
 		row = cursor.fetchone()
 		conn.close()
 		conn.close()
-		#print('end time : ', now_)	
+		
 		if Init:
 		if Init:
 			if row != None:				
 			if row != None:				
 				recentDateTime = row[4]
 				recentDateTime = row[4]

+ 1 - 2
RealTimeSimulator_LoadForecasting.py

@@ -626,8 +626,7 @@ if __name__ == "__main__" :
 					cursor.execute("DELETE " + targetDBName + ".dbo.BemsMonitoringPointForecastingHourAhead where SiteId = 1 and FacilityTypeId = 99 and FacilityCode = 4863 and PropertyId = 1 and TargetDateTime >= '" + datetime.datetime.now().strftime('%Y-%m-%d 00:00:00') + "' and TargetDateTime < '" + (datetime.datetime.now() + datetime.timedelta(days=1)).strftime('%Y-%m-%d 00:00:00') + "'")
 					cursor.execute("DELETE " + targetDBName + ".dbo.BemsMonitoringPointForecastingHourAhead where SiteId = 1 and FacilityTypeId = 99 and FacilityCode = 4863 and PropertyId = 1 and TargetDateTime >= '" + datetime.datetime.now().strftime('%Y-%m-%d 00:00:00') + "' and TargetDateTime < '" + (datetime.datetime.now() + datetime.timedelta(days=1)).strftime('%Y-%m-%d 00:00:00') + "'")
 					
 					
 					for i in range(len(tmpTime)):
 					for i in range(len(tmpTime)):
-						cursor.execute("INSERT INTO " + targetDBName + ".dbo.BemsMonitoringPointForecastingHourAhead (SiteId,FacilityTypeId,FacilityCode,PropertyId,CreatedDateTime,TargetDateTime,ForecastedValue) VALUES(1,99,4863,1,'" + datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') + "','"+ datetime.datetime(tmpTime[i].year,tmpTime[i].month,tmpTime[i].day,tmpTime[i].hour,0,0).strftime('%Y-%m-%d %H:00:00') + "',"+str(y_pred_oneStep[i])+")")	
-					
+						cursor.execute("INSERT INTO " + targetDBName + ".dbo.BemsMonitoringPointForecastingHourAhead (SiteId,FacilityTypeId,FacilityCode,PropertyId,CreatedDateTime,TargetDateTime,ForecastedValue) VALUES(1,99,4863,1,'" + datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') + "','"+ datetime.datetime(tmpTime[i].year,tmpTime[i].month,tmpTime[i].day,tmpTime[i].hour,0,0).strftime('%Y-%m-%d %H:00:00') + "',"+str(y_pred_oneStep[i])+")")					
 						
 						
 					# Day-ahead (지우고 다시 쓰기)	
 					# Day-ahead (지우고 다시 쓰기)	
 					FinalTime = datetime.datetime(now.year, now.month, now.day, 23, 0, 0)
 					FinalTime = datetime.datetime(now.year, now.month, now.day, 23, 0, 0)