Пример #1
0
        public List <string> GetAvailableDataProviderElements(
            string stkObjectPath, string DataProviderName, string GroupName)
        {
            IAgStkObject        stkObject = root.GetObjectFromPath(stkObjectPath);
            IAgDataProviderInfo dpInfo    = stkObject.DataProviders[DataProviderName];

            IAgDataProvider dataProvider = stkObject.DataProviders[DataProviderName] as IAgDataProvider;

            if (dpInfo.IsGroup())
            {
                IAgDataProviderGroup dpGroup     = dpInfo as IAgDataProviderGroup;
                IAgDataProviders     dpAvailable = dpGroup.Group;

                for (int i = 0; i < dpAvailable.Count; ++i)
                {
                    if (dpAvailable[i].Name == GroupName)
                    {
                        dataProvider = dpAvailable[i] as IAgDataProvider;
                        break;
                    }
                }
            }

            List <string> dataElements = new List <string>();

            for (int i = 0; i < dataProvider.Elements.Count; ++i)
            {
                dataElements.Add(dataProvider.Elements[i].Name);
            }
            return(dataElements);
        }
Пример #2
0
        public List <String> GetAvailableGroups(string stkObjectPath, string DataProviderName)
        {
            IAgStkObject stkObject = root.GetObjectFromPath(stkObjectPath);

            IAgDataProviderInfo dataProvider = stkObject.DataProviders[DataProviderName];

            List <String> groups = new List <string>();

            if (dataProvider.IsGroup())
            {
                IAgDataProviderGroup dpGroup     = dataProvider as IAgDataProviderGroup;
                IAgDataProviders     dpAvailable = dpGroup.Group;

                for (int i = 0; i < dpAvailable.Count; ++i)
                {
                    groups.Add(dpAvailable[i].Name);
                }
            }

            return(groups);
        }
Пример #3
0
        public Array GetDataProviders(string stkObjectPath, string DataProviderName,
                                      string GroupName, string ElementName)
        {
            string startTime = scen.StartTime.ToString();
            string stopTime  = scen.StopTime.ToString();
            double stepSize  = 60;

            IAgStkObject stkObject = root.GetObjectFromPath(stkObjectPath);

            IAgDataProviderInfo dpInfo = stkObject.DataProviders[DataProviderName];

            IAgDataProvider dataProvider = stkObject.DataProviders[DataProviderName] as IAgDataProvider;

            if (dpInfo.IsGroup())
            {
                IAgDataProviderGroup dpGroup     = dpInfo as IAgDataProviderGroup;
                IAgDataProviders     dpAvailable = dpGroup.Group;

                for (int i = 0; i < dpAvailable.Count; ++i)
                {
                    if (dpAvailable[i].Name == GroupName)
                    {
                        dataProvider = dpAvailable[i] as IAgDataProvider;
                        break;
                    }
                }
            }

            IAgDrResult dpResult = null;

            switch (dpInfo.Type)
            {
            case AgEDataProviderType.eDrFixed:
                //Fixed data doesnt change over time
                IAgDataPrvFixed dpFixed = dataProvider as IAgDataPrvFixed;
                dpResult = dpFixed.Exec();
                break;

            case AgEDataProviderType.eDrIntvl:
                //Interval data is given as a list of intervals with start, stop and duration
                IAgDataPrvInterval dpInterval = dataProvider as IAgDataPrvInterval;
                //Must provide analysis start and stop time

                dpResult = dpInterval.Exec(startTime, stopTime);
                break;

            case AgEDataProviderType.eDrTimeVar:
                //Time varyign data is given as an array of time based values
                IAgDataPrvTimeVar dpTimeVarying = dataProvider as IAgDataPrvTimeVar;
                //Must provide analysis start and stop time plus an evaluation step size
                dpResult = dpTimeVarying.Exec(startTime, stopTime, stepSize);
                break;

            default:
                break;
            }

            Array dataValues = null;

            IAgDrDataSetCollection datasets = dpResult.DataSets;

            if (datasets.Count > 0)
            {
                IAgDrDataSet thisDataset = datasets.GetDataSetByName(ElementName);

                dataValues = thisDataset.GetValues();
            }
            return(dataValues);
        }