## 3 Proposed Modelling Methodology, Simulation Mechanism, and Control Strategy
### Performance of Proposed Simulation Procedure  
The completed implementation of the proposed simulation procedure, shown in Figure 11, has been carried out by integrating the modelling methodologies, RTSM, and the proposed control strategy in the MATLAB/Simulink environment; meanwhile, various supporting tools are used as well. In Figure 11, three stages: data input and initialization, simulations, and results, are classified as responsible for performing different tasks, and the implementations of these tasks are summarized as follows:  
* Step 1: Definition of a C-_i_grid system topology by users or based on a real system configuration, as in the case in this study. Then, required assemblies in the C-_i_grid can be clarified; these may contain traditional electric sources such as the utility grid, impedances such as transmission lines, DERs like PV systems and BES units, power conversion devices such as the DC/DC converter and DC/AC inverter, required controller designs for different facilities, and load units. Some initialization works can be done in this step, for example setting the capacity of PV systems and BESs initial SOC state.
* Step 2: Data collection and arrangement as model inputs. Meanwhile, solar insolation and the load electricity profile are required in this study, and a pyranometer and power meters for every user on real sites are used to record these data. Data from the meters are first stored as excel files and are then imported to the MATLAB workspace; these data are further numerically processed by the MATLAB m-file program, and then saved to MATLAB workspace again to wait for a call from the models. Here, the numerical process for the data includes removal of invalid data, and  
Figure 10: Proposed C-_i_grid control strategy.  
data length regulation. Furthermore, once input data are not able to be obtained on site, any assumed parameters can be used as well for the models.
* Step 3: Here, the C-\(u\)grid system model is developed by MATLAB/Simulink and its SPS toolbox based on the defined topology in step 1. All the components in the C-\(u\)grid are modelled in detail according to the methodologies in Section 3.1; in addition, the controller designs and power balancing control strategy are achieved. In this step, all the work is done at the host PC of RTSM, and the ARTEMIS and RT-LAB software are then used to help the running of real-time simulation in step 4 [20].
* Step 4: In order to run parallel computing in RTSM, a completed C-\(u\)grid model developed in step 3 should be broken as several sub-models by model partition as described in Section 3.2. These separated sub-models are then loaded to the target cluster in RTSM from the host PC by an Ethernet communication. Then, with the operation of RTOS in the target cluster, real-time simulation can be implemented.
* Step 5: Results from the step 4 can be further analyzed based on the defined test scenario, and these results can be presented in various ways like time-series electricity distributions, the per hour bar chart and quantified tables, etc. Finally, equations for different electricity rates can provided to evaluate the electricity bill of total home users in the C-\(u\)grid. In this step, excel and MATLAB m-file programs are again used as support for graphical or numerical analyses and processes.