Skip to content

Commit

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

commit 5659043
Author: joaquin.f.fernandez <joaquin.f.fernandez@gmail.com>
Date:   Mon Sep 4 11:55:26 2023 -0300

    Updated compiler system tests.

commit d64dc80
Author: joaquin.f.fernandez <joaquin.f.fernandez@gmail.com>
Date:   Mon Sep 4 11:55:04 2023 -0300

    Updated engine system tests.

commit b6599e4
Author: joaquin.f.fernandez <joaquin.f.fernandez@gmail.com>
Date:   Mon Sep 4 11:40:03 2023 -0300

    Update TD QSS data field to IT.
  • Loading branch information
joaquinffernandez committed Sep 4, 2023
1 parent 279ade7 commit 784884d
Show file tree
Hide file tree
Showing 16 changed files with 679 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/engine/qss/parallel/qss_par_integrator.c
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ void QSS_PAR_integrator(QSS_simulator simulator)
double *x = qssData->x;
double *q = qssData->q;
int **SD = qssData->SD;
int *TD = qssData->TD;
int *TD = qssData->IT;
const QSS_idxMap qMap = lp->qMap;
int id = simulator->id;
IBX_inbox inbox = simulator->inbox;
Expand Down
4 changes: 2 additions & 2 deletions src/engine/qss/qss_binary.c
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ void BT_updateI(SC_scheduler scheduler, QSS_data simData, QSS_time simTime)
#ifdef QSS_PARALLEL
scheduler->state->stepType = ST_State;
#endif
BT_UPDATE_TREE(scheduler, states, NULL, 0, simData->TD[simTime->minIndex]);
BT_UPDATE_TREE(scheduler, states, NULL, 0, simData->IT[simTime->minIndex]);
minIdx = states->nodes[states->height][0].value;
minVal = simTime->nextStateTime[minIdx];
BT_UPDATE_TREE(scheduler, inputs, NULL, 0, simTime->minIndex);
Expand Down Expand Up @@ -599,7 +599,7 @@ void BT_updateHI(SC_scheduler scheduler, QSS_data simData, QSS_time simTime)
#ifdef QSS_PARALLEL
scheduler->state->stepType = ST_State;
#endif
BT_UPDATE_TREE(scheduler, states, NULL, 0, simData->TD[simTime->minIndex]);
BT_UPDATE_TREE(scheduler, states, NULL, 0, simData->IT[simTime->minIndex]);
minIdx = states->nodes[states->height][0].value;
minVal = simTime->nextStateTime[minIdx];
BT_UPDATE_TREE(scheduler, inputs, NULL, 0, simTime->minIndex);
Expand Down
4 changes: 2 additions & 2 deletions src/engine/qss/qss_binary_random.c
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ void BTR_updateI(SC_scheduler scheduler, QSS_data simData, QSS_time simTime)
w = ST_Input;
}
} else if (simTime->type == ST_Input) {
BTR_updateTree(scheduler, scheduler->state->BTR_states, NULL, 0, simData->TD[simTime->minIndex], simTime->nextStateTime);
BTR_updateTree(scheduler, scheduler->state->BTR_states, NULL, 0, simData->IT[simTime->minIndex], simTime->nextStateTime);
minIdx = scheduler->state->BTR_states->nodes[scheduler->state->BTR_states->height][0].value;
minVal = simTime->nextStateTime[minIdx];
BTR_updateTree(scheduler, scheduler->state->BTR_inputs, NULL, 0, simTime->minIndex, simTime->nextInputTime);
Expand Down Expand Up @@ -507,7 +507,7 @@ void BTR_updateHI(SC_scheduler scheduler, QSS_data simData, QSS_time simTime)
w = ST_Input;
}
} else if (simTime->type == ST_Input) {
BTR_updateTree(scheduler, scheduler->state->BTR_states, NULL, 0, simData->TD[simTime->minIndex], simTime->nextStateTime);
BTR_updateTree(scheduler, scheduler->state->BTR_states, NULL, 0, simData->IT[simTime->minIndex], simTime->nextStateTime);
minIdx = scheduler->state->BTR_states->nodes[scheduler->state->BTR_states->height][0].value;
minVal = simTime->nextStateTime[minIdx];
BTR_updateTree(scheduler, scheduler->state->BTR_inputs, NULL, 0, simTime->minIndex, simTime->nextInputTime);
Expand Down
16 changes: 8 additions & 8 deletions src/engine/qss/qss_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -397,9 +397,9 @@ QSS_data QSS_Data(int states, int discretes, int events, int inputs, int algs, i
p->DH = NULL;
}
if (inputs) {
p->TD = (int *)malloc(inputs * sizeof(int));
p->IT = (int *)malloc(inputs * sizeof(int));
} else {
p->TD = NULL;
p->IT = NULL;
}
if (discretes) {
cleanDoubleVector(p->d, 0, discretes);
Expand Down Expand Up @@ -569,12 +569,12 @@ void QSS_dataCopyStructure(QSS_data data, QSS_data p)
p->HZ = NULL;
}
if (inputs) {
p->TD = (int *)malloc(inputs * sizeof(int));
p->IT = (int *)malloc(inputs * sizeof(int));
for (i = 0; i < inputs; i++) {
p->TD[i] = data->TD[i];
p->IT[i] = data->IT[i];
}
} else {
p->TD = NULL;
p->IT = NULL;
}
p->params = SD_copyParameters(data->params);
} else {
Expand Down Expand Up @@ -610,9 +610,9 @@ void QSS_dataCopyStructure(QSS_data data, QSS_data p)
p->HZ = NULL;
}
if (inputs) {
p->TD = data->TD;
p->IT = data->IT;
} else {
p->TD = NULL;
p->IT = NULL;
}
p->params = data->params;
}
Expand Down Expand Up @@ -823,7 +823,7 @@ void QSS_freeData(QSS_data data)
free(data->nHZ);
}
if (data->inputs) {
free(data->TD);
free(data->IT);
}
for (i = 0; i < states; i++) {
if (data->SD[i] != NULL) {
Expand Down
2 changes: 1 addition & 1 deletion src/engine/qss/qss_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ struct QSS_data_ {
int *nSH;
int *nHH;
int *nDH;
int *TD;
int *IT;
int *BDF;
int *BDFMap;
int *BDFOutputs;
Expand Down
2 changes: 1 addition & 1 deletion src/engine/qss/qss_hyb_integrator.c
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ void QSS_HYB_integrate(SIM_simulator simulate)
double *q = qssData->q;
double *a = qssData->alg;
int **SD = qssData->SD;
int *TD = qssData->TD;
int *TD = qssData->IT;
int *BDF = qssData->BDF;
int *BDFMap = qssData->BDFMap;
int nBDF = qssData->nBDF;
Expand Down
4 changes: 2 additions & 2 deletions src/engine/qss/qss_integrator.c
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ void QSS_SEQ_initialize(SIM_simulator simulate)
#endif
forUL = qssData->inputs;
for (i = 0; i < forUL; i++) {
j = qssData->TD[i];
j = qssData->IT[i];
FRW_nextInputTime(frw, qssModel, qssData, qssTime, 0, j, i);
}
#ifdef DEBUG
Expand Down Expand Up @@ -750,7 +750,7 @@ void QSS_PAR_initializeSimulation(QSS_simulator simulator)
#endif
forUL = qssData->inputs;
for (i = 0; i < forUL; i++) {
j = qssData->TD[i];
j = qssData->IT[i];
if (lp->qMap[j] > NOT_ASSIGNED) {
FRW_nextInputTime(frw, qssModel, qssData, qssTime, 0, j, i);
}
Expand Down
2 changes: 1 addition & 1 deletion src/engine/qss/qss_seq_integrator.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ void QSS_SEQ_integrate(SIM_simulator simulate)
double *q = qssData->q;
double *a = qssData->alg;
int **SD = qssData->SD;
int *TD = qssData->TD;
int *TD = qssData->IT;
int cf0, infCf0;
const int qOrder = xOrder - 1;
int nSZ, nLHSSt, nRHSSt, nHD, nHZ;
Expand Down
23 changes: 23 additions & 0 deletions src/engine/tests/system/gt_data/test_input/test_input.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
model test_input

Real y;

equation
der(y) = cos(time);
annotation(
experiment(
MMO_Description="",
MMO_Solver=QSS3,
MMO_SymDiff=false,
MMO_PartitionMethod=Metis,
MMO_Output={y},
Jacobian=Dense,
MMO_BDF_PDepth=1,
MMO_BDF_Max_Step=0,
StartTime=0.0,
StopTime=100,
Tolerance={1e-3},
AbsTolerance={1e-6}
));
end test_input;
Loading

0 comments on commit 784884d

Please sign in to comment.