예제 #1
0
    def __init__(self,ini_date, end_date, id_meters = None):

        self.__ini_date = ini_date
        self.__end_date = end_date

        ids = []
        if id_meters is None:
            ids = Raw_data.get_id_meters()
        else:
            ids = id_meters

        self.insert_update()

        # Creates each object and find mininma maxima
        for meter in ids:
            meter_data_obj = Meter_data(meter,self.__ini_date,self.__end_date,self.__id_meter_data_collection)
            min_obj,max_obj = meter_data_obj.get_min_max()

            if (min_obj < self.__min_val):
                self.__min_val = min_obj
            if(max_obj > self.__max_val):
                self.__max_val = max_obj

            self.__meters_data[meter] = meter_data_obj
        
        # after finding min and max, update
        self.insert_update()

        # Normalize all the measurements and insert into DB
        for meter_id,meter_data_obj in self.__meters_data.items():
            meter_data_obj.normalize(self.__min_val,self.__max_val)
            meter_data_obj.insert()
예제 #2
0
    def __init__(self,id_meter, ini, end, id_meter_data_collection = None, insert=False):

        if(id_meter_data_collection is not None):
            self.__id_meter_data_collection = id_meter_data_collection        

        self.__id_meter = id_meter
        
        if(insert):
            self.insert()


        r = Raw_data()
        v = []
        d = []
        for item in r.get_interval(ini,end,id_meter):            
            v.append(item.kwh)
            d.append(item.date)

        self.__measurements = np.array(v)
        self.__dates = d
예제 #3
0
from classes.raw_data import Raw_data
from classes.date import Smart_meter_date

import datetime
import copy

rd = Raw_data()
meters = rd.get_id_meters()

smd_ini_date = Smart_meter_date()
smd_ini_date.set_datetime(year=2009, month=12, day=21, hour=0, minute=0)

smd_end_date = Smart_meter_date()
smd_end_date.set_datetime(year=2010, month=12, day=21, hour=0, minute=0)
i = 0
weekdays = list(range(0, 6))
d = {}
total_meters = 0
for meter in meters:
    rd = Raw_data(id_meter=meter)
    print(meter)
    d[meter] = rd.get_profile(smd_ini_date, smd_end_date)
    print(d[meter])
    total_meters += 1
    if total_meters > 3000:
        break
예제 #4
0
from classes.raw_data import Raw_data

rd = Raw_data()

for raw_data_obj in rd.get_full_data():
    print(raw_data_obj)
    #raw_data_obj.update()