All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.cloudbus.cloudsim.power.models.PowerModel Maven / Gradle / Ivy

Go to download

CloudSim Plus: A modern, highly extensible and easier-to-use Java 8 Framework for Modeling and Simulation of Cloud Computing Infrastructures and Services

There is a newer version: 8.0.0
Show newest version
/*
 * Title:        CloudSim Toolkit
 * Description:  CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
 * Licence:      GPL - http://www.gnu.org/copyleft/gpl.html
 *
 * Copyright (c) 2009-2012, The University of Melbourne, Australia
 */
package org.cloudbus.cloudsim.power.models;

import org.cloudbus.cloudsim.hosts.Host;

/**
 * Provides a model for power consumption of hosts, depending on utilization of a critical system
 * component, such as CPU.
 * This is the fundamental class to enable power-aware Hosts.
 * However, a Host just provides power usage data if a PowerModel is set using the
 * {@link Host#setPowerModel(PowerModel)}.
 *
 *
 * 

The interface implements the Null Object * Design Pattern in order to start avoiding {@link NullPointerException} when * using the {@link PowerModel#NULL} object instead of attributing {@code null} to * {@link PowerModel} variables.

* *

If you are using any algorithms, policies or workload included in the * power package please cite the following paper:

* * * * @author Anton Beloglazov * @author Manoel Campos da Silva Filho * * @since CloudSim Toolkit 2.0 */ public interface PowerModel extends PowerAware { /** * A property that implements the Null Object Design Pattern for {@link Host} * objects. */ PowerModel NULL = new PowerModel() { @Override public Host getHost() { return Host.NULL; } @Override public void setHost(Host host) {} @Override public double getMaxPower() { return 0; } @Override public double getPower() { return 0; } @Override public double getPower(double utilization) throws IllegalArgumentException { return 0; } @Override public double getEnergyLinearInterpolation(double fromUtilization, double toUtilization, double time) { return 0; } }; Host getHost(); void setHost(Host host); /** * Gets the max power that can be consumed by the host in Watt-Second (Ws). * * @return the max consumption power in Watt-Second (Ws) */ double getMaxPower(); /** * Gets power consumption in Watt-Second (Ws) of the Power Model, according to the utilization * percentage of a critical resource, such as CPU. * *

The power consumption data is just available while the host is active.

* * @param utilization the utilization percentage (between [0 and 1]) of a * resource that is critical for power consumption. * @return the power consumption in Watt-Second (Ws) * @throws IllegalArgumentException when the utilization percentage is not * between [0 and 1] */ double getPower(double utilization) throws IllegalArgumentException; /** * Gets an estimation of energy consumption using linear interpolation of the utilization * change. * It's required to set a {@link PowerModel} in order to get power usage data. * * @param fromUtilization the initial utilization percentage * @param toUtilization the final utilization percentage * @param time the time span between the initial and final utilization to compute the energy consumption * @return the estimated energy consumption */ double getEnergyLinearInterpolation(double fromUtilization, double toUtilization, double time); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy