Skip to content

Commit

Permalink
upload IEEE 300-bus test system data
Browse files Browse the repository at this point in the history
  • Loading branch information
qhuang-pnl committed Jun 21, 2020
1 parent a071805 commit 7c40fa2
Show file tree
Hide file tree
Showing 10 changed files with 4,026 additions and 16 deletions.
6 changes: 6 additions & 0 deletions docs/Dev_notes
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
=====================
V0.93 improve data adapter for PSS/E V33 and add APIs for accessing Adjacency Matrix, setting branch, generator and load status

=====================
V0.92 add APIs to access generation and load information

=====================
V0.91 transfer the observation array in byte array to python.

Expand Down
Binary file modified lib/RLGCJavaServer0.93.jar
Binary file not shown.
5 changes: 5 additions & 0 deletions src/org/pnnl/gov/pss_gateway/IpssPyGateway.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.ieee.odm.adapter.IODMAdapter.NetType;
import org.ieee.odm.adapter.psse.PSSEAdapter;
import org.ieee.odm.adapter.psse.PSSEAdapter.PsseVersion;
import org.ieee.odm.common.ODMLogger;
import org.ieee.odm.model.dstab.DStabModelParser;
import org.interpss.IpssCorePlugin;
import org.interpss.fadapter.IpssFileAdapter.FileFormat;
Expand Down Expand Up @@ -149,6 +150,7 @@ public class IpssPyGateway {
public IpssPyGateway() {
IpssCorePlugin.init();
IpssLogger.getLogger().setLevel(Level.OFF);
ODMLogger.getLogger().setLevel(Level.OFF);

System.out.println("Working Directory = " +
System.getProperty("user.dir"));
Expand Down Expand Up @@ -1651,12 +1653,15 @@ public void setLoadStatus(int busNum, String loadId, int status) {
public void setLoggerLevel(int level) {
if(level>=2) {
IpssLogger.getLogger().setLevel(Level.FINE);
ODMLogger.getLogger().setLevel(Level.FINE);
}
else if(level==1) {
IpssLogger.getLogger().setLevel(Level.WARNING);
ODMLogger.getLogger().setLevel(Level.WARNING);
}
else {
IpssLogger.getLogger().setLevel(Level.OFF);
ODMLogger.getLogger().setLevel(Level.OFF);
}
}

Expand Down
54 changes: 38 additions & 16 deletions src/org/pnnl/gov/test/DStab_IEEE300Bus_Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ public void test_IEEE300_loadshedding_RL_continuous() {
}

app.reset(0, 2, 1.0, 0.10);
double[][] obs_ary = app.getEnvObservations();
double[][] obs_ary = app.getEnvObservationsDbl2DAry();

// zone 1, observations: 108 buses (>60kv)
// zone 1, actions: 20 buses
Expand Down Expand Up @@ -294,15 +294,15 @@ public void test_IEEE300_loadshedding_RL_continuous() {
public void test_IEEE300_loadshedding_RL_continuous_moreActionBuses() {

IpssPyGateway app = new IpssPyGateway();
app.setLoggerLevel(1);
app.setLoggerLevel(1); //0 - no logging, 1 - warming, 2 - info

String[] caseFiles = new String[]{
"testData/IEEE300/IEEE300Bus_modified_noHVDC_v2.raw",
"testData/IEEE300/IEEE300_dyn_cmld_zone1.dyr"
};

String dynSimConfigFile = "testData\\IEEE300\\json\\IEEE300_dyn_config.json"; // define dynamic simulation and monitoring
String rlConfigJsonFile = "testData\\IEEE300\\json\\IEEE300_RL_loadShedding_zone1_continuous_LSTM_new_morefaultbuses_moreActionBuses_testing.json";
String dynSimConfigFile = "testData\\ACTIVSg2000\\json\\Texas2000_dyn_config.json"; // define dynamic simulation and monitoring
String rlConfigJsonFile = "testData\\ACTIVSg2000\\json\\Texas2000_RL_loadShedding_zone3.json";

int[] ob_act_space_dim = null;

Expand All @@ -317,8 +317,8 @@ public void test_IEEE300_loadshedding_RL_continuous_moreActionBuses() {
e.printStackTrace();
}

app.reset(0, 0, 0.0, 0.08);
double[][] obs_ary = app.getEnvObservations();
app.reset(0, 1, 0.0, 0.08);
double[][] obs_ary = app.getEnvObservationsDbl2DAry();

// zone 1, observations: 108 buses (>60kv)
// zone 1, actions: 20 buses
Expand All @@ -339,17 +339,39 @@ public void test_IEEE300_loadshedding_RL_continuous_moreActionBuses() {


// for faults at bus idx 1 or 2, fault duration 0.1 s
double[] actions = new double[] {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1};
// double[] actions = new double[] {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
// -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
// -1, -1, -1, -1, -1, -1};

// to check COMPLDW 3-phase induction motor when all loads at 3 buses are shedded.
// double[] actions = new double[] {-1, -1, -1};

double[] actions = new double[] {-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};

int i = 0;
while(app.getDStabAlgo().getSimuTime()<app.getDStabAlgo().getTotalSimuTimeSec()) {
System.out.println("Time ="+app.getDStabAlgo().getSimuTime());
if(app.getDStabAlgo().getSimuTime()>1.1 && app.getDStabAlgo().getSimuTime()<1.85){
app.nextStepDynSim(0.1, actions, "continuous");
}
else
app.nextStepDynSim(0.1, new double[46], "continuous");

app.nextStepDynSim(0.1, actions, "continuous");

// if(app.getDStabAlgo().getSimuTime()<0.1)
// app.nextStepDynSim(0.1, new double[46], "continuous");
// else if(i<5) {
// app.nextStepDynSim(0.1, actions, "continuous");
// i++;
// }
// else {
// app.nextStepDynSim(0.1, new double[46], "continuous");
// }


// if(app.getDStabAlgo().getSimuTime()>1.1 && app.getDStabAlgo().getSimuTime()<1.85){
// app.nextStepDynSim(0.1, actions, "continuous");
// }
// else
// app.nextStepDynSim(0.1, new double[46], "continuous");
//
//app.nextStepDynSim(0.1, new double[20], "continuous");
//app.nextStepDynSim(0.1, actions, "continuous");
Expand All @@ -366,8 +388,8 @@ public void test_IEEE300_loadshedding_RL_continuous_moreActionBuses() {



//System.out.println(app.getStateMonitor().toCSVString(app.getStateMonitor().getMachSpeedTable()));
// System.out.println(app.getStateMonitor().toCSVString(app.getStateMonitor().getMachAngleTable()));
System.out.println(app.getStateMonitor().toCSVString(app.getStateMonitor().getMachSpeedTable()));
System.out.println(app.getStateMonitor().toCSVString(app.getStateMonitor().getMachAngleTable()));
System.out.println(app.getStateMonitor().toCSVString(app.getStateMonitor().getBusVoltTable()));
// FileUtil.writeText2File("C:\\Qiuhua\\DeepScienceLDRD\\output\\mach_angle_refbus1.csv",app.getStateMonitor().toCSVString(app.getStateMonitor().getMachAngleTable()));

Expand Down
61 changes: 61 additions & 0 deletions src/py/test_IEEE300_Zone1_loadshedding.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
from py4j.java_gateway import (JavaGateway, GatewayParameters)
from subprocess import call, Popen, PIPE

import os, time


java_port = 25338

jar_file = "\lib\RLGCJavaServer0.91.jar"

a = os.path.abspath(os.path.dirname(__file__))

folder_dir = a[:-7]

jar_path = folder_dir + jar_file

case_files_array = []


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

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

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

rl_config_file = folder_dir + '/testData/IEEE300/json/IEEE300_RL_loadShedding_zone1_continuous_LSTM_new_morefaultbuses_moreActionBuses_testing.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,folder_dir)

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)
#print('step reward =', rewards)


print('test completed')
toc = time.perf_counter()

print(f"Used time in {toc - tic:0.4f} seconds")

env.close_connection()
print('connection with Ipss Server is closed')


Empty file added testData/IEEE300/IEEE300.seq
Empty file.
Loading

0 comments on commit 7c40fa2

Please sign in to comment.