Skip to content
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

Outputs of the FMU not correct when using an input.csv file #564

Closed
alexad19 opened this issue Aug 20, 2024 · 13 comments
Closed

Outputs of the FMU not correct when using an input.csv file #564

alexad19 opened this issue Aug 20, 2024 · 13 comments

Comments

@alexad19
Copy link

Having run some tests in our environment using fmusim on Ubuntu 22.04, we have discovered that some outputs are not displayed correctly in output.csv file, even if in the console they are printed just fine:
image

This behaviour is present on Ubuntu, but not on Windows and it affects outputs of type enum, s32 and u32, as one may observe in the picture above.

@t-sommer
Copy link
Collaborator

Can you share an FMU and steps to reproduce the problem?

@alexad19
Copy link
Author

alexad19 commented Aug 20, 2024

Ubuntu2204_fmus.zip
Here are 2 similar fmus (which reproduce the issue), the difference between them is that one has been compiled with debug information and one without.

Steps to reproduce the issue:

  • To get the result inside the console:
    fmusim --log-fmi-calls SimpleExample.fmu

  • To get the wrong behaviour inside the output.csv:
    fmusim --log-fmi-calls --fmi-log-file logfile_SimpleEx.txt --stop-time 0.02--output-interval 0.01 --output-file output_SimpleEx.csv

Please let me know if there's anything I can provide you with

@t-sommer
Copy link
Collaborator

With the latest build (3596ae9) I cannot reproduce the problem.

For

fmusim --log-fmi-calls --output-interval 1 --output-variable enum_out --output-variable s32_out --output-variable u32_ou
t --output-file SimpleExample_out.csv SimpleExample.fmu > SimpleExample_log.txt

I get

"time","enum_out","s32_out","u32_out"
0,2,2,2
1,1,1,1
2,1,1,1
3,1,1,1
4,1,1,1
5,1,1,1
6,1,1,1
7,1,1,1
8,1,1,1
9,1,1,1
10,1,1,1

and

fmi2Instantiate(instanceName="instance1", fmuType=1, fmuGUID="{acadf0cc-be6b-4727-878a-b472372b9844}", fmuResourceLocation="file:///tmp/fmusim.Zk5zJt/resources/", functions={logger=0x0x5565e26f6e11, allocateMemory=0x0x7fd24df21520, freeMemory=0x0x7fd24df203e0, stepFinished=0x(nil), componentEnvironment=0x0x5565e37bab10}, visible=0, loggingOn=0) -> OK
fmi2SetupExperiment(toleranceDefined=0, tolerance=0, startTime=0, stopTimeDefined=0, stopTime=0) -> OK
This is the test_enter_init function
fmi2EnterInitializationMode() -> OK
This is the test_exit_init function
fmi2ExitInitializationMode() -> OK
fmi2GetReal(vr={15, 16}, nvr=2, value={4, 4}) -> OK
fmi2GetReal(vr={51, 52, 75, 76, 111, 112}, nvr=6, value={1, 1, 3, 3, 2, 2}) -> OK
fmi2GetInteger(vr={1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 74, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 113, 114, 115, 116, 117, 118, 119, 120}, nvr=108, value={4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}) -> OK
fmi2GetBoolean(vr={13, 37, 73, 97}, nvr=4, value={0, 0, 0, 0}) -> OK
fmi2GetInteger(vr={110, 115, 119}, nvr=3, value={2, 2, 2}) -> OK
fmi2DoStep(currentCommunicationPoint=0, communicationStepSize=1, noSetFMUStatePriorToCurrentPoint=1) -> OK
fmi2GetInteger(vr={110, 115, 119}, nvr=3, value={1, 1, 1}) -> OK
fmi2DoStep(currentCommunicationPoint=1, communicationStepSize=1, noSetFMUStatePriorToCurrentPoint=1) -> OK
fmi2GetInteger(vr={110, 115, 119}, nvr=3, value={1, 1, 1}) -> OK
fmi2DoStep(currentCommunicationPoint=2, communicationStepSize=1, noSetFMUStatePriorToCurrentPoint=1) -> OK
fmi2GetInteger(vr={110, 115, 119}, nvr=3, value={1, 1, 1}) -> OK
fmi2DoStep(currentCommunicationPoint=3, communicationStepSize=1, noSetFMUStatePriorToCurrentPoint=1) -> OK
fmi2GetInteger(vr={110, 115, 119}, nvr=3, value={1, 1, 1}) -> OK
fmi2DoStep(currentCommunicationPoint=4, communicationStepSize=1, noSetFMUStatePriorToCurrentPoint=1) -> OK
fmi2GetInteger(vr={110, 115, 119}, nvr=3, value={1, 1, 1}) -> OK
fmi2DoStep(currentCommunicationPoint=5, communicationStepSize=1, noSetFMUStatePriorToCurrentPoint=1) -> OK
fmi2GetInteger(vr={110, 115, 119}, nvr=3, value={1, 1, 1}) -> OK
fmi2DoStep(currentCommunicationPoint=6, communicationStepSize=1, noSetFMUStatePriorToCurrentPoint=1) -> OK
fmi2GetInteger(vr={110, 115, 119}, nvr=3, value={1, 1, 1}) -> OK
fmi2DoStep(currentCommunicationPoint=7, communicationStepSize=1, noSetFMUStatePriorToCurrentPoint=1) -> OK
fmi2GetInteger(vr={110, 115, 119}, nvr=3, value={1, 1, 1}) -> OK
fmi2DoStep(currentCommunicationPoint=8, communicationStepSize=1, noSetFMUStatePriorToCurrentPoint=1) -> OK
fmi2GetInteger(vr={110, 115, 119}, nvr=3, value={1, 1, 1}) -> OK
fmi2DoStep(currentCommunicationPoint=9, communicationStepSize=1, noSetFMUStatePriorToCurrentPoint=1) -> OK
fmi2GetInteger(vr={110, 115, 119}, nvr=3, value={1, 1, 1}) -> OK
fmi2Terminate() -> OK
fmi2FreeInstance() -> OK

@alexad19
Copy link
Author

alexad19 commented Aug 20, 2024

try running:

fmusim --log-fmi-calls --fmi-log-file logfile_SimpleEx.txt --stop-time 0.02 --output-interval 0.01 --output-file output_SimpleEx.csv

As there are more outputs, the problem I guess will be reproduced.

@t-sommer
Copy link
Collaborator

Here you go:

"time","float32_out","float64_out","array1D_out_0","array1D_out_1","array1D_out_2","array2D_out_0_0","array2D_out_0_1","array2D_out_0_2","array2D_out_1_0","array2D_out_1_1","array2D_out_1_2","array2D_out_2_0","array2D_out_2_1","array2D_out_2_2","enum_array1D_out_0","enum_array1D_out_1","enum_array1D_out_2","enum_array2D_out_0_0","enum_array2D_out_0_1","enum_array2D_out_0_2","enum_array2D_out_1_0","enum_array2D_out_1_1","enum_array2D_out_1_2","enum_array2D_out_2_0","enum_array2D_out_2_1","enum_array2D_out_2_2","enum_out","s8_out","s16_out","s32_out","s64_out","u8_out","u16_out","u32_out","u64_out","bool_out"
0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0
0.01,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0
0.02,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0
fmi2Instantiate(instanceName="instance1", fmuType=1, fmuGUID="{acadf0cc-be6b-4727-878a-b472372b9844}", fmuResourceLocation="file:///tmp/fmusim.QUgMHu/resources/", functions={logger=0x0x5596524aee11, allocateMemory=0x0x7fed8b06e520, freeMemory=0x0x7fed8b06d3e0, stepFinished=0x(nil), componentEnvironment=0x0x559653997af0}, visible=0, loggingOn=0) -> OK
fmi2SetupExperiment(toleranceDefined=0, tolerance=0, startTime=0, stopTimeDefined=0, stopTime=0) -> OK
This is the test_enter_init function
fmi2EnterInitializationMode() -> OK
This is the test_exit_init function
fmi2ExitInitializationMode() -> OK
fmi2GetReal(vr={15, 16}, nvr=2, value={4, 4}) -> OK
fmi2GetReal(vr={51, 52, 75, 76, 111, 112}, nvr=6, value={1, 1, 3, 3, 2, 2}) -> OK
fmi2GetInteger(vr={1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 74, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 113, 114, 115, 116, 117, 118, 119, 120}, nvr=108, value={4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}) -> OK
fmi2GetBoolean(vr={13, 37, 73, 97}, nvr=4, value={0, 0, 0, 0}) -> OK
fmi2GetReal(vr={111, 112}, nvr=2, value={2, 2}) -> OK
fmi2GetInteger(vr={85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 113, 114, 115, 116, 117, 118, 119, 120}, nvr=33, value={2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}) -> OK
fmi2GetBoolean(vr={97}, nvr=1, value={0}) -> OK
fmi2DoStep(currentCommunicationPoint=0, communicationStepSize=0.01, noSetFMUStatePriorToCurrentPoint=1) -> OK
fmi2GetReal(vr={111, 112}, nvr=2, value={1, 1}) -> OK
fmi2GetInteger(vr={85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 113, 114, 115, 116, 117, 118, 119, 120}, nvr=33, value={1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}) -> OK
fmi2GetBoolean(vr={97}, nvr=1, value={0}) -> OK
fmi2DoStep(currentCommunicationPoint=0.01, communicationStepSize=0.01, noSetFMUStatePriorToCurrentPoint=1) -> OK
fmi2GetReal(vr={111, 112}, nvr=2, value={1, 1}) -> OK
fmi2GetInteger(vr={85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 113, 114, 115, 116, 117, 118, 119, 120}, nvr=33, value={1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}) -> OK
fmi2GetBoolean(vr={97}, nvr=1, value={0}) -> OK
fmi2Terminate() -> OK
fmi2FreeInstance() -> OK

