Skip to content

Solution CSV export for alias variables #198

Open
@AnHeuermann

Description

@AnHeuermann

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions