cloudsim-plus-master/cloudsim-plus-master/cloudsim-plus-examples/src/main/java/org/cloudbus/cloudsim/examples/network/applications/NetworkVmsExampleBagOfTasksApp.java
@Override
    public List<NetworkCloudlet> createNetworkCloudlets(DatacenterBroker broker){
        final int NETCLOUDLETS_FOR_EACH_APP = 3;
        List<NetworkCloudlet> networkCloudletList = new ArrayList<>(NETCLOUDLETS_FOR_EACH_APP+1);
        List<NetworkVm> selectedVms = randomlySelectVmsForApp(broker, NETCLOUDLETS_FOR_EACH_APP+1);
        //basically, each task runs the simulation and then data is consolidated in one task
        long memory = 1000;
        long networkCloudletLength = 10000;
        int taskStageId=0;
        int currentCloudletId = -1;
        for(int i = 0; i < NETCLOUDLETS_FOR_EACH_APP; i++){
            currentCloudletId++;
            UtilizationModel utilizationModel = new UtilizationModelFull();
            NetworkCloudlet cloudlet =
                    new NetworkCloudlet(
                            currentCloudletId,
                            networkCloudletLength,
                            NETCLOUDLET_PES_NUMBER);
            cloudlet
                    .setMemory(memory)
                    .setFileSize(NETCLOUDLET_FILE_SIZE)
                    .setOutputSize(NETCLOUDLET_OUTPUT_SIZE)
                    .setUtilizationModel(utilizationModel)
                    .setVm(selectedVms.get(i));

            //compute and send data to node 0
            CloudletTask task;
            task = new CloudletExecutionTask(taskStageId++, networkCloudletLength);
            task.setMemory(memory);
            cloudlet.addTask(task);

            //NetworkCloudlet 0 wait data from other cloudlets, while the other cloudlets send data
            if (i==0){
                for(int j=1; j < NETCLOUDLETS_FOR_EACH_APP; j++) {
                    task = new CloudletReceiveTask(taskStageId++, selectedVms.get(j+1));
                    task.setMemory(memory);
                    cloudlet.addTask(task);
                }
            } else {
                task = new CloudletSendTask(taskStageId++);
                task.setMemory(memory);
                cloudlet.addTask(task);
            }

            networkCloudletList.add(cloudlet);
        }

        return networkCloudletList;
    }
/**
     * @TODO @author manoelcampos It isn't adding packets to send.
     * See {@link CloudletSendTask#addPacket(Cloudlet, long)}
     * @param broker the broker that the cloudlets will belong to
     * @return
     */
@TODO @author manoelcampos It isn't adding packets to send.
See  CloudletSendTask#addPacket(Cloudlet, long)
@param broker the broker that the cloudlets will belong to
@return
@TODO @author manoelcampos It isn ' t adding packets to send . See CloudletSendTask#addPacket ( Cloudlet long ) @param broker the broker that the cloudlets will belong to @return
@Override
    public List<NetworkCloudlet> createNetworkCloudlets(DatacenterBroker broker){
        final int NETCLOUDLETS_FOR_EACH_APP = 3;
        List<NetworkCloudlet> networkCloudletList = new ArrayList<>(NETCLOUDLETS_FOR_EACH_APP+1);
        List<NetworkVm> selectedVms = randomlySelectVmsForApp(broker, NETCLOUDLETS_FOR_EACH_APP+1);
        long memory = 1000;
        long networkCloudletLength = 10000;
        int taskStageId=0;
        int currentCloudletId = -1;
        for(int i = 0; i < NETCLOUDLETS_FOR_EACH_APP; i++){
            currentCloudletId++;
            UtilizationModel utilizationModel = new UtilizationModelFull();
            NetworkCloudlet cloudlet =
                    new NetworkCloudlet(
                            currentCloudletId,
                            networkCloudletLength,
                            NETCLOUDLET_PES_NUMBER);
            cloudlet
                    .setMemory(memory)
                    .setFileSize(NETCLOUDLET_FILE_SIZE)
                    .setOutputSize(NETCLOUDLET_OUTPUT_SIZE)
                    .setUtilizationModel(utilizationModel)
                    .setVm(selectedVms.get(i));
            CloudletTask task;
            task = new CloudletExecutionTask(taskStageId++, networkCloudletLength);
            task.setMemory(memory);
            cloudlet.addTask(task);
            if (i==0){
                for(int j=1; j < NETCLOUDLETS_FOR_EACH_APP; j++) {
                    task = new CloudletReceiveTask(taskStageId++, selectedVms.get(j+1));
                    task.setMemory(memory);
                    cloudlet.addTask(task);
                }
            } else {
                task = new CloudletSendTask(taskStageId++);
                task.setMemory(memory);
                cloudlet.addTask(task);
            }
            networkCloudletList.add(cloudlet);
        }
        return networkCloudletList;
    }
@ Override public List < NetworkCloudlet > createNetworkCloudlets ( DatacenterBroker broker ) { final int NETCLOUDLETS_FOR_EACH_APP = 3 ; List < NetworkCloudlet > networkCloudletList = new ArrayList < > ( NETCLOUDLETS_FOR_EACH_APP + 1 ) ; List < NetworkVm > selectedVms = randomlySelectVmsForApp ( broker , NETCLOUDLETS_FOR_EACH_APP + 1 ) ; long memory = 1000 ; long networkCloudletLength = 10000 ; int taskStageId = 0 ; int currentCloudletId = - 1 ; for ( int i = 0 ; i < NETCLOUDLETS_FOR_EACH_APP ; i ++ ) { currentCloudletId ++ ; UtilizationModel utilizationModel = new UtilizationModelFull ( ) ; NetworkCloudlet cloudlet = new NetworkCloudlet ( currentCloudletId , networkCloudletLength , NETCLOUDLET_PES_NUMBER ) ; cloudlet . setMemory ( memory ) . setFileSize ( NETCLOUDLET_FILE_SIZE ) . setOutputSize ( NETCLOUDLET_OUTPUT_SIZE ) . setUtilizationModel ( utilizationModel ) . setVm ( selectedVms . get ( i ) ) ; CloudletTask task ; task = new CloudletExecutionTask ( taskStageId ++ , networkCloudletLength ) ; task . setMemory ( memory ) ; cloudlet . addTask ( task ) ; if ( i == 0 ) { for ( int j = 1 ; j < NETCLOUDLETS_FOR_EACH_APP ; j ++ ) { task = new CloudletReceiveTask ( taskStageId ++ , selectedVms . get ( j + 1 ) ) ; task . setMemory ( memory ) ; cloudlet . addTask ( task ) ; } } else { task = new CloudletSendTask ( taskStageId ++ ) ; task . setMemory ( memory ) ; cloudlet . addTask ( task ) ; } networkCloudletList . add ( cloudlet ) ; } return networkCloudletList ; }
@TODO @author manoelcampos It isn't adding packets to send.
@TODO @author manoelcampos It isn ' t adding packets to send .
//basically, each task runs the simulation and then data is consolidated in one task //compute and send data to node 0 //NetworkCloudlet 0 wait data from other cloudlets, while the other cloudlets send data