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

Feature/779 state serialization #780

Open
wants to merge 18 commits into
base: dev/state-persistence
Choose a base branch
from

Conversation

davidhjp01
Copy link
Contributor

@davidhjp01 davidhjp01 commented Dec 10, 2024

closes #779

  • Uses libcbor for (de)serialization.
  • Overrides << and >> to (de)seserialize cosim::serialization::node object to std::o/istream
  • Added state_serilization_test.cpp which is based on save_state_test.cpp for testing.
  • Extended save_state_test.cpp for testing export and import of states to/from files
  • Added print_ptree for replacing the previous << operator for pretty-printing cosim::serialization::node.
  • Reads canGetAndSetFMUstate and canSerializeFMUstate cosim capabilities from modelDescrpition.xml and store them to cosim::model_description

TODOs

  • Add missing comments to the new APIs.

@davidhjp01 davidhjp01 linked an issue Dec 10, 2024 that may be closed by this pull request
3 tasks
@davidhjp01 davidhjp01 changed the base branch from master to dev/state-persistence December 10, 2024 04:18
@davidhjp01 davidhjp01 changed the base branch from dev/state-persistence to master December 10, 2024 04:20
@davidhjp01 davidhjp01 marked this pull request as draft December 10, 2024 04:51
@davidhjp01 davidhjp01 changed the base branch from master to dev/state-persistence December 10, 2024 08:16
@davidhjp01 davidhjp01 marked this pull request as ready for review January 15, 2025 08:21
@davidhjp01
Copy link
Contributor Author

@kyllingstad, @restenb the PR is ready for your reviews :)

davidhjp01 and others added 2 commits January 23, 2025 13:23
* Added an option to file_observer_config to set
fixed precision value.

* Fixed build failure
@davidhjp01
Copy link
Contributor Author

I think we need to parse the following CoSimulation capabilities from each FMU's modelDescription file

  • canGetAndSetFMUstate
  • canSerializeFMUstate

so that users can check if they can export states from the FMUs they are running. I think FMUs not implementing these functions can throw exception or abruptly terminate?

@restenb
Copy link
Member

restenb commented Jan 24, 2025

I think we need to parse the following CoSimulation capabilities from each FMU's modelDescription file

  • canGetAndSetFMUstate
  • canSerializeFMUstate

so that users can check if they can export states from the FMUs they are running. I think FMUs not implementing these functions can throw exception or abruptly terminate?

Not sure what the behavior would be, but it makes sense to include this check in any case. An FMU that does not set these flags should not be possible to use with state saving.

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.

Implement CBOR based de-/serializer for state import/export
3 participants