public DerForecastDayAhead CalculateGenerator(Forecast forecast, Generator generator)
        {
            DerForecastDayAhead generatorForecast = new DerForecastDayAhead(generator.GlobalId);

            DayAhead dayAhead = generator.CalculateDayAhead(forecast, generator.GlobalId, new Substation(generator.GlobalId));

            generatorForecast.Production += dayAhead;
            generatorForecastList[generator.GlobalId] = generatorForecast;
            return(generatorForecast);
        }
Пример #2
0
        private void CalculateDayAheadSubstation()
        {
            List <EnergyConsumer> energyConsumers = new List <EnergyConsumer>();

            energyConsumers    = GetEnergyConsumers();
            substationDayAhead = new Dictionary <long, DayAhead>();

            foreach (KeyValuePair <DMSType, Dictionary <long, IdentifiedObject> > kvp in networkModel.Insert)
            {
                foreach (KeyValuePair <long, IdentifiedObject> kvpDic in kvp.Value)
                {
                    DayAhead consumerDayAhead = consumerCharacteristics.GetDayAhead();

                    var type = kvpDic.Value.GetType();
                    if (type.Name.Equals("Substation"))
                    {
                        var gr = (Substation)kvpDic.Value;

                        Forecast forecast = CalculationEngineCache.Instance.GetForecast(kvpDic.Key);

                        foreach (DERMSCommon.WeatherForecast.HourDataPoint dataPoint in consumerDayAhead.Hourly)
                        {
                            DarkSkyApi.Models.HourDataPoint hourDataPoint = forecast.Hourly.Hours.FirstOrDefault(h => h.Time.Hour == dataPoint.Time.Hour);
                            float curveFactor = 0;
                            curveFactor           = dataPoint.ActivePower;
                            dataPoint.ActivePower = 0;
                            foreach (EnergyConsumer ec in energyConsumers)
                            {
                                if (gr.Equipments.Contains(ec.GlobalId))
                                {
                                    dataPoint.ActivePower += ec.PFixed * curveFactor;
                                }
                            }
                        }
                        substationDayAhead.Add(kvpDic.Key, consumerDayAhead.Clone());
                    }
                }
            }
        }