Abstract
Despite the large number of applications and growing interest in the challenges that co-simulation poses, the field is fragmented into multiple application domains, with limited sharing of knowledge.
This demo promotes a deeper understanding of a well known stabilization feature in co-simulation, which is used in the INTO-CPS tool chain.
We develop the techniques that explain the empirical results of instability of the double mass-spring-damper system, and how to the stabilization feature improves the results. Moreover, we show how the restrictions of the Functional Mock-up Interface Standard impacts stability.
This work was executed under the framework of the COST Action IC1404 – Multi-Paradigm Modelling for Cyber-Physical Systems (MPM4CPS), and partially supported by: Flanders Make vzw, the strategic research centre for the manufacturing industry; and PhD fellowship grants from the Agency for Innovation by Science and Technology in Flanders (IWT, dossier 151067).
Access provided by CONRICYT-eBooks. Download conference paper PDF
Similar content being viewed by others
Keywords
1 Introduction
INTO-CPS provides an entire tool chain [8] that enables combining different tools and formalisms using co-simulation [6]. This demo provides the theoretical rationale for the stabilization feature of the Co-simulation Orchestration Engine from INTO-CPS called Maestro [12]. The feature will be illustrated with a small case study that is documented online [10].
This demo assumes that the reader is familiar with the main concepts in co-simulation (see, e.g., [7]).
In the next section, we describe the principles of stability analysis for linear Ordinary Differential Equations (ODEs), and linear discrete time systems. Then, in Sect. 3, we apply these principles to analyse the numerical stability of the commonly used Jacobi algorithm within the FMI context, and the stabilization method used in INTO-CPS. While the master algorithms are applicable outside the Functional Mockup Interface (FMI) context, the FMI version 2.0 has constraints that makes the stability analysis not applicable to other contexts.
2 Stability of Linear Systems
This section is based on [7].
Notation. We denote vectors with bold face, and we use capital letters for matrices and vector valued functions. Given a vector \(\varvec{x}\), we denote its transpose as \(\varvec{x}^T\). Furthermore, we denote the i-th element of vector \(\varvec{x}\) by \(x_{i}\), so that \(\varvec{x} = \left[ \begin{matrix} x_{1}&x_{2}&\cdots&x_{n} \end{matrix} \right] ^T\). Similarly, \(F_{i}(\varvec{x})\) denotes the i-th element of the vector returned by \(F(\varvec{x})\).
A linear ODE has the following form:
where \(\varvec{x}(t)\) is a vector function, and A is a constant matrix. When an initial condition in the form \(\varvec{x}(0)=\varvec{x_0}\) is specified, we denote Eq. (1) as an Initial Value Problem (IVP).
Example 1
The mass-spring-damper system, illustrated in Fig. 1a, is modelled by the following second order ordinary differential equation:
where x denotes the position of the mass, \(c>0\) is the stiffness coefficient of the spring, \(d>0\) is the damping constant of the damper, t is time, and \(f_e(t)\) denotes an external force exerted on the mass.
The above equation can be put into the form of Eq. (1) by introducing a new variable for velocity, \(v = \dot{x} \), and letting the vector \(\varvec{x} = \left[ \begin{matrix} x&v \end{matrix} \right] ^T\). Given an initial position \(x_0\) and velocity \(v_0\), we obtain the following:
Figure 1b shows the solution of the position component of the mass-spring-damper IVP, introduced in Example 1, and will be explained below. The solution to the velocity component is omitted.
We say that the system in Eq. (1) is asymptotically stable when all its solutions tend to zero as time passes, regardless of the initial value specified. Formally,
An ODE in the form of Eq. (1) is asymptotically stable, i.e. it satisfies Eq. (2), if the real part of all eigenvalues of A is strictly negative. Formally,
This condition can be computed easily in most programming languages.
To approximate the solution to the IVP in Example 1, one can use the forward Euler method:
where I is the identify matrix with the appropriate dimensions, and \(h>0\) is the given simulation step size.
In general, for a given matrix \(\tilde{A}\), a system on the form
is stable if \(\rho (\tilde{A}) < 1\), where \(\rho (\tilde{A})\) is the spectral radius [9] of \(\tilde{A}\).
3 Stability Analysis of FMI Orchestration Algorithms
Our aim is to encode the co-simulation as a system in the form of Eq. (5). We perform this for a two-simulator system using two orchestration algorithms: the traditional Jacobi method, and the stabilization method used by INTO-CPS. A two simulator system introduced in [10] is illustrated in Fig. 2. More details about this example are given in [6, Sect. 4]. For more examples of stability analysis in co-simulation, refer to [2,3,4,5].
3.1 Co-simulation Unit Modelling
In the context of co-simulation, time is discretized into a countable set \(T = \left\{ t_0, t_1, t_2, \ldots \right\} \subset \mathbb {R}\), where \(t_{i+1} = t_i + H_i\) is the time at step i and \(H_i\) is the communication step size at step i, with \(i=0,1,\ldots \)
Simulators exchange outputs only at times \(t \in T\).
In the interval \(t \in \left[ t_i, t_{i+1} \right] \), each simulator \(S_j\) approximates the solution to a linear ODE,
where \(\varvec{x}_j\) is the state vector, \(\varvec{y}_j\) is the output vector, \(A_j, B_j, C_j, D_j\) are matrices, the initial state \(\varvec{x}_j(t_i)\) is computed in the most recent co-simulation step, and \(j=1,2\).
Since the simulators only exchange outputs at times \(t_i, t_{i+1} \in T\), the input \(\varvec{u}_j\) has to be extrapolated in the interval \([t_i, t_{i+1})\). In the simplest co-simulation strategyFootnote 1, this extrapolation is often implemented as a zero-order hold: \(\tilde{\varvec{u}}_j(t) = \varvec{u}_j(t_i)\), for \(t \in [t_i, t_{i+1})\). Then, Eq. (6) can be re-written to represent the unforced system being integrated by each simulator:
We can represent the multiple internal integration steps of Eq. (7), performed by the simulator \(S_j\) in the interval \(t \in \left[ t_i, t_{i+1} \right] \), as
where, e.g., \(\tilde{A}_j = \mathbf {I} + h_j \left[ \begin{matrix} A_j &{} B_j \\ \mathbf {0} &{} \mathbf {0} \end{matrix} \right] \) for the Forward Euler method, \(k_j=(t_{i+1} - t_i)/h_j\) is the number of internal steps, and \(0 < h_j \le H_i\) is the internal fixed step size that divides \(H_i\).
Therefore, each co-simulation unit can be modelled as a discrete time system:
with
3.2 FMI Jacobi Algorithm
We assume without loss of generality that the two simulators are coupled in a feedback loop, that is,
And, to avoid algebraic loops and keep the exposition short, we assume that either \(D_1\) or \(D_2\) (recall Eq. (6)) is the zero matrix. Let \(D_2 = \mathbf {0}\).
The ideal Jacobi coupling would be described by:
However, due the FMI restrictions [11, Restriction 1], the actual coupling is:
Applying Eq. (12) to \(t_{i+1}\) and using Eq. (9), yields:
which can be arranged to the form of Eq. (5):
3.3 INTO-CPS Method
The method used in INTO-CPS is a sucessive substitution fixed point iteration, described by:
The above equation can be expanded and simplified to:
which can be put in matrix form:
Renaming the above equation to \(\bar{\varvec{x}}_{i+1} = \bar{M}_i \bar{\varvec{x}}_i + \bar{M}_{i+1} \bar{\varvec{x}}_{i+1}\), we get an equation in the form of Eq. (5):
In most cases in practice, \(\rho ((I - \bar{M}_{i+1}) ^{-1} \bar{M}_i)\) is smaller than the spectral radius of the matrix in Eq. (14). The practical results of this analysis are shown in the case study described in [10].
This can be generalized. However, in practice, one must be aware of the internal details of each co-simulation unit, which is usually difficult. As such, this analysis can be used to determine the best orchestration algorithm, without providing guarantees.
Notes
- 1.
The derivation presented can be applied to more sophisticated input extrapolation techniques, see [1, Eq. (9)].
References
Busch, M.: Continuous approximation techniques for co-simulation methods: analysis of numerical stability and local error. J. Appl. Math. Mech. 96(9), 1061–1081 (2016)
Gomes, C., Jungers, R., Legat, B., Vangheluwe, H.: Minimally constrained stable switched systems and application to co-simulation. Technical report. arXiv:1809.02648 (2018), http://arxiv.org/abs/1809.02648
Gomes, C., Legat, B., Jungers, R., Vangheluwe, H.: Minimally constrained stable switched systems and application to co-simulation. In: IEEE Conference on Decision and Control, Miami Beach, FL, USA (2018). To be published
Gomes, C., Legat, B., Jungers, R.M., Vangheluwe, H.: Stable adaptive co-simulation: a switched systems approach. In: IUTAM Symposium on Co-Simulation and Solver Coupling, Darmstadt, Germany (2017). To appear
Gomes, C., Thule, C., Broman, D., Larsen, P.G., Vangheluwe, H.: Co-simulation: state of the art. Technical report, February 2017. http://arxiv.org/abs/1702.00686
Gomes, C., Thule, C., Broman, D., Larsen, P.G., Vangheluwe, H.: Co-simulation: a survey. ACM Comput. Surv. 51(3) (2018). Article 49
Gomes, C., Thule, C., Larsen, P.G., Denil, J., Vangheluwe, H.: Co-simulation of continuous systems: a tutorial. arXiv:1809.08463 [cs, math], September 2018. http://arxiv.org/abs/1809.08463
Larsen, P.G., Fitzgerald, J., Woodcock, J., Gamble, C., Payne, R., Pierce, K.: Features of integrated model-based co-modelling and co-simulation technology. In: Cerone, A., Roveri, M. (eds.) SEFM 2017. LNCS, vol. 10729, pp. 377–390. Springer, Cham (2018). https://doi.org/10.1007/978-3-319-74781-1_26
Strang, G.: Introduction to Linear Algebra, vol. vol, p. 3. Wellesley-Cambridge Press, Wellesley (1993)
Thule, C.: Mass-spring-damper Case Study (2018). https://github.com/INTO-CPS-Association/example-mass_spring_damper
Thule, C., Gomes, C., Deantoni, J., Larsen, P.G., Brauer, J., Vangheluwe, H.: Towards verification of hybrid co-simulation algorithms. In: 2nd Workshop on Formal Co-Simulation of Cyber-Physical Systems, Toulouse, France. Springer, Cham (2018). To be published
Thule, C., Lausdahl, K., Larsen, P.G., Meisl, G.: Maestro: The INTO-CPSCo-simulation orchestration engine (2018). Submitted to Simulation Modelling Practice and Theory
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2018 Springer Nature Switzerland AG
About this paper
Cite this paper
Gomes, C., Thule, C., Lausdahl, K., Larsen, P.G., Vangheluwe, H. (2018). Demo: Stabilization Technique in INTO-CPS. In: Mazzara, M., Ober, I., Salaün, G. (eds) Software Technologies: Applications and Foundations. STAF 2018. Lecture Notes in Computer Science(), vol 11176. Springer, Cham. https://doi.org/10.1007/978-3-030-04771-9_4
Download citation
DOI: https://doi.org/10.1007/978-3-030-04771-9_4
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-030-04770-2
Online ISBN: 978-3-030-04771-9
eBook Packages: Computer ScienceComputer Science (R0)