cloudsim-plus-master/cloudsim-plus-master/cloudsim-plus-examples/src/main/java/org/cloudbus/cloudsim/examples/network/applications/NetworkVmExampleAbstract.java
protected final NetworkDatacenter createDatacenter() {
        final int numberOfHosts = EdgeSwitch.PORTS * AggregateSwitch.PORTS * RootSwitch.PORTS;
        List<Host> hostList = new ArrayList<>(numberOfHosts);
        for (int i = 0; i < numberOfHosts; i++) {
            List<Pe> peList = createPEs(HOST_PES, HOST_MIPS);
            Host host = new NetworkHost(HOST_RAM, HOST_BW, HOST_STORAGE, peList)
                    .setRamProvisioner(new ResourceProvisionerSimple())
                    .setBwProvisioner(new ResourceProvisionerSimple())
                    .setVmScheduler(new VmSchedulerTimeShared());
            hostList.add(host);
        }

        // 5. Create a DatacenterCharacteristics object that stores the
        // properties of a data center: architecture, OS, list of
        // Machines, allocation policy: time- or space-shared, time zone
        // and its price (G$/Pe time unit).
        DatacenterCharacteristics characteristics =
                new DatacenterCharacteristicsSimple(hostList)
                    .setCostPerSecond(COST)
                    .setCostPerMem(COST_PER_MEM)
                    .setCostPerStorage(COST_PER_STORAGE)
                    .setCostPerBw(COST_PER_BW);
        // 6. Finally, we need to create a NetworkDatacenter object.
        NetworkDatacenter newDatacenter =
                new NetworkDatacenter(
                        simulation, characteristics, new VmAllocationPolicySimple());
        newDatacenter.setSchedulingInterval(5);

        createNetwork(newDatacenter);
        return newDatacenter;
    }
/**
     * Creates the Datacenter.
     *
     * @return the Datacenter
     */
Creates the Datacenter.
@return the Datacenter
Creates the Datacenter . @return the Datacenter
protected final NetworkDatacenter createDatacenter() {
        final int numberOfHosts = EdgeSwitch.PORTS * AggregateSwitch.PORTS * RootSwitch.PORTS;
        List<Host> hostList = new ArrayList<>(numberOfHosts);
        for (int i = 0; i < numberOfHosts; i++) {
            List<Pe> peList = createPEs(HOST_PES, HOST_MIPS);
            Host host = new NetworkHost(HOST_RAM, HOST_BW, HOST_STORAGE, peList)
                    .setRamProvisioner(new ResourceProvisionerSimple())
                    .setBwProvisioner(new ResourceProvisionerSimple())
                    .setVmScheduler(new VmSchedulerTimeShared());
            hostList.add(host);
        }
        DatacenterCharacteristics characteristics =
                new DatacenterCharacteristicsSimple(hostList)
                    .setCostPerSecond(COST)
                    .setCostPerMem(COST_PER_MEM)
                    .setCostPerStorage(COST_PER_STORAGE)
                    .setCostPerBw(COST_PER_BW);
        NetworkDatacenter newDatacenter =
                new NetworkDatacenter(
                        simulation, characteristics, new VmAllocationPolicySimple());
        newDatacenter.setSchedulingInterval(5);
        createNetwork(newDatacenter);
        return newDatacenter;
    }
protected final NetworkDatacenter createDatacenter ( ) { final int numberOfHosts = EdgeSwitch . PORTS * AggregateSwitch . PORTS * RootSwitch . PORTS ; List < Host > hostList = new ArrayList < > ( numberOfHosts ) ; for ( int i = 0 ; i < numberOfHosts ; i ++ ) { List < Pe > peList = createPEs ( HOST_PES , HOST_MIPS ) ; Host host = new NetworkHost ( HOST_RAM , HOST_BW , HOST_STORAGE , peList ) . setRamProvisioner ( new ResourceProvisionerSimple ( ) ) . setBwProvisioner ( new ResourceProvisionerSimple ( ) ) . setVmScheduler ( new VmSchedulerTimeShared ( ) ) ; hostList . add ( host ) ; } DatacenterCharacteristics characteristics = new DatacenterCharacteristicsSimple ( hostList ) . setCostPerSecond ( COST ) . setCostPerMem ( COST_PER_MEM ) . setCostPerStorage ( COST_PER_STORAGE ) . setCostPerBw ( COST_PER_BW ) ; NetworkDatacenter newDatacenter = new NetworkDatacenter ( simulation , characteristics , new VmAllocationPolicySimple ( ) ) ; newDatacenter . setSchedulingInterval ( 5 ) ; createNetwork ( newDatacenter ) ; return newDatacenter ; }
Creates the Datacenter.
Creates the Datacenter .
// 5. Create a DatacenterCharacteristics object that stores the // properties of a data center: architecture, OS, list of // Machines, allocation policy: time- or space-shared, time zone // and its price (G$/Pe time unit). // 6. Finally, we need to create a NetworkDatacenter object.