# 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
Obviously, as more complex models and smaller values for time step are employed, the precision in the obtained results go up. Now, in the case of an orchestrated federated co-simulation solution, a new stochastic process may be defined, representing the total simulation time \(T_{T}^{orches}\) if stop-and-wait coordination mechanism is implemented (4). Moreover, another variable \(T_{T-para}^{orches}\) may be defined (5) if parallel execution is available. \[T_{T-8\&uv}^{orches}=\;T_{ph}+\;T_{so}+\;T_{cy}+\;T_{comm}+\;T_{init}+T_{end} \tag{4}\]  
\[T_{T-para}^{orches}=\;max\Big{\{}T_{ph},\;T_{so},\;T_{cy}\Big{\}}+\;T_{init}+T_{end} \tag{5}\]  
In (4), \(T_{comm}\) indicates the total time used in communicating the three domain-specific simulators (also a stochastic process, which includes, besides, delays due to feedback loops which are present in co-simulation tools but not on domain specific simulators). \(T_{init}\) is the time used in configuring the simulation at the initial moment and \(T_{end}\) the required time by the orchestrator for processing and presenting all the results by the simulators. In general, if mean values are considered, \((\mu_{init}+\mu_{end})<\;\Big{(}\mu_{pro\_scenario}+\;\mu_{pro\_results}\Big{)}\), as the third-party engine may processes the initial configuration faster than any expert. Thus, in general, \(\mu_{T}^{orches}<\;\mu_{T}^{indep}\). The time expressed in (4) and (5) could be reduced if choreographed co-simulation solutions are considered. In that case, as no orchestrator is deployed, the time \(T_{init}+T_{end}\) does not have to be considered. Then, the total simulation time in this case \(T_{T}^{choreo}\) is represented by two new stochastic processes (6) or (7) depending on the selected coordination mechanism. \[T_{T-8\&uv}^{choreo}=\;T_{ph}+\;T_{so}+\;T_{cy}+\;T_{comm} \tag{6}\]  
\[T_{T-para}^{choreo}=\;max\Big{\{}T_{ph},\;T_{so},\;T_{cy}\Big{\}} \tag{7}\]  
Clearly, if mean values are considered, \(\mu_{T}^{choreo}<\;\mu_{T}^{orches}\) in all cases. Finally, as we said, in integrated solutions this step is not applicable as no coordination mechanism is needed. As said, it is important to note that all previous temporal variables (in Equations (2)-(7)) are not fixed values. In general, the required time to perform a certain simulation is a stochastic variable which depends on many uncontrollable factors. Thus, relations among the variables may change in time. However, in order to support the decision making, in this section we are considering a typical case and the values can be fixed calculating the medium of various evaluations or by theoretical studies considering the algorithms complexity and the underlying hardware. On the other hand, one additional temporal variable could be considered. Sometimes, the same event must be processed in various simulation tools, or events which are internal when using a unique domain-specific simulator must be externalize when this tool is included in a co-simulator. Then, the total time required to simulate each subsystem in a co-simulator (called, \(T_{ph}^{c},\ T_{so}^{c},\ T_{cy}^{c}\)) is, in mean, greater than the required time in independent tools (\(T_{ph},\ T_{so},\ T_{cy}\)). In particular, this situation may be reduced to the inclusion of and additional stochastic process \(T_{co-sim}\) representing these activities (8). \[T_{ph}+\ T_{so}+\ T_{cy}<\ T_{ph}^{c}+\ T_{so}^{c}+\ T_{cy}^{c}=\ T_{co-sim}+\ T_{ph}+\ T_{so}+\ T_{cy} \tag{8}\]  
The main disadvantage of this new variable is that it depends on the particular implementation employed in the new co-simulator. Thus, discussing its possible values is outside of the scope of this paper. Nevertheless, it can be seen that (although could be partial) the previous analysis is valid as the relations among the different variables are almost independent of the additional time \(T_{co-sim}\).