This commit is contained in:
chenxiaodong 2024-06-18 14:54:23 +08:00
parent 488a893354
commit 25a5da0e00
8 changed files with 6 additions and 6 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -105,7 +105,7 @@ if __name__ == '__main__':
record = test_one_episode(env, agent.act, agent.device) record = test_one_episode(env, agent.act, agent.device)
eval_data = pd.DataFrame(record['system_info']) eval_data = pd.DataFrame(record['system_info'])
eval_data.columns = ['time_step', 'price', 'netload', 'action', 'real_action', 'soc', 'battery', 'gen1', 'gen2', eval_data.columns = ['time_step', 'price', 'netload', 'action', 'real_action', 'soc', 'battery', 'gen1', 'gen2',
'gen3', 'unbalance', 'operation_cost'] 'gen3', 'temperature', 'irradiance', 'unbalance', 'operation_cost']
if args.save_test_data: if args.save_test_data:
test_data_save_path = f'{args.cwd}/test_data.pkl' test_data_save_path = f'{args.cwd}/test_data.pkl'
with open(test_data_save_path, 'wb') as tf: with open(test_data_save_path, 'wb') as tf:

4
PPO.py
View File

@ -130,7 +130,7 @@ class AgentPPO:
for i in range(target_step): for i in range(target_step):
action, noise = self.select_action(state) action, noise = self.select_action(state)
state, next_state, reward, done, = env.step( state, next_state, reward, done, = env.step(
np.tanh(action)) # here the step of cut action is finally organized into the environment. np.tanh(action)) # the step of cut action is finally organized into the environment.
trajectory_temp.append((state, reward, done, action, noise)) trajectory_temp.append((state, reward, done, action, noise))
if done: if done:
state = env.reset() state = env.reset()
@ -371,7 +371,7 @@ if __name__ == '__main__':
record = test_one_episode(env, agent.act, agent.device) record = test_one_episode(env, agent.act, agent.device)
eval_data = pd.DataFrame(record['system_info']) eval_data = pd.DataFrame(record['system_info'])
eval_data.columns = ['time_step', 'price', 'netload', 'action', 'real_action', 'soc', 'battery', 'gen1', 'gen2', eval_data.columns = ['time_step', 'price', 'netload', 'action', 'real_action', 'soc', 'battery', 'gen1', 'gen2',
'gen3', 'unbalance', 'operation_cost'] 'gen3', 'temperature', 'irradiance', 'unbalance', 'operation_cost']
if args.save_test_data: if args.save_test_data:
test_data_save_path = f'{args.cwd}/test_data.pkl' test_data_save_path = f'{args.cwd}/test_data.pkl'
with open(test_data_save_path, 'wb') as tf: with open(test_data_save_path, 'wb') as tf:

2
SAC.py
View File

@ -109,7 +109,7 @@ if __name__ == '__main__':
record = test_one_episode(env, agent.act, agent.device) record = test_one_episode(env, agent.act, agent.device)
eval_data = pd.DataFrame(record['system_info']) eval_data = pd.DataFrame(record['system_info'])
eval_data.columns = ['time_step', 'price', 'netload', 'action', 'real_action', 'soc', 'battery', 'gen1', 'gen2', eval_data.columns = ['time_step', 'price', 'netload', 'action', 'real_action', 'soc', 'battery', 'gen1', 'gen2',
'gen3', 'unbalance', 'operation_cost'] 'gen3', 'temperature', 'irradiance', 'unbalance', 'operation_cost']
if args.save_test_data: if args.save_test_data:
test_data_save_path = f'{args.cwd}/test_data.pkl' test_data_save_path = f'{args.cwd}/test_data.pkl'
with open(test_data_save_path, 'wb') as tf: with open(test_data_save_path, 'wb') as tf:

2
TD3.py
View File

@ -105,7 +105,7 @@ if __name__ == '__main__':
record = test_one_episode(env, agent.act, agent.device) record = test_one_episode(env, agent.act, agent.device)
eval_data = pd.DataFrame(record['system_info']) eval_data = pd.DataFrame(record['system_info'])
eval_data.columns = ['time_step', 'price', 'netload', 'action', 'real_action', 'soc', 'battery', 'gen1', 'gen2', eval_data.columns = ['time_step', 'price', 'netload', 'action', 'real_action', 'soc', 'battery', 'gen1', 'gen2',
'gen3', 'unbalance', 'operation_cost'] 'gen3', 'temperature', 'irradiance', 'unbalance', 'operation_cost']
if args.save_test_data: if args.save_test_data:
test_data_save_path = f'{args.cwd}/test_data.pkl' test_data_save_path = f'{args.cwd}/test_data.pkl'
with open(test_data_save_path, 'wb') as tf: with open(test_data_save_path, 'wb') as tf:

View File

@ -175,7 +175,7 @@ class ESSEnv(gym.Env):
# process_elements(pv, lambda x: x, self.data_manager.add_pv_element) # process_elements(pv, lambda x: x, self.data_manager.add_pv_element)
process_elements(price, lambda x: max(x / 10, 0.5), self.data_manager.add_price_element) process_elements(price, lambda x: max(x / 10, 0.5), self.data_manager.add_price_element)
process_elements(load, lambda x: x * 5, self.data_manager.add_load_element) process_elements(load, lambda x: x * 3, self.data_manager.add_load_element)
process_elements(irradiance, lambda x: x, self.data_manager.add_irradiance_element) process_elements(irradiance, lambda x: x, self.data_manager.add_irradiance_element)
process_elements(temperature, lambda x: x - 273.15, self.data_manager.add_temperature_element) process_elements(temperature, lambda x: x - 273.15, self.data_manager.add_temperature_element)
process_elements(wind, lambda x: x, self.data_manager.add_wind_element) process_elements(wind, lambda x: x, self.data_manager.add_wind_element)