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

REECA1 fix #240

Merged
merged 7 commits into from
Dec 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions andes/models/governor/hygov.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
"""
HYGOV hydro governor model.
"""

from andes.core import Algeb, ConstService, NumParam, State
from andes.core.block import Integrator, Lag, DeadBand1, AntiWindupRate
from andes.core.service import VarService
Expand Down Expand Up @@ -123,6 +127,9 @@ class HYGOVModel(TGBase):
Implement HYGOV model.

The input lead-lag filter is ignored.

The ``g`` signal (LAG) is initialized to the initial value of
``q`` (Integrator) to simplify the initializaiton equations.
"""

def __init__(self, system, config):
Expand Down
28 changes: 15 additions & 13 deletions andes/models/renewable/reeca1.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ def __init__(self, system, config):

self.Iqcmd = ExtAlgeb(model='RenGen', src='Iqcmd', indexer=self.reg, export=False,
info='Retrieved Iqcmd of RenGen',
e_str='-Iqcmd0 - IqHL_y',
e_str='-Iqcmd0 + IqHL_y',
)

self.p0 = ExtService(model='RenGen',
Expand Down Expand Up @@ -394,6 +394,15 @@ def __init__(self, system, config):
self.S1 = Lag(u='Pe', T=self.Tp, K=1, tex_name='S_1', info='Pe filter',
)

self.qref0 = ConstService(tex_name='q_{ref0}')
self.qref0.v_str = 'SWQ_s1 * (v - Vref1) + SWQ_s0 * Iqcmd0 * (v * VLower_zi + 0.01 * VLower_zl)'
self.Qref = Algeb(tex_name='Q_{ref}',
info='external Q ref',
v_str='qref0',
e_str='qref0 - Qref',
unit='p.u.',
)

# ignore `Qcpf` if `pfaref` is pi/2 by multiplying (1-zp0)
self.Qcpf = Algeb(tex_name='Q_{cpf}',
info='Q calculated from P and power factor',
Expand All @@ -403,13 +412,6 @@ def __init__(self, system, config):
unit='p.u.',
)

self.Qref = Algeb(tex_name='Q_{ref}',
info='external Q ref',
v_str='q0',
e_str='q0 - Qref',
unit='p.u.',
)

self.PFsel = Algeb(v_str='SWPF_s0*Qref + SWPF_s1*Qcpf',
e_str='SWPF_s0*Qref + SWPF_s1*Qcpf - PFsel',
info='Output of PFFLAG selector',
Expand All @@ -423,22 +425,22 @@ def __init__(self, system, config):
e_str='(PFsel*PFlim_zi + QMin*PFlim_zl + QMax*PFlim_zu) - Qe - Qerr',
)

self.PIQ = PITrackAWFreeze(u=self.Qerr,
self.PIQ = PITrackAWFreeze(u='SWV_s1 * Qerr + SWV_s0 * 0',
kp=self.Kqp, ki=self.Kqi, ks=self.config.kqs,
lower=self.VMIN, upper=self.VMAX,
freeze=self.Volt_dip,
)

# If `VFLAG=0`, set the input as `Vref1` (see the NREL report)
self.Vsel = GainLimiter(u='SWV_s0 * Vref1 + SWV_s1 * PIQ_y',
self.Vsel = GainLimiter(u='SWV_s0 * (Vref1 + SWPF_s0 * Qref + SWPF_s1 * Qcpf) + SWV_s1 * PIQ_y',
K=1, R=1,
lower=self.VMIN, upper=self.VMAX,
info='Selection output of VFLAG',
)

# --- Placeholders for `Iqmin` and `Iqmax` ---

self.s4 = LagFreeze(u='PFsel / vp', T=self.Tiq, K=1,
self.s4 = LagFreeze(u='PFsel / vp',
T=self.Tiq, K=1,
freeze=self.Volt_dip,
tex_name='s_4',
info='Filter for calculated voltage with freeze',
Expand Down Expand Up @@ -641,7 +643,7 @@ def __init__(self, system, config):
info='Lower limit on Ipcmd',
)

self.PIV = PITrackAWFreeze(u='Vsel_y - s0_y * SWV_s0',
self.PIV = PITrackAWFreeze(u='SWQ_s1 * (Vsel_y - s0_y * SWV_s0)',
x0='-SWQ_s1 * Iqcmd0',
kp=self.Kvp, ki=self.Kvi, ks=self.config.kvs,
lower=self.Iqmin, upper=self.Iqmax,
Expand Down