Skip to content
This repository has been archived by the owner on Oct 17, 2023. It is now read-only.

Fix bug with setting discrete real input #58

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/FMI1/fmi1_input_reader.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,9 @@ void fmi1_update_input_interpolation(fmi1_csv_input_t* indata, double t) {
indata->interpData[i] = v1[i] * (1.0 - indata->interpLambda) + v2[i] * indata->interpLambda;
indata->interpContinuousData[cont_i++] = indata->interpData[i];
} else {
/*discrete real, no interpolation*/
/* discrete real, no interpolation */
fmi1_real_t* v1 = (fmi1_real_t*)jm_vector_get_item(jm_voidp)(indata->realInputData,indata->discreteIndex);
indata->interpData[i] = *v1;
indata->interpData[i] = v1[i];
}
}
}
Expand Down
5 changes: 2 additions & 3 deletions src/FMI2/fmi2_input_reader.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ void fmi2_update_input_interpolation(fmi2_csv_input_t* indata, double t) {
indata->interpIndex1 = indata->interpIndex2 - 1;
t1 = jm_vector_get_item(double)(&indata->timeStamps, indata->interpIndex1);
indata->interpLambda = (t - t1)/(t2 -t1);

}

for(i = 0; i < fmi2_import_get_variable_list_size(indata->realInputs); i++) {
Expand All @@ -147,9 +146,9 @@ void fmi2_update_input_interpolation(fmi2_csv_input_t* indata, double t) {
fmi2_real_t* v2 = (fmi2_real_t*)jm_vector_get_item(jm_voidp)(indata->realInputData,indata->interpIndex2);
indata->interpData[i] = v1[i] * (1.0 - indata->interpLambda) + v2[i] * indata->interpLambda;
} else {
/*discrete real, no interpolation*/
/* discrete real, no interpolation */
fmi2_real_t* v1 = (fmi2_real_t*)jm_vector_get_item(jm_voidp)(indata->realInputData,indata->discreteIndex);
indata->interpData[i] = *v1;
indata->interpData[i] = v1[i];
}
}
}
Expand Down