private void _plotSelectedToEdit(object obj) { var selection = obj as SignalPlotPanel; if (SelectedSignalPlotPanel != selection) { if (SelectedSignalPlotPanel != null) { SelectedSignalPlotPanel.IsPlotSelected = false; foreach (var s in SelectedSignalPlotPanel.Signals) { s.IsChecked = false; //foreach (var tr in s.SignalTreeContained) //{ // tr.ChangeIsCheckedStatus(false); // tr.CheckDirectParent(); //} } } SelectedSignalPlotPanel = selection; SelectedSignalPlotPanel.IsPlotSelected = true; foreach (var s in SelectedSignalPlotPanel.Signals) { s.IsChecked = true; //foreach (var tr in s.SignalTreeContained) //{ // tr.ChangeIsCheckedStatus(true); // tr.CheckDirectParent(); //} } SampleDataMngr.DetermineCheckStatusOfGroupedSignals(); } }
private void _dataWriterSelected(object obj) { DataWriterViewModel step = obj as DataWriterViewModel; if (SelectedStep != step) { if (SelectedStep != null) { SelectedStep.ThisStepInputsGroupedByType.SignalList = SampleDataMngr.SortSignalsByType(SelectedStep.InputChannels); SelectedStep.IsSelected = false; } var lastNmberOfSteps = step.StepCounter; var stepsInputAsSignalHierachy = new ObservableCollection <SignalTree>(); foreach (var sig in DataWriters) { if (sig.StepCounter < lastNmberOfSteps) { stepsInputAsSignalHierachy.Add(sig.ThisStepInputsGroupedByType); } else { break; } } step.IsSelected = true; SelectedStep = step; SampleDataMngr.GroupedSignalByDataWriterStepsInput = stepsInputAsSignalHierachy; SampleDataMngr.DetermineCheckStatusOfGroupedSignals(); } }
private void _signalCheckStatusChanged(SignalTree e) { _updateSignals(e); if (SelectedStep != null) { //SelectedStep.UpdateInputOutputTree(); SelectedStep.ThisStepInputsGroupedByType.SignalList = SampleDataMngr.SortSignalsByType(SelectedStep.InputChannels); if (SelectedStep is PreProcessStepViewModel) { //SampleDataMngr.GroupedSignalByPreProcessStepsInput.Add(SelectedStep.ThisStepInputsGroupedByType); SelectedStep.ThisStepOutputsGroupedByPMU.SignalList = SampleDataMngr.SortSignalByPMU(SelectedStep.OutputChannels); //var thisSelectedStep = SelectedStep as PreProcessStepViewModel; //if (thisSelectedStep.Model is Customization) //{ // SampleDataMngr.GroupedSignalByPreProcessStepsOutput.Add(SelectedStep.ThisStepOutputsGroupedByPMU); //} } //if (SelectedStep is SignatureSettingViewModel) //{ // SampleDataMngr.GroupedSignalBySignatureStepsInput.Add(SelectedStep.ThisStepInputsGroupedByType); //} //if (SelectedStep is DataWriterViewModel) //{ // SampleDataMngr.GroupedSignalByDataWriterStepsInput.Add(SelectedStep.ThisStepInputsGroupedByType); //} } }
public void DeSelectAllPlots(object obj) { if (SelectedSignalPlotPanel != null) { foreach (var s in SelectedSignalPlotPanel.Signals) { s.IsChecked = false; } SelectedSignalPlotPanel.IsPlotSelected = false; SelectedSignalPlotPanel = null; SampleDataMngr.DetermineCheckStatusOfGroupedSignals(); } }
private void _deSelectAllSteps(object obj) { if (SelectedStep != null) { //foreach (var s in SelectedStep.InputChannels) //{ // s.IsChecked = false; //} SelectedStep.IsSelected = false; SelectedStep = null; SampleDataMngr.DetermineCheckStatusOfGroupedSignals(); } }
private void _stepSelectedToEdit(object obj) { PreProcessStepViewModel step = obj as PreProcessStepViewModel; if (SelectedStep != step) { if (SelectedStep != null) { SelectedStep.ThisStepInputsGroupedByType.SignalList = SampleDataMngr.SortSignalsByType(SelectedStep.InputChannels); if (((PreProcessStepViewModel)SelectedStep).Model is Customization) { SelectedStep.ThisStepOutputsGroupedByPMU.SignalList = SampleDataMngr.SortSignalByPMU(SelectedStep.OutputChannels); } // Deselect previously selected step SelectedStep.IsSelected = false; // Check if this step is complete // if (!step.IsComplete) //{ // MessageBox.Show("Missing field(s) in this step, please double check!", "Error!", MessageBoxButtons.OK); //} } var lastNmberOfSteps = step.StepCounter; var stepsInputAsSignalHierachy = new ObservableCollection <SignalTree>(); var stepsOutputAsSignalHierachy = new ObservableCollection <SignalTree>(); foreach (var stp in PreProcessSteps) { if (stp.StepCounter < lastNmberOfSteps) { stepsInputAsSignalHierachy.Add(stp.ThisStepInputsGroupedByType); if (stp.Model is Customization) { stepsOutputAsSignalHierachy.Add(stp.ThisStepOutputsGroupedByPMU); } } else { break; } } // Set this step to selected step.IsSelected = true; SelectedStep = step; SampleDataMngr.GroupedSignalByPreProcessStepsInput = stepsInputAsSignalHierachy; SampleDataMngr.GroupedSignalByPreProcessStepsOutput = stepsOutputAsSignalHierachy; SampleDataMngr.DetermineCheckStatusOfGroupedSignals(); } }
private void _deleteAPlot(object obj) { var toBeDeleted = obj as SignalPlotPanel; foreach (var s in toBeDeleted.Signals) { s.IsChecked = false; //foreach (var tr in s.SignalTreeContained) //{ // tr.ChangeIsCheckedStatus(false); // tr.CheckDirectParent(); //} } SampleDataMngr.DetermineCheckStatusOfGroupedSignals(); toBeDeleted.IsPlotSelected = false; SelectedSignalPlotPanel = null; if (SignalPlots.Contains(toBeDeleted)) { SignalPlots.Remove(toBeDeleted); } }
public void ReadConfigFile(string configFile) { using (StreamReader reader = File.OpenText(configFile)) { JsonSerializer serializer = new JsonSerializer(); var config = (SettingsViewModel)serializer.Deserialize(reader, typeof(SettingsViewModel)); WindowOverlapStr = config.WindowOverlapStr; WindowSizeStr = config.WindowSizeStr; DataSourceVM = config.DataSourceVM; DatawriteOutFrequencyStr = config.DatawriteOutFrequencyStr; DatawriteOutFrequencyUnit = config.DatawriteOutFrequencyUnit; //SignatureOutputDir = config.SignatureOutputDir; PreProcessSteps = new ObservableCollection <PreProcessStepViewModel>(); SignatureSettings = new ObservableCollection <SignatureSettingViewModel>(); DataWriters = new ObservableCollection <DataWriterViewModel>(); DateTimeStart = config.DateTimeStart; DateTimeEnd = config.DateTimeEnd; foreach (var pre in config.PreProcessSteps) { var newStep = new PreProcessStepViewModel(pre.Name); newStep.StepCounter = PreProcessSteps.Count + 1; PreProcessSteps.Add(newStep); if (newStep.Model is VoltPhasorFilt) { newStep.NomVoltage = pre.NomVoltage; newStep.VoltMin = pre.VoltMin; newStep.VoltMax = pre.VoltMax; } if (newStep.Model is FreqFilt) { newStep.FreqMaxChan = pre.FreqMaxChan; newStep.FreqMinChan = pre.FreqMinChan; newStep.FreqPctChan = pre.FreqPctChan; newStep.FreqMaxSamp = pre.FreqMaxSamp; newStep.FreqMinSamp = pre.FreqMinSamp; } // take care of all input output signals foreach (var sig in pre.InputChannels) { var foundSig = SampleDataMngr.FindSignal(sig.PMUName, sig.SignalName); if (foundSig != null) { newStep.AddSignal(foundSig); } } //if (newStep.Model is Filter) //{ // newStep.OutputChannels = newStep.InputChannels; //} //else //{ // foreach (var sig in newStep.InputChannels) // { // // need to make up output signals from each input, which might depends on different customization and all differ // } //} newStep.ThisStepInputsGroupedByType = new SignalTree("Step " + newStep.StepCounter.ToString() + " _ " + newStep.Name); newStep.ThisStepOutputsGroupedByPMU = new SignalTree("Step " + newStep.StepCounter.ToString() + " _ " + newStep.Name); newStep.ThisStepOutputsGroupedByPMU.SignalList = SampleDataMngr.SortSignalByPMU(newStep.OutputChannels); newStep.ThisStepInputsGroupedByType.SignalList = SampleDataMngr.SortSignalsByType(newStep.InputChannels); SampleDataMngr.GroupedSignalByPreProcessStepsInput.Add(newStep.ThisStepInputsGroupedByType); if (newStep.Model is Customization) { SampleDataMngr.GroupedSignalByPreProcessStepsOutput.Add(newStep.ThisStepOutputsGroupedByPMU); } } foreach (var signature in config.SignatureSettings) { var newSig = new SignatureSettingViewModel(signature.SignatureName); newSig.WindowOverlapStr = WindowOverlapStr; newSig.WindowSizeStr = WindowSizeStr; newSig.StepCounter = SignatureSettings.Count + 1; newSig.OmitNan = signature.OmitNan; if (newSig.Model is RootMeanSquare) { newSig.RemoveMean = signature.RemoveMean; } if (newSig.Model is FrequencyBandRMS) { newSig.CalculateFull = signature.CalculateFull; newSig.CalculateBand2 = signature.CalculateBand2; newSig.CalculateBand3 = signature.CalculateBand3; newSig.CalculateBand4 = signature.CalculateBand4; newSig.Threshold = signature.Threshold; } if (newSig.Model is Percentile) { newSig.PercentileStr = signature.PercentileStr; } if (newSig.Model is Histogram) { newSig.Minimum = signature.Minimum; newSig.Maximum = signature.Maximum; newSig.NumberOfBins = signature.NumberOfBins; } SignatureSettings.Add(newSig); Model.SignatureSettings.Add(newSig.Model); foreach (var sig in signature.InputChannels) { var foundSig = SampleDataMngr.FindSignal(sig.PMUName, sig.SignalName); if (foundSig != null) { newSig.InputChannels.Add(foundSig); } } newSig.ThisStepInputsGroupedByType = new SignalTree("Step " + newSig.StepCounter.ToString() + " _ " + newSig.SignatureName); //newStep.ThisStepOutputsGroupedByPMU.SignalList = SampleDataMngr.SortSignalByPMU(newStep.OutputChannels); newSig.ThisStepInputsGroupedByType.SignalList = SampleDataMngr.SortSignalsByType(newSig.InputChannels); SampleDataMngr.GroupedSignalBySignatureStepsInput.Add(newSig.ThisStepInputsGroupedByType); //if (newStep.Model is Customization) //{ // SampleDataMngr.GroupedSignalByPreProcessStepsOutput.Add(newStep.ThisStepOutputsGroupedByPMU); //} } foreach (var writer in config.DataWriters) { var newWriter = new DataWriterViewModel(writer.Name); newWriter.StepCounter = DataWriters.Count + 1; newWriter.Mnemonic = writer.Mnemonic; newWriter.SeparatePMUs = writer.SeparatePMUs; newWriter.SavePath = writer.SavePath; DataWriters.Add(newWriter); Model.DataWriters.Add(newWriter.Model); foreach (var sig in writer.InputChannels) { var foundSig = SampleDataMngr.FindSignal(sig.PMUName, sig.SignalName); if (foundSig != null) { newWriter.InputChannels.Add(foundSig); } } newWriter.ThisStepInputsGroupedByType = new SignalTree(newWriter.Name + " " + newWriter.StepCounter.ToString()); newWriter.ThisStepInputsGroupedByType.SignalList = SampleDataMngr.SortSignalsByType(newWriter.InputChannels); SampleDataMngr.GroupedSignalByDataWriterStepsInput.Add(newWriter.ThisStepInputsGroupedByType); } } }