public static TParam CreateNewParameter <TParam>(this IAlgorithmParameters oldParameters) where TParam : class, IAlgorithmParameters, new() { return(!(oldParameters is TParam) ? new TParam() : (TParam)(oldParameters as TParam).Clone()); }
public static TParam CreateNewParameters <TParam>([CanBeNull] this IAlgorithmParameters parameters) where TParam : class, IAlgorithmParameters, new() { return(parameters is TParam oldParams ? (TParam)oldParams.Clone() : new TParam()); }
protected SignalFixer(IAlgorithmParameters algorithmParams, ISignalFixerIterationData[] iterationData) { AlgorithmParams = algorithmParams; IterationsToRun = algorithmParams.IterationToRun; IterationsData = iterationData; CurrentIterationIndex = -1; PeriodLength = AlgorithmParams.SeedExperiment.SignalGeneratorData.ArbitrarySignalData.Count(); ZeroPhaseOutputReference = FunctionGenerator.PositivieNormalizeCosine(PeriodLength); BestIterationIndex = 0; }
public static ISignalFixer CreateSignalFixerObject(IAlgorithmParameters algorithmParams) { ISignalFixer signalFixer = null; ISignalFixerIterationData[] iterationData; switch (algorithmParams.AlgorithmType) { case SignalFixerAlgorithmTypes.PID: iterationData = new SignalFixerIterationData[algorithmParams.IterationToRun]; signalFixer = new PIDSignalFixer((IPIDAlgorithmParameters) algorithmParams, iterationData); break; case SignalFixerAlgorithmTypes.FirstOrder: iterationData = new SignalFixerIterationData[algorithmParams.IterationToRun]; signalFixer = new FirstOrderSignalFixer(algorithmParams, iterationData); break; case SignalFixerAlgorithmTypes.DesertLion: break; case SignalFixerAlgorithmTypes.FrequencyDomain: iterationData = new SignalFixerIterationData[algorithmParams.IterationToRun]; signalFixer = new FrequencyDomainSignalFixer((IFrequencyDomainAlgorithmParameters) algorithmParams, iterationData); break; case SignalFixerAlgorithmTypes.ManualFreuqency: iterationData = new SignalFixerIterationData[algorithmParams.IterationToRun]; signalFixer = new ManualFrequencySignalFixer((IManualFrequencySignalFixerParameters)algorithmParams, iterationData); break; case SignalFixerAlgorithmTypes.HighFrequencyDistortion: iterationData = new HighFrequencyDistortionIterationData[algorithmParams.IterationToRun]; signalFixer = new HighFrequencyDistortionAlgorithm((IHighFrequencyDistortionAlgorithmParameters)algorithmParams, (IHighFrequencyDistortionIterationData[]) iterationData); break; } return signalFixer; }
internal void FixSignalPressed(IAlgorithmParameters algorithmParemeters) { ISignalFixerIterationData[] fixIterationsData; applicationController.FixSignal(algorithmParemeters, out fixIterationsData); managedForm.ShowSignalFixerResults(fixIterationsData); }
public void FixSignal(IAlgorithmParameters algorithmParameters, out ISignalFixerIterationData[] fixData) { ERROR_CODES status = ERROR_CODES.AA_OK; IExperimentData expIteration = null; ExperimentInitialSettings expSettings = algorithmParameters.SeedExperiment.InitialSettings; ISignalFixer signalFixer = SignalFixer.Classes.SignalFixer.CreateSignalFixerObject(algorithmParameters); double[] fixedSignalGeneratorInput; bool fixDone = false; signalFixer.FixSignalIteration(algorithmParameters.SeedExperiment, out fixedSignalGeneratorInput, out fixDone ); int i = 1; for (i = 1; i < algorithmParameters.IterationToRun; i++) { try { try { status = this.AddNewExperiment(fixedSignalGeneratorInput, expSettings, out expIteration); if (status != ERROR_CODES.AA_OK) { status = status; } } catch (Exception ex) { string s = ex.Message; } signalFixer.FixSignalIteration(expIteration, out fixedSignalGeneratorInput, out fixDone); if (fixDone == true) { break; } } catch (Exception ex) { string s = ex.Message; } } fixData = signalFixer.IterationsData; if (i < algorithmParameters.IterationToRun) { Array.Resize(ref fixData, i+1); } }
public FirstOrderSignalFixer(IAlgorithmParameters algorithmParams, ISignalFixerIterationData[] iterationData) : base(algorithmParams, iterationData) { }