Commit bd09bbc0 authored by Anton Beloglazov's avatar Anton Beloglazov

Added: 3 power models of IBM servers using the data from SPECpower

parent 0dc399f5
......@@ -23,11 +23,9 @@ public interface PowerModel {
* according to the power model.
*
* @param utilization the utilization
*
* @return power consumption
*
* @throws Exception the exception
* @throws IllegalArgumentException the illegal argument exception
*/
double getPower(double utilization) throws Exception;
double getPower(double utilization) throws IllegalArgumentException;
}
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/
*/
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);
}
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
*/
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];
}
}
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
*/
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];
}
}
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
*/
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];
}
}
/*
* 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-2010, The University of Melbourne, Australia
*/
package org.cloudbus.cloudsim.power.models;
import static org.junit.Assert.assertEquals;
import org.junit.Before;
import org.junit.Test;
/**
* @author Anton Beloglazov
* @since CloudSim Toolkit 2.0
*/
public class PowerModelSpecPowerIbmX3550XeonX5675Test {
private PowerModel powerModel;
@Before
public void setUp() throws Exception {
powerModel = new PowerModelSpecPowerIbmX3550XeonX5675();
}
@Test (expected = IllegalArgumentException.class)
public void testGetPowerArgumentLessThenZero() throws IllegalArgumentException {
powerModel.getPower(-1);
}
@Test (expected = IllegalArgumentException.class)
public void testGetPowerArgumentLargerThenOne() throws IllegalArgumentException {
powerModel.getPower(2);
}
@Test
public void testGetPower() {
assertEquals(58.4, powerModel.getPower(0), 0);
assertEquals(58.4 + (98 - 58.4) / 5, powerModel.getPower(0.02), 0);
assertEquals(98, powerModel.getPower(0.1), 0);
assertEquals(140, powerModel.getPower(0.5), 0);
assertEquals(189, powerModel.getPower(0.8), 0);
assertEquals(189 + 0.7 * 10 * (205 - 189) / 10, powerModel.getPower(0.87), 0);
assertEquals(205, powerModel.getPower(0.9), 0);
assertEquals(222, powerModel.getPower(1), 0);
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment