def test_get_instant_power_load(self): for i in range(10): self.house.add(agents.EV(i)) self.house.add(agents.PV(2*i)) for i, EV_agent in enumerate(self.house.get_agents(agents.EV)): EV_agent.set_instant_power_load(3) self.assertEqual(self.house.get_instant_net_load(), 30)
def test_get_agents(self): EV_agent = agents.EV(agent_id=0) PV_agent = agents.PV(agent_id=1) self.house.add(EV_agent) self.house.add(PV_agent) list_agents_house = [EV_agent, PV_agent] self.assertEqual(self.house.get_agents(), list_agents_house)
def setUp(self): self.agent_PV = agents.PV(agent_id=0) self.house = agentgroups.ResidentialBuilding(group_id=0) self.house.add(self.agent_PV) self.event_PV = self.house.get_list_eventhandlers()[0] self.irradiance_data = [0.1, 0.2, 0.3] self.event_PV.set_irradiance_data(self.irradiance_data)
def test_get_acum_net_load(self): for i in range(10): self.house.add(agents.EV(i)) self.house.add(agents.PV(2*i)) for agent in self.house.get_agents(): agent.set_instant_power_load(1) agent.update_accum_power_load() agent.set_instant_power_load(1) agent.update_accum_power_load() self.assertEqual(self.house.get_accum_net_load(), 40)
visualize = visualization.Visualize() np.random.seed(seed=1) list_houses = [] list_localschedulers = [] globalscheduler = schedulers.TravaccaEtAl2017GlobalScheduler( start_day=32, plot_callback=visualize.callback) data_generator = globalscheduler.get_data_generator() for i in range(50): group_id = i house = agentgroups.AgentGroup(group_id) list_houses.append(house) house.add(agents.EV(i)) house.add(agents.PV(2 * i)) localscheduler = schedulers.TravaccaEtAl2017LocalScheduler( house, globalscheduler, data_generator, plot_callback=visualize.callback) list_localschedulers.append(localscheduler) globalscheduler.set_list_localschedulers(list_localschedulers) globalscheduler.run_global_optim() visualize.plot_all()
def test_list_eventhandlers(self): EV_agent = agents.EV(agent_id=0) PV_agent = agents.PV(agent_id=1) self.house.add(EV_agent) self.house.add(PV_agent) self.assertIsInstance(self.house.get_list_eventhandlers()[0], eventhandlers.EventHandler)
def setUp(self): self.agent_PV = agents.PV(0)
def setUp(self): self.agent_PV = agents.PV(agent_id=0) self.house = agentgroups.ResidentialBuilding(group_id=0) self.house.add(self.agent_PV) self.event = self.house.get_list_eventhandlers()[0]