예제 #1
0
        public static string FindDataSource(RiverSystemScenario scenario, object target, string element,
                                            string inputSet = null)
        {
            var ri = GetReflectedItem(target, element);

            Network  theNetwork  = scenario.Network;
            InputSet theInputSet = null;

            if (inputSet != null)
            {
                IList <InputSet> inputSets = theNetwork.InputSets;
                theInputSet = inputSets.FirstOrDefault(i => i.Name == inputSet);
            }

            if (theInputSet == null)
            {
                theInputSet = theNetwork.DefaultInputSet;
            }


            DataManager dm = theNetwork.DataManager;

            foreach (var name in dm.DataGroups.Select(g => g.GetFullPath(ri, theInputSet)).Where(name => !String.IsNullOrEmpty(name)))
            {
                return(name);
            }
            return("");
        }
예제 #2
0
        //public static string FindMemberFromAka(Type t, string aka)
        //{
        //    foreach (MemberInfo memberInfo in t.GetMembers())
        //    {
        //        if (AkaAttribute.FindAka(memberInfo).ToLower() == aka.ToLower())
        //            return memberInfo.Name;
        //    }
        //    return null;
        //}

        public static void AssignTimeSeries(RiverSystemScenario scenario, object target, string element,
                                            string dataGroupName, string dataItem, int column = 0)
        {
            var ri = GetReflectedItem(target, element);

            var dm = scenario.Network.DataManager;

            dm.RemoveUsage(ri);

            var dataGroup = dm.DataGroups.Where(dg => dg.Name == dataGroupName).FirstOrDefault();

            if (dataGroup == null)
            {
                dataGroup      = DataGroupItem.CreateGroup <GeneratedCentralDataSource>(scenario.Network.DefaultInputSet);
                dataGroup.Name = dataGroupName;
                dm.DataGroups.Add(dataGroup);
            }

            var dataGroupItem = dataGroup.DataDetails.Where(dgi => dgi.Name == dataItem).FirstOrDefault();

            if (dataGroupItem == null)
            {
                Data[]     loaded = NonInteractiveIO.Load(dataItem);
                TimeSeries ts     = loaded[column] as TimeSeries;
                ts.name = dataItem;
                dataGroup.CreateUsage <GeneratedDataDetails>(ri, ts);
            }
            else
            {
                dataGroupItem.Usages.Add(new DataUsage {
                    ReflectedItem = ri
                });
            }
        }
예제 #3
0
        public static void InitialiseModelsForConstituent(RiverSystemScenario s, Constituent c)
        {
            ConstituentsManagement cm = s.Network.ConstituentsManagement;

            cm.Elements.OfType <NetworkElementConstituentData>().ForEachItem(d =>
            {
                if (d.Data == null)
                {
                    d.Data = new ConstituentsModel();
                }

                d.Data.GetModel(c, DefaultSourceSinkType(d));
                if (!d.Data.ConstituentPlayedValues.Any(cpv => cpv.Constituent == c))
                {
                    d.Data.ConstituentPlayedValues.Add(new ConstituentPlayedValue(c)
                    {
                        PlayedType = ConstituentPlayedValue.ConstituentPlayedType.varConcentration
                    });
                }
                d.Reset(cm, false, null, ScenarioType.RiverManager);
            });

            foreach (var catchment in s.Network.Catchments.OfType <Catchment>())
            {
                foreach (var functionalUnit in catchment.FunctionalUnits.OfType <StandardFunctionalUnit>())
                {
                    InitialiseConstituentSources(s, catchment, functionalUnit, c);
                }
            }
        }
예제 #4
0
        public static DataTable FunctionalUnits(RiverSystemScenario scenario)
        {
            var result = new DataTable();

            result.Columns.Add("Catchment", typeof(string));
            scenario.Network.FunctionalUnitConfiguration.fuDefinitions.ForEachItem(fud => result.Columns.Add(fud.Name, typeof(double)));

            foreach (ICatchment ic in scenario.Network.Catchments)
            {
                Catchment c = ic as Catchment;
                if (c == null)
                {
                    continue;
                }

                var row = result.NewRow();
                row["Catchment"] = c.Name;
                c.FunctionalUnits.ForEachItem(fu =>
                {
                    row[fu.definition.Name] = fu.areaInSquareMeters;
                });
                result.Rows.Add(row);
            }
            return(result);
        }
