public override EventGenerator FromParameters(DetectionSystem parent, string newName, List <Parameter> parameters, uint id) { Channel channel = null; double threshold = 0; TimeSpan debounceTime = TimeSpan.FromTicks(0); foreach (Parameter param in parameters) { switch (param.Name) { case "Channel": channel = ((SystemChannelParameter)param).ToChannel(); break; case "Threshold": threshold = ((DoubleParameter)param).ToDouble(); break; case "Debounce Time": debounceTime = ((TimeSpanParameter)param).ToTimeSpan(); break; } } return(new ThresholdEG(parent, newName, channel, threshold, debounceTime, id)); }
public ThresholdEG(DetectionSystem parent, string newName, Channel newChannel, double newThreshold, uint id) : base(parent, newName, id) { eventGeneratorType = "Threshold"; channel = newChannel; threshold = newThreshold; debounceTime = TimeSpan.FromTicks(0); }
public override Instrument FromParameters(DetectionSystem parent, string newName, List <Parameter> parameters, uint id) { GRANDInstrument instrument = new GRANDInstrument(parent, newName, id); Instrument.ApplyStandardInstrumentParameters(instrument, parameters); return(instrument); }
public ManualEG(DetectionSystem parent, string newName, uint id) : base(parent, newName, id) { eventGeneratorType = "Manual"; dataFolder = "Data\\" + id.ToString("X8"); dataFile = dataFolder + "\\Events.csv"; CheckFoldersExist(); LoadEvents(); }
public EventGenerator(DetectionSystem parent, string name, uint id) : base(parent, name, id) { parent.GetEventGenerators().Add(this); eventWatcher = parent; events = new List <Event>(); actions = new List <Action>(); }
public SystemEventGeneratorParameter(string name, DetectionSystem system) : base(name, ParameterType.SystemEventGenerator) { System = system; ValidValues = new List <string>(); foreach (EventGenerator eg in System.GetEventGenerators()) { ValidValues.Add(eg.Name); } }
public override Instrument FromParameters(DetectionSystem parent, string newName, List <Parameter> parameters, uint id) { int nHeaders = 0; int nChannels = 0; string tStampFormat = ""; string fileExtension = "csv"; CSVParser.DelimiterType delimiter = CSVParser.DelimiterType.Comma; bool hasEndTimes = false; foreach (Parameter param in parameters) { switch (param.Name) { case "Delimiter": switch (((EnumParameter)param).Value) { case "Comma": delimiter = CSVParser.DelimiterType.Comma; break; case "Comma or Whitespace": delimiter = CSVParser.DelimiterType.CommaOrWhitespace; break; } break; case "Extension": fileExtension = ((StringParameter)param).Value; break; case "Headers": nHeaders = ((IntParameter)param).ToInt(); break; case "Channels": nChannels = ((IntParameter)param).ToInt(); break; case "Time Stamp Format": tStampFormat = ((StringParameter)param).Value; break; case "Has End Times": hasEndTimes = (param as BoolParameter).ToBool(); break; } } CSVInstrument instrument = new CSVInstrument(parent, newName, nChannels, hasEndTimes, id); instrument.Delimiter = delimiter; instrument.NumberOfHeaders = nHeaders; instrument.TimeStampFormat = tStampFormat; instrument.FileExtension = fileExtension; Instrument.ApplyStandardInstrumentParameters(instrument, parameters); return(instrument); }
public ImageInstrument(DetectionSystem parent, string name, uint id) : base(parent, name, id) { InstrumentType = "Image"; FileExtension = FILE_EXTENSION; filePrefix = ""; numChannels = 1; channels = new Channel[numChannels]; channels[0] = new Channel(Name + "-Channel", this, Channel.ChannelType.VIDEO, 0); }
public CoincidenceEG(DetectionSystem parent, string newName, CoincidenceType newCoincidenceType, TimingType newTimingType, uint id) : base(parent, newName, id) { eventGeneratorType = "Coincidence"; coincidenceType = newCoincidenceType; timingType = newTimingType; eventGeneratorA = null; eventGeneratorB = null; window = TimeSpan.FromTicks(0); minDifference = TimeSpan.FromTicks(0); }
public static DetectionSystem FromXML(XmlNode node, Facility parent) { string name; uint id; Persister.StartFromXML(node, out name, out id); DetectionSystem system = new DetectionSystem(parent, name, id); return(system); }
public CoincidenceEG(DetectionSystem parent, string newName, uint id) : base(parent, newName, id) { eventGeneratorType = "Coincidence"; coincidenceType = CoincidenceType.A_THEN_B; timingType = TimingType.START_TO_END; eventGeneratorA = null; eventGeneratorB = null; window = TimeSpan.FromTicks(0); minDifference = TimeSpan.FromTicks(0); }
private void SaveButton_Click(object sender, EventArgs e) { TreeNode node = SitesTreeView.SelectedNode; Action act = null; if (node.Tag is EventGenerator) { DetectionSystem eventWatcher = (DetectionSystem)node.Parent.Tag; EventGenerator eg = (EventGenerator)node.Tag; if (eg.Name != NameTextBox.Text && siteMan.ContainsName(NameTextBox.Text)) { MessageBox.Show("All items in the Site Manager and Event Manager require a unique name!"); return; } if (!ParamListPanel.ValidateInput()) { return; } EventGeneratorHookup hookup = EventGenerator.GetHookup(eg.GetEventGeneratorType()); int index = 0; List <EventGenerator> egs = (eg.Parent as DetectionSystem).GetEventGenerators(); for (int i = 0; i < egs.Count; i++) { if (eg.ID == egs[i].ID) { index = i; break; } } eg.Delete(); eg = hookup.FromParameters(eventWatcher, NameTextBox.Text, ParamListPanel.Parameters, eg.ID); eg.SetIndex(index); foreach (Action action in eg.GetActions()) { if (action.Name == ActionsComboBox.Text) { SaveAction(eg, action); act = action; break; } } siteMan.Save(); UpdateSitesTree(); siteManChanged = true; SitesTreeView.SelectedNode = SitesTreeView.Nodes.Find(eg.Name, true)[0]; if (act != null) { ActionsComboBox.Text = act.Name; } } }
public MCAInstrument(DetectionSystem parent, string name, uint id) : base(parent, name, id) { InstrumentType = "MCA"; FileExtension = FILE_EXTENSION; filePrefix = ""; spectrumParser = new CHNParser(); numChannels = NUM_CHANNELS; channels = new Channel[numChannels]; channels[COUNT_RATE] = new Channel(Name + "-Count_Rate", this, Channel.ChannelType.DURATION_VALUE, 0); }
public static EventGenerator FromXML(XmlNode eventNode, DetectionSystem system) { string name; uint id; Persister.StartFromXML(eventNode, out name, out id); EventGeneratorHookup hookup = GetHookup(eventNode.Attributes["Type"]?.InnerText); List <Parameter> parameters = Parameter.FromXML(eventNode, hookup.TemplateParameters, system); return(hookup?.FromParameters(system, name, parameters, id)); }
public SystemChannelParameter(string name, DetectionSystem system) : base(name, ParameterType.SystemChannel) { System = system; ValidValues = new List <string>(); foreach (Instrument inst in System.GetInstruments()) { foreach (Channel ch in inst.GetChannels()) { ValidValues.Add(ch.Name); } } }
public SiteManagerForm(MainForm master, SiteManager newSiteMan) { main = master; siteMan = newSiteMan; selectedSystem = null; selectedChannel = null; selectedVirtualChannel = null; this.StartPosition = FormStartPosition.CenterParent; InitializeComponent(); }
public DeclarationInstrument(DetectionSystem parent, string name, uint id) : base(parent, name, id) { InstrumentType = "Declaration"; filePrefix = ""; FileExtension = "dec"; decFiles = new string[0]; decDates = new DateTime[0]; decParser = new DECFile(); numChannels = NUM_CHANNELS; channels = new Channel[numChannels]; channels[DECLARATION] = new Channel(Name + "-Declarations", this, Channel.ChannelType.DURATION_VALUE, 0); }
private void RemoveButton_Click(object sender, EventArgs e) { TreeNode node = SitesTreeView.SelectedNode; DialogResult dialogResult = MessageBox.Show("Are you sure you want to delete " + node.Text + "?", "Delete Item", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.No) { return; } if (node.Tag is Site) { Site site = (Site)node.Tag; site.Delete(); // G - Turn off other buttons if there are no longer any sites if (siteMan.GetSites().Count == 0) { DisableButtons(); } } else if (node.Tag is Facility) { Facility fac = (Facility)node.Tag; fac.Delete(); } else if (node.Tag is DetectionSystem) { DetectionSystem sys = (DetectionSystem)node.Tag; sys.Delete(); } else if (node.Tag is Instrument) { Instrument inst = (Instrument)node.Tag; inst.Delete(); } else if (node.Tag is EventGenerator) { EventGenerator eg = (EventGenerator)node.Tag; DetectionSystem sys = (DetectionSystem)node.Parent.Tag; sys.GetEventGenerators().Remove(eg); } siteMan.Save(); UpdateSitesTree(); siteManChanged = true; // G - Select new node after deleting SitesTreeView.SelectedNode = SitesTreeView.TopNode; }
public override EventGenerator FromParameters(DetectionSystem parent, string newName, List <Parameter> parameters, uint id) { Channel channel = null; foreach (Parameter param in parameters) { switch (param.Name) { case "Channel": channel = ((SystemChannelParameter)param).ToChannel(); break; } } return(new DataPresentEG(parent, newName, channel, id)); }
public ISRInstrument(DetectionSystem parent, string name, uint id) : base(parent, name, id) { InstrumentType = "ISR"; FileExtension = FILE_EXTENSION; filePrefix = ""; isrParser = new ISRParser(); numChannels = NUM_CHANNELS; channels = new Channel[numChannels]; channels[TOTALS1] = new Channel(Name + "-Totals-1", this, Channel.ChannelType.COUNT_RATE, 0); channels[TOTALS2] = new Channel(Name + "-Totals-2", this, Channel.ChannelType.COUNT_RATE, 0); channels[TOTALS3] = new Channel(Name + "-Totals-3", this, Channel.ChannelType.COUNT_RATE, 0); channels[REALS_PLUS_ACC] = new Channel(Name + "-Real+Acc", this, Channel.ChannelType.COUNT_RATE, 0); channels[ACC] = new Channel(Name + "-Acc", this, Channel.ChannelType.COUNT_RATE, 0); }
public CSVInstrument(DetectionSystem parent, string newName, int nChannels, bool hasEndTimes, uint id) : base(parent, newName, id) { InstrumentType = "CSV"; numChannels = nChannels; FileExtension = FILE_EXTENSION; filePrefix = ""; Delimiter = CSVParser.DelimiterType.Comma; NumberOfHeaders = 0; TimeStampFormat = ""; HasEndTimes = hasEndTimes; MakeNewParser(); ReinitializeChannels(); }
private void NewSystemButton_Click(object sender, EventArgs e) { // Get parent facility int index = -1; TreeNode node = SitesTreeView.SelectedNode; Facility fac; if (node.Tag is Facility) { fac = (Facility)node.Tag; } else if (node.Tag is DetectionSystem) { fac = (Facility)node.Parent.Tag; DetectionSystem sys = (DetectionSystem)node.Tag; index = fac.GetSystems().IndexOf(sys) + 1; } else { fac = (Facility)node.Parent.Parent.Tag; DetectionSystem sys = (DetectionSystem)node.Parent.Tag; index = fac.GetSystems().IndexOf(sys) + 1; } if (index < 0) { index = fac.GetSystems().Count; } bool uniqueName = false; int iteration = 0; string name = ""; while (!uniqueName) { iteration++; name = "New-System-" + iteration.ToString(); uniqueName = !siteMan.ContainsName(name); } DetectionSystem newSys = new DetectionSystem(fac, name, 0); newSys.SetIndex(index); siteMan.Save(); UpdateSitesTree(); siteManChanged = true; SitesTreeView.SelectedNode = SitesTreeView.Nodes.Find(name, true)[0]; }
public override Instrument FromParameters(DetectionSystem parent, string newName, List <Parameter> parameters, uint id) { MCAInstrument instrument = new MCAInstrument(parent, newName, id); Instrument.ApplyStandardInstrumentParameters(instrument, parameters); foreach (Parameter param in parameters) { switch (param.Name) { case "File Extension": instrument.FileExtension = param.Value; break; } } return(instrument); }
public override EventGenerator FromParameters(DetectionSystem parent, string newName, List <Parameter> parameters, uint id) { CoincidenceEG.CoincidenceType coincidenceType = CoincidenceEG.CoincidenceType.A_THEN_B; CoincidenceEG.TimingType timingType = CoincidenceEG.TimingType.END_TO_END; EventGenerator egA = null; EventGenerator egB = null; TimeSpan window = TimeSpan.FromTicks(0); TimeSpan minDifference = TimeSpan.FromTicks(0); foreach (Parameter param in parameters) { switch (param.Name) { case "Coincidence Type": coincidenceType = (CoincidenceEG.CoincidenceType)((EnumParameter)param).ToInt(); break; case "Timing Type": timingType = (CoincidenceEG.TimingType)((EnumParameter)param).ToInt(); break; case "Event Generator A": egA = ((SystemEventGeneratorParameter)param).ToEventGenerator(); break; case "Event Generator B": egB = ((SystemEventGeneratorParameter)param).ToEventGenerator(); break; case "Window": window = ((TimeSpanParameter)param).ToTimeSpan(); break; case "Min Difference": minDifference = ((TimeSpanParameter)param).ToTimeSpan(); break; } } CoincidenceEG eg = new CoincidenceEG(parent, newName, coincidenceType, timingType, id); eg.SetEventGeneratorA(egA); eg.SetEventGeneratorB(egB); eg.SetWindow(window); eg.SetMinDifference(minDifference); return(eg); }
public override Instrument FromParameters(DetectionSystem parent, string newName, List <Parameter> parameters, uint id) { ImageInstrument instrument = new ImageInstrument(parent, newName, id); foreach (Parameter param in parameters) { switch (param.Name) { case "Date Pattern": instrument.DatePattern = param.Value; instrument.DateRegexPattern = (param as DateTimeFormatParameter).GetRegexPattern(); break; } } Instrument.ApplyStandardInstrumentParameters(instrument, parameters); return(instrument); }
public NGAMInstrument(DetectionSystem parent, string name, uint id) : base(parent, name, id) { InstrumentType = "NGAM"; FileExtension = FILE_EXTENSION; filePrefix = ""; vbfParser = new VBFParser(); numChannels = NUM_CHANNELS; channels = new Channel[numChannels]; channels[data0] = new Channel(Name + "-data0", this, Channel.ChannelType.COUNT_RATE, 0); channels[data1] = new Channel(Name + "-data1", this, Channel.ChannelType.COUNT_RATE, 0); channels[data2] = new Channel(Name + "-data2", this, Channel.ChannelType.COUNT_RATE, 0); channels[data3] = new Channel(Name + "-data3", this, Channel.ChannelType.COUNT_RATE, 0); channels[data4] = new Channel(Name + "-data4", this, Channel.ChannelType.COUNT_RATE, 0); channels[data5] = new Channel(Name + "-data5", this, Channel.ChannelType.COUNT_RATE, 0); channels[data6] = new Channel(Name + "-data6", this, Channel.ChannelType.COUNT_RATE, 0); channels[data7] = new Channel(Name + "-data7", this, Channel.ChannelType.COUNT_RATE, 0); }
public GRANDInstrument(DetectionSystem parent, string name, uint id) : base(parent, name, id) { InstrumentType = "GRAND"; FileExtension = FILE_EXTENSION; filePrefix = ""; FileExtension = "bid"; bidParser = new BIDParser(); numChannels = NUM_CHANNELS; channels = new Channel[numChannels]; channels[chACountRate] = new Channel(Name + "-Neutrons-A", this, Channel.ChannelType.COUNT_RATE, 0); channels[chBCountRate] = new Channel(Name + "-Neutrons-B", this, Channel.ChannelType.COUNT_RATE, 0); channels[chCCountRate] = new Channel(Name + "-Neutrons-C", this, Channel.ChannelType.COUNT_RATE, 0); channels[gamInGamCh1] = new Channel(Name + "-Gammas-1", this, Channel.ChannelType.COUNT_RATE, 0); channels[gamCh1Sigma] = new Channel(Name + "-Gammas-1-Sigma", this, Channel.ChannelType.COUNT_RATE, 0); channels[gamInGamCh2] = new Channel(Name + "-Gammas-2", this, Channel.ChannelType.COUNT_RATE, 0); channels[gamCh2Sigma] = new Channel(Name + "-Gammas-2-Sigma", this, Channel.ChannelType.COUNT_RATE, 0); }
private void DownButton_Click(object sender, EventArgs e) { TreeNode node = SitesTreeView.SelectedNode; if (node.Tag is EventGenerator) { EventGenerator eg = (EventGenerator)node.Tag; DetectionSystem eventWatcher = (DetectionSystem)node.Parent.Tag; int index = eventWatcher.GetEventGenerators().IndexOf(eg); if (index < eventWatcher.GetEventGenerators().Count - 1) { eg.SetIndex(index + 1); siteMan.Save(); UpdateSitesTree(); siteManChanged = true; SitesTreeView.SelectedNode = SitesTreeView.Nodes.Find(eg.Name, true)[0]; } } }
public override EventGenerator FromParameters(DetectionSystem parent, string newName, List <Parameter> parameters, uint id) { Channel channel = null; double interval = 0; foreach (Parameter param in parameters) { switch (param.Name) { case "Channel": channel = ((SystemChannelParameter)param).ToChannel(); break; case "Interval": interval = ((TimeSpanParameter)param).ToTimeSpan().TotalSeconds; break; } } return(new GapEG(parent, newName, channel, interval, id)); }
private void PopulateDataSourceTab(AnalysisAction action, int compiler) { DetectionSystem sys = (DetectionSystem)action.GetEventGenerator().GetEventWatcher(); DataSourceTabControl.TabPages.Add("Data Source " + (compiler + 1).ToString()); DataCompilerPanel compilerPanel = new DataCompilerPanel(); compilerPanel.Dock = DockStyle.Fill; DataSourceTabControl.TabPages[compiler].Controls.Add(compilerPanel); compilerPanel.ChannelComboBox.Items.Clear(); foreach (Instrument inst in sys.GetInstruments()) { foreach (Channel ch in inst.GetChannels()) { compilerPanel.ChannelComboBox.Items.Add(ch.Name); } } compilerPanel.ChannelComboBox.Text = action.GetChannels()[compiler].Name; }