示例#1
0
    def __init__(self, config_path, **kwargs):
        Agent.__init__(self, **kwargs)
        myTransactiveNode.__init__(self)

        self.config_path = config_path
        self.config = utils.load_config(config_path)
        self.name = self.config.get('name')
        self.market_cycle_in_min = int(
            self.config.get('market_cycle_in_min', 60))
        self.duality_gap_threshold = float(
            self.config.get('duality_gap_threshold', 0.01))
        self.supplier_loss_factor = float(
            self.config.get('supplier_loss_factor'))
        self.neighbors = []

        self.db_topic = self.config.get("db_topic", "tnc")
        self.campus_demand_topic = "{}/campus/city/demand".format(
            self.db_topic)
        self.city_supply_topic = "{}/city/campus/supply".format(self.db_topic)

        self.reschedule_interval = timedelta(minutes=10, seconds=1)

        self.simulation = self.config.get('simulation', False)
        self.simulation_start_time = parser.parse(
            self.config.get('simulation_start_time'))
        self.simulation_one_hour_in_seconds = int(
            self.config.get('simulation_one_hour_in_seconds'))

        Timer.created_time = datetime.now()
        Timer.simulation = self.simulation
        Timer.sim_start_time = self.simulation_start_time
        Timer.sim_one_hr_in_sec = self.simulation_one_hour_in_seconds
示例#2
0
    def __init__(self, config_path, **kwargs):
        Agent.__init__(self, **kwargs)
        myTransactiveNode.__init__(self)

        self.config_path = config_path
        self.config = utils.load_config(config_path)
        self.name = self.config.get('name')
        self.market_cycle_in_min = int(self.config.get('market_cycle_in_min', 60))
        self.duality_gap_threshold = float(self.config.get('duality_gap_threshold', 0.01))
        self.building_names = self.config.get('buildings', [])
        self.building_powers = self.config.get('building_powers')

        self.neighbors = []

        self.city_supply_topic = 'tnsmarket/city/campus/supply'
        self.building_demand_topic = 'tnsmarket/{}/campus/demand'
        self.campus_demand_topic = 'tnsmarket/campus/city/demand'
        self.campus_supply_topic = 'tnsmarket/campus/{}/supply'

        self.reschedule_interval = timedelta(minutes=10, seconds=1)

        self.simulation = self.config.get('simulation', False)
        self.simulation_start_time = parser.parse(self.config.get('simulation_start_time'))
        self.simulation_one_hour_in_seconds = int(self.config.get('simulation_one_hour_in_seconds'))

        Timer.created_time = datetime.now()
        Timer.simulation = self.simulation
        Timer.sim_start_time = self.simulation_start_time
        Timer.sim_one_hr_in_sec = self.simulation_one_hour_in_seconds
示例#3
0
    def __init__(self, config_path, **kwargs):
        Agent.__init__(self, **kwargs)
        myTransactiveNode.__init__(self)

        self.config_path = config_path
        self.config = utils.load_config(config_path)
        self.name = self.config.get('name')
        self.market_cycle_in_min = int(
            self.config.get('market_cycle_in_min', 60))
        self.duality_gap_threshold = float(
            self.config.get('duality_gap_threshold', 0.01))
        self.building_names = self.config.get('buildings', [])
        self.building_powers = self.config.get('building_powers')
        self.db_topic = self.config.get("db_topic", "tnc")
        self.PV_max_kW = float(self.config.get("PV_max_kW"))
        self.city_loss_factor = float(self.config.get("city_loss_factor"))

        self.demand_threshold_coef = float(
            self.config.get('demand_threshold_coef'))
        self.monthly_peak_power = float(self.config.get('monthly_peak_power'))

        self.neighbors = []

        self.city_supply_topic = "{}/city/campus/supply".format(self.db_topic)
        self.building_demand_topic = "/".join(
            [self.db_topic, "{}/campus/demand"])
        self.campus_demand_topic = "{}/campus/city/demand".format(
            self.db_topic)
        self.campus_supply_topic = "/".join(
            [self.db_topic, "campus/{}/supply"])
        self.solar_topic = "/".join([self.db_topic, "campus/pv"])
        self.system_loss_topic = "{}/{}/system_loss".format(
            self.db_topic, self.name)
        self.dc_threshold_topic = "{}/{}/dc_threshold_topic".format(
            self.db_topic, self.name)
        self.price_topic = "{}/{}/marginal_prices".format(
            self.db_topic, self.name)

        self.reschedule_interval = timedelta(minutes=10, seconds=1)

        self.simulation = self.config.get('simulation', False)
        self.simulation_start_time = parser.parse(
            self.config.get('simulation_start_time'))
        self.simulation_one_hour_in_seconds = int(
            self.config.get('simulation_one_hour_in_seconds'))

        Timer.created_time = datetime.now()
        Timer.simulation = self.simulation
        Timer.sim_start_time = self.simulation_start_time
        Timer.sim_one_hr_in_sec = self.simulation_one_hour_in_seconds
示例#4
0
    def __init__(self, config_path, **kwargs):
        MarketAgent.__init__(self, **kwargs)
        myTransactiveNode.__init__(self)

        self.config_path = config_path
        self.config = utils.load_config(config_path)
        self.name = self.config.get('name')
        self.agent_name = self.config.get('agentid', 'building_agent')
        self.db_topic = self.config.get("db_topic", "tnc")
        self.power_topic = self.config.get("power_topic")

        self.market_cycle_in_min = int(self.config.get('market_cycle_in_min', 60))
        self.duality_gap_threshold = float(self.config.get('duality_gap_threshold', 0.01))
        self.campus_loss_factor = float(self.config.get('campus_loss_factor', 0.01))

        self.neighbors = []
        self.max_deliver_capacity = float(self.config.get('max_deliver_capacity'))
        self.demand_threshold_coef = float(self.config.get('demand_threshold_coef'))
        self.monthly_peak_power = float(self.config.get('monthly_peak_power'))

        self.building_demand_topic = "{}/{}/campus/demand".format(self.db_topic, self.name)
        self.campus_supply_topic = "{}/campus/{}/supply".format(self.db_topic, self.name)
        self.system_loss_topic = "{}/{}/system_loss".format(self.db_topic, self.name)

        self.mix_market_running = False
        verbose_logging = self.config.get('verbose_logging', True)

        self.prices = [None for i in range(25)]
        self.quantities = [None for i in range(25)]
        self.building_demand_curves = [None for i in range(25)]
        self.mix_market_duration = timedelta(minutes=20)

        self.reschedule_interval = timedelta(minutes=10, seconds=1)

        self.simulation = self.config.get('simulation', False)
        try:
            self.simulation_start_time = parser.parse(self.config.get('simulation_start_time'))
            self.simulation_one_hour_in_seconds = int(self.config.get('simulation_one_hour_in_seconds'))
        except:
            self.simulation_start_time = datetime.now()
            self.simulation_one_hour_in_seconds = 3600

        # Create market names to join
        self.base_market_name = 'electric'  # Need to agree on this with other market agents
        self.market_names = []
        for i in range(24):
            self.market_names.append('_'.join([self.base_market_name, str(i)]))

        Timer.created_time = datetime.now()
        Timer.simulation = self.simulation
        Timer.sim_start_time = self.simulation_start_time
        Timer.sim_one_hr_in_sec = self.simulation_one_hour_in_seconds

        if self.simulation:
            self.ep_lines = []
            self.cur_ep_line = 0
            # with open(ep_res_path, 'r') as fh:
            #     for line in fh:
            #         self.ep_lines.append(line)

        _log2.debug("Mixmarket for agent {}:".format(self.name))