Here are the examples of the csharp api System.Collections.Generic.IEnumerable.Contains(SPMWatchDogErrorEvent) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
4 Examples
19
Source : WatchDogScan.cs
with Apache License 2.0
from udotdevelopment
with Apache License 2.0
from udotdevelopment
private void
CheckForLowDetectorHits(Models.Signal signal)
{
var detectors = signal.GetDetectorsForSignalThatSupportAMetric(6);
//Parallel.ForEach(detectors, options, detector =>
foreach (var detector in detectors)
try
{
if(detector.DetectionTypes != null && detector.DetectionTypes.Any(d => d.DetectionTypeID == 2))
{
var channel = detector.DetChannel;
var direction = detector.Approach.DirectionType.Description;
var start = new DateTime();
var end = new DateTime();
if (Settings.WeekdayOnly && ScanDate.DayOfWeek == DayOfWeek.Monday)
{
start = ScanDate.AddDays(-3).Date.AddHours(Settings.PreviousDayPMPeakStart);
end = ScanDate.AddDays(-3).Date.AddHours(Settings.PreviousDayPMPeakEnd);
}
else
{
start = ScanDate.AddDays(-1).Date.AddHours(Settings.PreviousDayPMPeakStart);
end = ScanDate.AddDays(-1).Date.AddHours(Settings.PreviousDayPMPeakEnd);
}
var currentVolume = detector.GetVolumeForPeriod(start, end);
//Compare collected hits to low hit threshold,
if (currentVolume < Convert.ToInt32(Settings.LowHitThreshold))
{
var error = new SPMWatchDogErrorEvent();
error.SignalID = signal.SignalID;
error.DetectorID = detector.DetectorID;
error.Phase = detector.Approach.ProtectedPhaseNumber;
error.TimeStamp = ScanDate;
error.Direction = detector.Approach.DirectionType.Description;
error.Message = "CH: " + channel.ToString() + " - Count: " + currentVolume.ToString();
error.ErrorCode = 2;
if (!LowHitCountErrors.Contains(error))
LowHitCountErrors.Add(error);
}
}
}
catch (Exception ex)
{
var er =
ApplicationEventRepositoryFactory.Create();
er.QuickAdd("SPMWatchDog", "Program", "CheckForLowDetectorHits",
ApplicationEvent.SeverityLevels.Medium, detector.DetectorID + "-" + ex.Message);
}
//);
}
19
Source : WatchDogScan.cs
with Apache License 2.0
from udotdevelopment
with Apache License 2.0
from udotdevelopment
private void CheckForStuckPed(replacedysisPhase phase, Models.Signal signal)
{
if (phase.PedestrianEvents.Count > Settings.MaximumPedestrianEvents)
{
var error = new SPMWatchDogErrorEvent();
error.SignalID = signal.SignalID;
error.Phase = phase.PhaseNumber;
error.TimeStamp = ScanDate;
error.Direction = phase.Direction ?? "";
error.Message = phase.PedestrianEvents.Count +
" Pedestrian Activations";
error.ErrorCode = 3;
if (!StuckPedErrors.Contains(error))
{
Console.WriteLine("Signal " + signal.SignalID + phase.PedestrianEvents.Count +
" Pedestrian Activations");
StuckPedErrors.Add(error);
}
}
}
19
Source : WatchDogScan.cs
with Apache License 2.0
from udotdevelopment
with Apache License 2.0
from udotdevelopment
private void CheckForForceOff(replacedysisPhase phase, Models.Signal signal)
{
if (phase.PercentForceOffs > Settings.PercentThreshold &&
phase.TerminationEvents.Where(t => t.EventCode != 7).Count() > Settings.MinPhaseTerminations)
{
var error = new SPMWatchDogErrorEvent();
error.SignalID = signal.SignalID;
error.Phase = phase.PhaseNumber;
error.TimeStamp = ScanDate;
error.Direction = phase.Direction ?? "";
error.Message = "Force Offs " + Math.Round(phase.PercentForceOffs * 100, 1) + "%";
error.ErrorCode = 4;
if (!ForceOffErrors.Contains(error))
ForceOffErrors.Add(error);
}
}
19
Source : WatchDogScan.cs
with Apache License 2.0
from udotdevelopment
with Apache License 2.0
from udotdevelopment
private void CheckForMaxOut(replacedysisPhase phase,
Models.Signal signal)
{
if (phase.PercentMaxOuts > Settings.PercentThreshold &&
phase.TotalPhaseTerminations > Settings.MinPhaseTerminations)
{
var error = new SPMWatchDogErrorEvent();
error.SignalID = signal.SignalID;
error.Phase = phase.PhaseNumber;
error.TimeStamp = ScanDate;
error.Direction = phase.Direction ?? "";
error.Message = "Max Outs " + Math.Round(phase.PercentMaxOuts * 100, 1) + "%";
error.ErrorCode = 5;
if (MaxOutErrors.Count == 0 || !MaxOutErrors.Contains(error))
{
Console.WriteLine("Signal " + signal.SignalID + " Has MaxOut Errors");
MaxOutErrors.Add(error);
}
}
}