  A Cyber-Physical System (CPS) comprises physical as well as software
subsystems. Simulation-based approaches are typically used to support design
and Verification and Validation (V&V) of CPSs in several domains such as:
aerospace, defence, automotive, smart grid and healthcare. Accordingly, many
simulation-based tools are available, and this poses huge interoperability
challenges. To overcome them, in 2010 the Functional Mock-up Interface (FMI)
was proposed as an open standard to support both Model Exchange (ME) and
Co-Simulation (CS). Models adhering to such a standard are called Functional
Mock-up Units (FMUs). FMUs play an essential role in defining complex CPSs
through, e.g., the SSP standard. Simulation-based V&V of CPSs typically
requires exploring different scenarios (i.e., exogenous CPS input sequences),
many of them showing a shared prefix. Accordingly, the simulator state at the
end of a shared prefix is saved and then restored and used as a start state for
the simulation of the next scenario. In this context, an important FMI feature
is the capability to save and restore the internal FMU state on demand.
Unfortunately, the implementation of this feature is not mandatory and it is
available only within some commercial software. This motivates developing such
a feature for open-source CPS simulation environments. In this paper, we focus
on JModelica, an open-source modelling and simulation environment for CPSs
defined in the Modelica language. We describe how we have endowed JModelica
with our open-source implementation of the FMI 2.0 functions to save and
restore internal states of FMUs for ME. Furthermore, we present results
evaluating, through 934 benchmark models, correctness and efficiency of our
extended JModelica. Our results show that simulation-based V&V is, on average,
22 times faster with our get/set functionality than without it.