@alexad19
Copy link
Author

I have managed to reproduce the error in the console as well. Will investigate and keep you posted.

@alexad19
Copy link
Author

alexad19 commented Sep 2, 2024

Here you go:

"time","float32_out","float64_out","array1D_out_0","array1D_out_1","array1D_out_2","array2D_out_0_0","array2D_out_0_1","array2D_out_0_2","array2D_out_1_0","array2D_out_1_1","array2D_out_1_2","array2D_out_2_0","array2D_out_2_1","array2D_out_2_2","enum_array1D_out_0","enum_array1D_out_1","enum_array1D_out_2","enum_array2D_out_0_0","enum_array2D_out_0_1","enum_array2D_out_0_2","enum_array2D_out_1_0","enum_array2D_out_1_1","enum_array2D_out_1_2","enum_array2D_out_2_0","enum_array2D_out_2_1","enum_array2D_out_2_2","enum_out","s8_out","s16_out","s32_out","s64_out","u8_out","u16_out","u32_out","u64_out","bool_out"
0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0
0.01,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0
0.02,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0
fmi2Instantiate(instanceName="instance1", fmuType=1, fmuGUID="{acadf0cc-be6b-4727-878a-b472372b9844}", fmuResourceLocation="file:///tmp/fmusim.QUgMHu/resources/", functions={logger=0x0x5596524aee11, allocateMemory=0x0x7fed8b06e520, freeMemory=0x0x7fed8b06d3e0, stepFinished=0x(nil), componentEnvironment=0x0x559653997af0}, visible=0, loggingOn=0) -> OK
fmi2SetupExperiment(toleranceDefined=0, tolerance=0, startTime=0, stopTimeDefined=0, stopTime=0) -> OK
This is the test_enter_init function
fmi2EnterInitializationMode() -> OK
This is the test_exit_init function
fmi2ExitInitializationMode() -> OK
fmi2GetReal(vr={15, 16}, nvr=2, value={4, 4}) -> OK
fmi2GetReal(vr={51, 52, 75, 76, 111, 112}, nvr=6, value={1, 1, 3, 3, 2, 2}) -> OK
fmi2GetInteger(vr={1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 74, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 113, 114, 115, 116, 117, 118, 119, 120}, nvr=108, value={4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}) -> OK
fmi2GetBoolean(vr={13, 37, 73, 97}, nvr=4, value={0, 0, 0, 0}) -> OK
fmi2GetReal(vr={111, 112}, nvr=2, value={2, 2}) -> OK
fmi2GetInteger(vr={85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 113, 114, 115, 116, 117, 118, 119, 120}, nvr=33, value={2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}) -> OK
fmi2GetBoolean(vr={97}, nvr=1, value={0}) -> OK
fmi2DoStep(currentCommunicationPoint=0, communicationStepSize=0.01, noSetFMUStatePriorToCurrentPoint=1) -> OK
fmi2GetReal(vr={111, 112}, nvr=2, value={1, 1}) -> OK
fmi2GetInteger(vr={85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 113, 114, 115, 116, 117, 118, 119, 120}, nvr=33, value={1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}) -> OK
fmi2GetBoolean(vr={97}, nvr=1, value={0}) -> OK
fmi2DoStep(currentCommunicationPoint=0.01, communicationStepSize=0.01, noSetFMUStatePriorToCurrentPoint=1) -> OK
fmi2GetReal(vr={111, 112}, nvr=2, value={1, 1}) -> OK
fmi2GetInteger(vr={85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 113, 114, 115, 116, 117, 118, 119, 120}, nvr=33, value={1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}) -> OK
fmi2GetBoolean(vr={97}, nvr=1, value={0}) -> OK
fmi2Terminate() -> OK
fmi2FreeInstance() -> OK

