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

Tables interface for FMUSolution #199

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

AnHeuermann
Copy link
Contributor

Changes

  • Implementing Tables.jl interface
    • Column access defined
  • Removed DataFrames extension, it's handled by Tables.
  • Simplified fmiSaveSolutionCSV, CSV.write used Tables interface as well.

Related Issue

Fixes #198

@AnHeuermann AnHeuermann marked this pull request as draft October 31, 2023 10:49
@AnHeuermann
Copy link
Contributor Author

Creating DataFrames from solution::DiffEqCallbacks.SavedValues{Float64, NTuple{76, Float64}} works fine, but I'm not sure why it breaks fmiLoadSolution for JLD2.

@ThummeTo
Copy link
Owner

Maybe a general issue with the latest JLD2 release... this issue is not limited to your PR

@AnHeuermann
Copy link
Contributor Author

Seems you are right, using

[compat]
JLD2 = "< 0.4.37"

works locally.

@AnHeuermann
Copy link
Contributor Author

I noticed an issue with my implementation in Tables.jl. It is wrong to add all alias variables to the column names. We should only add the ones that where in recordValues of the fmiSimulate call.
@ThummeTo is the array recordValues stored in the simulation result?

@ThummeTo
Copy link
Owner

ThummeTo commented Nov 6, 2023

It is!

@ThummeTo
Copy link
Owner

The JLD2-thing seems resolved ...

@AnHeuermann
Copy link
Contributor Author

I'll see if I can finish this PR soonish.

  - Column access defined
  - Restricting  JLD2 to version smaller 0.4.37
@AnHeuermann
Copy link
Contributor Author

It is!

I can't find the list of variable names recordValues inside struct FMU2Solution or FMU3Solution. The list of value references is stored in valueReferences, but this is not unique.
The case I'm having trouble with is when FMU A.fmu has alias variables a=b. Both will have have the same value reference, but if I simulate with

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

only a should be in the list of names of the table.

If that is not available we can keep it as it is now: Store both a and b in table.

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

Successfully merging this pull request may close these issues.

Solution CSV export for alias variables
2 participants