From 3fadcfa720cf9feea6303094dea337c5221bb940 Mon Sep 17 00:00:00 2001
From: Hamid Choucha <hamidc@uab.edu>
Date: Mon, 17 Apr 2023 10:02:57 -0500
Subject: [PATCH] Fixed the watts issue

---
 backend/database/CS_499_backend.py | 105 ++++++++++++++++++-----------
 1 file changed, 64 insertions(+), 41 deletions(-)

diff --git a/backend/database/CS_499_backend.py b/backend/database/CS_499_backend.py
index e1fed93..db3f25c 100644
--- a/backend/database/CS_499_backend.py
+++ b/backend/database/CS_499_backend.py
@@ -37,8 +37,8 @@ for i in range(0,NUM_WEEKS):
         Door_Window_History[time_stamp] = Door_Window(WORKWEEK[j], door_opens, door_minutes, window_open, window_minutes)
         time_stamp += 1
 
-# for i in Door_Window_History:
-#     print(i, Door_Window_History[i].day, Door_Window_History[i].Door_status, Door_Window_History[i].Door_time, Door_Window_History[i].Window_status, Door_Window_History[i].Window_time)
+for i in Door_Window_History:
+    print(i,Door_Window_History[i].day,Door_Window_History[i].Door_status,Door_Window_History[i].Door_time,Door_Window_History[i].Window_status,Door_Window_History[i].Window_time)
 
 class Appliance_1:
 
@@ -121,7 +121,7 @@ TC_pwr_MAR_brtv=0
 TC_ct_MAR_lrtv=0
 TC_ct_MAR_brtv=0
 
-# print("######################################################  TOTAL APP1 HISTORY FOR 77  DAYS  ###################################################### \n")
+print("######################################################  TOTAL APP1 HISTORY FOR 77  DAYS  ###################################################### \n")
 for i in App1_History:
     if i<=31:
         monthly_power1_JAN += App1_History[i].micro_pwr + App1_History[i].stove_pwr + App1_History[i].oven_pwr + App1_History[i].Lrtv_pwr + App1_History[i].Brtv_pwr + App1_History[i].fridge_pwr +App1_History[i].lights_pwr
@@ -137,15 +137,25 @@ for i in App1_History:
         TC_ct_MAR_lrtv += App1_History[i].micro_ct + App1_History[i].stove_ct + App1_History[i].oven_ct + App1_History[i].Lrtv_ct + App1_History[i].Brtv_ct + App1_History[i].fridge_ct + App1_History[i].lights_ct + App1_History[i].test_case_1_ct
         TC_ct_MAR_brtv += App1_History[i].micro_ct + App1_History[i].stove_ct + App1_History[i].oven_ct + App1_History[i].Lrtv_ct + App1_History[i].Brtv_ct + App1_History[i].fridge_ct + App1_History[i].lights_ct + App1_History[i].test_case_2_ct
     #print(i,App1_History[i].day,App1_History[i].micro_pwr,App1_History[i].stove_pwr,App1_History[i].oven_pwr,App1_History[i].Lrtv_pwr,App1_History[i].Brtv_pwr,App1_History[i].micro_ct,App1_History[i].stove_ct,App1_History[i].oven_ct,App1_History[i].Lrtv_ct,App1_History[i].Brtv_ct)
-# print( "_ - _ - _ - _  Power used for each Month  _ - _ - _ - _ \n")
-# print( "Jan APP1 watts used : ",monthly_power1_JAN )
-# print( "FEB APP1 watts used : ",monthly_power1_FEB )
-# print( "MAR APP1 watts used : ",monthly_power1_MAR )
-# print( "_ - _ - _ - _  Cost used for each Month  _ - _ - _ - _ \n")
-# print( "Jan APP1 cost used : ",monthly_cost1_JAN )
-# print( "FEB APP1 cost used : ",monthly_cost1_FEB )
-# print( "MAR APP1 cost used : ",monthly_cost1_MAR )
-#print("################################################################################################################################################################# \n")
+monthly_power1_JAN=monthly_power1_JAN/10000
+monthly_power1_FEB=monthly_power1_FEB/10000
+monthly_power1_MAR=monthly_power1_MAR/10000
+TC_pwr_MAR_lrtv=TC_pwr_MAR_lrtv/10000
+TC_pwr_MAR_brtv=TC_pwr_MAR_brtv/10000
+
+print( "_ - _ - _ - _  Power used for each Month  _ - _ - _ - _ \n")
+print( "Jan APP1 watts used 1 : ",monthly_power1_JAN )
+print( "FEB APP1 watts used : ",monthly_power1_FEB )
+print( "MAR APP1 watts used : ",monthly_power1_MAR )
+print( "Test power cost March Living room TV : " ,TC_pwr_MAR_lrtv)
+print( "Test power cost March Living room TV : " ,TC_pwr_MAR_brtv)
+print( "_ - _ - _ - _  Cost used for each Month  _ - _ - _ - _ \n")
+print( "Jan APP1 cost used : ",monthly_cost1_JAN )
+print( "FEB APP1 cost used : ",monthly_cost1_FEB )
+print( "MAR APP1 cost used : ",monthly_cost1_MAR )
+print( "Test case cost March Living room TV : " ,TC_ct_MAR_lrtv)
+print( "Test case cost March Living room TV : " ,TC_ct_MAR_brtv)
+#print( "################################################################################################################################################################# \n")
 
 
 
@@ -257,7 +267,10 @@ monthly_water_usg_FEB=0
 monthly_cost2_MAR=0
 monthly_power2_MAR=0
 monthly_water_usg_MAR=0
-# print("######################################################  TOTAL APP2 HISTORY FOR 77 DAYS  ###################################################### \n")
+TC_shower_cost2_MAR=0
+TC_shower_power2_MAR=0
+TC_shower_water_usg_MAR=0
+print("######################################################  TOTAL APP2 HISTORY FOR 77 DAYS  ###################################################### \n")
 for i in App2_History:
     if i>=31:
         monthly_cost2_JAN+= App2_History[i].Water_Heat_ct + App2_History[i].DishWasher_ct + App2_History[i].Clothes_Wash_ct + App2_History[i].Clothes_dry_ct +App2_History[i].Water_ct + App2_History[i].bath_fans_ct
@@ -276,18 +289,25 @@ for i in App2_History:
         TC_shower_power2_MAR+= App2_History[i].DishWasher_pwr + App2_History[i].Clothes_Wash_pwr + App2_History[i].Clothes_dry_pwr + App2_History[i].bath_fans_pwr+ App2_History[i].test_case_shower_pwr
         TC_shower_water_usg_MAR+= App2_History[i].Bath_water_ug + App2_History[i].Shower_water_ug + App2_History[i].DishWasher_ug+ App2_History[i].Clothes_Wash_ug+App2_History[i].test_case_shower_ug
     #print(i,App2_History[i].day,App2_History[i].Water_Heat_pwr,App2_History[i].DishWasher_pwr,App2_History[i].Clothes_Wash_pwr,App2_History[i].Clothes_dry_pwr,App2_History[i].bath_fans_pwr,App2_History[i].Water_Heat_ug,App2_History[i].Bath_water_ug,App2_History[i].Shower_water_ug,App2_History[i].DishWasher_ug,App2_History[i].Clothes_Wash_ug,App2_History[i].Water_Heat_ct,App2_History[i].DishWasher_ct,App2_History[i].Clothes_Wash_ct,App2_History[i].Clothes_dry_ct,App2_History[i].bath_fans_ct,App2_History[i].Water_ct,App2_History[i].bath,App2_History[i].shower)
-# print( "_ - _ - _ - _  Power used for each Month  _ - _ - _ - _ \n")
-# print( "Jan APP2 watts used : ",monthly_power2_JAN )
-# print( "FEB APP2 watts used : ",monthly_power2_FEB )
-# print( "MAR APP2 watts used : ",monthly_power2_MAR )
-# print( "_ - _ - _ - _  Cost used for each Month  _ - _ - _ - _ \n")
-# print( "Jan APP2 cost used : ",monthly_cost2_JAN )
-# print( "FEB APP2 cost used : ",monthly_cost2_FEB )
-# print( "MAR APP2 cost used : ",monthly_cost2_MAR )
-# print( "_ - _ - _ - _  Gallons used for each Month  _ - _ - _ - _ \n")
-# print( "Jan APP2 water used : ",monthly_water_usg_JAN )
-# print( "FEB APP2 water used : ",monthly_water_usg_FEB )
-# print( "MAR APP2 water used : ",monthly_water_usg_MAR )
+monthly_power2_JAN=monthly_power2_JAN/10000
+monthly_power2_FEB=monthly_power2_FEB/10000
+monthly_power2_MAR=monthly_power2_MAR/10000
+TC_shower_power2_MAR=TC_shower_power2_MAR/10000
+print( "_ - _ - _ - _  Power used for each Month  _ - _ - _ - _ \n")
+print( "Jan APP1 watts used 2 : ",monthly_power2_JAN )
+print( "FEB APP1 watts used : ",monthly_power2_FEB )
+print( "MAR APP1 watts used : ",monthly_power2_MAR )
+print( " Test case MAR APP1 power used : ", TC_shower_power2_MAR)
+print( "_ - _ - _ - _  Cost used for each Month  _ - _ - _ - _ \n")
+print( "Jan APP1 cost used : ",monthly_cost2_JAN )
+print( "FEB APP1 cost used : ",monthly_cost2_FEB )
+print( "MAR APP1 cost used : ",monthly_cost2_MAR )
+print( "Test case MAR APP1 cost used : ", TC_shower_cost2_MAR )
+print( "_ - _ - _ - _  Gallons used for each Month  _ - _ - _ - _ \n")
+print( "Jan APP1 water used : ",monthly_water_usg_JAN )
+print( "FEB APP1 water used : ",monthly_water_usg_FEB )
+print( "MAR APP1 water used : ",monthly_water_usg_MAR )
+print( "Test case MAR APP1 water used : ", TC_shower_water_usg_MAR )
 #print( "################################################################################################################################################################# \n")
 
 
@@ -349,7 +369,7 @@ monthly_temp_ct_FEB=0
 monthly_temp_watts_FEB=0
 monthly_temp_ct_MAR=0
 monthly_temp_watts_MAR=0
-# print("######################################################  TOTAL TEMP HISTORY FOR 77 DAYS  ###################################################### \n")
+print("######################################################  TOTAL TEMP HISTORY FOR 77 DAYS  ###################################################### \n")
 for i in App3_History:
     if i<=31:
         monthly_temp_watts_JAN+=App3_History[i].temp_power
@@ -360,21 +380,24 @@ for i in App3_History:
     if i>59:
         monthly_temp_ct_MAR+=App3_History[i].temp_cost
         monthly_temp_watts_MAR+=App3_History[i].temp_power
-# print( "_ - _ - _ - _  Power used for each Month  _ - _ - _ - _ \n")
-# print( "Jan APP3 watts used : ",monthly_temp_watts_JAN )
-# print( "FEB APP3 watts used : ",monthly_temp_watts_FEB )
-# print( "MAR APP3 watts used : ",monthly_temp_watts_MAR )
-# print( "_ - _ - _ - _  Cost used for each Month  _ - _ - _ - _ \n")
-# print( "Jan APP3 cost used : ",monthly_temp_ct_JAN )
-# print( "FEB APP3 cost used : ",monthly_temp_ct_FEB )
-# print( "MAR APP3 cost used : ",monthly_temp_ct_MAR )
-# print( "################################################################################################################################################################# \n")
-# print("January Total cost",monthly_temp_ct_JAN+monthly_cost2_JAN+monthly_cost1_JAN)
-# print("Febuary Total cost",monthly_temp_ct_FEB+monthly_cost2_FEB+monthly_cost1_FEB)
-# print("March Total cost",monthly_temp_ct_MAR+monthly_cost2_FEB+monthly_cost1_MAR)
-# print("January Total Watts",monthly_temp_watts_JAN+monthly_power2_JAN+monthly_power1_JAN)
-# print("Febuary Total Watts",monthly_temp_watts_FEB+monthly_power2_FEB+monthly_power1_FEB)
-# print("March Total Watts",monthly_temp_watts_MAR+monthly_power2_MAR+monthly_power1_MAR)
+monthly_temp_watts_JAN=monthly_temp_watts_JAN/100000
+monthly_temp_watts_FEB=monthly_temp_watts_FEB/100000
+monthly_temp_watts_MAR=monthly_temp_watts_MAR/100000
+print( "_ - _ - _ - _  Power used for each Month  _ - _ - _ - _ \n")
+print( "Jan APP1 watts used : ",monthly_temp_watts_JAN  )
+print( "FEB APP1 watts used : ",monthly_temp_watts_FEB  )
+print( "MAR APP1 watts used : ",monthly_temp_watts_MAR  )
+print( "_ - _ - _ - _  Cost used for each Month  _ - _ - _ - _ \n")
+print( "Jan APP1 cost used : ",monthly_temp_ct_JAN )
+print( "FEB APP1 cost used : ",monthly_temp_ct_FEB )
+print( "MAR APP1 cost used : ",monthly_temp_ct_MAR )
+print( "################################################################################################################################################################# \n")
+print("January Total cost",monthly_temp_ct_JAN+monthly_cost2_JAN+monthly_cost1_JAN)
+print("Febuary Total cost",monthly_temp_ct_FEB+monthly_cost2_FEB+monthly_cost1_FEB)
+print("March Total cost",monthly_temp_ct_MAR+monthly_cost2_FEB+monthly_cost1_MAR)
+print("January Total Watts",monthly_temp_watts_JAN+monthly_power2_JAN+monthly_power1_JAN)
+print("Febuary Total Watts",monthly_temp_watts_FEB+monthly_power2_FEB+monthly_power1_FEB)
+print("March Total Watts",monthly_temp_watts_MAR +monthly_power2_MAR+monthly_power1_MAR)
 
 
 
-- 
GitLab