Ejemplo n.º 1
0
 public RUSAData processRUSAData(RUSAData data)
 {
     WebLogger.Info("RUSA process", VotGES.Logger.LoggerSource.service);
     data.Result = new List<RUSAResult>();
     ProcessRUSAData.processEqualData(data);
     ProcessRUSAData.processDiffData(data);
     foreach (RUSAResult result in data.EqResult) {
         data.Result.Add(result);
     }
     foreach (RUSAResult result in data.DiffResult) {
         data.Result.Add(result);
     }
     return data;
 }
Ejemplo n.º 2
0
 public static void processDiffData(RUSAData data)
 {
     List<RUSADiffPower.RusaChoice> choices=RUSADiffPower.getChoices(data.getAvailGenerators(), data.Napor, data.Power,3);
     foreach (RUSADiffPower.RusaChoice choice in choices) {
         double rashod=choice.rashod;
         data.DiffResult = new List<RUSAResult>();
         RUSAResult result=new RUSAResult();
         result.Rashod = rashod;
         result.Sostav = new Dictionary<int, double>();
         foreach (KeyValuePair<int, double> de in choice.sostav) {
             if (de.Value > 0) {
                 result.Sostav.Add(de.Key, de.Value);
             }
         }
         result.KPD = RashodTable.KPD(data.Power, data.Napor, rashod)*100;
         data.EqResult.Add(result);
     }
 }
Ejemplo n.º 3
0
 public static void processEqualData(RUSAData data)
 {
     SortedList<double,List<int>> sostavs=RUSA.getOptimRashodsFull(data.Power, data.Napor, data.getAvailGenerators());
     int index=0;
     data.EqResult = new List<RUSAResult>();
     foreach (KeyValuePair<double, List<int>> de in sostavs) {
         if (index == 3)
             break;
         index++;
         double rashod=de.Key;
         List<int> sostav=de.Value;
         RUSAResult result=new RUSAResult();
         result.Rashod = rashod;
         result.Sostav = new Dictionary<int, double>();
         foreach (int ga in sostav) {
             result.Sostav.Add(ga, data.Power / sostav.Count);
         }
         result.KPD = RashodTable.KPD(data.Power, data.Napor, rashod) * 100;
         data.EqResult.Add(result);
     }
 }
Ejemplo n.º 4
0
        public void init(RUSADomainContext context)
        {
            this.context = context;
            CurrentData = new RUSAData();
            CurrentData.GaAvail = new List<GAParams>();
            for (int ga=1; ga <= 10; ga++) {
                GAParams p=new GAParams();
                p.GaNumber = ga;
                p.Avail = true;
                CurrentData.GaAvail.Add(p);
            }
            CurrentData.Power = 300;
            CurrentData.Napor = 21;

            items=new Dictionary<int, TabItem>();
            gridControls=new Dictionary<int, RUSAGridControl>();

            items.Add(1, tab1);
            items.Add(2, tab2);
            items.Add(3, tab3);
            items.Add(4, tab4);
            items.Add(5, tab5);
            items.Add(6, tab6);
            items.Add(7, tab7);
            items.Add(8, tab8);
            items.Add(9, tab9);
            items.Add(10, tab10);

            gridControls.Add(1, grid1);
            gridControls.Add(2, grid2);
            gridControls.Add(3, grid3);
            gridControls.Add(4, grid4);
            gridControls.Add(5, grid5);
            gridControls.Add(6, grid6);
            gridControls.Add(7, grid7);
            gridControls.Add(8, grid8);
            gridControls.Add(9, grid9);
            gridControls.Add(10, grid10);
        }
Ejemplo n.º 5
0
        public static void processEqualData(RUSAData data)
        {
            SortedList<double,List<int>> sostavs=RUSA.getOptimRashodsFull(data.Power, data.Napor, data.getAvailGenerators());
            int index=0;
            data.EqResult = new List<RUSAResult>();
            Dictionary<int, FullResultRUSARecord> FullResult = new Dictionary<int, FullResultRUSARecord>();
            try {
                foreach (KeyValuePair<double, List<int>> de in sostavs) {
                    index++;
                    double rashod=de.Key;
                    List<int> sostav=de.Value;
                    RUSAResult result=new RUSAResult();
                    result.Rashod = rashod;
                    result.Sostav = new Dictionary<int, double>();
                    foreach (int ga in sostav) {
                        result.Sostav.Add(ga, data.Power / sostav.Count);
                    }
                    result.ProcessSostav(result.Sostav);
                    result.Sostav = null;

                    result.KPD = RashodTable.KPD(data.Power, data.Napor, rashod) * 100;
                    result.Count = sostav.Count;

                    if (!FullResult.ContainsKey(sostav.Count)) {
                        data.EqResult.Add(result);
                        FullResult.Add(sostav.Count, new FullResultRUSARecord());
                        FullResult[sostav.Count].Data = new List<RUSAResult>();
                    }
                    FullResult[sostav.Count].Data.Add(result);
                    FullResult[sostav.Count].CountGA = sostav.Count;
                }
                data.FullResultList = FullResult.Values.ToList();
            } catch (Exception e) {
                Logger.Error("Ошибка при расчете РУСА ");
                Logger.Error(e.ToString());
            }
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Асинхронно вызывает метод "processRUSAData" службы DomainService.
 /// </summary>
 /// <param name="data">Значение параметра "data" для данного действия.</param>
 /// <returns>Экземпляр операции, который может быть использован для управления асинхронным запросом.</returns>
 public InvokeOperation<RUSAData> processRUSAData(RUSAData data)
 {
     Dictionary<string, object> parameters = new Dictionary<string, object>();
     parameters.Add("data", data);
     this.ValidateMethod("processRUSAData", parameters);
     return ((InvokeOperation<RUSAData>)(this.InvokeOperation("processRUSAData", typeof(RUSAData), parameters, true, null, null)));
 }
Ejemplo n.º 7
0
 private void btnCalcRUSA_Click(object sender, RoutedEventArgs e)
 {
     InvokeOperation currentOper=context.processRUSAData(CurrentData, oper => {
         if (oper.IsCanceled) {
             return;
         }
         try {
             GlobalStatus.Current.StartProcess();
             clear();
             CurrentData = oper.Value;
             process();
         } catch (Exception ex) {
             Logging.Logger.info(ex.ToString());
             GlobalStatus.Current.ErrorLoad("Ошибка");
         } finally {
             GlobalStatus.Current.StopLoad();
         }
     }, null);
     GlobalStatus.Current.StartLoad(currentOper);
 }