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

pf2pp: reactive and active power limits of gen and sgens will be converted #2359

Open
wants to merge 10 commits into
base: develop
Choose a base branch
from
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Change Log

[upcoming release] - 2024-..-..
-------------------------------
- [ADDED] pf2pp: min/max q_mvar and min/max p_mw limits for sgens and gen will be converted
- [FIXED] cast the column to the correct type before assigning values
- [FIXED] replacement for deprecated namespaces scipy.sparse.csc and scipy.sparse.csr
- [FIXED] copy array element to standard python scalar
Expand Down
40 changes: 36 additions & 4 deletions pandapower/converter/powerfactory/pp_import_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1943,13 +1943,26 @@
logger.debug('av_mode: %s - creating as gen' % av_mode)
params.vm_pu = item.usetp
del params['q_mvar']

# add reactive and active power limits
params.min_q_mvar = item.cQ_min
params.max_q_mvar = item.cQ_max
params.min_p_mw = item.Pmin_uc
params.max_p_mw = item.Pmax_uc

Check warning on line 1951 in pandapower/converter/powerfactory/pp_import_functions.py

View check run for this annotation

Codecov / codecov/patch

pandapower/converter/powerfactory/pp_import_functions.py#L1948-L1951

Added lines #L1948 - L1951 were not covered by tests

sg = pp.create_gen(net, **params)
element = 'gen'
else:
if is_unbalanced:
sg = pp.create_asymmetric_sgen(net, **params)
element = "asymmetric_sgen"
else:
# add reactive and active power limits
params.min_q_mvar = item.cQ_min
params.max_q_mvar = item.cQ_max
params.min_p_mw = item.Pmin_uc
params.max_p_mw = item.Pmax_uc

Check warning on line 1964 in pandapower/converter/powerfactory/pp_import_functions.py

View check run for this annotation

Codecov / codecov/patch

pandapower/converter/powerfactory/pp_import_functions.py#L1961-L1964

Added lines #L1961 - L1964 were not covered by tests

sg = pp.create_sgen(net, **params)
element = 'sgen'
logger.debug('created sgen at index <%d>' % sg)
Expand Down Expand Up @@ -2154,13 +2167,32 @@
if av_mode == 'constv':
logger.debug('creating sym %s as gen' % name)
vm_pu = item.usetp
sid = pp.create_gen(net, bus=bus1, p_mw=p_mw, vm_pu=vm_pu,
name=name, type=cat, in_service=in_service, scaling=global_scaling)
if item.iqtype == 1:
type = item.typ_id
sid = pp.create_gen(net, bus=bus1, p_mw=p_mw, vm_pu=vm_pu,

Check warning on line 2172 in pandapower/converter/powerfactory/pp_import_functions.py

View check run for this annotation

Codecov / codecov/patch

pandapower/converter/powerfactory/pp_import_functions.py#L2170-L2172

Added lines #L2170 - L2172 were not covered by tests
min_q_mvar=type.Q_min, max_q_mvar=type.Q_max,
min_p_mw=item.Pmin_uc, max_p_mw=item.Pmax_uc,
name=name, type=cat, in_service=in_service, scaling=global_scaling)
else:
sid = pp.create_gen(net, bus=bus1, p_mw=p_mw, vm_pu=vm_pu,

Check warning on line 2177 in pandapower/converter/powerfactory/pp_import_functions.py

View check run for this annotation

Codecov / codecov/patch

pandapower/converter/powerfactory/pp_import_functions.py#L2177

Added line #L2177 was not covered by tests
min_q_mvar=item.cQ_min, max_q_mvar=item.cQ_max,
min_p_mw=item.Pmin_uc, max_p_mw=item.Pmax_uc,
name=name, type=cat, in_service=in_service, scaling=global_scaling)
element = 'gen'
elif av_mode == 'constq':
q_mvar = ngnum * item.qgini * multiplier
sid = pp.create_sgen(net, bus=bus1, p_mw=p_mw, q_mvar=q_mvar,
name=name, type=cat, in_service=in_service, scaling=global_scaling)
if item.iqtype == 1:
type = item.typ_id
sid = pp.create_sgen(net, bus=bus1, p_mw=p_mw, q_mvar=q_mvar,

Check warning on line 2186 in pandapower/converter/powerfactory/pp_import_functions.py

View check run for this annotation

Codecov / codecov/patch

pandapower/converter/powerfactory/pp_import_functions.py#L2184-L2186

Added lines #L2184 - L2186 were not covered by tests
min_q_mvar=type.Q_min, max_q_mvar=type.Q_max,
min_p_mw=item.Pmin_uc, max_p_mw=item.Pmax_uc,
name=name, type=cat, in_service=in_service, scaling=global_scaling)
else:
sid = pp.create_sgen(net, bus=bus1, p_mw=p_mw, q_mvar=q_mvar,

Check warning on line 2191 in pandapower/converter/powerfactory/pp_import_functions.py

View check run for this annotation

Codecov / codecov/patch

pandapower/converter/powerfactory/pp_import_functions.py#L2191

Added line #L2191 was not covered by tests
min_q_mvar=item.cQ_min, max_q_mvar=item.cQ_max,
min_p_mw=item.Pmin_uc, max_p_mw=item.Pmax_uc,
name=name, type=cat, in_service=in_service, scaling=global_scaling)

element = 'sgen'

if sid is None or element is None:
Expand Down
Loading