|
@@ -10,20 +10,28 @@ namespace ShakerService.ViewModel
|
|
{
|
|
{
|
|
internal class ServiceRandomConfigViewModel:BaseServiceViewModel<RandomConfigModel>
|
|
internal class ServiceRandomConfigViewModel:BaseServiceViewModel<RandomConfigModel>
|
|
{
|
|
{
|
|
|
|
+ public double[] PSDWindow { get;private set;}
|
|
|
|
+ public double[] FixedWindow { get; private set; }
|
|
public double HanningWindowCompensationCoefficient => Model.HanningWindowCompensationCoefficient;
|
|
public double HanningWindowCompensationCoefficient => Model.HanningWindowCompensationCoefficient;
|
|
public uint LinearAverage => Model.LinearAverage;
|
|
public uint LinearAverage => Model.LinearAverage;
|
|
public uint ExponentialAverage => Model.ExponentialAverage;
|
|
public uint ExponentialAverage => Model.ExponentialAverage;
|
|
|
|
+ public uint DOF { get; private set; }
|
|
|
|
+ public double FrequencyResolution { get; private set; }
|
|
public uint RandomSampleRate => Model.RandomSampleRate;
|
|
public uint RandomSampleRate => Model.RandomSampleRate;
|
|
public int MaxFrequency => (int)Model.MaxFrequency;
|
|
public int MaxFrequency => (int)Model.MaxFrequency;
|
|
public AccelerationSynthesisType SynthesisType => Model.SynthesisType;
|
|
public AccelerationSynthesisType SynthesisType => Model.SynthesisType;
|
|
public double MinFrequency => Model.MinFrequency;
|
|
public double MinFrequency => Model.MinFrequency;
|
|
public uint SpectrumLines => (uint)Model.SpectrumLines;
|
|
public uint SpectrumLines => (uint)Model.SpectrumLines;
|
|
|
|
+ public double[] StartWindow { get;private set; }
|
|
|
|
+ public double[] StopWindow { get; private set; }
|
|
public double Sigma =>Model.Sigma;
|
|
public double Sigma =>Model.Sigma;
|
|
public ServiceRandomIdentifyViewModel Identify { get; } = new ServiceRandomIdentifyViewModel();
|
|
public ServiceRandomIdentifyViewModel Identify { get; } = new ServiceRandomIdentifyViewModel();
|
|
public List<ServiceRandomSpectrumItemViewModel> SpectrumItems { get; } = new List<ServiceRandomSpectrumItemViewModel>();
|
|
public List<ServiceRandomSpectrumItemViewModel> SpectrumItems { get; } = new List<ServiceRandomSpectrumItemViewModel>();
|
|
public List<ServiceRandomPlanItemViewModel> PlanItems { get; } = new List<ServiceRandomPlanItemViewModel>();
|
|
public List<ServiceRandomPlanItemViewModel> PlanItems { get; } = new List<ServiceRandomPlanItemViewModel>();
|
|
public uint StopLins =>Model.StopLins;
|
|
public uint StopLins =>Model.StopLins;
|
|
public uint WarnLines =>Model.WarnLines;
|
|
public uint WarnLines =>Model.WarnLines;
|
|
|
|
+ public int FFTFrameLength { get; private set; }
|
|
|
|
+ public int FFTHalfFrameLength { get; private set; }
|
|
public double StopRMS =>Model.StopRMS;
|
|
public double StopRMS =>Model.StopRMS;
|
|
private ServiceRandomConfigViewModel()
|
|
private ServiceRandomConfigViewModel()
|
|
{
|
|
{
|
|
@@ -74,7 +82,23 @@ namespace ShakerService.ViewModel
|
|
{
|
|
{
|
|
PlanItems.Add(new ServiceRandomPlanItemViewModel(item));
|
|
PlanItems.Add(new ServiceRandomPlanItemViewModel(item));
|
|
}
|
|
}
|
|
|
|
+ DOF = (model.LinearAverage << 1) * ((model.ExponentialAverage << 1) - 1);
|
|
|
|
+ FrequencyResolution = MaxFrequency / (double)SpectrumLines;
|
|
|
|
+ FFTFrameLength = (int)((double)RandomSampleRate / MaxFrequency * SpectrumLines);
|
|
|
|
+ FFTHalfFrameLength = FFTFrameLength >> 1;
|
|
|
|
+ PSDWindow = Enumerable.Range(0, FFTHalfFrameLength).Select(x => (x * FrequencyResolution >= MinFrequency || x * FrequencyResolution <= MaxFrequency) ? 1d : 0d).ToArray();
|
|
|
|
+ FixedWindow = Enumerable.Repeat(1d, FFTFrameLength).ToArray();
|
|
|
|
+ StartWindow = new double[RandomSampleRate];
|
|
|
|
+ StopWindow = new double[RandomSampleRate];
|
|
|
|
+ for(int i=0;i<RandomSampleRate;i++)
|
|
|
|
+ {
|
|
|
|
+ double d = i * double.Pi / (RandomSampleRate << 1);
|
|
|
|
+ StartWindow[i] = Math.Pow(Math.Sin(d),3);
|
|
|
|
+ StopWindow[i] = Math.Pow(Math.Cos(d), 3);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ public ServiceRandomDataViewModel RandomData { get; } = new ServiceRandomDataViewModel();
|
|
public static ServiceRandomConfigViewModel Instance { get; } = new ServiceRandomConfigViewModel();
|
|
public static ServiceRandomConfigViewModel Instance { get; } = new ServiceRandomConfigViewModel();
|
|
}
|
|
}
|
|
}
|
|
}
|