예제 #5
0
 public VeneerStatus(RiverSystemScenario s)
 {
     Version       = PROTOCOL_VERSION;
     SourceVersion = new Constants.ProductVersion().GetFullVersionString();
     ProjectFile   = s.Project.FileName;
     Scenario      = s.Name;
 }
예제 #6
0
        //public static string FindMemberFromAka(Type t, string aka)
        //{
        //    foreach (MemberInfo memberInfo in t.GetMembers())
        //    {
        //        if (AkaAttribute.FindAka(memberInfo).ToLower() == aka.ToLower())
        //            return memberInfo.Name;
        //    }
        //    return null;
        //}

        public static void AssignTimeSeries(RiverSystemScenario scenario, object target, string element,
            string dataGroupName, string dataItem, int column = 0)
        {
            var ri = GetReflectedItem(target, element);

            var dm = scenario.Network.DataManager;
            dm.RemoveUsage(ri);

            var dataGroup = dm.DataGroups.Where(dg => dg.Name == dataGroupName).FirstOrDefault();
            if (dataGroup == null)
            {
                dataGroup = DataGroupItem.CreateGroup<GeneratedCentralDataSource>(scenario.Network.DefaultInputSet);
                dataGroup.Name = dataGroupName;
                dm.DataGroups.Add(dataGroup);
            }

            var dataGroupItem = dataGroup.DataDetails.Where(dgi => dgi.Name == dataItem).FirstOrDefault();
            if (dataGroupItem == null)
            {
                Data[] loaded = NonInteractiveIO.Load(dataItem);
                TimeSeries ts = loaded[column] as TimeSeries;
                ts.name = dataItem;
                dataGroup.CreateUsage<GeneratedDataDetails>(ri, ts);
            }
            else
            {
                dataGroupItem.Usages.Add(new DataUsage {ReflectedItem = ri});
            }
        }
예제 #7
0
        public DataGroupItem AddToScenario(RiverSystemScenario scenario)
        {
            var dm            = scenario.Network.DataManager;
            var asFile        = Items.All(i => i.DetailsAsCSV == null);
            var dataGroupType = asFile
                ? typeof(FileCentralDataSource)
                : typeof(GeneratedCentralDataSource);

            var dataGroup = DataGroupItem.CreateGroup(dataGroupType, scenario.Network.InputSets);

            dataGroup.Name = Name;
            if (asFile)
            {
                dataGroup.InputSetItems.ForEachItem(i =>
                {
                    FileCentralDataSource ds = i.DataSource.SourceInformation as FileCentralDataSource;
                    ds.Filename = Name;
                });
            }

            dm.DataGroups.Add(dataGroup);

            if (Items == null)
            {
                return(dataGroup);
            }

            for (int i = 0; i < Items.Length; i++)
            {
                var item = Items[i];
                item.AddToGroup(scenario, dataGroup, i);
            }
            return(dataGroup);
        }
예제 #8
0
 public E2CatchmentRREvaluator(RiverSystemScenario scenario)
 {
     this.scenario = scenario;
     RiverSystem.Node node = scenario.Network.outletNodes()[0] as RiverSystem.Node;
     theRunoff = scenario.NetworkRunner.record("Flow", node.Outflow);
     scenario.NetworkRunner.execute();
     observedRunoff = (TimeSeries)theRunoff.copy( );
 }
예제 #9
0
        public static SchematicNetworkConfigurationPersistent GetSchematic(RiverSystemScenario scenario)
        {
            object tmp;

            scenario.AuxiliaryInformation.TryGetValue(SchematicNetworkControl.AUX_CONFIG, out tmp);
            SchematicNetworkConfigurationPersistent schematic = tmp as SchematicNetworkConfigurationPersistent;

            return(schematic);
        }
예제 #10
0
        private static RiverSystemScenario CreateEmptyScenario(Options options)
        {
            var project           = RiverSystemProject.CreateProject("Created Project");
            var scenario          = new RiverSystemScenario(project);
            var scenarioContainer = new RiverSystemScenarioContainer(scenario);

            project.AddScenario(scenarioContainer);

            return(scenario);
        }
예제 #11
0
 public static void InitialiseModelsForConstituentSource(RiverSystemScenario s)
 {
     foreach (var catchment in s.Network.Catchments.OfType <Catchment>())
     {
         foreach (var functionalUnit in catchment.FunctionalUnits.OfType <StandardFunctionalUnit>())
         {
             foreach (var constituent in s.SystemConfiguration.Constituents)
             {
                 InitialiseConstituentSources(s, catchment, functionalUnit, constituent);
             }
         }
     }
 }
예제 #12
0
        internal void AddToGroup(RiverSystemScenario scenario, DataGroupItem dataGroup, int index)
        {
            DataSourceItem sourceItem = dataGroup.InputSetItems[index].DataSource;

            sourceItem.Name = Name;

            if (DetailsAsCSV == null)
            {
                LoadFromFile(dataGroup, sourceItem);
            }
            else
            {
                LoadFromDetails(dataGroup, sourceItem);
            }
        }
예제 #13
0
        private static void InitialiseConstituentSources(RiverSystemScenario scenario, Catchment catchment, StandardFunctionalUnit fu, Constituent constituent)
        {
            ConstituentsManagement        cm               = scenario.Network.ConstituentsManagement;
            FunctionalUnitConstituentData model            = cm.GetConstituentData <CatchmentElementConstituentData>(catchment).GetFunctionalUnitData(fu);
            ConstituentContainer          constituentModel = model.ConstituentModels.SingleOrDefault(f => f.Constituent.Equals(constituent));

            if (constituentModel == null)
            {
                constituentModel = new ConstituentContainer(constituent);
                model.ConstituentModels.Add(constituentModel);
            }

#if V3 || V4_0 || V4_1 || V4_2 || V4_3
            if (constituentModel.ConstituentSources.Count == scenario.SystemConfiguration.ConstituentSources.Count)
            {
                return;
            }
#else
            if (constituentModel.ConstituentSources.Length == scenario.SystemConfiguration.ConstituentSources.Count)
            {
                return;
            }
#endif

            scenario.SystemConfiguration.ConstituentSources.ForEachItem(cs =>
            {
                if (constituentModel.ConstituentSources.Any(csc => csc.ConstituentSource == cs))
                {
                    return;
                }
#if V3 || V4_0 || V4_1 || V4_2 || V4_3
                constituentModel.ConstituentSources.Add(new ConstituentSourceContainer(cs, new NilConstituent(), new PassThroughFilter()));
#else
                constituentModel.AddConstituentSources(new ConstituentSourceContainer(cs, new NilConstituent(), new PassThroughFilter()));
#endif
            });

            /*
             * var defaultConstituentSource = scenario.SystemConfiguration.ConstituentSources.First(cs => cs.IsDefault);
             #if V3 || V4_0 || V4_1 || V4_2 || V4_3_0
             *          constituentModel.ConstituentSources.Add(new ConstituentSourceContainer(defaultConstituentSource, new NilConstituent(), new PassThroughFilter()));
             #else
             *          constituentModel.AddConstituentSources(new ConstituentSourceContainer(defaultConstituentSource, new NilConstituent(), new PassThroughFilter()));
             #endif
             */
        }
예제 #14
0
        public static void printPrams(RiverSystemScenario scenario, ISystemConfiguration pSet)
        {
            StringBuilder sb = new StringBuilder();

            foreach (Catchment c in scenario.Network.catchmentList)
            {
                foreach (StandardFunctionalUnit fu in c.FunctionalUnits)
                {
                    List <AccessorMemberInfo> accessorInfoList = MetaParameterSet.KnownParameters(fu.rainfallRunoffModel);
                    foreach (var accessorMemberInfo in accessorInfoList)
                    {
                        sb.AppendLine(c.Name + ":" + fu.definition.Name + ":" + accessorMemberInfo.Name + ":" + accessorMemberInfo.GetValue(fu.rainfallRunoffModel));
                    }
                    sb.AppendLine("-----");
                }
            }
            (pSet as MetaParameterSet).RealConfiguration = sb.ToString();
            Console.WriteLine(sb.ToString());
        }
예제 #15
0
        public static void EnsureElementsHaveConstituentProviders(RiverSystemScenario scenario)
        {
            Network network           = scenario.Network;
            ConstituentsManagement cm = network.ConstituentsManagement;

            Action <INetworkElement> ensure = element =>
            {
                cm.NetworkElementAdded(element, null);
            };

            network.Nodes.ForEachItem(ensure);
            network.Links.ForEachItem(ensure);

            /*
             *              var element = sender as INetworkElement;
             * if (element != null && !_elementsDictionary.ContainsKey(element))
             *  _elementsDictionary.Add(element, ElementDataFactory.GetNetworkElementConstituentData(element));
             */
        }
예제 #16
0
        public GeoJSONFeature(Link l, RiverSystemScenario scenario, bool useSchematicLocation)
        {
            id = LinkURL(l);
            properties.Add("name", l.Name);
            properties.Add(FeatureTypeProperty, "link");
            properties.Add("from_node", NodeURL((Node)l.UpstreamNode, l.Network));
            properties.Add("to_node", NodeURL((Node)l.DownstreamNode, l.Network));
            properties.Add("length", l.Length);

            if (useSchematicLocation)
            {
                var schematic = ScriptHelpers.GetSchematic(scenario);
                if (scenario != null)
                {
                    geometry = new GeoJSONGeometry(SchematicLocationForNode(l.from, schematic), SchematicLocationForNode(l.to, schematic));
                    return;
                }
            }
            geometry = new GeoJSONGeometry(l, useSchematicLocation);
        }
예제 #17
0
        public GeoJSONFeature(Node n,RiverSystemScenario scenario,bool useSchematicLocation)
        {           
            id = NodeURL(n);

            properties.Add("name",n.Name);
            properties.Add(FeatureTypeProperty, "node");
            Coordinate loc = n.location;
            var schematic = ScriptHelpers.GetSchematic(scenario);
            if (schematic != null)
            {
                PointF schematicLocation = SchematicLocationForNode(n, schematic);
                properties.Add("schematic_location",new double[] {schematicLocation.X,schematicLocation.Y});
                if (useSchematicLocation)
                    loc = new Coordinate(schematicLocation);
            }
            properties.Add(ResourceProperty,
                UriTemplates.Resources.Replace("{resourceName}", ResourceName(n)));

            geometry = new GeoJSONGeometry(loc);
        }
예제 #18
0
        public VariableSummary(AbstractFunctionVariable v,RiverSystemScenario scenario)
        {
            Scenario = scenario;
            Variable = v;
            Name = v.Name;
            FullName = v.FullName;
            ID = v.id;
            VariableType = v.GetType().Name;
 
            if (v is BilinearVariable)
            {
                VeneerSupported = false;
            }
            else if (v is ContextVariable)
            {
                VeneerSupported = false;
            }
            else if (v is ModelledVariable)
            {
                VeneerSupported = false;
            }
            else if (v is PatternVariable)
            {
                VeneerSupported = false;
            }
            else if (v is LinearVariable)
            {
                VeneerSupported = true;
                PiecewiseFunctionData = new SimplePiecewise(v as LinearVariable);
                PiecewiseFunction = String.Format("/variables/{0}/Piecewise", FullName.Replace("$", ""));
            }
            else if (v is TimeSeriesVariable)
            {
                VeneerSupported = true;
                var tsV = (TimeSeriesVariable) v;
                VeneerDebugInfo += kvp("DisplayName", tsV.DisplayName) +
                                   kvp("ResultUnit", tsV.ResultUnit.Name);
                TimeSeriesData = new SimpleTimeSeries(FindTimeSeries());
                TimeSeries = String.Format("/variables/{0}/TimeSeries", FullName.Replace("$", ""));
            }
        }
예제 #19
0
        public VariableSummary(AbstractFunctionVariable v, RiverSystemScenario scenario)
        {
            Scenario     = scenario;
            Variable     = v;
            Name         = v.Name;
            FullName     = v.FullName;
            ID           = v.id;
            VariableType = v.GetType().Name;

            if (v is BilinearVariable)
            {
                VeneerSupported = false;
            }
            else if (v is ContextVariable)
            {
                VeneerSupported = false;
            }
            else if (v is ModelledVariable)
            {
                VeneerSupported = false;
            }
            else if (v is PatternVariable)
            {
                VeneerSupported = false;
            }
            else if (v is LinearVariable)
            {
                VeneerSupported       = true;
                PiecewiseFunctionData = new SimplePiecewise(v as LinearVariable);
                PiecewiseFunction     = String.Format("/variables/{0}/Piecewise", FullName.Replace("$", ""));
            }
            else if (v is TimeSeriesVariable)
            {
                VeneerSupported = true;
                var tsV = (TimeSeriesVariable)v;
                VeneerDebugInfo += kvp("DisplayName", tsV.DisplayName) +
                                   kvp("ResultUnit", tsV.ResultUnit.Name);
                TimeSeriesData = new SimpleTimeSeries(FindTimeSeries());
                TimeSeries     = String.Format("/variables/{0}/TimeSeries", FullName.Replace("$", ""));
            }
        }
        public MetaParameterSet(object system)
        {
            var r = new List <AccessorMemberInfo>( );
            RiverSystemScenario riverSystemScenario = system as RiverSystemScenario;

            foreach (var item in riverSystemScenario.Network.catchmentList)
            {
                Catchment catchment = item as Catchment;
                foreach (StandardFunctionalUnit functionalUnit in catchment.FunctionalUnits)
                {
                    List <AccessorMemberInfo> list = KnownParameters(functionalUnit.rainfallRunoffModel);
                    r.AddRange(list);
                }
            }
            foreach (AccessorMemberInfo key in r)
            {
                if (!availableParameters.Contains(key))
                {
                    availableParameters.Add(key);
                }
            }
        }
예제 #21
0
        public static TimeSeries FindInputTimeSeries(RiverSystemScenario scenario, object target, string element, string inputSet = null)
        {
            var ri = GetReflectedItem(target, element);

            Network  theNetwork  = scenario.Network;
            InputSet theInputSet = null;

            if (inputSet != null)
            {
                IList <InputSet> inputSets = theNetwork.InputSets;
                theInputSet = inputSets.FirstOrDefault(i => i.Name == inputSet);
            }

            if (theInputSet == null)
            {
                theInputSet = theNetwork.DefaultInputSet;
            }

            DataManager dm = theNetwork.DataManager;

            return(dm.GetUsedTimeSeries(theInputSet, ri));
        }
예제 #22
0
        public GeoJSONFeature(Node n, RiverSystemScenario scenario, bool useSchematicLocation)
        {
            id = NodeURL(n, scenario.Network);

            properties.Add("name", n.Name);
            properties.Add(FeatureTypeProperty, "node");
            Coordinate loc       = n.location;
            var        schematic = ScriptHelpers.GetSchematic(scenario);

            if (schematic != null)
            {
                PointF schematicLocation = SchematicLocationForNode(n, schematic);
                properties.Add("schematic_location", new double[] { schematicLocation.X, schematicLocation.Y });
                if (useSchematicLocation)
                {
                    loc = new Coordinate(schematicLocation);
                }
            }
            properties.Add(ResourceProperty,
                           UriTemplates.Resources.Replace("{resourceName}", ResourceName(n)));

            geometry = new GeoJSONGeometry(loc);
        }
