# A Methodology for the Design of Application-Specific Cyber-Physical Social Sensing Co-Simulators
## 2 State of the Art
### Selection of the Appropriate Coordination Mechanism
In particular, Equation (9) provides a theoretical analysis in order to optimally select the best approach for specific situations (depending on the expected number of simulations to be performed, etc.) We are supposing a simulation about a global scenario \(S_{G}\) represented by means of a global model \(M_{G}\) composed of information about three different domains: the physical, social and cyber world (1). \[M_{G}=\ \left\{m_{ph},m_{so},m_{cy}\right\} \tag{1}\]  
We are calling \(T_{ph}\) to the needed time to simulate the physical model \(m_{ph}\) in a physical processes simulator; \(T_{so}\) to the needed time to simulate the social model \(m_{so}\) in a social simulator; and \(T_{cy}\) to the needed time to simulate the cyber model \(m_{cy}\) in a networks simulator. All these variables, \(T_{ph}\), \(T_{so}\) and \(T_{cy}\), represent stochastic processes which may be understood as ergodic processes whose statistical mean is referred as \(E\left[T_{ph}\right]=\ \mu_{ph}\), \(E\left[T_{so}\right]=\ \mu_{so}\) and \(E\left[T_{cy}\right]=\ \mu_{cy}\). Calculation time is a stochastic process as aleatory facts (such as numerical noise) may affect the calculation speed, the time step (if it is considered as variable), etc. As reference, in average, the total amount of time required nowadays to simulate the global model \(M_{G}\) using independent simulation \(\mu_{T}^{indep}\) is (2) and (3). \[\mu_{T-s\&w}^{indep}=\ \mu_{ph}+\ \mu_{so}+\ \mu_{cy}+\ \mu_{pro\_ scenario}+\ \mu_{pro\_results} \tag{2}\]  
\[\mu_{T-para}^{indep}=\ max\Big{\{}\mu_{ph},\ \mu_{so},\ \mu_{cy}\Big{\}}+\ \mu_{pro\_ scenario}+\ \mu_{pro\_results} \tag{3}\]  
In Equations (2) and (3), \(\mu_{pro\_ scenario}\) represents the mean of a stochastic process \(T_{pro\_ scenario}\) indicating the time an expert need to separate the global model in the different domains. In the same  
Figure 8: (**a**) Sequence diagram describing the initial synchronization process in a co-simulator; (**b**) Example of a sequence diagram about the stop-and-wait coordination mechanism when using a federated co-simulation controlled by a third-party engine. way, \(\mu_{pro\_results}\) is the statistical mean of a stochastic process \(T_{pro\_results}\) which indicates the required time to combine the obtained independent results. Both tasks could be performed automatically by using the adequate tools, but this implies a first initial version of a CPSS co-simulator for the application under study is available. For this work, no previous requirements are necessary, so tasks are considered to be performed manually. If the stop-and-wait coordination mechanism is implemented, the domain-specific simulations would have to be executed in a row and the total simulation time is indicated by (2). If parallel execution is available, the total simulation time is which indicated in (3). It is obvious that if parallel execution is available the mean required simulation time goes down, as \(max\Big{\{}\mu_{ph},\;\mu_{so},\;\mu_{cy}\Big{\}}\ll\Big{(}\mu_{ph}+\;\mu_{so}+ \;\mu_{cy}\Big{)}\), especially when the number of included devices and people goes up (as, typically, simulation algorithms present a complexity of order \(\sigma(n^{2})\)). Another parameter which strongly affects the simulation time is the selected value for the minimum time step (usually simulation algorithms includes variable time step solvers). In most cases, the complexity order of the simulation algorithms depending on the time step is \(\sigma(n)\), so co-simulation tools usually present softer limitations related to the time step than which they present in respect to the number of considered devices. Moreover, the complexity of the simulation models and the attribute representation of agents may extend the simulation time, even in various magnitude orders (overall if non-linear models are included, which must be solved using complex numerical algorithms). In general, if more devices want to be included it is necessary to use simpler attribute representations and higher values for the time step.