Пример #1
0
        protected override void fillDBWithMeters()
        {
            CustomerData tempCustomer = new CustomerData();
            int          customerId   = tempCustomer.FillEmptyCustomer();

            myDatabase.InsertCustomerData(tempCustomer);

            MeterManufactorData tempMeterManufactor = new MeterManufactorData();
            int meterManufactorId = tempMeterManufactor.FillEmptyMeterManufactor();

            myDatabase.InsertMeterManufactorData(tempMeterManufactor);

            MeterProtocolData tempMeterProtocol = new MeterProtocolData();
            int meterProtocolId = tempMeterProtocol.FillEmptyMeterProtocol();

            myDatabase.InsertMeterProtocolData(tempMeterProtocol);

            MeterTypeData tempMeterType = new MeterTypeData();
            int           meterTypeId   = tempMeterType.FillEmptyMeterType();

            myDatabase.InsertMeterTypeData(tempMeterType);


            REDDMeter.SetCustomerId(customerId);
            REDDMeter.SetManufactorId(meterManufactorId);
            REDDMeter.SetProtolId(meterProtocolId);
            REDDMeter.SetTypeId(meterTypeId);
            REDDMeter.SetKey("not availiable");
            REDDMeter.SetPeriod(1);
            REDDMeter.SetPort("not availiable");
            REDDMeter.SetSerial("not availiable");
            REDDMeter.SetActive(true);
            myDatabase.InsertMeterManagementData(REDDMeter);
        }
        protected override void fillDBWithMeters()
        {
            CustomerData tempCustomer = new CustomerData();
            int          customerId   = tempCustomer.FillEmptyCustomer();

            myDatabase.InsertCustomerData(tempCustomer);

            MeterManufactorData tempMeterManufactor = new MeterManufactorData();
            int meterManufactorId = tempMeterManufactor.FillEmptyMeterManufactor();

            myDatabase.InsertMeterManufactorData(tempMeterManufactor);

            MeterProtocolData tempMeterProtocol = new MeterProtocolData();
            int meterProtocolId = tempMeterProtocol.FillEmptyMeterProtocol();

            myDatabase.InsertMeterProtocolData(tempMeterProtocol);

            MeterTypeData tempMeterType = new MeterTypeData();
            int           meterTypeId   = tempMeterType.FillEmptyMeterType();

            myDatabase.InsertMeterTypeData(tempMeterType);

            for (int i = 0; i < 81; i++)
            {
                int HomeNbr        = i / 9;
                int ApplicationNbr = i % 9;

                MeterManagementData GREENDMeter = new MeterManagementData();
                GREENDMeter.SetCustomerId(customerId);
                GREENDMeter.SetManufactorId(meterManufactorId);
                GREENDMeter.SetProtolId(meterProtocolId);
                GREENDMeter.SetTypeId(meterTypeId);
                GREENDMeter.SetDescribtion("GREEND-" + HomeNbr + "-" + ApplicationNbr);
                GREENDMeter.SetKey("not availiable");
                GREENDMeter.SetPeriod(1);
                GREENDMeter.SetPort("not availiable");
                GREENDMeter.SetSerial("not availiable");
                GREENDMeter.SetActive(true);
                myDatabase.InsertMeterManagementData(GREENDMeter);

                Tuple <int, ApplicationEnum> temp = new Tuple <int, ApplicationEnum>(GREENDMeter.GetMeterId(), this.getEnumFromGREENDEnumId((HomeNbr * 9) + ApplicationNbr));
                this.meterList.Add(temp);
            }
        }