예제 #23
0
        public static void ConfigureAssuranceRule(RiverSystemScenario scenario, string level = "Off", string name = null, string category = null)
        {
            var      config = scenario.GetScenarioConfiguration <AssuranceConfiguration>();
            LogLevel logLevel;

            if (!Enum.TryParse <LogLevel>(level, true, out logLevel))
            {
                throw new Exception("Unknown log level");
            }

            if (name == null)
            {
                scenario.Network.AssuranceManager.DefaultLogLevels.ForEachItem(ar =>
                {
                    ConfigureAssuranceRule(scenario, level, ar.Name, ar.Category);
                });
                return;
            }

            bool          needToAdd = false;
            AssuranceRule rule      = GetAssuranceRule(name, category, config.Entries);

            if (rule == null)
            {
                rule      = GetAssuranceRule(name, category, scenario.Network.AssuranceManager.DefaultLogLevels);
                needToAdd = true;
            }
            if (rule == null)
            {
                throw new Exception("Unknown assurance rule");
            }
            rule.LogLevel = logLevel;
            if (needToAdd)
            {
                config.Entries.Add(rule);
            }
        }
예제 #24
0
        public void ReplaceInScenario(RiverSystemScenario scenario, DataGroupItem existing)
        {
            var dm   = scenario.Network.DataManager;
            var name = Name;

            Name = string.Format("TMP___{0}", name);

            var newItem = AddToScenario(scenario);

            foreach (var origDetail in existing.DataDetails)
            {
                var destDetail = newItem.DataDetails.First(dd => dd.Name == origDetail.Name);
                foreach (var usage in origDetail.Usages)
                {
                    destDetail.Usages.Add(usage);
                }

                origDetail.Usages.Clear();
            }
            Name         = name;
            newItem.Name = name;
            dm.RemoveGroup(existing);
            dm.Refresh();
        }
예제 #25
0
        public static string FindDataSource(RiverSystemScenario scenario, object target, string element,
            string inputSet = null)
        {
            var ri = GetReflectedItem(target, element);

            Network theNetwork = scenario.Network;
            InputSet theInputSet = null;

            if (inputSet != null)
            {
                IList<InputSet> inputSets = theNetwork.InputSets;
                theInputSet = inputSets.FirstOrDefault(i => i.Name == inputSet);
            }

            if (theInputSet == null)
                theInputSet = theNetwork.DefaultInputSet;


            DataManager dm = theNetwork.DataManager;

            foreach (var name in dm.DataGroups.Select(g => g.GetFullPath(ri,theInputSet)).Where(name => !String.IsNullOrEmpty(name)))
            {
                return name;
            }
            return "";
        }
예제 #26
0
 public ParseDataRequests(RiverSystemScenario scenario)
 {
     Scenario = scenario;
 }
예제 #27
0
 private IObjectiveEvaluator<MetaParameterSet> buildNewEvaluator( RiverSystemScenario scenario )
 {
     return new E2CatchmentRREvaluator( scenario );
 }
예제 #28
0
 private static RainfallRunoffModel[] findAllAwbmInstances(RiverSystemScenario scenario)
 {
     return(RiverSystem.TestingSupport.TestHelperRiverSystem.RainfallRunoffModels(scenario).FindAll((x => (x is  AWBM))).ToArray());
 }
예제 #29
0
 public LumpedAWBMFactory(RiverSystemScenario scenario, IRandomNumberGeneratorFactory rng)
 {
     this.scenario = scenario;
     this.random   = rng.CreateRandom();
     GetMetaParameterSet();
 }
예제 #30
0
 public InputSets(RiverSystemScenario scenario)
 {
     Scenario = scenario;
 }
예제 #31
0
        public GeoJSONFeature(Link l, RiverSystemScenario scenario, bool useSchematicLocation)
        {
            id = LinkURL(l);
            properties.Add("name", l.Name);
            properties.Add(FeatureTypeProperty, "link");
            properties.Add("from_node", NodeURL(l.UpstreamNode));
            properties.Add("to_node", NodeURL(l.DownstreamNode));

            if (useSchematicLocation)
            {
                var schematic = ScriptHelpers.GetSchematic(scenario);
                if (scenario != null)
                {

                    geometry = new GeoJSONGeometry(SchematicLocationForNode(l.from,schematic),SchematicLocationForNode(l.to,schematic));
                    return;
                }
            }
            geometry = new GeoJSONGeometry(l, useSchematicLocation);
        }
예제 #32
0
        public static void InitialiseModelsForConstituent(RiverSystemScenario s, Constituent c)
        {
            ConstituentsManagement cm = s.Network.ConstituentsManagement;
            
            cm.Elements.OfType<NetworkElementConstituentData>().ForEachItem(d =>
            {
                if (d.Data == null)
                    d.Data = new ConstituentsModel();

                d.Data.GetModel(c, DefaultSourceSinkType(d));
            });

            foreach (var catchment in s.Network.Catchments.OfType<Catchment>())
            {
                foreach (var functionalUnit in catchment.FunctionalUnits.OfType<StandardFunctionalUnit>())
                {
                    InitialiseConstituentSources(s,catchment, functionalUnit,c);
                }
            }
        }
예제 #33
0
 public InputSets(RiverSystemScenario scenario)
 {
     Scenario = scenario;
 }
예제 #34
0
        public static void EnsureElementsHaveConstituentProviders(RiverSystemScenario scenario)
        {
            Network network = scenario.Network;
            ConstituentsManagement cm = network.ConstituentsManagement;

            Action<INetworkElement> ensure = element =>
            {
                cm.NetworkElementAdded(element,null);
            };

            network.Nodes.ForEachItem(ensure);
            network.Links.ForEachItem(ensure);
            /* 
                            var element = sender as INetworkElement;
            if (element != null && !_elementsDictionary.ContainsKey(element))
                _elementsDictionary.Add(element, ElementDataFactory.GetNetworkElementConstituentData(element));
*/
        }
예제 #35
0
        private static void InitialiseConstituentSources(RiverSystemScenario scenario, Catchment catchment, StandardFunctionalUnit fu, Constituent constituent)
        {
            ConstituentsManagement cm = scenario.Network.ConstituentsManagement;
            FunctionalUnitConstituentData model = cm.GetConstituentData<CatchmentElementConstituentData>(catchment).GetFunctionalUnitData(fu);
            ConstituentContainer constituentModel = model.ConstituentModels.SingleOrDefault(f => f.Constituent.Equals(constituent));
            if (constituentModel == null)
            {
                constituentModel = new ConstituentContainer(constituent);
                model.ConstituentModels.Add(constituentModel);
            }

            if (constituentModel.ConstituentSources.Count > 0) return;

            var defaultConstituentSource = scenario.SystemConfiguration.ConstituentSources.First(cs => cs.IsDefault);
            constituentModel.ConstituentSources.Add(new ConstituentSourceContainer(defaultConstituentSource, new NilConstituent(), new PassThroughFilter()));
        }
예제 #36
0
 public static SchematicNetworkConfigurationPersistent GetSchematic(RiverSystemScenario scenario)
 {
     object tmp;
     scenario.AuxiliaryInformation.TryGetValue(SchematicNetworkControl.AUX_CONFIG, out tmp);
     SchematicNetworkConfigurationPersistent schematic = tmp as SchematicNetworkConfigurationPersistent;
     return schematic;
 }
예제 #37
0
 public ParseDataRequests(RiverSystemScenario scenario)
 {
     Scenario = scenario;
 }
예제 #38
0
        public static TimeSeries FindInputTimeSeries(RiverSystemScenario scenario, object target, string element, string inputSet=null)
        {
            var ri = GetReflectedItem(target, element);

            Network theNetwork = scenario.Network;
            InputSet theInputSet = null;

            if (inputSet != null)
            {
                IList<InputSet> inputSets = theNetwork.InputSets;
                theInputSet = inputSets.FirstOrDefault(i => i.Name == inputSet);
            }

            if(theInputSet==null)
                theInputSet= theNetwork.DefaultInputSet;
            
            DataManager dm = theNetwork.DataManager;
            return dm.GetUsedTimeSeries(theInputSet,ri);
        }
예제 #39
0
 public void Initialise(RiverSystemScenario scenario)
 {
     this.scenario = scenario;
 }