public final class ConsumptionContext extends Object implements PowerModelRegistryChangeListener
| Modifier and Type | Method and Description |
|---|---|
void |
cleanUp()
Since the ConsumptionContext registers change listener to the referenced PowerModelRegistry
it is important to call cleanUp before discarding the ConsumptionContext instance.
|
static ConsumptionContext |
createConsumptionContext(PowerBindingRepository bindingRepository,
AbstractEvaluationScope initialScope,
PowerModelRegistry powerModelRegistry)
Creates a consumption context.
|
static ConsumptionContext |
createConsumptionContext(PowerProvidingEntity ppe,
AbstractEvaluationScope initialScope,
PowerModelRegistry powerModelRegistry)
Creates a consumption context.
|
void |
distributionPowerModelChanged(AbstractDistributionPowerModelCalculator calculator,
PowerProvidingEntity affectedEntity)
Method is called just before a new calculator is set for a power providing entity.
|
org.jscience.physics.amount.Amount<javax.measure.quantity.Power> |
evaluateDistributionPowerConsumption(PowerConsumingProvidingEntity powerConsumingProvidingEntity,
Map<PowerConsumingEntity,org.jscience.physics.amount.Amount<javax.measure.quantity.Power>> consumers)
Evaluates the consumed power which is supplied by the given power providing entity.
|
org.jscience.physics.amount.Amount<javax.measure.quantity.Power> |
evaluateResourcePowerConsumption(AbstractPowerConsumingResource resource)
Evaluates the power consumption of a passed resource.
|
org.jscience.physics.amount.Amount<javax.measure.quantity.Power> |
evaluateStatefulResourcePowerConsumption(StatefulPowerConsumingResource resource)
Evaluates the power consumption of a passed stateful resource.
|
PowerBindingRepository |
getPowerBindingRepository()
Get the PowerBindingRepository associated with the ConsumptionCotext.
|
void |
resourcePowerModelChanged(IResourcePowerModelCalculator calculator,
AbstractPowerConsumingResource affectedResource)
Method is called just before a new calculator is set for a power consuming resource.
|
public static ConsumptionContext createConsumptionContext(PowerBindingRepository bindingRepository, AbstractEvaluationScope initialScope, PowerModelRegistry powerModelRegistry)
bindingRepository - The Binding repository for which the consumption context is created.initialScope - The initial scope for which the consumption prediction is performed.powerModelRegistry - The registry that keeps track of the power models on a per-resource basis.IllegalArgumentException - In case any of the parameters is null.public static ConsumptionContext createConsumptionContext(PowerProvidingEntity ppe, AbstractEvaluationScope initialScope, PowerModelRegistry powerModelRegistry)
createConsumptionContext(ppe.getDistributionPowerAssemblyContext().getPowerBindingRepository(),
initialScope, powerModelRegistry). ppe - The given PowerProvidingEntity is used to obtain the
PowerBindingRepository for the new consumption context.initialScope - The initial scope for which the consumption prediction is performed.powerModelRegistry - The registry that keeps track of the power models on a per-resource basis.createConsumptionContext(PowerBindingRepository, AbstractEvaluationScope,
PowerModelRegistry)public org.jscience.physics.amount.Amount<javax.measure.quantity.Power> evaluateResourcePowerConsumption(AbstractPowerConsumingResource resource)
resource - The PowerConsumingResource for which the power consumption is being evaluated.public org.jscience.physics.amount.Amount<javax.measure.quantity.Power> evaluateStatefulResourcePowerConsumption(StatefulPowerConsumingResource resource)
resource - The PowerConsumingResource for which the power consumption is being evaluated.public org.jscience.physics.amount.Amount<javax.measure.quantity.Power> evaluateDistributionPowerConsumption(PowerConsumingProvidingEntity powerConsumingProvidingEntity, Map<PowerConsumingEntity,org.jscience.physics.amount.Amount<javax.measure.quantity.Power>> consumers)
powerConsumingProvidingEntity - The PowerConsumingProvidingEntity which supplies power to consumersconsumers - A Map that contains the currently consumed power of all
PowerConsumingEntity which are supplied by the given power providing
entity.Amount, according to the underlying
DistributionPowerModelSpecification.IllegalArgumentException - In case no DistributionPowerModelSpecification (more precisely, no
AbstractDistributionPowerModelCalculator) could be found.IllegalArgumentException - In case any of the PowerConsumingEntitys passed in the consumers
map is not supplied by the given powerConsumingProvidingEntity.NullPointerException - In case either of the arguments is null.public PowerBindingRepository getPowerBindingRepository()
public void cleanUp()
public void resourcePowerModelChanged(IResourcePowerModelCalculator calculator, AbstractPowerConsumingResource affectedResource)
PowerModelRegistryChangeListenerresourcePowerModelChanged in interface PowerModelRegistryChangeListenercalculator - the new calculatoraffectedResource - the affected resourcepublic void distributionPowerModelChanged(AbstractDistributionPowerModelCalculator calculator, PowerProvidingEntity affectedEntity)
PowerModelRegistryChangeListenerdistributionPowerModelChanged in interface PowerModelRegistryChangeListenercalculator - the new calculatoraffectedEntity - the affected resource