# A Methodology for the Design of Application-Specific Cyber-Physical Social Sensing Co-Simulators
## 4 Experimental Validation: Co-Simulator Development and Experiment Description
### Co-Simulator Implementation
#### STEP #1. Selection of the co-simulation paradigm  
First, as said in CHAR#7, no experts on simulators programming were available. Thus, integrated co-simulation got discarded (see Table 5). Besides, all considered simulators present an open architecture, so federated co-simulations are enabled. Secondly, in CHAR #9, it must be noted that MATLAB is not an open source tool, so choreographed co-simulation is not allowed. Finally, the results presentation and graphic interface provided with the selected tools do not meet the requirements of a crowd management system (in particular, any environment to visualize animations described in CHAR#6 is available). Moreover, CHAR#1 indicates that users are not programmers. Therefore, the proposed co-simulator must be implemented following the orchestrated by a third party engine federated co-simulation paradigm. Figure 11 presents the architecture of the proposed co-simulator. As a novelty, a database where all the logs are stored is also included (as we said, optional components could be added if necessary). Additionally, NS3 simulator presents, by default, a modularity architecture, so REQ#2 is fulfilled, and any type of new devices could be easily added to the resulting co-simulator. Moreover, all the domain-specific independent simulators meet scalability requirement REQ#3. STEP #2. Particularization of the general simulation model and simulation lifecycle  
In this case, the simulation lifecycle is maintained as shown in Figure 6. No additional task is required and, as indicated in the characteristics cited above all the basic states are necessary. In respect to the simulation model, CHAR#3 states that the most important subsystem in crowd management systems is the social world, so this area must be expanded in the model. Besides, as indicated in Table 6, the physical world should be also slightly complemented in order to represent in the proper way the scenario. Considering this both elements, Figure 12 shows the additional part to be included in the simulation model showed in Figure 6, by extending the relations of \"Personal state\", \"Social state\" (both in green, as they are social elements) and \"Physical object\" (in red, as it belongs to the physical world). In respect to devices (cyber world), which usually make up a very heterogeneous platform (the CPSS framework is known to have various types of device), the selected network simulator (NS3) has to be able to simulate all the required devices. In particular, see Figure 6, control, communication and processing devices have to be included. Different works [131] have proved that NS3 simulator may be used in that way, being possible to simulate from huge computing systems to small wireless sensor networks or cellular communications. STEP #3. Selection of the appropriate coordination mechanism  
In the third step, the coordination mechanism must be selected. In this case, it must be noted that three different simulation schemes are presented in the co-simulator: physical simulator makes a continuous simulation but the results are shared when the process finished; social simulator also makes a continuous simulation and shares the results each time step and, finally, network simulator makes an event-oriented simulation. However, at implementation stage, these three different schemes may be reduced to only two different schemes. In physical processes simulators, it is very common to recover the simulation routine using a program which runs the simulation each time step and  
Figure 11: CPSS simulator architecture. Figure 12: Extensions for the simulation model (**a**) Social world (**b**) Physical world. shows the generated results. In that way, physical processes simulators (Matlab in our case) and social simulators (MSON in this works) behave in the same manner. Considering this situation, implement a parallel execution solution in the planned co-simulator would be a very difficult task. On the other hand, as indicated in CHAR#4, the required processing capabilities to execute the simulations are limited.