Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Solution CSV export for alias variables #198

Open
AnHeuermann opened this issue Oct 30, 2023 · 2 comments · May be fixed by #199
Open

Solution CSV export for alias variables #198

AnHeuermann opened this issue Oct 30, 2023 · 2 comments · May be fixed by #199

Comments

@AnHeuermann
Copy link

Description

After simulating an FMU

fmu = fmiLoad(fmuPath)
solution = fmiSimulateME(fmu, (0., 1.); recordValues=["a", "b"])

the resulting solution is hard to handle.
When using the CSV export the resulting list of names is a bit strange / difficult to work with.

When you have alias variables a=b the CSV file contains one entry

"[""a"",  ""b""]"
1
2
3
4

I can see that this will save disk space, but it's difficult to work with. To retrieve the value of a I need to know all alias variables and the order of them.

df = DataFrame(CSV.read("solution.csv", DataFrame))
df[!, "a"]
ERROR: ArgumentError: column name :a not found in the data frame

Expected Behavior

I would suggest to flatten this. If the user want's to record alias variables by providing recordValues=["a", "b"] to simulate then the resulting CSV should contain them as well.

"a",  "b"
1, 1
2, 2
3, 3
4, 4

Version

  • OS: Ubuntu Focal
  • Julia Version 1.9.1
  • [14a09403] FMI v0.12.3
@AnHeuermann
Copy link
Author

I added an implementation for Tables.jl interface to FMI.jl instead of doing it directly for DataFrames, CSV and so on.

@AnHeuermann
Copy link
Author

The MAT solution writer won't save b at all. I guess it is possible to define references in the mat format, so you don't need to save the result twice.

@AnHeuermann AnHeuermann linked a pull request Oct 30, 2023 that will close this issue
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant