Battery.java 2.46 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/*
 * Copyright (c) 2005-2010 KOM – Multimedia Communications Lab
 *
 * This file is part of PeerfactSim.KOM.
 * 
 * PeerfactSim.KOM is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * any later version.
 * 
 * PeerfactSim.KOM is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with PeerfactSim.KOM.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

21
22
package de.tud.kom.p2psim.api.energy;

23

24
25

/**
26
27
 * This interface implements basic methods used by the EnergyModel to simulate a
 * battery.
28
29
30
31
32
33
 * 
 * @author Fabio Zöllner
 * @version 1.0, 20.04.2012
 */
public interface Battery extends Cloneable {

34
35
36
37
38
39
40
	/**
	 * Returns the maximum energy level in uJ.
	 * 
	 * @return the maximum capacity of the battery in uJ
	 */
	public double getMaximumEnergyLevel();
	
41
42
43
44
45
46
47
	/**
	 * Returns the current status of the Battery as a Percentage-Value
	 * 
	 * @return double between 0 and 100
	 */
	public double getCurrentPercentage();

48
49
50
51
52
53
54
	/**
	 * Returns the current energy level in uJ.
	 * 
	 * @return the current capacity of the battery in uJ
	 */
	public double getCurrentEnergyLevel();

55
56
57
58
59
60
61
62
63
64
	/**
	 * Returns the consumed energy in uJoule
	 * 
	 * @return The consumed Energy in uJoule
	 */
	public double getConsumedEnergy();

	/**
	 * Resets the Battery to the initial Energy-Level
	 */
65
66
67
	default public void reset() {
		throw new UnsupportedOperationException();
	}
68

69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
	/**
	 * Sets the battery to a given percentage.
	 * 
	 * @param double between 0 and 100
	 */
	public void setToPercentage(double percentage);

	/**
	 * Consumes the given amount of energy in uJoule (10^-6)
	 * 
	 * @param energy
	 *            Energy in uJoule
	 */
	public void consumeEnergy(double energy);

	/**
	 * Returns true, if the battery is empty. In such a case, there should be no
	 * further calls to consumeEnergy.
	 * 
	 * @return
	 */
	public boolean isEmpty();

	/**
	 * Clone a battery, used during configuration
	 * 
	 * @param battery
	 * @return
	 */
	public Battery clone();
99
100
101
102
103
104
105
	
	/**
	 * Returns true, if the battery is fully charged. 
	 * 
	 * @return
	 */
	public boolean isFullyCharged();
106
107
	
	public Battery copy(double initialEnergy);
108
}