Пример #1
0
        void WriteAnalysis(System.Text.StringBuilder text, ProjectReportProperties ProjectReportProperties, string keyCode)
        {
            if (Attributes.IsKeyCodeEnabled)
            {
                AppendStringTab(text, keyCode);
            }

            if (Attributes.IsTotalVolumeEnabled)
            {
                AppendStringTab(text, ProjectReportProperties.TotalVolume);
            }

            if (Attributes.IsTraceBeginsEnabled)
            {
                AppendStringTab(text, ProjectReportProperties.TraceBegins);
            }

            if (Attributes.IsTraceEndsEnabled)
            {
                AppendStringTab(text, ProjectReportProperties.TraceEnds);
            }

            if (Attributes.IsTraceLengthDaysEnabled)
            {
                AppendStringTab(text, ProjectReportProperties.TraceLengthDays);
            }

            if (Attributes.IsTotalGpdEnabled)
            {
                AppendStringTab(text, ProjectReportProperties.TotalGpd);
            }

            if (Attributes.IsIndoorGpdEnabled)
            {
                AppendStringTab(text, ProjectReportProperties.IndoorGpd);
            }

            if (Attributes.IsOutdoorGpdEnabled)
            {
                AppendStringTab(text, ProjectReportProperties.OutdoorGpd);
            }

            if (Attributes.IsIndoorTotalGalEnabled)
            {
                AppendStringTab(text, ProjectReportProperties.IndoorTotalGal);
            }

            if (Attributes.IsOutdoorTotalGalEnabled)
            {
                AppendStringTab(text, ProjectReportProperties.OutdoorTotalGal);
            }

            if (Attributes.IsTotalGallonsColumnsEnabled)
            {
                AppendStringTab(text, ProjectReportProperties.BathtubTotalGal);
                AppendStringTab(text, ProjectReportProperties.ClotheswasherTotalGal);
                AppendStringTab(text, ProjectReportProperties.CoolerTotalGal);
                AppendStringTab(text, ProjectReportProperties.DishwasherTotalGal);
                AppendStringTab(text, ProjectReportProperties.FaucetTotalGal);
                AppendStringTab(text, ProjectReportProperties.LeakTotalGal);
                AppendStringTab(text, ProjectReportProperties.OtherTotalGal);
                AppendStringTab(text, ProjectReportProperties.ShowerTotalGal);
                AppendStringTab(text, ProjectReportProperties.ToiletTotalGal);
                AppendStringTab(text, ProjectReportProperties.TreatmentTotalGal);
            }

            if (Attributes.IsEventsColumnsEnabled)
            {
                AppendStringTab(text, ProjectReportProperties.BathtubEvents);
                AppendStringTab(text, ProjectReportProperties.ClotheswasherEvents);
                AppendStringTab(text, ProjectReportProperties.CoolerEvents);
                AppendStringTab(text, ProjectReportProperties.DishwasherEvents);
                AppendStringTab(text, ProjectReportProperties.FaucetEvents);
                AppendStringTab(text, ProjectReportProperties.LeakEvents);
                AppendStringTab(text, ProjectReportProperties.OtherEvents);
                AppendStringTab(text, ProjectReportProperties.ShowerEvents);
                AppendStringTab(text, ProjectReportProperties.ToiletEvents);
                AppendStringTab(text, ProjectReportProperties.TreatmentEvents);
            }

            if (Attributes.IsGallonsPerDayColumnsEnabled)
            {
                AppendStringTab(text, ProjectReportProperties.BathtubGpd);
                AppendStringTab(text, ProjectReportProperties.ClotheswasherGpd);
                AppendStringTab(text, ProjectReportProperties.CoolerGpd);
                AppendStringTab(text, ProjectReportProperties.DishwasherGpd);
                AppendStringTab(text, ProjectReportProperties.FaucetGpd);
                AppendStringTab(text, ProjectReportProperties.LeakGpd);
                AppendStringTab(text, ProjectReportProperties.OtherGpd);
                AppendStringTab(text, ProjectReportProperties.ShowerGpd);
                AppendStringTab(text, ProjectReportProperties.ToiletGpd);
                AppendStringTab(text, ProjectReportProperties.TreatmentGpd);
            }

            if (Attributes.IsClotheswasherDetailColumnsEnabled)
            {
                AppendStringTab(text, ProjectReportProperties.AverageClotheswasherLoadGal);
                AppendStringTab(text, ProjectReportProperties.ClotheswasherLoadsPerDay);
            }

            if (Attributes.IsShowerDetailColumnsEnabled)
            {
                AppendStringTab(text, ProjectReportProperties.TotalShowerMinutes);
                AppendStringTab(text, ProjectReportProperties.AverageShowerSeconds);
                AppendStringTab(text, ProjectReportProperties.TotalShowerGal);
                AppendStringTab(text, ProjectReportProperties.AverageShowerGal);
                AppendStringTab(text, ProjectReportProperties.AverageShowerModeFlowGpm);
                AppendStringTab(text, ProjectReportProperties.ShowersPerDay);
                AppendStringTab(text, ProjectReportProperties.ShowerMinutesPerDay);
            }

            if (Attributes.IsToiletDetailColumnsEnabled)
            {
                AppendStringTab(text, ProjectReportProperties.AverageToiletFlushVolume);
                AppendStringTab(text, ProjectReportProperties.ToiletFlushStDev);
                AppendStringTab(text, ProjectReportProperties.NumberOfToiletFlushesLessThan2Point2Gal);
                AppendStringTab(text, ProjectReportProperties.NumberOfToiletFlushesGreaterThan2Point2Gal);
                AppendStringTab(text, ProjectReportProperties.FlushesPerDay);
            }

            WriteLine(text);
        }
