Skip to content

Commit

Permalink
[iss-235]
Browse files Browse the repository at this point in the history
Squashed commit of the following:

commit 9c56ba9
Author: joaquin.f.fernandez <joaquin.f.fernandez@gmail.com>
Date:   Fri Sep 8 09:51:59 2023 -0300

    Updated doc.

commit e84a7d3
Author: joaquin.f.fernandez <joaquin.f.fernandez@gmail.com>
Date:   Fri Sep 8 09:51:46 2023 -0300

    Remove dead code.

commit a0bfe18
Author: joaquin.f.fernandez <joaquin.f.fernandez@gmail.com>
Date:   Tue Sep 5 15:50:29 2023 -0300

    Added engine system tests.

commit f46cb9e
Author: joaquin.f.fernandez <joaquin.f.fernandez@gmail.com>
Date:   Tue Sep 5 15:50:01 2023 -0300

    Added engine mliqss system tests.

commit 5939f60
Author: joaquin.f.fernandez <joaquin.f.fernandez@gmail.com>
Date:   Tue Sep 5 14:59:12 2023 -0300

    Added mliqss continuous system tests.

commit 493791c
Author: joaquin.f.fernandez <joaquin.f.fernandez@gmail.com>
Date:   Tue Sep 5 14:58:32 2023 -0300

    Added GT test files.

commit 089183a
Author: joaquin.f.fernandez <joaquin.f.fernandez@gmail.com>
Date:   Tue Sep 5 14:57:49 2023 -0300

    Fixed code style.

commit ff7f663
Author: joaquin.f.fernandez <joaquin.f.fernandez@gmail.com>
Date:   Fri Sep 1 14:12:10 2023 -0300

    Update vscode settings.

commit dbfeb48
Author: joaquin.f.fernandez <joaquin.f.fernandez@gmail.com>
Date:   Fri Sep 1 14:11:53 2023 -0300

    Updated mLIQSS3 method.

commit d5917d9
Author: joaquin.f.fernandez <joaquin.f.fernandez@gmail.com>
Date:   Fri Sep 1 14:11:39 2023 -0300

    Updated mLIQSS2 method.

commit 9e600d3
Author: joaquin.f.fernandez <joaquin.f.fernandez@gmail.com>
Date:   Fri Sep 1 14:11:15 2023 -0300

    Updated mLIQSS method.

commit f3303b0
Author: joaquin.f.fernandez <joaquin.f.fernandez@gmail.com>
Date:   Fri Sep 1 14:10:52 2023 -0300

    Updated dq in liqss methods.

commit f8d9e8b
Author: joaquin.f.fernandez <joaquin.f.fernandez@gmail.com>
Date:   Fri Sep 1 14:10:23 2023 -0300

    Modified mLIQSS change and next quantizer fields.

commit 40cd00e
Author: joaquin.f.fernandez <joaquin.f.fernandez@gmail.com>
Date:   Fri Sep 1 14:09:51 2023 -0300

    Update x time after updateQuantizedState needed for mliqss methods.
  • Loading branch information
joaquinffernandez committed Sep 8, 2023
1 parent 784884d commit cb2dc48
Show file tree
Hide file tree
Showing 46 changed files with 47,039 additions and 356 deletions.
18 changes: 8 additions & 10 deletions src/engine/qss/methods/liqss.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ void LIQSS_init(QA_quantizer quantizer, QSS_data simData, QSS_time simTime)
{
int i;
int states = simData->states;
quantizer->state->dq = (double *)malloc(states * sizeof(double));
quantizer->state->oldDx = (double *)malloc(states * sizeof(double));
quantizer->state->qAux = (double *)malloc(states * sizeof(double));
quantizer->state->a = (double *)malloc(states * sizeof(double));
Expand All @@ -48,7 +47,6 @@ void LIQSS_init(QA_quantizer quantizer, QSS_data simData, QSS_time simTime)
quantizer->state->oldDx[i] = 0;
quantizer->state->a[i] = 0;
quantizer->state->u0[i] = 0;
quantizer->state->dq[i] = 0;
quantizer->state->lt[i] = simData->it;
}
quantizer->state->simTime = &simTime->time;
Expand Down Expand Up @@ -150,27 +148,27 @@ void LIQSS_updateQuantizedState(QA_quantizer quantizer, int var, double *q, doub
double dx;
double *u = quantizer->state->u0;
double *a = quantizer->state->a;
double *dq = quantizer->state->dq;
double dq;
quantizer->state->qAux[var] = q[cf0];
quantizer->state->oldDx[var] = x[cf1];
quantizer->state->lt[var] = *(quantizer->state->simTime);
q[cf0] = x[cf0];
if (x[cf1] > 0) {
dx = u[var] + (q[cf0] + lqu[var]) * a[var];
if (dx >= 0) {
dq[var] = lqu[var];
dq = lqu[var];
} else if (dx < 0) {
dq[var] = -u[var] / a[var] - q[cf0];
dq = -u[var] / a[var] - q[cf0];
}
} else {
dx = u[var] + (q[cf0] - lqu[var]) * a[var];
if (dx <= 0) {
dq[var] = -lqu[var];
dq = -lqu[var];
} else if (dx > 0) {
dq[var] = -u[var] / a[var] - q[cf0];
dq = -u[var] / a[var] - q[cf0];
}
}
if (dq[var] > 2 * lqu[var]) dq[var] = 2 * lqu[var];
if (dq[var] < -2 * lqu[var]) dq[var] = -2 * lqu[var];
q[cf0] += dq[var];
if (dq > 2 * lqu[var]) dq = 2 * lqu[var];
if (dq < -2 * lqu[var]) dq = -2 * lqu[var];
q[cf0] += dq;
}
Loading

0 comments on commit cb2dc48

Please sign in to comment.