case_files_array.append(repo_path + '/testData/IEEE300/IEEE300Bus_modified_noHVDC_v2.raw')

case_files_array.append(repo_path + '/testData/IEEE300/IEEE300_dyn_cmld_zone1.dyr')

dyn_config_file = repo_path + '/testData/IEEE300/json/IEEE300_dyn_config.json'

rl_config_file = repo_path + '/testData/IEEE300/json/IEEE300_RL_loadShedding_zone1_continuous_LSTM_new_morefaultbuses_moreActionBuses_testing.json'

import os.path
import sys
 

from PowerDynSimEnvDef_v7 import PowerDynSimEnv
env = PowerDynSimEnv(case_files_array,dyn_config_file,rl_config_file,jar_path,java_port,repo_path)

print("all base cases:", env.get_base_cases())

import time

tic = time.perf_counter()

env.reset()
done = False
actions = [-0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, 
                    -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, 
                    -0.2, -0.2, -0.2, -0.2, -0.2, -0.2]
while not done:
    states, rewards, done,_ = env.step(actions) # no action is applied
    #print('states =',states)
#
# rl_config_file = repo_path + '/testData/IEEE39/json/IEEE39_RL_loadShedding_3motor_continuous.json'

###-------uncomment below four lines for Windows -------------------------
case_files_array.append(repo_path + '/testData/IEEE39/IEEE39bus_multiloads_xfmr4_smallX_v30.raw')

case_files_array.append(repo_path + '/testData/IEEE39/IEEE39bus_3AC.dyr')

dyn_config_file = repo_path + '/testData/IEEE39/json/IEEE39_dyn_config.json'

rl_config_file = repo_path + '/testData/IEEE39/json/IEEE39_RL_loadShedding_3motor_continuous.json'

import os.path
import sys
# This is to fix the issue of "ModuleNotFoundError" below
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))

import sys
sys.path.insert(0, './src/environments')

from PowerDynSimEnvDef_v7 import PowerDynSimEnv
env = PowerDynSimEnv(case_files_array,dyn_config_file,rl_config_file,jar_path,java_port)


manual_test()
      
env.close_connection()



			 
示例#3
0
# config the RLGC Java Sever
java_port = 25003
jar_file = '/lib/RLGCJavaServer1.0.0_rc.jar'

repo_path = os.path.abspath('.')

jar_path = repo_path + jar_file

import sys
sys.path.insert(0, repo_path + '/src/environments')

#case_files_array[0] = folder_dir + '/testData/IEEE39/IEEE39bus_multiloads_xfmr4_smallX_v30.raw'
#case_files_array[1] = folder_dir + '/testData/IEEE39/IEEE39bus_3AC.dyr'
dyn_config_file = repo_path + '\\testData\\IEEE39\\json\\IEEE39_dyn_config.json'

rl_config_file = repo_path + '\\testData\\IEEE39\\json\\IEEE39_RL_loadShedding_3motor_continuous.json'

from PowerDynSimEnvDef_v7 import PowerDynSimEnv
env = PowerDynSimEnv(None, dyn_config_file, rl_config_file, jar_path,
                     java_port)

for i in range(15):
    results = env.step([-.5, -0.3, -0.1])  # no action is applied
    print('step reward =', results[1])

print('test completed')

env.close_connection()
print('connection with Ipss Server is closed')
示例#4
0
# step_starttime = list()
# step_durationtime = list()

check_pt_dir = "./TrainedModels"
if not os.path.exists(check_pt_dir):
    os.makedirs(check_pt_dir)

model_file = os.path.join(check_pt_dir, "sac_ieee39_loadshedding")


import time
start = time.time()


from PowerDynSimEnvDef_v7 import PowerDynSimEnv
env = PowerDynSimEnv(case_files_array,dyn_config_file,rl_config_file,jar_path,java_port,verbose=0),


env = Monitor(env, log_dir, allow_early_resets=True)

time_steps = 5000
#for ll in [0.0001, 0.0005, 0.00005]:

for ll in [0.00005]:
    # step_rewards = list()
    # step_actions = list()
    # step_observations = list()
    # step_status = list()
    # step_starttime = list()
    # step_durationtime = list()
示例#5
0
    repo_path + '/testData/IEEE39/IEEE39bus_multiloads_xfmr4_smallX_v30.raw')

case_files_array.append(repo_path + '/testData/IEEE39/IEEE39bus_3AC.dyr')

dyn_config_file = repo_path + '/testData/IEEE39/json/IEEE39_dyn_config.json'

rl_config_file = repo_path + '/testData/IEEE39/json/IEEE39_RL_loadShedding_3motor_continuous.json'

import os.path
import sys
# This is to fix the issue of "ModuleNotFoundError" below
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))

from PowerDynSimEnvDef_v7 import PowerDynSimEnv

env = PowerDynSimEnv(case_files_array, dyn_config_file, rl_config_file,
                     jar_path, java_port, repo_path)

print("all base cases:", env.get_base_cases())

assert len(env.get_base_cases()) == 13

print("observation names:", env.get_observation_names())

assert len(env.get_observation_names()) == 11

print("all generator active power:", env.get_all_generator_activePower())

assert len(env.get_all_generator_activePower()) == 10

print("all load active power:", env.get_all_load_activePower())