Hello @t-sommer,

I have had a look on this matter and it appears that the problem appears only if we "stimulate" the FMU with an input file.
The command running wrongly is:

fmusim --log-fmi-calls --fmi-log-file log.txt --stop-time 0.02 --output-interval 0.01 --input-file input.csv --output-file output.csv SimpleExample.fmu > printf.txt

With the latest build (3596ae9) I cannot reproduce the problem.

For

fmusim --log-fmi-calls --output-interval 1 --output-variable enum_out --output-variable s32_out --output-variable u32_ou
t --output-file SimpleExample_out.csv SimpleExample.fmu > SimpleExample_log.txt

I get

"time","enum_out","s32_out","u32_out"
0,2,2,2
1,1,1,1
2,1,1,1
3,1,1,1
4,1,1,1
5,1,1,1
6,1,1,1
7,1,1,1
8,1,1,1
9,1,1,1
10,1,1,1

and

fmi2Instantiate(instanceName="instance1", fmuType=1, fmuGUID="{acadf0cc-be6b-4727-878a-b472372b9844}", fmuResourceLocation="file:///tmp/fmusim.Zk5zJt/resources/", functions={logger=0x0x5565e26f6e11, allocateMemory=0x0x7fd24df21520, freeMemory=0x0x7fd24df203e0, stepFinished=0x(nil), componentEnvironment=0x0x5565e37bab10}, visible=0, loggingOn=0) -> OK
fmi2SetupExperiment(toleranceDefined=0, tolerance=0, startTime=0, stopTimeDefined=0, stopTime=0) -> OK
This is the test_enter_init function
fmi2EnterInitializationMode() -> OK
This is the test_exit_init function
fmi2ExitInitializationMode() -> OK
fmi2GetReal(vr={15, 16}, nvr=2, value={4, 4}) -> OK
fmi2GetReal(vr={51, 52, 75, 76, 111, 112}, nvr=6, value={1, 1, 3, 3, 2, 2}) -> OK
fmi2GetInteger(vr={1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 74, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 113, 114, 115, 116, 117, 118, 119, 120}, nvr=108, value={4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}) -> OK
fmi2GetBoolean(vr={13, 37, 73, 97}, nvr=4, value={0, 0, 0, 0}) -> OK
fmi2GetInteger(vr={110, 115, 119}, nvr=3, value={2, 2, 2}) -> OK
fmi2DoStep(currentCommunicationPoint=0, communicationStepSize=1, noSetFMUStatePriorToCurrentPoint=1) -> OK
fmi2GetInteger(vr={110, 115, 119}, nvr=3, value={1, 1, 1}) -> OK
fmi2DoStep(currentCommunicationPoint=1, communicationStepSize=1, noSetFMUStatePriorToCurrentPoint=1) -> OK
fmi2GetInteger(vr={110, 115, 119}, nvr=3, value={1, 1, 1}) -> OK
fmi2DoStep(currentCommunicationPoint=2, communicationStepSize=1, noSetFMUStatePriorToCurrentPoint=1) -> OK
fmi2GetInteger(vr={110, 115, 119}, nvr=3, value={1, 1, 1}) -> OK
fmi2DoStep(currentCommunicationPoint=3, communicationStepSize=1, noSetFMUStatePriorToCurrentPoint=1) -> OK
fmi2GetInteger(vr={110, 115, 119}, nvr=3, value={1, 1, 1}) -> OK
fmi2DoStep(currentCommunicationPoint=4, communicationStepSize=1, noSetFMUStatePriorToCurrentPoint=1) -> OK
fmi2GetInteger(vr={110, 115, 119}, nvr=3, value={1, 1, 1}) -> OK
fmi2DoStep(currentCommunicationPoint=5, communicationStepSize=1, noSetFMUStatePriorToCurrentPoint=1) -> OK
fmi2GetInteger(vr={110, 115, 119}, nvr=3, value={1, 1, 1}) -> OK
fmi2DoStep(currentCommunicationPoint=6, communicationStepSize=1, noSetFMUStatePriorToCurrentPoint=1) -> OK
fmi2GetInteger(vr={110, 115, 119}, nvr=3, value={1, 1, 1}) -> OK
fmi2DoStep(currentCommunicationPoint=7, communicationStepSize=1, noSetFMUStatePriorToCurrentPoint=1) -> OK
fmi2GetInteger(vr={110, 115, 119}, nvr=3, value={1, 1, 1}) -> OK
fmi2DoStep(currentCommunicationPoint=8, communicationStepSize=1, noSetFMUStatePriorToCurrentPoint=1) -> OK
fmi2GetInteger(vr={110, 115, 119}, nvr=3, value={1, 1, 1}) -> OK
fmi2DoStep(currentCommunicationPoint=9, communicationStepSize=1, noSetFMUStatePriorToCurrentPoint=1) -> OK
fmi2GetInteger(vr={110, 115, 119}, nvr=3, value={1, 1, 1}) -> OK
fmi2Terminate() -> OK
fmi2FreeInstance() -> OK

