Class SimulationTimePowerCalculator
- java.lang.Object
-
- org.palladiosimulator.metricspec.metricentity.MetricEntity
-
- org.palladiosimulator.measurementframework.listener.MeasurementSource
-
- org.palladiosimulator.simulizar.power.calculators.SimulationTimePowerCalculator
-
- All Implemented Interfaces:
org.palladiosimulator.commons.designpatterns.IAbstractObservable<org.palladiosimulator.measurementframework.listener.IMeasurementSourceListener>
,org.palladiosimulator.metricspec.metricentity.IMetricEntity
,ISimulationEvaluationScopeListener
public class SimulationTimePowerCalculator extends org.palladiosimulator.measurementframework.listener.MeasurementSource implements ISimulationEvaluationScopeListener
Implementation of aMeasurementSource
which uses measurements provided by aSimulationTimeEvaluationScope
to compute the power consumption of aPowerProvidingEntity
at simulation-time.
-
-
Constructor Summary
Constructors Constructor Description SimulationTimePowerCalculator(de.fzi.power.interpreter.ConsumptionContext consumptionContext, SimulationTimeEvaluationScope scope, de.fzi.power.infrastructure.PowerProvidingEntity ppe)
Initializes a new instance of theSimulationTimePowerCalculator
class with the given arguments.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
newElementAvailable()
An observedSimulationTimeEvaluationScope
invokes this callback method once a new measurement has been collected.void
preUnregister()
If the observed scope is about to detach an observer (e.g., due to a call ofSimulationTimeEvaluationScope.removeAllListeners()
orSimulationTimeEvaluationScope.removeListener(ISimulationEvaluationScopeListener)
), this callback method is invoked.-
Methods inherited from class org.palladiosimulator.measurementframework.listener.MeasurementSource
addObserver, getMeasurementSourceListeners, notifyMeasurementSourceListener, removeObserver
-
-
-
-
Constructor Detail
-
SimulationTimePowerCalculator
public SimulationTimePowerCalculator(de.fzi.power.interpreter.ConsumptionContext consumptionContext, SimulationTimeEvaluationScope scope, de.fzi.power.infrastructure.PowerProvidingEntity ppe)
Initializes a new instance of theSimulationTimePowerCalculator
class with the given arguments.- Parameters:
consumptionContext
- TheConsumptionContext
used for evaluating the power consumption.scope
- TheSimulationTimeEvaluationScope
this instance will observe.ppe
- ThePowerProvidingEntity
whose consumption is to be calculated.- Throws:
NullPointerException
- In case any of the arguments isnull
.
-
-
Method Detail
-
newElementAvailable
public void newElementAvailable()
An observedSimulationTimeEvaluationScope
invokes this callback method once a new measurement has been collected. The new measurement can be retrieved by means of the scope'sAbstractEvaluationScope.next()
method or by using the scope'siterator
.
This implementation obtains a new power consumption measurement based on the new measurement provided by the evaluation scope and forwards it to all attached listeners.- Specified by:
newElementAvailable
in interfaceISimulationEvaluationScopeListener
-
preUnregister
public void preUnregister()
Description copied from interface:ISimulationEvaluationScopeListener
If the observed scope is about to detach an observer (e.g., due to a call ofSimulationTimeEvaluationScope.removeAllListeners()
orSimulationTimeEvaluationScope.removeListener(ISimulationEvaluationScopeListener)
), this callback method is invoked.- Specified by:
preUnregister
in interfaceISimulationEvaluationScopeListener
-
-