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

Add interfaces to FMI functions for saving/serialising/deserialising/restoring FMU state #756

Open
1 of 2 tasks
kyllingstad opened this issue Mar 4, 2024 · 0 comments · May be fixed by #769
Open
1 of 2 tasks

Add interfaces to FMI functions for saving/serialising/deserialising/restoring FMU state #756

kyllingstad opened this issue Mar 4, 2024 · 0 comments · May be fixed by #769
Assignees
Labels
enhancement New feature or request

Comments

@kyllingstad
Copy link
Member

kyllingstad commented Mar 4, 2024

Required for #757. The following features are needed:

  • functions to save, restore, and delete subsimulator states, corresponding to fmi2{Get,Set,Free}FMUstate()
  • functions to serialise and deserialise subsimulator states, corresponding to fmi2[De]SerializeFMUstate()
@kyllingstad kyllingstad added the enhancement New feature or request label Mar 4, 2024
@kyllingstad kyllingstad self-assigned this Mar 4, 2024
kyllingstad added a commit that referenced this issue Jun 16, 2024
This is the first step towards closing #756.

Also fixes #762.
kyllingstad added a commit that referenced this issue Jun 22, 2024
This is the first step towards closing #756.  I've added functions
corresponding to FMI 2.0's `fmi2{Get,Set,Free}FMUstate()` throughout the
various layers of subsimulator interfaces and implementations:

* `cosim::slave` and its implementation in
   `cosim::fmi::v2::slave_instance`
* `cosim::simulator` and its implementation in `cosim::slave_simulator`

This led me to also remove the `slave_state` and `state_guard` stuff
that was in `slave_simulator.{hpp,cpp}`. The overloading of the "state"
terminology became confusing, and it seemed like it was a lot of code
for very little gain. (It was supposed to be a check of correct API
usage, but I can't remember it ever actually catching a bug.)

This commit also fixes #762.
kyllingstad added a commit that referenced this issue Jun 24, 2024
This is the first step towards closing #756.  I've added functions
corresponding to FMI 2.0's `fmi2{Get,Set,Free}FMUstate()` throughout the
various layers of subsimulator interfaces and implementations:

* `cosim::slave` and its implementation in
   `cosim::fmi::v2::slave_instance`
* `cosim::simulator` and its implementation in `cosim::slave_simulator`

This led me to also remove the `slave_state` and `state_guard` stuff
that was in `slave_simulator.{hpp,cpp}`. The overloading of the "state"
terminology became confusing, and it seemed like it was a lot of code
for very little gain. (It was supposed to be a check of correct API
usage, but I can't remember it ever actually catching a bug.)

This commit also fixes #762.
kyllingstad added a commit that referenced this issue Jul 4, 2024
This is the first step towards closing #756.  I've added functions
corresponding to FMI 2.0's `fmi2{Get,Set,Free}FMUstate()` throughout the
various layers of subsimulator interfaces and implementations:

* `cosim::slave` and its implementation in
   `cosim::fmi::v2::slave_instance`
* `cosim::simulator` and its implementation in `cosim::slave_simulator`

This led me to also remove the `slave_state` and `state_guard` stuff
that was in `slave_simulator.{hpp,cpp}`. The overloading of the "state"
terminology became confusing, and it seemed like it was a lot of code
for very little gain. (It was supposed to be a check of correct API
usage, but I can't remember it ever actually catching a bug.)
kyllingstad added a commit that referenced this issue Jul 4, 2024
This is a follow-up to #765 and the second and final step to close #756.

Here, I've implemented functionality to export the internal state of
individual subsimulators in a generic, structured form, and to import
them again later.

This exported form is intended as an intermediate step before
serialisation and disk storage.  The idea was to create a type that can
be inspected and serialised to almost any file format we'd like.

The type is defined by `cosim::serialization::node` in
`cosim/serialization.hpp`.  It is a hierarchical, dynamic data type with
support for a variety of primitive scalar types and a few aggregate
types: strings, arrays of nodes, dictionaries of nodes, and binary
blobs. (Think JSON, only with more types.)
@kyllingstad kyllingstad linked a pull request Jul 4, 2024 that will close this issue
@kyllingstad kyllingstad linked a pull request Jul 4, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
1 participant