Running the fmusim like this yields the correct results.

I have attached my input.csv
input.csv
and output.csv files.
output.csv

Please note that this analysis was done using version 0.0.33 of fmusim.

@alexad19 alexad19 changed the title Outputs of the FMU not synced between command line and output.csv Outputs of the FMU not correct when using an input.csv file Sep 2, 2024
t-sommer added a commit to t-sommer/Reference-FMUs that referenced this issue Sep 10, 2024
@t-sommer
Copy link
Collaborator

@alexad19, can you check if #576 solves your problem?

@alexad19
Copy link
Author

hi @t-sommer, sadly I get the same output:
image

@t-sommer
Copy link
Collaborator

With your input file I get the following call sequence. Can you please point out the error?

fmi2Instantiate(instanceName="instance1", fmuType=1, fmuGUID="{acadf0cc-be6b-4727-878a-b472372b9844}", fmuResourceLocation="file:///tmp/fmusim.kf7p2f/resources/", functions={logger=0x0x55c272980e11, allocateMemory=0x0x7faec98f5520, freeMemory=0x0x7faec98f43e0, stepFinished=0x(nil), componentEnvironment=0x0x55c27380ecd0}, visible=0, loggingOn=0) -> OK
fmi2SetupExperiment(toleranceDefined=0, tolerance=0, startTime=0, stopTimeDefined=0, stopTime=0) -> OK
fmi2EnterInitializationMode() -> OK
fmi2SetInteger(vr={25}, nvr=1, value={11}) -> OK
fmi2SetInteger(vr={26}, nvr=1, value={12}) -> OK
fmi2SetInteger(vr={27}, nvr=1, value={13}) -> OK
fmi2SetInteger(vr={28}, nvr=1, value={100}) -> OK
fmi2SetInteger(vr={29}, nvr=1, value={101}) -> OK
fmi2SetInteger(vr={30}, nvr=1, value={102}) -> OK
fmi2SetInteger(vr={31}, nvr=1, value={110}) -> OK
fmi2SetInteger(vr={32}, nvr=1, value={111}) -> OK
fmi2SetInteger(vr={33}, nvr=1, value={112}) -> OK
fmi2SetInteger(vr={34}, nvr=1, value={120}) -> OK
fmi2SetInteger(vr={35}, nvr=1, value={121}) -> OK
fmi2SetInteger(vr={36}, nvr=1, value={122}) -> OK
fmi2SetBoolean(vr={37}, nvr=1, value={1}) -> OK
fmi2SetInteger(vr={38}, nvr=1, value={4}) -> OK
fmi2SetInteger(vr={39}, nvr=1, value={4}) -> OK
fmi2SetInteger(vr={40}, nvr=1, value={4}) -> OK
fmi2SetInteger(vr={41}, nvr=1, value={3}) -> OK
fmi2SetInteger(vr={42}, nvr=1, value={3}) -> OK
fmi2SetInteger(vr={43}, nvr=1, value={3}) -> OK
fmi2SetInteger(vr={44}, nvr=1, value={3}) -> OK
fmi2SetInteger(vr={45}, nvr=1, value={3}) -> OK
fmi2SetInteger(vr={46}, nvr=1, value={3}) -> OK
fmi2SetInteger(vr={47}, nvr=1, value={3}) -> OK
fmi2SetInteger(vr={48}, nvr=1, value={3}) -> OK
fmi2SetInteger(vr={49}, nvr=1, value={3}) -> OK
fmi2SetInteger(vr={50}, nvr=1, value={5}) -> OK
fmi2SetReal(vr={51}, nvr=1, value={12.34}) -> OK
fmi2SetReal(vr={52}, nvr=1, value={56.78}) -> OK
fmi2SetInteger(vr={53}, nvr=1, value={-5}) -> OK
fmi2SetInteger(vr={54}, nvr=1, value={-6}) -> OK
fmi2SetInteger(vr={55}, nvr=1, value={-7}) -> OK
fmi2SetInteger(vr={56}, nvr=1, value={-8}) -> OK
fmi2SetInteger(vr={57}, nvr=1, value={5}) -> OK
fmi2SetInteger(vr={58}, nvr=1, value={6}) -> OK
fmi2SetInteger(vr={59}, nvr=1, value={7}) -> OK
fmi2SetInteger(vr={60}, nvr=1, value={8}) -> OK
fmi2ExitInitializationMode() -> OK
fmi2GetReal(vr={15, 16, 51, 52, 75, 76, 111, 112}, nvr=8, value={4, 4, 12.34000015258789, 56.78, 3, 3, 2, 2}) -> OK
fmi2GetInteger(vr={1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 74, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 113, 114, 115, 116, 117, 118, 119, 120}, nvr=108, value={4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 11, 12, 13, 100, 101, 102, 110, 111, 112, 120, 121, 122, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, -5, -6, -7, -8, 5, 6, 7, 8, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, -1, 2, 2, 2, 0, 2}) -> OK
fmi2GetBoolean(vr={13, 37, 73, 97}, nvr=4, value={0, 1, 0, 0}) -> OK
fmi2GetReal(vr={111, 112}, nvr=2, value={2, 2}) -> OK
fmi2GetInteger(vr={85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 113, 114, 115, 116, 117, 118, 119, 120}, nvr=33, value={2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, -1, 2, 2, 2, 0, 2}) -> OK
fmi2GetBoolean(vr={97}, nvr=1, value={0}) -> OK
fmi2SetInteger(vr={25}, nvr=1, value={11}) -> OK
fmi2SetInteger(vr={26}, nvr=1, value={12}) -> OK
fmi2SetInteger(vr={27}, nvr=1, value={13}) -> OK
fmi2SetInteger(vr={28}, nvr=1, value={100}) -> OK
fmi2SetInteger(vr={29}, nvr=1, value={101}) -> OK
fmi2SetInteger(vr={30}, nvr=1, value={102}) -> OK
fmi2SetInteger(vr={31}, nvr=1, value={110}) -> OK
fmi2SetInteger(vr={32}, nvr=1, value={111}) -> OK
fmi2SetInteger(vr={33}, nvr=1, value={112}) -> OK
fmi2SetInteger(vr={34}, nvr=1, value={120}) -> OK
fmi2SetInteger(vr={35}, nvr=1, value={121}) -> OK
fmi2SetInteger(vr={36}, nvr=1, value={122}) -> OK
fmi2SetBoolean(vr={37}, nvr=1, value={1}) -> OK
fmi2SetInteger(vr={38}, nvr=1, value={4}) -> OK
fmi2SetInteger(vr={39}, nvr=1, value={4}) -> OK
fmi2SetInteger(vr={40}, nvr=1, value={4}) -> OK
fmi2SetInteger(vr={41}, nvr=1, value={3}) -> OK
fmi2SetInteger(vr={42}, nvr=1, value={3}) -> OK
fmi2SetInteger(vr={43}, nvr=1, value={3}) -> OK
fmi2SetInteger(vr={44}, nvr=1, value={3}) -> OK
fmi2SetInteger(vr={45}, nvr=1, value={3}) -> OK
fmi2SetInteger(vr={46}, nvr=1, value={3}) -> OK
fmi2SetInteger(vr={47}, nvr=1, value={3}) -> OK
fmi2SetInteger(vr={48}, nvr=1, value={3}) -> OK
fmi2SetInteger(vr={49}, nvr=1, value={3}) -> OK
fmi2SetInteger(vr={50}, nvr=1, value={5}) -> OK
fmi2SetReal(vr={51}, nvr=1, value={12.34}) -> OK
fmi2SetReal(vr={52}, nvr=1, value={56.78}) -> OK
fmi2SetInteger(vr={53}, nvr=1, value={-5}) -> OK
fmi2SetInteger(vr={54}, nvr=1, value={-6}) -> OK
fmi2SetInteger(vr={55}, nvr=1, value={-7}) -> OK
fmi2SetInteger(vr={56}, nvr=1, value={-8}) -> OK
fmi2SetInteger(vr={57}, nvr=1, value={5}) -> OK
fmi2SetInteger(vr={58}, nvr=1, value={6}) -> OK
fmi2SetInteger(vr={59}, nvr=1, value={7}) -> OK
fmi2SetInteger(vr={60}, nvr=1, value={8}) -> OK
fmi2DoStep(currentCommunicationPoint=0, communicationStepSize=0.01, noSetFMUStatePriorToCurrentPoint=1) -> OK
fmi2GetReal(vr={111, 112}, nvr=2, value={12.34000015258789, 56.78}) -> OK
fmi2GetInteger(vr={85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 113, 114, 115, 116, 117, 118, 119, 120}, nvr=33, value={11, 12, 13, 100, 101, 102, 110, 111, 112, 120, 121, 122, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, -5, -6, -7, -8, 5, 6, 7, 8}) -> OK
fmi2GetBoolean(vr={97}, nvr=1, value={1}) -> OK
...

@alexad19
Copy link
Author

the incorrect output would be:

fmi2GetInteger(vr={1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 74, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 113, 114, 115, 116, 117, 118, 119, 120}, nvr=108, value={4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 11, 12, 13, 100, 101, 102, 110, 111, 112, 120, 121, 122, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, -5, -6, -7, -8, 5, 6, 7, 8, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, -1, 2, 2, 2, 0, 2}) -> OK

the ones that are in bold. Those outputs correspond to the enum_out, s32_out and u32_out variables respectively

@t-sommer
Copy link
Collaborator

fmi2GetInteger() only retrieves the variables from the FMU, so how is this an error in fmusim?

@alexad19
Copy link
Author

Hello @t-sommer,

I can confirm that all is good now.

@alexad19, can you check if #576 solves your problem?
The answer is yes, this has solved the issue.

Sorry for bothering. This issue can be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants