Exemple #1
0
    def obtain_harvested_energy(self, parameter):
        """
        Randomly choose energy between $[0, E_i^H]$.

        :param parameter: the instance of class Parameter
        :return: actually harvested energy, $\alpha_i$
        """
        return random.uniform(
            0, ToolFunction.generate_harvestable_energy(parameter))
    def obtain_harvested_energy(self, parameter):
        """
        Obtain the optimal harvested energy by solving the 'optimal energy harvesting' sub-problem
        according to \eqref{18}.

        :param parameter: the instance of class Parameter
        :return: the optimal harvested energy
        """
        if self.get_virtual_energy_levels() <= 0:
            return ToolFunction.generate_harvestable_energy(parameter)
        else:
            return 0