Example #1
0
        public static ElectricStation[] CreateConfigurations(double power, double budget)
        {
            List <ElectricStation> buffer_list = new List <ElectricStation>();

            // temporary method

            StreamReader SR_inverter = new StreamReader("test-db-inverter.txt");

            string[] inverter_db      = SR_inverter.ReadLine().Split(',');
            int      amount_inverters = 2;

            while (SR_inverter.ReadLine() != "")
            {
                if (Convert.ToDouble(inverter_db[1]) * amount_inverters <= budget / 4)
                {
                    StreamReader SR_es = new StreamReader("test-db-es.txt");
                    string       es_string;
                    while ((es_string = SR_es.ReadLine()) != "")
                    {
                        string[] es_db        = es_string.Split(',');
                        int      amount_of_es = Convert.ToInt32(power / Convert.ToDouble(inverter_db[0]));
                        if (Convert.ToDouble(es_db[6]) * amount_of_es <= budget / 2)
                        {
                            StreamReader SR_accumulator = new StreamReader("test-db-accumulator.txt");
                            string       accum_string;
                            while ((accum_string = SR_accumulator.ReadLine()) != "")
                            {
                                string[] accumulator_db        = accum_string.Split(',');
                                int      amount_of_accumulator = Convert.ToInt32(power / Convert.ToDouble(accumulator_db[0]));
                                if (Convert.ToDouble(accumulator_db[10]) * amount_of_accumulator <= budget / 4)
                                {
                                    Accumulator     ac       = new Accumulator(amount_of_accumulator, Convert.ToDouble(accumulator_db[1]), Convert.ToDouble(accumulator_db[2]), Convert.ToDouble(accumulator_db[3]), Convert.ToDouble(accumulator_db[4]), Convert.ToDouble(accumulator_db[5]), accumulator_db[6], accumulator_db[7], accumulator_db[8], accumulator_db[9], Convert.ToDouble(accumulator_db[10]));
                                    EnergySource    es       = new EnergySource(amount_of_es, es_db[0], es_db[1], es_db[2], Convert.ToDouble(es_db[3]), Convert.ToDouble(es_db[4]), Convert.ToDouble(es_db[5]));
                                    Inverter        inv      = new Inverter(Convert.ToDouble(inverter_db[0]), Convert.ToDouble(inverter_db[1]), inverter_db[2], Convert.ToInt32(inverter_db[3]), Convert.ToInt32(inverter_db[4]), inverter_db[5], Convert.ToDouble(inverter_db[6]), amount_inverters);
                                    ElectricStation estation = new ElectricStation(ac, inv, es, power, budget);
                                    estation.full_cost  = Convert.ToDouble(es_db[10]) * amount_of_es + Convert.ToDouble(es_db[6]) * amount_of_es + Convert.ToDouble(inverter_db[1]) * amount_inverters;
                                    estation.full_power = Convert.ToDouble(es_db[4]) * amount_of_es + Convert.ToDouble(es_db[0]) * amount_inverters;
                                    buffer_list.Add(estation);
                                }
                            }
                        }
                    }
                }
            }
            return(buffer_list.ToArray());
        }
Example #2
0
        public ElectricStation [] CalculateMostEfficientStation()
        {
            ElectricStation[] all_stations = ElectricStation.CreateConfigurations(estation.power, estation.budget);
            // temp method of calculation

            for (int i = 0; i < all_stations.Length; i++)
            {
                all_stations[i].efficiency = all_stations[i].full_power / (all_stations[i].full_cost * region.average_temperature * 0.7 * region.humidity * 0.3 * region.intensity * 0.1 * region.windiness * 0.03);
            }
            ElectricStation[] top_stations = all_stations;
            //need sort function
            //
            //
            //
            //
            //
            return(top_stations);
        }
Example #3
0
 public Efficiency(ElectricStation estation, Region region)
 {
     this.estation = estation;
     this.region   = region;
 }