Package org.cloudbus.cloudsim.power
Class PowerMeter
java.lang.Object
org.cloudbus.cloudsim.core.CloudSimEntity
org.cloudbus.cloudsim.power.PowerMeter
- All Implemented Interfaces:
Cloneable
,Comparable<SimEntity>
,Runnable
,Identifiable
,Nameable
,SimEntity
Periodically measures the current power usage of one or more
PowerAware
entities,
according to a defined interval
, storing the results.- Since:
- CloudSim Plus 6.0.0
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.cloudbus.cloudsim.core.SimEntity
SimEntity.State
-
Field Summary
-
Constructor Summary
ConstructorDescriptionPowerMeter
(Simulation simulation, Supplier<List<? extends PowerAware<? extends PowerModel>>> powerAwareEntitiesSupplier) Initializes aPowerMeter
with a function that supplies a list ofPowerAware
entities to have their combined power consumption periodically measured.PowerMeter
(Simulation simulation, List<? extends PowerAware<? extends PowerModel>> powerAwareEntities) Initializes aPowerMeter
to periodically measure the combined power consumption of a list ofPowerAware
entities.PowerMeter
(Simulation simulation, PowerAware<? extends PowerModel> powerAwareEntity) Initializes aPowerMeter
to periodically measure power consumption of a singlePowerAware
entity. -
Method Summary
Modifier and TypeMethodDescriptiondouble
Gets the time interval to collect power measurements.Gets the list of all measurements collected up to now.void
processEvent
(SimEvent evt) Processes events or services that are available for the entity.setMeasurementInterval
(double measurementInterval) Sets the time interval to collect power measurements.Sets the Entity name.protected void
Defines the logic to be performed by the entity when the simulation starts.Methods inherited from class org.cloudbus.cloudsim.core.CloudSimEntity
cancelEvent, clone, compareTo, equals, getId, getName, getNextEvent, getNextEvent, getShutdownTime, getSimulation, getStartTime, getState, hashCode, isAlive, isFinished, isStarted, pause, run, run, schedule, schedule, schedule, schedule, schedule, schedule, scheduleFirst, scheduleFirst, scheduleFirstNow, scheduleFirstNow, scheduleNow, scheduleNow, selectEvent, send, send, sendNow, sendNow, setEventBuffer, setId, setSimulation, setState, shutdown, start, waitForEvent
-
Constructor Details
-
PowerMeter
Initializes aPowerMeter
to periodically measure power consumption of a singlePowerAware
entity.- Parameters:
simulation
- The simulation instance the Entity is related topowerAwareEntity
- an entity to have its power consumption measured
-
PowerMeter
public PowerMeter(Simulation simulation, List<? extends PowerAware<? extends PowerModel>> powerAwareEntities) Initializes aPowerMeter
to periodically measure the combined power consumption of a list ofPowerAware
entities.If you want to compute power consumption individually for each entity, check
PowerMeter(Simulation, PowerAware)
.- Parameters:
simulation
- The simulation instance the Entity is related topowerAwareEntities
- a list of entities to have their combined power consumption measured
-
PowerMeter
public PowerMeter(Simulation simulation, Supplier<List<? extends PowerAware<? extends PowerModel>>> powerAwareEntitiesSupplier) Initializes aPowerMeter
with a function that supplies a list ofPowerAware
entities to have their combined power consumption periodically measured. This is useful if the list of entities varies during the simulation run.If you want to compute power consumption individually for each entity, check
PowerMeter(Simulation, PowerAware)
.- Parameters:
simulation
- The simulation instance the Entity is related topowerAwareEntitiesSupplier
- aSupplier
that provides a list of entities to have their combined power consumption measured
-
-
Method Details
-
startInternal
protected void startInternal()Description copied from class:CloudSimEntity
Defines the logic to be performed by the entity when the simulation starts.- Specified by:
startInternal
in classCloudSimEntity
-
processEvent
Description copied from interface:SimEntity
Processes events or services that are available for the entity. This method is invoked by theCloudSim
class whenever there is an event in the deferred queue, which needs to be processed by the entity.- Parameters:
evt
- information about the event just happened
-
setName
Description copied from interface:SimEntity
Sets the Entity name.- Specified by:
setName
in interfaceSimEntity
- Overrides:
setName
in classCloudSimEntity
- Parameters:
name
- the new name- Returns:
-
getPowerMeasurements
Gets the list of all measurements collected up to now. Each entry is a measurement collected in the definedmeasurementInterval
. If you provided a list of entities on the class constructor, a entry is the combined measurement for those entities.- Returns:
-
getMeasurementInterval
public double getMeasurementInterval()Gets the time interval to collect power measurements.- Returns:
-
setMeasurementInterval
Sets the time interval to collect power measurements.- Parameters:
measurementInterval
- the value to set- Returns:
-