This commit is contained in:
2021-04-06 00:45:28 +02:00
commit 17fabc368e
836 changed files with 3042963 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
/*
* 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;
/**
* The PowerModel interface needs to be implemented in order to provide a model of power consumption
* depending on utilization for system components.
*
* If you are using any algorithms, policies or workload included in the power package, please cite
* the following paper:
*
* Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* Heuristics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in
* Cloud Data Centers", Concurrency and Computation: Practice and Experience (CCPE), Volume 24,
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
*
* @author Anton Beloglazov
*
* @author Anton Beloglazov
* @since CloudSim Toolkit 2.0
*/
public interface PowerModel {
/**
* Get power consumption by the utilization percentage according to the power model.
*
* @param utilization the utilization
* @return power consumption
* @throws IllegalArgumentException the illegal argument exception
*/
double getPower(double utilization) throws IllegalArgumentException;
}

View File

@@ -0,0 +1,119 @@
/*
* 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;
/**
* The Class PowerModelCubic.
*
* If you are using any algorithms, policies or workload included in the power package, please cite
* the following paper:
*
* Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* Heuristics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in
* Cloud Data Centers", Concurrency and Computation: Practice and Experience (CCPE), Volume 24,
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
*
* @author Anton Beloglazov
*
* @author Anton Beloglazov
* @since CloudSim Toolkit 2.0
*/
public class PowerModelCubic implements PowerModel {
/** The max power. */
private double maxPower;
/** The constant. */
private double constant;
/** The static power. */
private double staticPower;
/**
* Instantiates a new power model cubic.
*
* @param maxPower the max power
* @param staticPowerPercent the static power percent
*/
public PowerModelCubic(double maxPower, double staticPowerPercent) {
setMaxPower(maxPower);
setStaticPower(staticPowerPercent * maxPower);
setConstant((maxPower - getStaticPower()) / Math.pow(100, 3));
}
/*
* (non-Javadoc)
* @see gridsim.virtualization.power.PowerModel#getPower(double)
*/
@Override
public double getPower(double utilization) throws IllegalArgumentException {
if (utilization < 0 || utilization > 1) {
throw new IllegalArgumentException("Utilization value must be between 0 and 1");
}
if (utilization == 0) {
return 0;
}
return getStaticPower() + getConstant() * Math.pow(utilization * 100, 3);
}
/**
* Gets the max power.
*
* @return the max power
*/
protected double getMaxPower() {
return maxPower;
}
/**
* Sets the max power.
*
* @param maxPower the new max power
*/
protected void setMaxPower(double maxPower) {
this.maxPower = maxPower;
}
/**
* Gets the constant.
*
* @return the constant
*/
protected double getConstant() {
return constant;
}
/**
* Sets the constant.
*
* @param constant the new constant
*/
protected void setConstant(double constant) {
this.constant = constant;
}
/**
* Gets the static power.
*
* @return the static power
*/
protected double getStaticPower() {
return staticPower;
}
/**
* Sets the static power.
*
* @param staticPower the new static power
*/
protected void setStaticPower(double staticPower) {
this.staticPower = staticPower;
}
}

View File

@@ -0,0 +1,119 @@
/*
* 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;
/**
* The Class PowerModelLinear.
*
* If you are using any algorithms, policies or workload included in the power package, please cite
* the following paper:
*
* Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* Heuristics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in
* Cloud Data Centers", Concurrency and Computation: Practice and Experience (CCPE), Volume 24,
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
*
* @author Anton Beloglazov
*
* @author Anton Beloglazov
* @since CloudSim Toolkit 2.0
*/
public class PowerModelLinear implements PowerModel {
/** The max power. */
private double maxPower;
/** The constant. */
private double constant;
/** The static power. */
private double staticPower;
/**
* Instantiates a new linear power model.
*
* @param maxPower the max power
* @param staticPowerPercent the static power percent
*/
public PowerModelLinear(double maxPower, double staticPowerPercent) {
setMaxPower(maxPower);
setStaticPower(staticPowerPercent * maxPower);
setConstant((maxPower - getStaticPower()) / 100);
}
/*
* (non-Javadoc)
* @see cloudsim.power.PowerModel#getPower(double)
*/
@Override
public double getPower(double utilization) throws IllegalArgumentException {
if (utilization < 0 || utilization > 1) {
throw new IllegalArgumentException("Utilization value must be between 0 and 1");
}
if (utilization == 0) {
return 0;
}
return getStaticPower() + getConstant() * utilization * 100;
}
/**
* Gets the max power.
*
* @return the max power
*/
protected double getMaxPower() {
return maxPower;
}
/**
* Sets the max power.
*
* @param maxPower the new max power
*/
protected void setMaxPower(double maxPower) {
this.maxPower = maxPower;
}
/**
* Gets the constant.
*
* @return the constant
*/
protected double getConstant() {
return constant;
}
/**
* Sets the constant.
*
* @param constant the new constant
*/
protected void setConstant(double constant) {
this.constant = constant;
}
/**
* Gets the static power.
*
* @return the static power
*/
protected double getStaticPower() {
return staticPower;
}
/**
* Sets the static power.
*
* @param staticPower the new static power
*/
protected void setStaticPower(double staticPower) {
this.staticPower = staticPower;
}
}

