Commit 46b03aae authored by Paul Schultz's avatar Paul Schultz
Browse files

debugging

parent e0c445e4
from __future__ import division, print_function, absolute_import, unicode_literals
#from __future__ import division, print_function, absolute_import, unicode_literals
import numpy as np
import baobap as bao
......@@ -17,6 +17,14 @@ def load_PYPSA(filename):
node_list = [SwingEquationNode(3, infeed=input_power[i], H=0.1, damping=0.01) for i in range(system_size)]
return node_list,Y
def load_PyPSA_df(adm, par):
from pandas import read_csv
Y = np.load(adm)
df = read_csv(par, index_col=0)
system_size = df.shape[0]
node_list = [SwingEquationNode(3, infeed=df.p.iloc[i], H=0.1, damping=0.01, v_set=df.v_nom.iloc[i]) for i in range(system_size)]
return node_list, Y
def define_gen_rc(brp, rhs):
system_size = brp.system_dimension
def generate_run_conditions(batch, run):
......@@ -41,7 +49,8 @@ def lorenz_ob(time_series, rc):
def main(sim_dir=default_dir, create_test_data=True, run_test=True, flag_baobab=True):
node_list, Y = load_PYPSA('microgrid_testcase.npz')
#node_list, Y = load_PYPSA('microgrid_testcase.npz')
node_list, Y = load_PyPSA_df("bus_admittance.npy", "bus_parameters")
rhs = define_network_rhs(node_list, Y)
# nrhs = define_network_rhs_codegen(node_list, Y)
......@@ -86,11 +95,11 @@ def main(sim_dir=default_dir, create_test_data=True, run_test=True, flag_baobab=
ax = fig.gca(projection='3d')
for k in range(brp.system_dimension):
ax.plot(states[:, k], states[:, brp.system_dimension+k], states[:, 2*brp.system_dimension+k])
ax.set_xlabel("real V")
ax.set_ylabel("imag V")
ax.set_xlabel(r"$\Re$ V")
ax.set_ylabel(r"$\Im$ V")
ax.set_zlabel(r"$\omega$")
plt.show()
if __name__ == "__main__":
main(flag_baobab=True)
main(flag_baobab=False)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment