agregator.py
def calculate(self, time, delta_time):
        """
        Method where the temperature forecast is computed and sent to the local controllers and where
        the cost is computed ans sent to the local controller, too

        :param time: The actual time reference
        :type time

        :param delta_time: The delta time
        :type time

        """

        time = units.value(units.convert(time, units.second))
        delta_time = units.value(units.convert(delta_time, units.second))

        # If this is the decision time we simulate a cost and a forecast for the temperature.
        if int(time) % int(self._decision_time) == 0:

            ratio = float(len(self.cost_reference)) / float(len(range(int(time), int(time + self._decision_time), int(delta_time))))
            print "ratio: ", ratio
            j = 0
            cost = {}
            for i in range(int(time), int(time + self._decision_time), int(delta_time)):
                cost[i] = max(0, self.cost_reference[int(j * ratio)] + random.normalvariate(0, self.cost_sigma))
                j += 1

            # Add the first cost for the day next
            cost[int(time + self._decision_time)] = self.cost_reference[0]

            for controller in self._controllers:         
                # Push the cost & Compute
                controller.cost = cost
                controller.outside_temperature_forecast = self.__temperature(
                    time,
                    time + self._decision_time + delta_time,
                    delta_time)

        #
        # Rest of the time
        #
        for controller in self._controllers:  
            controller.calculate(time, delta_time)

        Method where the temperature forecast is computed and sent to the local controllers and where
        the cost is computed ans sent to the local controller, too

        :param time: The actual time reference
        :type time

        :param delta_time: The delta time
        :type time

        
Method where the temperature forecast is computed and sent to the local controllers and where
the cost is computed ans sent to the local controller, too



:param delta_time: The delta time
:type time
Method where the temperature forecast is computed and sent to the local controllers and where the cost is computed ans sent to the local controller too : param delta_time : The delta time : type time
def calculate(self, time, delta_time):
        time = units.value(units.convert(time, units.second))
        delta_time = units.value(units.convert(delta_time, units.second))
        if int(time) % int(self._decision_time) == 0:
            ratio = float(len(self.cost_reference)) / float(len(range(int(time), int(time + self._decision_time), int(delta_time))))
            print "ratio: ", ratio
            j = 0
            cost = {}
            for i in range(int(time), int(time + self._decision_time), int(delta_time)):
                cost[i] = max(0, self.cost_reference[int(j * ratio)] + random.normalvariate(0, self.cost_sigma))
                j += 1
            cost[int(time + self._decision_time)] = self.cost_reference[0]
            for controller in self._controllers:         
                controller.cost = cost
                controller.outside_temperature_forecast = self.__temperature(
                    time,
                    time + self._decision_time + delta_time,
                    delta_time)
         Rest of the time
        for controller in self._controllers:  
            controller.calculate(time, delta_time)
def calculate ( self , time , delta_time ) : time = units . value ( units . convert ( time , units . second ) ) delta_time = units . value ( units . convert ( delta_time , units . second ) ) if int ( time ) % int ( self . _decision_time ) == 0 : ratio = float ( len ( self . cost_reference ) ) / float ( len ( range ( int ( time ) , int ( time + self . _decision_time ) , int ( delta_time ) ) ) ) print "ratio: " , ratio j = 0 cost = { } for i in range ( int ( time ) , int ( time + self . _decision_time ) , int ( delta_time ) ) : cost [ i ] = max ( 0 , self . cost_reference [ int ( j * ratio ) ] + random . normalvariate ( 0 , self . cost_sigma ) ) j += 1 cost [ int ( time + self . _decision_time ) ] = self . cost_reference [ 0 ] for controller in self . _controllers : controller . cost = cost controller . outside_temperature_forecast = self . __temperature ( time , time + self . _decision_time + delta_time , delta_time ) for controller in self . _controllers : controller . calculate ( time , delta_time )
Method where the temperature forecast is computed and sent to the local controllers and where
the cost is computed ans sent to the local controller, too
Method where the temperature forecast is computed and sent to the local controllers and where the cost is computed ans sent to the local controller too
"""
        Method where the temperature forecast is computed and sent to the local controllers and where
        the cost is computed ans sent to the local controller, too

        :param time: The actual time reference
        :type time

        :param delta_time: The delta time
        :type time

        """ # If this is the decision time we simulate a cost and a forecast for the temperature. # Add the first cost for the day next # Push the cost & Compute # # Rest of the time #
self
time
delta_time