Browse Source

Поле длительность теперь задает временной интервал, на котором происходит симуляция сигнала. Фаза в синусоидальном сигнале задается в градусах.

master
Никита 6 years ago
parent
commit
213885f2ca
  1. 17
      Signal Generator/DrawTask.cs
  2. 2
      Signal Generator/ProcedureModel.cs
  3. 2
      Signal Generator/Signal/FmSignal.cs
  4. 2
      Signal Generator/Signal/SinusoidalSignal.cs

17
Signal Generator/DrawTask.cs

@ -54,20 +54,21 @@ namespace Signal_Generator
private void drawSignalAtCanvas()
{
double lastX = 0, lastY = 0;
double w = canvas.ActualWidth;
for (int i = 0; i != (int)w; i++)
double W = canvas.ActualWidth;
double mod = (procedureModel.Duration / 1000) / W;
for (int X = 0; X != (int)W; X++)
{
updateTextBoxProps(multiSignal.currentAmplitude(i / 5.0), i / 5.0);
double y = multiSignal.currentAmplitude(i / 5.0);
drawLine(lastX, lastY, i, y);
lastX = i;
lastY = y;
double Y = multiSignal.currentAmplitude(X * mod);
updateTextBoxProps(Y, X * mod);
drawLine(lastX, lastY, X, Y);
lastX = X;
lastY = Y;
Thread.Sleep(10);
switch (state)
{
case State.Paused:
while (state == State.Paused)
Thread.Sleep(10);
Thread.Sleep(50);
break;
case State.Canceled: return;
}

2
Signal Generator/ProcedureModel.cs

@ -168,7 +168,7 @@ namespace Signal_Generator
}
}
private double duration;
private double duration = 1000;
public double Duration
{
get { return duration; }

2
Signal Generator/Signal/FmSignal.cs

@ -27,7 +27,7 @@ namespace Signal_Generator
public double currentAmplitude(double t)
{
var c = paramsCollection.ToArray<Parameter>();
return c[0].value * Math.Sin(2 * 3.14 * c[1].value* t + c[2].value * Math.Sin(t));
return c[0].value * Math.Sin(2 * 3.14 * c[1].value * t + c[2].value * Math.Sin(t));
}
}
}

2
Signal Generator/Signal/SinusoidalSignal.cs

@ -27,7 +27,7 @@ namespace Signal_Generator
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);
return c[0].value * Math.Sin(2.0 * 3.14 * c[1].value * t + c[2].value * 180 / 3.14);
}
}
}

Loading…
Cancel
Save