Пример #2
0
        public ProjectReportProperties CalculateProjectReportProperties(Events events, List <FixtureClass> fixtureClassesOutdoor)
        {
            Events           = events;
            FixtureSummaries = new FixtureSummaries(Events);
            FixtureSummaries.Update();

            List <FixtureClass> fixtureClassesIndoor = new List <FixtureClass>();

            foreach (FixtureClass fixtureClass in FixtureClasses.Items.Values)
            {
                if (!fixtureClassesOutdoor.Contains(fixtureClass))
                {
                    fixtureClassesIndoor.Add(fixtureClass);
                }
            }

            var ProjectReportProperties = new ProjectReportProperties();

            ProjectReportProperties.TotalVolume = Events.Volume;
            ProjectReportProperties.TraceBegins = Events.StartTime;
            ProjectReportProperties.TraceEnds   = Events.EndTime;

            ProjectReportProperties.TraceLengthDays = Events.EndTime.Date.Subtract(Events.StartTime.Date).Days + 1;

            ProjectReportProperties.TotalGpd = Events.Volume / ProjectReportProperties.TraceLengthDays;

            ProjectReportProperties.IndoorTotalGal  = CalculateVolume(fixtureClassesIndoor);
            ProjectReportProperties.OutdoorTotalGal = CalculateVolume(fixtureClassesOutdoor);

            ProjectReportProperties.BathtubTotalGal       = FixtureSummaries[FixtureClasses.Bathtub].Volume;
            ProjectReportProperties.ClotheswasherTotalGal = FixtureSummaries[FixtureClasses.Clotheswasher].Volume;
            ProjectReportProperties.CoolerTotalGal        = FixtureSummaries[FixtureClasses.Cooler].Volume;
            ProjectReportProperties.DishwasherTotalGal    = FixtureSummaries[FixtureClasses.Dishwasher].Volume;
            ProjectReportProperties.FaucetTotalGal        = FixtureSummaries[FixtureClasses.Faucet].Volume;
            ProjectReportProperties.LeakTotalGal          = FixtureSummaries[FixtureClasses.Leak].Volume;
            ProjectReportProperties.ShowerTotalGal        = FixtureSummaries[FixtureClasses.Shower].Volume;
            ProjectReportProperties.ToiletTotalGal        = FixtureSummaries[FixtureClasses.Toilet].Volume;
            ProjectReportProperties.TreatmentTotalGal     = FixtureSummaries[FixtureClasses.Treatment].Volume;

            ProjectReportProperties.OtherTotalGal = ProjectReportProperties.IndoorTotalGal
                                                    - FixtureSummaries[FixtureClasses.Bathtub].Volume
                                                    - FixtureSummaries[FixtureClasses.Clotheswasher].Volume
                                                    - FixtureSummaries[FixtureClasses.Cooler].Volume
                                                    - FixtureSummaries[FixtureClasses.Dishwasher].Volume
                                                    - FixtureSummaries[FixtureClasses.Faucet].Volume
                                                    - FixtureSummaries[FixtureClasses.Leak].Volume
                                                    - FixtureSummaries[FixtureClasses.Shower].Volume
                                                    - FixtureSummaries[FixtureClasses.Toilet].Volume
                                                    - FixtureSummaries[FixtureClasses.Treatment].Volume
            ;

            ProjectReportProperties.IndoorGpd        = ProjectReportProperties.IndoorTotalGal / ProjectReportProperties.TraceLengthDays;
            ProjectReportProperties.OutdoorGpd       = ProjectReportProperties.OutdoorTotalGal / ProjectReportProperties.TraceLengthDays;
            ProjectReportProperties.BathtubGpd       = ProjectReportProperties.BathtubTotalGal / ProjectReportProperties.TraceLengthDays;
            ProjectReportProperties.ClotheswasherGpd = ProjectReportProperties.ClotheswasherTotalGal / ProjectReportProperties.TraceLengthDays;
            ProjectReportProperties.CoolerGpd        = ProjectReportProperties.CoolerTotalGal / ProjectReportProperties.TraceLengthDays;
            ProjectReportProperties.DishwasherGpd    = ProjectReportProperties.DishwasherTotalGal / ProjectReportProperties.TraceLengthDays;
            ProjectReportProperties.FaucetGpd        = ProjectReportProperties.FaucetTotalGal / ProjectReportProperties.TraceLengthDays;
            ProjectReportProperties.LeakGpd          = ProjectReportProperties.LeakTotalGal / ProjectReportProperties.TraceLengthDays;
            ProjectReportProperties.ShowerGpd        = ProjectReportProperties.ShowerTotalGal / ProjectReportProperties.TraceLengthDays;
            ProjectReportProperties.ToiletGpd        = ProjectReportProperties.ToiletTotalGal / ProjectReportProperties.TraceLengthDays;
            ProjectReportProperties.TreatmentGpd     = ProjectReportProperties.TreatmentTotalGal / ProjectReportProperties.TraceLengthDays;
            ProjectReportProperties.OtherGpd         = ProjectReportProperties.OtherTotalGal / ProjectReportProperties.TraceLengthDays;

            ProjectReportProperties.BathtubEvents       = FixtureSummaries[FixtureClasses.Bathtub].Count;
            ProjectReportProperties.ClotheswasherEvents = FixtureSummaries[FixtureClasses.Clotheswasher].FirstCycles;
            ProjectReportProperties.CoolerEvents        = FixtureSummaries[FixtureClasses.Cooler].Count;
            ProjectReportProperties.DishwasherEvents    = FixtureSummaries[FixtureClasses.Dishwasher].FirstCycles;
            ProjectReportProperties.FaucetEvents        = FixtureSummaries[FixtureClasses.Faucet].Count;
            ProjectReportProperties.LeakEvents          = FixtureSummaries[FixtureClasses.Leak].Count;
            ProjectReportProperties.ShowerEvents        = FixtureSummaries[FixtureClasses.Shower].Count;
            ProjectReportProperties.ToiletEvents        = FixtureSummaries[FixtureClasses.Toilet].Count;
            ProjectReportProperties.TreatmentEvents     = FixtureSummaries[FixtureClasses.Treatment].Count;

            ProjectReportProperties.OtherEvents = CalculateEvents(fixtureClassesIndoor)
                                                  - FixtureSummaries[FixtureClasses.Bathtub].Count
                                                  - FixtureSummaries[FixtureClasses.Clotheswasher].Count
                                                  - FixtureSummaries[FixtureClasses.Cooler].Count
                                                  - FixtureSummaries[FixtureClasses.Dishwasher].Count
                                                  - FixtureSummaries[FixtureClasses.Faucet].Count
                                                  - FixtureSummaries[FixtureClasses.Leak].Count
                                                  - FixtureSummaries[FixtureClasses.Shower].Count
                                                  - FixtureSummaries[FixtureClasses.Toilet].Count
                                                  - FixtureSummaries[FixtureClasses.Treatment].Count
            ;

            ProjectReportProperties.AverageClotheswasherLoadGal = ProjectReportProperties.ClotheswasherTotalGal / ProjectReportProperties.ClotheswasherEvents;
            ProjectReportProperties.ClotheswasherLoadsPerDay    = ((double)ProjectReportProperties.ClotheswasherEvents) / ProjectReportProperties.TraceLengthDays;

            ProjectReportProperties.TotalShowerMinutes       = CalculateTotalMinutes(FixtureClasses.Shower);
            ProjectReportProperties.AverageShowerSeconds     = (ProjectReportProperties.TotalShowerMinutes / ProjectReportProperties.ShowerEvents) * 60;
            ProjectReportProperties.TotalShowerGal           = ProjectReportProperties.ShowerTotalGal;
            ProjectReportProperties.AverageShowerGal         = ProjectReportProperties.ShowerTotalGal / ProjectReportProperties.ShowerEvents;
            ProjectReportProperties.AverageShowerModeFlowGpm = CalculateMeanMode(FixtureClasses.Shower);
            ProjectReportProperties.ShowersPerDay            = ((double)FixtureSummaries[FixtureClasses.Shower].Count) / ProjectReportProperties.TraceLengthDays;
            ProjectReportProperties.ShowerMinutesPerDay      = ProjectReportProperties.TotalShowerMinutes / ProjectReportProperties.TraceLengthDays;

            ProjectReportProperties.AverageToiletFlushVolume = ProjectReportProperties.ToiletTotalGal / ProjectReportProperties.ToiletEvents;
            ProjectReportProperties.ToiletFlushStDev         = CalculateVolumeStandardDeviation(FixtureClasses.Toilet);
            ProjectReportProperties.NumberOfToiletFlushesLessThan2Point2Gal    = CalculateToiletEventsLessThan(2.2);;
            ProjectReportProperties.NumberOfToiletFlushesGreaterThan2Point2Gal = ProjectReportProperties.ToiletEvents - ProjectReportProperties.NumberOfToiletFlushesLessThan2Point2Gal;
            ProjectReportProperties.FlushesPerDay = ((double)ProjectReportProperties.ToiletEvents) / ProjectReportProperties.TraceLengthDays;

            return(ProjectReportProperties);
        }
Пример #3
0
 void WriteData(string dataSource, ProjectReportProperties properties, string keyCode)
 {
     System.Text.StringBuilder text = new System.Text.StringBuilder();
     WriteAnalysis(text, properties, keyCode);
     System.IO.File.AppendAllText(dataSource, text.ToString());
 }