View File

@@ -0,0 +1,57 @@
/*
* 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;
/**
* The abstract class of power models created based on data from SPECpower benchmark:
* http://www.spec.org/power_ssj2008/
*
* If you are using any algorithms, policies or workload included in the power package, please cite
* the following paper:
*
* Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* Heuristics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in
* Cloud Data Centers", Concurrency and Computation: Practice and Experience (CCPE), Volume 24,
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
*
* @author Anton Beloglazov
* @since CloudSim Toolkit 3.0
*/
public abstract class PowerModelSpecPower implements PowerModel {
/*
* (non-Javadoc)
* @see org.cloudbus.cloudsim.power.models.PowerModel#getPower(double)
*/
@Override
public double getPower(double utilization) throws IllegalArgumentException {
if (utilization < 0 || utilization > 1) {
throw new IllegalArgumentException("Utilization value must be between 0 and 1");
}
if (utilization % 0.1 == 0) {
return getPowerData((int) (utilization * 10));
}
int utilization1 = (int) Math.floor(utilization * 10);
int utilization2 = (int) Math.ceil(utilization * 10);
double power1 = getPowerData(utilization1);
double power2 = getPowerData(utilization2);
double delta = (power2 - power1) / 10;
double power = power1 + delta * (utilization - (double) utilization1 / 10) * 100;
return power;
}
/**
* Gets the power data.
*
* @param index the index
* @return the power data
*/
protected abstract double getPowerData(int index);
}

View File

@@ -0,0 +1,40 @@
/*
* 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;
/**
* The power model of an HP ProLiant ML110 G3 (1 x [Pentium D930 3000 MHz, 2 cores], 4GB).
* http://www.spec.org/power_ssj2008/results/res2011q1/power_ssj2008-20110127-00342.html
*
* If you are using any algorithms, policies or workload included in the power package, please cite
* the following paper:
*
* Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* Heuristics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in
* Cloud Data Centers", Concurrency and Computation: Practice and Experience (CCPE), Volume 24,
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
*
* @author Anton Beloglazov
* @since CloudSim Toolkit 3.0
*/
public class PowerModelSpecPowerHpProLiantMl110G3PentiumD930 extends PowerModelSpecPower {
/** The power. */
private final double[] power = { 105, 112, 118, 125, 131, 137, 147, 153, 157, 164, 169 };
/*
* (non-Javadoc)
* @see org.cloudbus.cloudsim.power.models.PowerModelSpecPower#getPowerData(int)
*/
@Override
protected double getPowerData(int index) {
return power[index];
}
}

View File

@@ -0,0 +1,40 @@
/*
* 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;
/**
* The power model of an HP ProLiant ML110 G4 (1 x [Xeon 3040 1860 MHz, 2 cores], 4GB).
* http://www.spec.org/power_ssj2008/results/res2011q1/power_ssj2008-20110127-00342.html
*
* If you are using any algorithms, policies or workload included in the power package, please cite
* the following paper:
*
* Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* Heuristics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in
* Cloud Data Centers", Concurrency and Computation: Practice and Experience (CCPE), Volume 24,
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
*
* @author Anton Beloglazov
* @since CloudSim Toolkit 3.0
*/
public class PowerModelSpecPowerHpProLiantMl110G4Xeon3040 extends PowerModelSpecPower {
/** The power. */
private final double[] power = { 86, 89.4, 92.6, 96, 99.5, 102, 106, 108, 112, 114, 117 };
/*
* (non-Javadoc)
* @see org.cloudbus.cloudsim.power.models.PowerModelSpecPower#getPowerData(int)
*/
@Override
protected double getPowerData(int index) {
return power[index];
}
}

View File

