public void removeUsagesForSFU(Catchment cat, StandardFunctionalUnit SFU)
        {
            //RRmodel
            if (SFU.rainfallRunoffModel != null)
            {
                removeUsagesForSpecificModel(SFU.rainfallRunoffModel);
            }

            CatchmentElementConstituentData CECD =
                Scenario.Network.ConstituentsManagement.GetConstituentData <CatchmentElementConstituentData>(cat);
            FunctionalUnitConstituentData FUCD = CECD.GetFunctionalUnitData(SFU);

            foreach (ConstituentContainer CC in FUCD.ConstituentModels)
            {
                foreach (ConstituentSourceContainer CSC in CC.ConstituentSources)
                {
                    removeUsagesForSpecificModel(CSC.GenerationModel);
                    removeUsagesForSpecificModel(CSC.FilterModel);
                }
            }
        }
Exemple #2
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()));
        }
Exemple #3
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
             */
        }