コード例 #1
0
ファイル: ConversionViewModel.cs プロジェクト: TagruP/CPS
        public ConversionViewModel(SignalViewModel first)
        {
            firstSignalViewModel  = first;
            secondSignalViewModel = new SignalViewModel();

            SamplingFrequency  = new FunctionAttribute <int>(10, false, 1, 5000, "SAMPLING FREQUENCY");
            QuantizationBits   = new FunctionAttribute <int>(3, false, 2, 10, "QUANTIZATION BITS");
            QuantizationLevels = new FunctionAttribute <int>(8, false, 2, 1024, "QUANTIZATION LEVELS");

            AttributesBinding.BindAttributesTwoWay(QuantizationLevels, QuantizationBits, new LogarithmConverter());
            NumberOfSamples = new FunctionAttribute <int>(5, false, 2, 500, "NUMBER OF SAMPLES");

            AnalogToDigitalConversionOperations = new List <string> {
                "UNIFORM SAMPLING", "UNIFORM QUANTIZATION"
            };
            DigitalToAnalogConversionOperations = new List <string> {
                "ZERO-ORDER HOLD", "SINC RECONSTRUCTION"
            };
            Operation = string.Empty;

            MaximumDifference      = new Parameter(0.0d, "MAXIMUM DIFFERENCE");
            SignalToNoiseRatio     = new Parameter(0, "SIGNAL TO NOISE RATIO");
            MeanSquaredError       = new Parameter(0, "MEAN SQUARED ERROR");
            PeakSignalToNoiseRatio = new Parameter(0, "PEAK SIGNAL TO NOISE RATIO");


            Attributes = new List <FunctionAttribute <int> >(
                new[] { SamplingFrequency, QuantizationLevels, QuantizationBits, NumberOfSamples });
            ConversionMetrics = new List <Parameter>(new[]
                                                     { MeanSquaredError, MaximumDifference, SignalToNoiseRatio, PeakSignalToNoiseRatio });

            FirstSignalData.Continuous.PropertyChanged += (sender, args) => OnPropertyChanged(nameof(IsSignalAnalog));
        }
コード例 #2
0
        public CompositionViewModel(SignalViewModel first, SignalViewModel second)
        {
            firstSignalViewModel  = first;
            secondSignalViewModel = second;

            firstSignalViewModel.SignalGenerated  += SignalsGenerated;
            secondSignalViewModel.SignalGenerated += SignalsGenerated;
        }
コード例 #3
0
ファイル: MainViewModel.cs プロジェクト: TagruP/CPS
        public MainViewModel()
        {
            FirstSignalViewModel  = new SignalViewModel();
            SecondSignalViewModel = new SignalViewModel();

            CompositionViewModel = new CompositionViewModel(FirstSignalViewModel, SecondSignalViewModel);
            ConversionViewModel  = new ConversionViewModel(FirstSignalViewModel);
            ConvolutionFiltrationCorrelationViewModel =
                new ConvolutionFiltrationCorrelationViewModel(FirstSignalViewModel);
            DistanceSensorViewModel = new DistanceSensorViewModel();
            TransformViewModel      = new TransformViewModel(FirstSignalViewModel.SignalData);
        }
コード例 #4
0
        public ConvolutionFiltrationCorrelationViewModel(SignalViewModel first)
        {
            firstSignalViewModel = first;
            SecondSignalData     = new FunctionData();
            filter = new Filter();

            filters = new Dictionary <FilterType, string>();
            filters.Add(FilterType.LowPassFilter, "LOW-PASS FILTER");
            filters.Add(FilterType.HighPassFilter, "HIGH-PASS FILTER");

            selectedFilter = FilterType.LowPassFilter;
            window         = new RectangularWindow();
            windows        = new List <IWindow>(new IWindow[]
                                                { new RectangularWindow(), new HanningWindow() /*, new HammingWindow(), new BlackmanWindow()*/ });

            filterOrder     = new FunctionAttribute <int>(5, true, 1, 500, "FILTER ORDER");
            cutoffFrequency = new FunctionAttribute <double>(400.0d, true, 10.0d, 25000.0d, "CUTOFF FREQUENCY");

            Attributes = new List <object>(new[] { filterOrder, (object)cutoffFrequency });

            firstSignalViewModel.SignalGenerated += (sender, args) => FilterCommand.RaiseCanExecuteChanged();
        }