コード例 #1
0
ファイル: __init__.py プロジェクト: rodwalker/ecoControl
    def step(self):
        """ execute one step of the simulation.
        This steps all devices, auto-optimizes if needed and store the values
        """
        execute_user_function(self.env, self.env.forecast, self.devices, self.user_function)

        if self.use_optimization and self.next_optimization <= 0.0:
            auto_optimize(self)
            self.next_optimization = 3600.0

        # call step function for all devices
        for device in self.devices:
            device.step()

        self.store_values()

        self.env.now += self.env.step_size
        self.next_optimization -= self.env.step_size
コード例 #2
0
    def step(self):
        """ execute one step of the simulation.
        This steps all devices, auto-optimizes if needed and store the values
        """
        execute_user_function(self.env, self.env.forecast, self.devices,
                              self.user_function)

        if self.use_optimization and self.next_optimization <= 0.0:
            auto_optimize(self)
            self.next_optimization = 3600.0

        # call step function for all devices
        for device in self.devices:
            device.step()

        self.store_values()

        self.env.now += self.env.step_size
        self.next_optimization -= self.env.step_size
コード例 #3
0
ファイル: __init__.py プロジェクト: wang23795/ecoControl
    def run(self):
        step = 0
        while True:
            # every minute
            functions.check_thresholds()

            if not execute_user_function(self.user_function, self.env, self.devices, get_forecast):
                logger.warning('user_function failed')

            # every 10 minutes
            if step % 10 == 0:
                # functions.refresh_views()
                pass

            # make sure step is within a day
            step = (step + 1) % (60 * 60 * 24)

            time.sleep(60)  # wait a minute