Пример #3
0
        protected override void fillDBWithMeters()
        {
            CustomerData tempCustomer = new CustomerData();
            int          customerId   = tempCustomer.FillEmptyCustomer();

            myDatabase.InsertCustomerData(tempCustomer);

            MeterManufactorData tempMeterManufactor = new MeterManufactorData();
            int meterManufactorId = tempMeterManufactor.FillEmptyMeterManufactor();

            myDatabase.InsertMeterManufactorData(tempMeterManufactor);

            MeterProtocolData tempMeterProtocol = new MeterProtocolData();
            int meterProtocolId = tempMeterProtocol.FillEmptyMeterProtocol();

            myDatabase.InsertMeterProtocolData(tempMeterProtocol);

            MeterTypeData tempMeterType = new MeterTypeData();
            int           meterTypeId   = tempMeterType.FillEmptyMeterType();

            myDatabase.InsertMeterTypeData(tempMeterType);

            ///Create whole houses meter
            for (int i = 0; i < 4; i++)
            {
                MeterManagementData UKDALEMeter = new MeterManagementData();
                UKDALEMeter.SetCustomerId(customerId);
                UKDALEMeter.SetManufactorId(meterManufactorId);
                UKDALEMeter.SetProtolId(meterProtocolId);
                UKDALEMeter.SetTypeId(meterTypeId);
                UKDALEMeter.SetDescribtion("UKDALE-" + i + "-ALL");
                UKDALEMeter.SetKey("not availiable");
                UKDALEMeter.SetPeriod(1);
                UKDALEMeter.SetPort("not availiable");
                UKDALEMeter.SetSerial("not availiable");
                UKDALEMeter.SetActive(true);
                myDatabase.InsertMeterManagementData(UKDALEMeter);

                int tempMeterId = UKDALEMeter.GetMeterId();

                Tuple <int, ApplicationEnum> temp;
                switch (i)
                {
                case 0:
                {
                    temp = new Tuple <int, ApplicationEnum>(tempMeterId, ApplicationEnum.UKDALEwholeHouse1);
                    break;
                }

                case 1:
                {
                    temp = new Tuple <int, ApplicationEnum>(tempMeterId, ApplicationEnum.UKDALEwholeHouse2);
                    break;
                }

                case 2:
                {
                    temp = new Tuple <int, ApplicationEnum>(tempMeterId, ApplicationEnum.UKDALEwholeHouse3);
                    break;
                }

                case 3:
                {
                    temp = new Tuple <int, ApplicationEnum>(tempMeterId, ApplicationEnum.UKDALEwholeHouse4);
                    break;
                }

                case 4:
                {
                    temp = new Tuple <int, ApplicationEnum>(tempMeterId, ApplicationEnum.UKDALEwholeHouse5);
                    break;
                }

                default:
                {
                    temp = new Tuple <int, ApplicationEnum>(tempMeterId, ApplicationEnum.None);
                    break;
                }
                }
                this.housesList.Add(temp);
            }

            String pathToUKDALEAplliances = "UKDaleAppliances\\";

            for (int i = 1; i <= 5; i++)
            {
                Console.WriteLine("working File: " + i);
                using (StreamReader file = new StreamReader(pathToUKDALEAplliances + "UKDALEdat_" + i + ".txt"))
                {
                    if (file != null)
                    {
                        String line = "";
                        while ((line = file.ReadLine()) != null)
                        {
                            MeterManagementData UKDALEMeter = new MeterManagementData();
                            UKDALEMeter.SetCustomerId(customerId);
                            UKDALEMeter.SetManufactorId(meterManufactorId);
                            UKDALEMeter.SetProtolId(meterProtocolId);
                            UKDALEMeter.SetTypeId(meterTypeId);

                            String[]        applicationParts     = line.Split(' ');
                            int             applicationNumber    = Int32.Parse(applicationParts[0]);
                            ApplicationEnum foundApplicationEnum = this.FindApplicationEnumByString(applicationParts[1]);

                            UKDALEMeter.SetDescribtion("UKDALE-" + (i - 1) + "-" + applicationNumber);
                            UKDALEMeter.SetKey("not availiable");
                            UKDALEMeter.SetPeriod(1);
                            UKDALEMeter.SetPort("not availiable");
                            UKDALEMeter.SetSerial("not availiable");
                            UKDALEMeter.SetActive(true);
                            myDatabase.InsertMeterManagementData(UKDALEMeter);

                            int tempMeterId = UKDALEMeter.GetMeterId();

                            int[] tempTupel = new int[2];
                            tempTupel[0] = tempMeterId;
                            tempTupel[1] = applicationNumber;

                            Tuple <int[], ApplicationEnum> temp = new Tuple <int[], ApplicationEnum>(tempTupel, foundApplicationEnum);

                            switch (i)
                            {
                            case 1:
                            {
                                this.house1ApplicationList.Add(temp);
                                break;
                            }

                            case 2:
                            {
                                this.house2ApplicationList.Add(temp);
                                break;
                            }

                            case 3:
                            {
                                this.house3ApplicationList.Add(temp);
                                break;
                            }

                            case 4:
                            {
                                this.house4ApplicationList.Add(temp);
                                break;
                            }

                            case 5:
                            {
                                this.house5ApplicationList.Add(temp);
                                break;
                            }
                            }
                        }
                    }
                }
            }
        }
Пример #4
0
        private static int userInputDataset(List <IDataHandler> dataHandlerList)
        {
            int choice = 0;

            Console.WriteLine("Which Dataset do you want to load data from <1 ADRES | 2 GREEND | 3 REDD | 4 UKdale> ?");
            Console.WriteLine("Or do you want to <5 print meter_data | 6 Delete meter_data | 7 Delete all data | 8 Create completly new data");
            Console.WriteLine("Or do you want to <9 print customer data | 10 print meter management data | 11 print meter manufactor data");
            Console.WriteLine("Or do you want to <12 print meter protocol data | 13 print meter type data>");
            choice = getIntFromConsole();
            if (choice == 0)
            {
                return(1);
            }

            switch (choice)
            {
            case 1:
            {
                List <TypeEnum> tempTypeEnums = new List <TypeEnum>();
                //tempTypeEnums.Add(TypeEnum.Power);
                tempTypeEnums.Add(TypeEnum.Voltage);
                IDataHandler handler = new ADRESDataHandler(myDatabase, null, null, null, tempTypeEnums, 5);
                handler.setPath(@"E:\Anna\Dokumente\Studium\Jahr3\Semester5\BAC1\Lastprofile\ADRES\00originalData\umgewandelt");

                dataHandlerList.Add(handler);
                break;
            }

            case 2:
            {
                //IDataHandler handler = new GREENDDataHandler(myDatabase);
                //IDataHandler handler = new GREENDDataHandler(myDatabase, new DateTime(2013, 12, 06, 23, 55, 00), new DateTime(2013, 12, 06, 23, 56, 00));
                //IDataHandler handler = new GREENDDataHandler(myDatabase, new DateTime(2013, 12, 06, 23, 55, 00), new DateTime(2013, 12, 06, 23, 56, 00), null, null, 1);

                /*
                 * List<TypeEnum> tempEnumList = new List<TypeEnum>();
                 * tempEnumList.Add(TypeEnum.Current);
                 * tempEnumList.Add(TypeEnum.Power);
                 * IDataHandler handler = new GREENDDataHandler(myDatabase, new DateTime(2013, 12, 06, 23, 55, 00), new DateTime(2013, 12, 06, 23, 56, 00), null, tempEnumList, 1);
                 */

                /*
                 * List<TypeEnum> tempEnumList = new List<TypeEnum>();
                 * tempEnumList.Add(TypeEnum.Current);
                 * tempEnumList.Add(TypeEnum.Voltage);
                 * IDataHandler handler = new GREENDDataHandler(myDatabase, new DateTime(2013, 12, 06, 23, 55, 00), new DateTime(2013, 12, 06, 23, 56, 00), null, tempEnumList, 1);
                 */

                /*
                 * List<ApplicationEnum> tempApplicationList = new List<ApplicationEnum>();
                 * tempApplicationList.Add(ApplicationEnum.TV);
                 * tempApplicationList.Add(ApplicationEnum.WaterKettle);
                 * tempApplicationList.Add(ApplicationEnum.Radio);
                 * IDataHandler handler = new GREENDDataHandler(myDatabase, null, null, tempApplicationList, null, 1);
                 */

                List <ApplicationEnum> tempApplicationList = new List <ApplicationEnum>();
                tempApplicationList.Add(ApplicationEnum.TV);
                tempApplicationList.Add(ApplicationEnum.WaterKettle);
                tempApplicationList.Add(ApplicationEnum.Radio);
                IDataHandler handler = new GREENDDataHandler(myDatabase, new DateTime(2013, 12, 06, 23, 50, 00), new DateTime(2013, 12, 06, 23, 59, 59), tempApplicationList, null, 1);

                handler.setPath(@"E:\Anna\Dokumente\Studium\Jahr3\Semester5\BAC1\Lastprofile\GREEND_0-1_311014");

                dataHandlerList.Add(handler);
                break;
            }

            case 3:
            {
                IDataHandler           handler         = new REDDDataHandler(myDatabase);
                List <ApplicationEnum> tempApplication = new List <ApplicationEnum>();
                tempApplication.Add(ApplicationEnum.Dishwasher);
                handler.setPath(@"E:\Anna\Dokumente\Studium\Jahr3\Semester5\BAC1\Lastprofile\REDD");

                dataHandlerList.Add(handler);
                break;
            }

            case 4:
            {
                //IDataHandler handler = new UKdaleDataHandler(myDatabase);

                //IDataHandler handler = new UKdaleDataHandler(myDatabase, new DateTime(2013, 12, 06, 23, 55, 00), new DateTime(2013, 12, 06, 23, 56, 00));

                /*
                 * List<TypeEnum> tempEnumList = new List<TypeEnum>();
                 * tempEnumList.Add(TypeEnum.Current);
                 * tempEnumList.Add(TypeEnum.Voltage);
                 * IDataHandler handler = new UKdaleDataHandler(myDatabase, new DateTime(2013, 12, 06, 23, 55, 00), new DateTime(2013, 12, 06, 23, 56, 00), null, tempEnumList);
                 */

                /*
                 * List<TypeEnum> tempEnumList = new List<TypeEnum>();
                 * tempEnumList.Add(TypeEnum.Power);
                 * IDataHandler handler = new UKdaleDataHandler(myDatabase, new DateTime(2012, 11, 09, 23, 02, 21), new DateTime(2012, 11, 09, 23, 04, 21), null, tempEnumList);
                 */

                //IDataHandler handler = new UKdaleDataHandler(myDatabase, new DateTime(2013, 12, 06, 23, 55, 00), new DateTime(2013, 12, 06, 23, 56, 00), null, null, 1);

                /*
                 * List<TypeEnum> tempEnumList = new List<TypeEnum>();
                 * tempEnumList.Add(TypeEnum.Power);
                 * IDataHandler handler = new UKdaleDataHandler(myDatabase, new DateTime(2012, 11, 09, 23, 02, 21), new DateTime(2012, 11, 09, 23, 04, 21), null, tempEnumList, 1);
                 */

                List <ApplicationEnum> tempAppList = new List <ApplicationEnum>();
                tempAppList.Add(ApplicationEnum.WaterKettle);
                tempAppList.Add(ApplicationEnum.Laptop);
                List <TypeEnum> tempEnumList = new List <TypeEnum>();
                tempEnumList.Add(TypeEnum.Power);
                IDataHandler handler = new UKdaleDataHandler(myDatabase, new DateTime(2012, 11, 09, 23, 02, 21), new DateTime(2012, 11, 09, 23, 04, 21), tempAppList, tempEnumList, 1);

                handler.setPath(@"E:\Datasets\UK-DaleSample");


                dataHandlerList.Add(handler);
                break;
            }

            case 5:
            {
                myDatabase.PrintMeterData("");
                break;
            }

            case 6:
            {
                myDatabase.DeleteAllMeterData();
                break;
            }

            case 7:
            {
                myDatabase.DeleteAllMeterManagementData();
                myDatabase.DeleteAllMeterData();
                myDatabase.DeleteAllCustomerData();
                myDatabase.DeleteAllMeterManufactorData();
                myDatabase.DeleteAllMeterProtocolData();
                myDatabase.DeleteAllMeterTypeData();
                break;
            }

            case 8:
            {
                CustomerData tempCustomer = new CustomerData();
                int          customerId   = tempCustomer.FillEmptyCustomer();
                myDatabase.InsertCustomerData(tempCustomer);

                MeterManufactorData tempMeterManufactor = new MeterManufactorData();
                int meterManufactorId = tempMeterManufactor.FillEmptyMeterManufactor();
                myDatabase.InsertMeterManufactorData(tempMeterManufactor);

                MeterProtocolData tempMeterProtocol = new MeterProtocolData();
                int meterProtocolId = tempMeterProtocol.FillEmptyMeterProtocol();
                myDatabase.InsertMeterProtocolData(tempMeterProtocol);

                MeterTypeData tempMeterType = new MeterTypeData();
                int           meterTypeId   = tempMeterType.FillEmptyMeterType();
                myDatabase.InsertMeterTypeData(tempMeterType);

                MeterManagementData tempMeterManagement = new MeterManagementData();
                tempMeterManagement.FillEmptyManagementData(meterTypeId, meterProtocolId, meterManufactorId, customerId);
                myDatabase.InsertMeterManagementData(tempMeterManagement);
                break;
            }

            case 9:
            {
                myDatabase.PrintCustomerData("");
                break;
            }

            case 10:
            {
                myDatabase.PrintMeterManagementData("");
                break;
            }

            case 11:
            {
                myDatabase.PrintMeterManufactorData();
                break;
            }

            case 12:
            {
                myDatabase.PrintMeterProtocolData();
                break;
            }

            case 13:
            {
                myDatabase.PrintMeterTypeData();
                break;
            }
            }
            return(0);
        }