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() private void drawSignalAtCanvas()
{ {
double lastX = 0, lastY = 0; double lastX = 0, lastY = 0;
double w = canvas.ActualWidth; double W = canvas.ActualWidth;
for (int i = 0; i != (int)w; i++) 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(X * mod);
double y = multiSignal.currentAmplitude(i / 5.0); updateTextBoxProps(Y, X * mod);
drawLine(lastX, lastY, i, y); drawLine(lastX, lastY, X, Y);
lastX = i; lastX = X;
lastY = y; lastY = Y;
Thread.Sleep(10); Thread.Sleep(10);
switch (state) switch (state)
{ {
case State.Paused: case State.Paused:
while (state == State.Paused) while (state == State.Paused)
Thread.Sleep(10); Thread.Sleep(50);
break; break;
case State.Canceled: return; 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 public double Duration
{ {
get { return duration; } get { return duration; }

2
Signal Generator/Signal/FmSignal.cs

@ -27,7 +27,7 @@ namespace Signal_Generator
public double currentAmplitude(double t) public double currentAmplitude(double t)
{ {
var c = paramsCollection.ToArray<Parameter>(); 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) public double currentAmplitude(double t)
{ {
var c = paramsCollection.ToArray<Parameter>(); 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