Bugfix: Sweep reaches from fl to fu within actual sweep time instead of [sweep time + quiescent time]
This commit is contained in:
parent
441685ad32
commit
6517fb0029
@ -110,15 +110,15 @@ void Sweep::resetImpl() {
|
||||
if (forward_sweep || backward_sweep) {
|
||||
/* Forward or backward sweep */
|
||||
/* TRACE(15, "Forward or backward sweep"); */
|
||||
us K = (us)(Dt * (fl * N + 0.5 * (N - 1) * (fu - fl)));
|
||||
d eps_num = ((d)K) / Dt - fl * N - 0.5 * (N - 1) * (fu - fl);
|
||||
d eps = eps_num / (0.5 * (N - 1));
|
||||
us K = (us)(Dt * (fl * Ns + 0.5 * (Ns - 1) * (fu - fl)));
|
||||
d eps_num = ((d)K) / Dt - fl * Ns - 0.5 * (Ns - 1) * (fu - fl);
|
||||
d eps = eps_num / (0.5 * (Ns - 1));
|
||||
/* iVARTRACE(15, K); */
|
||||
/* dVARTRACE(15, eps); */
|
||||
|
||||
for (us n = 0; n < Ns; n++) {
|
||||
_signal(n) = d_sin(phase);
|
||||
d fn = fl + ((d)n) / N * (fu + eps - fl);
|
||||
d fn = fl + ((d)n) / Ns * (fu + eps - fl);
|
||||
phase += 2 * arma::datum::pi * Dt * fn;
|
||||
}
|
||||
} else {
|
||||
@ -172,14 +172,14 @@ void Sweep::resetImpl() {
|
||||
/* Forward or backward sweep */
|
||||
DEBUGTRACE_PRINT("Forward or backward sweep");
|
||||
d k1 = (fu / fl);
|
||||
us K = (us)(Dt * fl * (k1 - 1) / (d_pow(k1, 1.0 / N) - 1));
|
||||
us K = (us)(Dt * fl * (k1 - 1) / (d_pow(k1, 1.0 / Ns) - 1));
|
||||
d k = k1;
|
||||
|
||||
/* Iterate k to the right solution */
|
||||
d E;
|
||||
for (us iter = 0; iter < 10; iter++) {
|
||||
E = 1 + K / (Dt * fl) * (d_pow(k, 1.0 / N) - 1) - k;
|
||||
d dEdk = K / (Dt * fl) * d_pow(k, 1.0 / N) / (N * k) - 1;
|
||||
E = 1 + K / (Dt * fl) * (d_pow(k, 1.0 / Ns) - 1) - k;
|
||||
d dEdk = K / (Dt * fl) * d_pow(k, 1.0 / Ns) / (Ns * k) - 1;
|
||||
k -= E / dEdk;
|
||||
}
|
||||
|
||||
@ -190,15 +190,15 @@ void Sweep::resetImpl() {
|
||||
|
||||
for (us n = 0; n < Ns; n++) {
|
||||
_signal[n] = d_sin(phase);
|
||||
d fn = fl * d_pow(k, ((d)n) / N);
|
||||
d fn = fl * d_pow(k, ((d)n) / Ns);
|
||||
phase += 2 * number_pi * Dt * fn;
|
||||
}
|
||||
} else {
|
||||
|
||||
DEBUGTRACE_PRINT("Continuous sweep");
|
||||
|
||||
const us Nf = N / 2;
|
||||
const us Nb = N - Nf;
|
||||
const us Nf = Ns / 2;
|
||||
const us Nb = Ns - Nf;
|
||||
const d k1 = (fu / fl);
|
||||
const d phif1 =
|
||||
2 * number_pi * Dt * fl * (k1 - 1) / (d_pow(k1, 1.0 / Nf) - 1);
|
||||
|
Loading…
Reference in New Issue
Block a user