@@ -0,0 +1,40 @@
/*
* 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;
/**
* The power model of an HP ProLiant ML110 G5 (1 x [Xeon 3075 2660 MHz, 2 cores], 4GB).
* http://www.spec.org/power_ssj2008/results/res2011q1/power_ssj2008-20110124-00339.html
*
* If you are using any algorithms, policies or workload included in the power package, please cite
* the following paper:
*
* Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* Heuristics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in
* Cloud Data Centers", Concurrency and Computation: Practice and Experience (CCPE), Volume 24,
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
*
* @author Anton Beloglazov
* @since CloudSim Toolkit 3.0
*/
public class PowerModelSpecPowerHpProLiantMl110G5Xeon3075 extends PowerModelSpecPower {
/** The power. */
private final double[] power = { 93.7, 97, 101, 105, 110, 116, 121, 125, 129, 133, 135 };
/*
* (non-Javadoc)
* @see org.cloudbus.cloudsim.power.models.PowerModelSpecPower#getPowerData(int)
*/
@Override
protected double getPowerData(int index) {
return power[index];
}
}

View File

@@ -0,0 +1,40 @@
/*
* 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;
/**
* The power model of an IBM server x3250 (1 x [Xeon X3470 2933 MHz, 4 cores], 8GB).
* http://www.spec.org/power_ssj2008/results/res2009q4/power_ssj2008-20091104-00213.html
*
* If you are using any algorithms, policies or workload included in the power package, please cite
* the following paper:
*
* Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* Heuristics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in
* Cloud Data Centers", Concurrency and Computation: Practice and Experience (CCPE), Volume 24,
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
*
* @author Anton Beloglazov
* @since CloudSim Toolkit 3.0
*/
public class PowerModelSpecPowerIbmX3250XeonX3470 extends PowerModelSpecPower {
/** The power. */
private final double[] power = { 41.6, 46.7, 52.3, 57.9, 65.4, 73, 80.7, 89.5, 99.6, 105, 113 };
/*
* (non-Javadoc)
* @see org.cloudbus.cloudsim.power.models.PowerModelSpecPower#getPowerData(int)
*/
@Override
protected double getPowerData(int index) {
return power[index];
}
}

View File

@@ -0,0 +1,40 @@
/*
* 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;
/**
* The power model of an IBM server x3250 (1 x [Xeon X3480 3067 MHz, 4 cores], 8GB).
* http://www.spec.org/power_ssj2008/results/res2010q4/power_ssj2008-20101001-00297.html
*
* If you are using any algorithms, policies or workload included in the power package, please cite
* the following paper:
*
* Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* Heuristics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in
* Cloud Data Centers", Concurrency and Computation: Practice and Experience (CCPE), Volume 24,
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
*
* @author Anton Beloglazov
* @since CloudSim Toolkit 3.0
*/
public class PowerModelSpecPowerIbmX3250XeonX3480 extends PowerModelSpecPower {
/** The power. */
private final double[] power = { 42.3, 46.7, 49.7, 55.4, 61.8, 69.3, 76.1, 87, 96.1, 106, 113 };
/*
* (non-Javadoc)
* @see org.cloudbus.cloudsim.power.models.PowerModelSpecPower#getPowerData(int)
*/
@Override
protected double getPowerData(int index) {
return power[index];
}
}

View File

@@ -0,0 +1,40 @@
/*
* 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;
/**
* The power model of an IBM server x3550 (2 x [Xeon X5670 2933 MHz, 6 cores], 12GB).
* http://www.spec.org/power_ssj2008/results/res2010q2/power_ssj2008-20100315-00239.html
*
* If you are using any algorithms, policies or workload included in the power package, please cite
* the following paper:
*
* Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* Heuristics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in
* Cloud Data Centers", Concurrency and Computation: Practice and Experience (CCPE), Volume 24,
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
*
* @author Anton Beloglazov
* @since CloudSim Toolkit 3.0
*/
public class PowerModelSpecPowerIbmX3550XeonX5670 extends PowerModelSpecPower {
/** The power. */
private final double[] power = { 66, 107, 120, 131, 143, 156, 173, 191, 211, 229, 247 };
/*
* (non-Javadoc)
* @see org.cloudbus.cloudsim.power.models.PowerModelSpecPower#getPowerData(int)
*/
@Override
protected double getPowerData(int index) {
return power[index];
}
}

View File

@@ -0,0 +1,40 @@
/*
* 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;
/**
* The power model of an IBM server x3550 (2 x [Xeon X5675 3067 MHz, 6 cores], 16GB).
* http://www.spec.org/power_ssj2008/results/res2011q2/power_ssj2008-20110406-00368.html
*
* If you are using any algorithms, policies or workload included in the power package, please cite
* the following paper:
*
* Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* Heuristics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in
* Cloud Data Centers", Concurrency and Computation: Practice and Experience (CCPE), Volume 24,
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
*
* @author Anton Beloglazov
* @since CloudSim Toolkit 3.0
*/
public class PowerModelSpecPowerIbmX3550XeonX5675 extends PowerModelSpecPower {
/** The power. */
private final double[] power = { 58.4, 98, 109, 118, 128, 140, 153, 170, 189, 205, 222 };
/*
* (non-Javadoc)
* @see org.cloudbus.cloudsim.power.models.PowerModelSpecPower#getPowerData(int)
*/
@Override
protected double getPowerData(int index) {
return power[index];
}
}

View File

@@ -0,0 +1,117 @@
/*
* 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;
/**
* The Class PowerModelSqrt.
*
* If you are using any algorithms, policies or workload included in the power package, please cite
* the following paper:
*
* Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* Heuristics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in
* Cloud Data Centers", Concurrency and Computation: Practice and Experience (CCPE), Volume 24,
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
*
* @author Anton Beloglazov
* @since CloudSim Toolkit 2.0
*/
public class PowerModelSqrt implements PowerModel {
/** The max power. */
private double maxPower;
/** The constant. */
private double constant;
/** The static power. */
private double staticPower;
/**
* Instantiates a new power model sqrt.
*
* @param maxPower the max power
* @param staticPowerPercent the static power percent
*/
public PowerModelSqrt(double maxPower, double staticPowerPercent) {
setMaxPower(maxPower);
setStaticPower(staticPowerPercent * maxPower);
setConstant((maxPower - getStaticPower()) / Math.sqrt(100));
}
/*
* (non-Javadoc)
* @see cloudsim.power.PowerModel#getPower(double)
*/
@Override
public double getPower(double utilization) throws IllegalArgumentException {
if (utilization < 0 || utilization > 1) {
throw new IllegalArgumentException("Utilization value must be between 0 and 1");
}
if (utilization == 0) {
return 0;
}
return getStaticPower() + getConstant() * Math.sqrt(utilization * 100);
}
/**
* Gets the max power.
*
* @return the max power
*/
protected double getMaxPower() {
return maxPower;
}
/**
* Sets the max power.
*
* @param maxPower the new max power
*/
protected void setMaxPower(double maxPower) {
this.maxPower = maxPower;
}
/**
* Gets the constant.
*
* @return the constant
*/
protected double getConstant() {
return constant;
}
/**
* Sets the constant.
*
* @param constant the new constant
*/
protected void setConstant(double constant) {
this.constant = constant;
}
/**
* Gets the static power.
*
* @return the static power
*/
protected double getStaticPower() {
return staticPower;
}
/**
* Sets the static power.
*
* @param staticPower the new static power
*/
protected void setStaticPower(double staticPower) {
this.staticPower = staticPower;
}
}

View File

@@ -0,0 +1,117 @@
/*
* 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;
/**
* The Class PowerModelSquare.
*
* If you are using any algorithms, policies or workload included in the power package, please cite
* the following paper:
*
* Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* Heuristics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in
* Cloud Data Centers", Concurrency and Computation: Practice and Experience (CCPE), Volume 24,
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
*
* @author Anton Beloglazov
* @since CloudSim Toolkit 2.0
*/
public class PowerModelSquare implements PowerModel {
/** The max power. */
private double maxPower;
/** The constant. */
private double constant;
/** The static power. */
private double staticPower;
/**
* Instantiates a new power model square.
*
* @param maxPower the max power
* @param staticPowerPercent the static power percent
*/
public PowerModelSquare(double maxPower, double staticPowerPercent) {
setMaxPower(maxPower);
setStaticPower(staticPowerPercent * maxPower);
setConstant((maxPower - getStaticPower()) / Math.pow(100, 2));
}
/*
* (non-Javadoc)
* @see gridsim.virtualization.power.PowerModel#getPower(double)
*/
@Override
public double getPower(double utilization) throws IllegalArgumentException {
if (utilization < 0 || utilization > 1) {
throw new IllegalArgumentException("Utilization value must be between 0 and 1");
}
if (utilization == 0) {
return 0;
}
return getStaticPower() + getConstant() * Math.pow(utilization * 100, 2);
}
/**
* Gets the max power.
*
* @return the max power
*/
protected double getMaxPower() {
return maxPower;
}
/**
* Sets the max power.
*
* @param maxPower the new max power
*/
protected void setMaxPower(double maxPower) {
this.maxPower = maxPower;
}
/**
* Gets the constant.
*
* @return the constant
*/
protected double getConstant() {
return constant;
}
/**
* Sets the constant.
*
* @param constant the new constant
*/
protected void setConstant(double constant) {
this.constant = constant;
}
/**
* Gets the static power.
*
* @return the static power
*/
protected double getStaticPower() {
return staticPower;
}
/**
* Sets the static power.
*
* @param staticPower the new static power
*/
protected void setStaticPower(double staticPower) {
this.staticPower = staticPower;
}
}