Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] Modifying the index of bus to a custom value results in an error #2434

Open
6 tasks done
258796535 opened this issue Nov 2, 2024 · 0 comments
Open
6 tasks done
Labels

Comments

@258796535
Copy link

Bug report checklis

  • Searched the issues page for similar reports

  • Read the relevant sections of the documentation

  • Browse the tutorials and tests for usefull code snippets and examples of use

  • Reproduced the issue after updating with pip install --upgrade pandapower (or git pull)

  • Tried basic troubleshooting (if a bug/error) like restarting the interpreter and checking the pythonpath

Reproducible Example

net = pp.create_empty_network()

b1 = pp.create_bus(net, name="bus 1", vn_kv=1., index=2)
b2 = pp.create_bus(net, name="bus 2", vn_kv=1., index=3)
b3 = pp.create_bus(net, name="bus 3", vn_kv=1., index=4)

pp.create_ext_grid(net, b1)  # set the slack bus to bus 1

l1 = pp.create_line_from_parameters(net, 2, 3, 1, r_ohm_per_km=.01, x_ohm_per_km=.03,
                                    c_nf_per_km=0, max_i_ka=1)
l2 = pp.create_line_from_parameters(net, 2, 4, 1, r_ohm_per_km=.02, x_ohm_per_km=.05,
                                    c_nf_per_km=0, max_i_ka=1)
l3 = pp.create_line_from_parameters(net, 3, 4, 1, r_ohm_per_km=.03, x_ohm_per_km=.08,
                                    c_nf_per_km=0, max_i_ka=1)
pp.create_measurement(net, "v", "bus", 1.006, 0.004, b1) #母线1电压1.006  装置误差0.004
pp.create_measurement(net, "v", "bus", 0.968, 0.004, b2) #母线2电压0.968  装置误差0.004

#============母线2 的有功 、无功测量 与 误差========
pp.create_measurement(net, "p", "bus", -0.501, 0.01, b2)#母线2有功-0.501 标准偏差0.01
pp.create_measurement(net, "q", "bus", -0.266, 0.01, b2)#母线2无功 -.266  误差0.01

#===线路测量====
pp.create_measurement(net, "p", "line",0.888, 0.008, l1, side=1)# P_line (bus 1 -> bus 2) at bus 1 有功0.888, 误差80.008.
pp.create_measurement(net, "p", "line", 1.173,0.008, l2, side=1)#P_line (bus 1 -> bus 3) at bus 1
pp.create_measurement(net, "q", "line", 0.568, 0.008, l1, side=1)#q_line (bus 1 -> bus 2) at bus 1
pp.create_measurement(net, "q", "line", 0.663, 0.008, l2, side=1)#Q_line (bus 1 -> bus 3) at bus 1

#现在,我们可以执行状态估计

success = est.estimate(net, init="flat")
#V, delta = net.res_bus_est.vm_pu, net.res_bus_est.va_degree #
print("母线结果:\n",net.res_bus_est)
linesresult=pd.DataFrame(net.res_line_est)
linesresult.to_csv("线路结果.csv")
print("线路结果:\n",net.res_line_est)

Issue Description and Traceback

Measurements available: 4. Measurements required: 5
Traceback (most recent call last):
File "D:\workspace_py\energy-api\dvadmin\poweranalysis\test\state_estimation_example1.py", line 81, in
success = est.estimate(net, init="flat")
File "D:\workspace_py\energy-api\venv\lib\site-packages\pandapower\estimation\state_estimation.py", line 87, in estimate
return se.estimate(v_start=v_start, delta_start=delta_start,
File "D:\workspace_py\energy-api\venv\lib\site-packages\pandapower\estimation\state_estimation.py", line 267, in estimate
self.eppci = self.solver.estimate(self.eppci, **opt_vars)
File "D:\workspace_py\energy-api\venv\lib\site-packages\pandapower\estimation\algorithm\base.py", line 80, in estimate
self.initialize(eppci)
File "D:\workspace_py\energy-api\venv\lib\site-packages\pandapower\estimation\algorithm\base.py", line 61, in initialize
self.check_observability(eppci, eppci.z)
File "D:\workspace_py\energy-api\venv\lib\site-packages\pandapower\estimation\algorithm\base.py", line 44, in check_observability
raise UserWarning("Measurements available: %d. Measurements required: %d" %
UserWarning: Measurements available: 4. Measurements required: 5

Expected Behavior

if I use default value of example as shown below,the index value of bus start of 1 or 0,it is not error!
ps: I modify the line params about bus info,the net is right.
net = pp.create_empty_network()

b1 = pp.create_bus(net, name="bus 1", vn_kv=1., index=1)
b2 = pp.create_bus(net, name="bus 2", vn_kv=1., index=2)
b3 = pp.create_bus(net, name="bus 3", vn_kv=1., index=3)

pp.create_ext_grid(net, b1) # set the slack bus to bus 1

l1 = pp.create_line_from_parameters(net, 1, 2, 1, r_ohm_per_km=.01, x_ohm_per_km=.03,
c_nf_per_km=0, max_i_ka=1)
l2 = pp.create_line_from_parameters(net, 1, 3, 1, r_ohm_per_km=.02, x_ohm_per_km=.05,
c_nf_per_km=0, max_i_ka=1)
l3 = pp.create_line_from_parameters(net, 2, 3, 1, r_ohm_per_km=.03, x_ohm_per_km=.08,
c_nf_per_km=0, max_i_ka=1)

Installed Versions

  • python version: * pandas version: * networkx version: * scipy version: * numpy version: * packaging version: * tqdm version: * deepdiff version: * Operating System name/version:2.13.1 or 2.14.11

Label

  • Relevant labels are selected
@258796535 258796535 added the bug label Nov 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant