-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Loading float numbers from external data CSV file fails. #534
Comments
Can you reproduce the problem if you use an input file with at least 3 rows? E.g.
|
Hi Sommer, I made again 3 tests and this is the status:
I am not saying that I understood completely the code of FMIApplyInput() function from FMIStaticInput.c but the fix suggested is based on next fact: |
Hi Sommer, |
You can download the binaries directly from the CI: https://github.com/modelica/Reference-FMUs/actions/runs/10073277513/artifacts/1734054905 |
--- Context ---
Built fmusim for Windows:
Platform: x86_64-windows
CMake Generator: Visual Studio 16 2019
Build type: Debug
Git commit checked:
Revision: 6d3a981
Author: Torsten Sommer torsten.sommer@3ds.com
Date: 7/5/2024 11:19:21 AM
Message: Fix variable index in fmi3{Get|Set}Binary() (#531)
--- Description ---
The error happens when importing external data from a CSV file and amongst other different inputs there are also inputs having float types.
Example:
time,s8_in,s16_in,array1D_in,float32_in
0,1,2,3 4 5,12.34
The error happens randomly.
The error message is: "Failed to reallocate memory."
The error occurs in fmusim/FMIStaticInput.c in function:
FMIStatus FMIApplyInput(FMIInstance* instance, const FMIStaticInput* input, double time, bool discrete, bool continuous, bool afterEvent)
at line 276:
CALL(FMIRealloc((void**)&input->buffer, requiredBufferSize));
The reason is requiredBufferSize variable has sometimes a very huge value due to some wrong memory read which is based on row variable.
This row variable is calculated in the while block from lines 255, see: "while (row < input->nRows - 2) {...."
Changing the while condition to "while (row < input->nRows - 1)" seems to solve the problem.
Can you check please?
The text was updated successfully, but these errors were encountered: