예제 #1
0
 void AddVolumeToChart(Chart chart, VolumeCollection volumeCollection)
 {
     foreach (var v in volumeCollection.Items)
     {
         chart.Series["Volume Per Hour"].Points.AddXY(v.XAxis, v.YAxis);
     }
 }
예제 #2
0
파일: PCDOptions.cs 프로젝트: zfx1982/ATSPM
 private void AddVolumeToChart(Chart chart, VolumeCollection volumeCollection)
 {
     foreach (MOE.Common.Business.Volume v in volumeCollection.Items)
     {
         chart.Series["Volume Per Hour"].Points.AddXY(v.XAxis, v.YAxis);
     }
 }
예제 #3
0
파일: Approach.cs 프로젝트: gmonk/ATSPM
 public void SetVolume(DateTime startDate, DateTime endDate,
                       int binSize)
 {
     if (DetectorEvents.Events != null)
     {
         Volume = new VolumeCollection(startDate, endDate, DetectorEvents.Events, binSize);
     }
 }
예제 #4
0
        protected int FindPeakValueinHour(DateTime startofHour, VolumeCollection volumeCollection)
        {
            int maxVolume = 0;

            if (volumeCollection.Items.Any(v => v.StartTime >= startofHour && v.StartTime < startofHour.AddHours(1)))
            {
                maxVolume = volumeCollection.Items.Where(v => v.StartTime >= startofHour && v.StartTime < startofHour.AddHours(1)).Max(v => v.DetectorCount);
            }
            return(maxVolume);
        }
예제 #5
0
        protected KeyValuePair <DateTime, int> GetPeakHourVolumeItem(VolumeCollection volumes)
        {
            KeyValuePair <DateTime, int>     peakHourValue   = new KeyValuePair <DateTime, int>();
            SortedDictionary <DateTime, int> iteratedVolumes = new SortedDictionary <DateTime, int>();

            foreach (var volume in volumes.Items)
            {
                iteratedVolumes.Add(volume.StartTime, volumes.Items.Where(v => v.StartTime >= volume.StartTime && v.StartTime < volume.StartTime.AddHours(1)).Sum(v => v.DetectorCount));
            }
            peakHourValue = iteratedVolumes.OrderByDescending(i => i.Value).FirstOrDefault();
            return(peakHourValue);
        }
예제 #6
0
        private void SetCombinedVolumeStatistics(int binSizeMultiplier)
        {
            CombinedDirectionsVolumes = new VolumeCollection(PrimaryDirectionVolume, OpposingDirectionVolume, _approachVolumeOptions.SelectedBinSize);
            KeyValuePair <DateTime, int> combinedPeakHourItem = GetPeakHourVolumeItem(CombinedDirectionsVolumes);

            MetricInfo.CombinedPeakHourValue   = FindPeakValueinHour(combinedPeakHourItem.Key, CombinedDirectionsVolumes);
            MetricInfo.CombinedPeakHourFactor  = GetPeakHourFactor(combinedPeakHourItem.Value, MetricInfo.CombinedPeakHourValue, binSizeMultiplier);
            MetricInfo.CombinedPeakHourKFactor = GetPeakHourKFactor(combinedPeakHourItem);
            MetricInfo.CombinedPeakHourString  = combinedPeakHourItem.Key.ToShortTimeString() + " - " + combinedPeakHourItem.Key.AddHours(1).ToShortTimeString();
            MetricInfo.CombinedPeakHourVolume  = combinedPeakHourItem.Value;
            MetricInfo.CombinedVolume          = CombinedDirectionsVolumes.Items.Sum(c => c.DetectorCount);
        }
예제 #7
0
        private VolumeCollection[] CalculateCollisionVolumes(
            NodeContent[] collisionNodes,
            ContentProcessorContext context
            )
        {
            List <VolumeCollection> collectionList = new List <VolumeCollection>();

            foreach (NodeContent currentNode in collisionNodes)
            {
                VolumeCollection collection = new VolumeCollection();
                collection.AddVolume(CalculateAlignedBox3(currentNode, context, false));
                collection.AddVolume(CalculateAlignedBox3Tree(currentNode, context, false));
                collection.AddVolume(CalculateCylinder3(currentNode, context, false));
                collection.AddVolume(CalculateSphere3(currentNode, context, false));
                collectionList.Add(collection);
            }
            return(collectionList.ToArray());
        }
예제 #8
0
        protected double GetPeakHourDFactor(DateTime startofHour, int peakhourvolume, VolumeCollection volumes,
                                            int binMultiplier)
        {
            int    totalVolume = 0;
            double PHDF        = 0;

            if (volumes.Items.Any(v => v.StartTime >= startofHour && v.StartTime < startofHour.AddHours(1)))
            {
                totalVolume = volumes.Items
                              .Where(v => v.StartTime >= startofHour && v.StartTime < startofHour.AddHours(1))
                              .Sum(v => v.DetectorCount);
            }
            //totalVolume /= binMultiplier;
            totalVolume += peakhourvolume;
            if (totalVolume > 0)
            {
                PHDF = Round(Convert.ToDouble(peakhourvolume) / Convert.ToDouble(totalVolume), 3);
            }
            else
            {
                PHDF = 0;
            }
            return(PHDF);
        }
예제 #9
0
        private MagmaModelContent ProcessContainerGroup(
            NodeContent input,
            ContentProcessorContext context
            )
        {
#if DEBUG
            context.Logger.LogImportantMessage("  processing one group contained in a model container");
#endif

            // find the child to process!
            NodeContent currentGroupNode = GetChild(input, CurrentGroup);
            Debug.Assert(currentGroupNode != null);
            if (currentGroupNode == null)
            {
                throw new ArgumentException(string.Format("unable to find referenced child ({0})!", CurrentGroup));
            }

            input.Children.Clear();
            input.Children.Add(currentGroupNode);

            // copy the identity
            //currentGroupNode.Identity = input.Identity;

            // calculate bounds because changes are based on the bounding box
            AlignedBox3 bb = CalculateAlignedBox3(input, context, true);

            // transform the graphical mesh and the collision meshes in one step!
            TransformMeshes(new NodeContent[] { input }, context, ref bb);

            // extract all collision meshes
            List <NodeContent> collisionNodes = new List <NodeContent>();
            foreach (NodeContent child in currentGroupNode.Children)
            {
                if (IsCollisionNode(child))
                {
                    collisionNodes.Add(child);
                }
            }
            foreach (NodeContent collisionMesh in collisionNodes)
            {
#if DEBUG
                context.Logger.LogImportantMessage("  using {0} as a collision fragment", collisionMesh.Name);
#endif
                currentGroupNode.Children.Remove(collisionMesh);
            }

            // let the base class process the graphical model
            MagmaModelContent modelContent = BaseProcessing(input, context);

            // now we process our collision meshes...
            // TODO: take all collision meshes not only the first one!
            VolumeCollection collection = new VolumeCollection();

            if (collisionNodes.Count == 0)
            {
                context.Logger.LogWarning(null, input.Identity, "unable to find a collision mesh in group {0}", CurrentGroup);
                modelContent.VolumeCollection = CalculateCollisionVolumes(new NodeContent[] { input }, context);
            }
            else
            {
                NodeContent[] collisionNodesArray = new NodeContent[collisionNodes.Count];
                for (int i = 0; i < collisionNodes.Count; ++i)
                {
                    collisionNodesArray[i] = collisionNodes[i];
                }
                modelContent.VolumeCollection = CalculateCollisionVolumes(collisionNodesArray, context);
            }

            return(modelContent);
        }