Class ConsumptionContext

    • Method Detail

      • createConsumptionContext

        public static ConsumptionContext createConsumptionContext​(PowerBindingRepository bindingRepository,
                                                                  AbstractEvaluationScope initialScope,
                                                                  PowerModelRegistry powerModelRegistry)
        Creates a consumption context. Attention: the creation of the consumption context registers a listener upon the powerModelRegistry. Therefore it is necessary to call cleanUp() after usage.
        Parameters:
        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.
        Returns:
        The newly created consumption context.
        Throws:
        IllegalArgumentException - In case any of the parameters is null.
      • evaluateResourcePowerConsumption

        public org.jscience.physics.amount.Amount<javax.measure.quantity.Power> evaluateResourcePowerConsumption​(AbstractPowerConsumingResource resource)
        Evaluates the power consumption of a passed resource. The consumption is evaluated in context to the current EvaluationScope.
        Parameters:
        resource - The PowerConsumingResource for which the power consumption is being evaluated.
        Returns:
        The power consumed by the resource.
      • evaluateStatefulResourcePowerConsumption

        public org.jscience.physics.amount.Amount<javax.measure.quantity.Power> evaluateStatefulResourcePowerConsumption​(StatefulPowerConsumingResourceSet resource)
        Evaluates the power consumption of a passed stateful resource. The consumption is evaluated in context to the current EvaluationScope.
        Parameters:
        resource - The PowerConsumingResource for which the power consumption is being evaluated.
        Returns:
        The power consumed by the resource.
      • getPowerBindingRepository

        public PowerBindingRepository getPowerBindingRepository()
        Get the PowerBindingRepository associated with the ConsumptionCotext.
        Returns:
        The ConsumptionContext for which the power consumption is being evaluated.
      • cleanUp

        public void cleanUp()
        Since the ConsumptionContext registers change listener to the referenced PowerModelRegistry it is important to call cleanUp before discarding the ConsumptionContext instance.