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 @@ -19,6 +19,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] replacing deprecated in1d with isin
- [ADDED] A switch to disable updating the vk and vkr values for trafo3w
- [FIXED] cast the column to the correct type before assigning values
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 @@ def create_sgen_genstat(net, item, pv_as_slack, pf_variable_p_gen, dict_net, is_
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

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

sg = pp.create_sgen(net, **params)
element = 'sgen'
logger.debug('created sgen at index <%d>' % sg)
Expand Down Expand Up @@ -2154,13 +2167,32 @@ def create_sgen_sym(net, item, pv_as_slack, pf_variable_p_gen, dict_net, export_
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,
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,
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,
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,
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