PoweFlowNet icon indicating copy to clipboard operation
PoweFlowNet copied to clipboard

Serveral Possible errors

Open FrankXu1 opened this issue 6 months ago • 3 comments

We found serveral possible errors in your codebase.

1. In /dataset_generator.py

function get_trafo_z_pu() 下载

I noticed, in lines 56, 57(yellow marks), they multiplied 1000, which is weird. We drew the scatter plot of the values of r and x of each edge, and found the r and x of the transformer lines are extremely large.

data_v2_edge = np.load('   YOUR PATH    /PoweFlowNet/data/raw/case118v2_edge_features.npy')

data_v2_edge_r = pd.DataFrame(data_v2_edge[:,:,2])

means = data_v2_edge_r.mean()
std_devs = data_v2_edge_r.std()

plt.figure(figsize=(10, 6))

for col in data_v2_edge_r.columns:
    plt.scatter([col]*len(data_v2_edge_r[col]), data_v2_edge_r[col], color='lightblue', alpha=0.6, edgecolor='k')

plt.plot(data_v2_edge_r.columns, means, marker='o', linestyle='-', color='blue', label='Mean')

plt.errorbar(data_v2_edge_r.columns, means, yerr=std_devs, fmt='o', color='blue', capsize=5, label='Mean ± 1 Std Dev')

plt.xlabel('Index (Columns)')
plt.ylabel('Values')

plt.title('data_v2_edge_r  Individual Values, Mean and Standard Deviation Range per Column')

plt.legend()
plt.grid(True)
plt.show()

下载 (1)

data_v2_edge = np.load('   YOUR PATH    /PoweFlowNet/data/raw/case118v2_edge_features.npy')

data_v2_edge_x = pd.DataFrame(data_v2_edge[:,:,3])

means = data_v2_edge_x.mean()
std_devs = data_v2_edge_x.std()

plt.figure(figsize=(10, 6))

for col in data_v2_edge_x.columns:
    plt.scatter([col]*len(data_v2_edge_x[col]), data_v2_edge_x[col], color='lightblue', alpha=0.6, edgecolor='k')

plt.plot(data_v2_edge_x.columns, means, marker='o', linestyle='-', color='blue', label='Mean')

plt.errorbar(data_v2_edge_x.columns, means, yerr=std_devs, fmt='o', color='blue', capsize=5, label='Mean ± 1 Std Dev')

plt.xlabel('Index (Columns)')
plt.ylabel('Values')

plt.title('data_v2_edge_x  Individual Values, Mean and Standard Deviation Range per Column')

plt.legend()
plt.grid(True)
plt.show()

5baac7c6-ec9c-4349-9d48-95e33ec20d2c

Once you remove the "*1000", the r and x of the transformers will change back to their original level. Same with the values in PYPOWER. However, we don't know whether you are mean to do this!!!

2. And, in line 60(bule marks), it should be changed to the same as line 73: "return r_pu, x_pu"

3. In /utils/evaluation.py

Function evaluate_epoch_v2() 下载 (2)

In line 162: the first batch of the loss value did not time len(data). This will make the total loss smaller than the actual value. This should be modified as: total_loss_terms = {key: value.item()*len(data) for key, value in loss_terms.items()}

EXTRA

We are a dedicated AI team under the China Southern Power Grid, and we are keen to connect with the best teams worldwide who share our passion for powerflow calculations. We believe that collaboration and the exchange of ideas can lead to groundbreaking advancements in this field. If you are interested in exploring potential cooperation, we would be thrilled to hear from you. Please feel free to reach out to me at [email protected] Looking forward to connecting with you!

FrankXu1 avatar Aug 24 '24 12:08 FrankXu1