|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Collections.ObjectModel;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Text;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
namespace Signal_Generator
|
|
|
|
{
|
|
|
|
[Serializable]
|
|
|
|
class SinusoidalSignal : AnalogSignalMethods, IAnalogSignal
|
|
|
|
{
|
|
|
|
public string typeToString => "SIN сигнал";
|
|
|
|
|
|
|
|
public new string paramsToString => paramsToString(paramsCollection);
|
|
|
|
|
|
|
|
public Collection<Parameter> paramsCollection { get; set; }
|
|
|
|
|
|
|
|
public SinusoidalSignal(double ampl, double freq, double phase = 0)
|
|
|
|
{
|
|
|
|
paramsCollection = new Collection<Parameter>();
|
|
|
|
paramsCollection.Add(new Parameter("Амплитуда", ampl));
|
|
|
|
paramsCollection.Add(new Parameter("Частота", freq));
|
|
|
|
paramsCollection.Add(new Parameter("Фаза", phase));
|
|
|
|
}
|
|
|
|
|
|
|
|
public double currentAmplitude(double t)
|
|
|
|
{
|
|
|
|
var c = paramsCollection.ToArray<Parameter>();
|
|
|
|
return c[0].value * Math.Sin(2.0 * 3.14 * c[1].value * t + c[2].value * 180 / 3.14);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|