Skip to content

Commit 518ab41

Browse files
authored
Merge pull request #93 from cuihantao/develop
Prepare for v1.2.2 release.
2 parents 5d0885a + 194bdac commit 518ab41

33 files changed

Lines changed: 890 additions & 412 deletions

andes/cases/GBnetwork/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
GBnetwork power flow case downloaded from
2-
https://www.maths.ed.ac.uk/optenergy/NetworkData/fullGB/
2+
<https://www.maths.ed.ac.uk/optenergy/NetworkData/fullGB/>
33

44
Dynamic data is randomly generated and does not represent the actual system.

andes/cases/ieee14/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ IEEE 14-Bus System
22

33
Power flow data is created by J. Conto.
44

5-
Data is available at https://drive.google.com/drive/folders/0B7uS9L2Woq_7YzYzcGhXT2VQYXc
5+
Data is available at <https://drive.google.com/drive/folders/0B7uS9L2Woq_7YzYzcGhXT2VQYXc>
66

77
Dynamic data is created by H. Cui for ANDES.
88

26.7 KB
Binary file not shown.

andes/cases/ieee14/pert.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
"""
2+
An empty pert file.
3+
"""
4+
5+
6+
def pert(t, system):
7+
"""
8+
Perturbation function called at each step.
9+
10+
The function is named "pert" and takes two arguments:
11+
``t`` for simulation time, and ``system`` for the system object.
12+
13+
"""
14+
pass

andes/cases/kundur/kundur_vsc.xlsx

17.1 KB
Binary file not shown.

andes/cases/nordic44/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Nordic 44-Bus System
22

3-
Source: https://github.com/ALSETLab/Nordic44-Nordpool/tree/master/nordic44/models
3+
Source: <https://github.com/ALSETLab/Nordic44-Nordpool/tree/master/nordic44/models>
44

55
Most dynamic models in this system have not been supported.

andes/cases/wecc/wecc_full.xlsx

69.1 KB
Binary file not shown.

andes/cases/wecc/wecc_gencls.xlsx

66.9 KB
Binary file not shown.

andes/core/block.py

Lines changed: 63 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1467,14 +1467,16 @@ class GainLimiter(Block):
14671467
│ │ _____/
14681468
└─────┘ lower
14691469
1470+
TODO: Add an extra gain block "R" for y.
1471+
14701472
Parameters
14711473
----------
14721474
u : str, BaseVar
14731475
Input variable, or an equation string for constructing an anonymous variable
14741476
14751477
"""
14761478

1477-
def __init__(self, u, K, upper, lower, no_upper=False, no_lower=False,
1479+
def __init__(self, u, K, lower, upper, no_lower=False, no_upper=False,
14781480
name=None, tex_name=None, info=None):
14791481
Block.__init__(self, name=name, tex_name=tex_name, info=info)
14801482
self.u = dummify(u)
@@ -1518,6 +1520,66 @@ def define(self):
15181520
self.y.e_str += f' - {self.name}_y'
15191521

15201522

1523+
class LimiterGain(Block):
1524+
"""
1525+
Limiter followed by a gain.
1526+
1527+
Exports the limited output `y`, unlimited output `x`, and HardLimiter `lim`. ::
1528+
1529+
upper ┌─────┐
1530+
/¯¯¯¯¯ │ │
1531+
u -> / -> │ K │ -> y
1532+
_____/ │ │
1533+
lower └─────┘
1534+
1535+
The intermediate variable before the gain is not saved.
1536+
1537+
Parameters
1538+
----------
1539+
u : str, BaseVar
1540+
Input variable, or an equation string for constructing an anonymous variable
1541+
1542+
"""
1543+
1544+
def __init__(self, u, K, lower, upper, no_lower=False, no_upper=False,
1545+
name=None, tex_name=None, info=None):
1546+
Block.__init__(self, name=name, tex_name=tex_name, info=info)
1547+
self.u = u
1548+
self.K = dummify(K)
1549+
self.upper = dummify(upper)
1550+
self.lower = dummify(lower)
1551+
1552+
if (no_upper and no_lower) is True:
1553+
raise ValueError("no_upper or no_lower cannot both be True")
1554+
1555+
self.no_lower = no_lower
1556+
self.no_upper = no_upper
1557+
1558+
self.lim = HardLimiter(u=self.u, lower=self.lower, upper=self.upper,
1559+
no_upper=no_upper, no_lower=no_lower,
1560+
tex_name='lim')
1561+
1562+
self.y = Algeb(info='Gain output after limiter', tex_name='y', discrete=self.lim)
1563+
1564+
self.vars = {'lim': self.lim, 'y': self.y}
1565+
1566+
def define(self):
1567+
"""
1568+
TODO: write docstring
1569+
"""
1570+
self.y.e_str = f'{self.K.name} * {self.u.name} * {self.name}_lim_zi'
1571+
self.y.v_str = f'{self.K.name} * {self.u.name} * {self.name}_lim_zi'
1572+
1573+
if not self.no_upper:
1574+
self.y.e_str += f' + {self.K.name} * {self.name}_lim_zu*{self.upper.name}'
1575+
self.y.v_str += f' + {self.K.name} * {self.name}_lim_zu*{self.upper.name}'
1576+
if not self.no_lower:
1577+
self.y.e_str += f' + {self.K.name} * {self.name}_lim_zl*{self.lower.name}'
1578+
self.y.v_str += f' + {self.K.name} * {self.name}_lim_zl*{self.lower.name}'
1579+
1580+
self.y.e_str += f' - {self.name}_y'
1581+
1582+
15211583
class Piecewise(Block):
15221584
"""
15231585
Piecewise block. Outputs an algebraic variable `y`.

andes/core/discrete.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,10 @@ class Limiter(Discrete):
203203
True to only use the upper limit
204204
no_upper : bool
205205
True to only use the lower limit
206-
equal: bool
206+
equal : bool
207207
True to include equal signs in comparison (>= or <=).
208+
no_warn : bool
209+
Disable initial limit warnings
208210
zu : 0 or 1
209211
Default value for `zu` if not enabled
210212
zl : 0 or 1
@@ -224,7 +226,8 @@ class Limiter(Discrete):
224226
"""
225227

226228
def __init__(self, u, lower, upper, enable=True, name=None, tex_name=None, info=None,
227-
no_upper=False, no_lower=False, equal=True, zu=0.0, zl=0.0, zi=1.0):
229+
no_upper=False, no_lower=False, equal=True, no_warn=False,
230+
zu=0.0, zl=0.0, zi=1.0):
228231
Discrete.__init__(self, name=name, tex_name=tex_name, info=info)
229232
self.u = u
230233
self.lower = dummify(lower)
@@ -233,6 +236,7 @@ def __init__(self, u, lower, upper, enable=True, name=None, tex_name=None, info=
233236
self.no_upper = no_upper
234237
self.no_lower = no_lower
235238
self.equal = equal
239+
self.no_warn = no_warn
236240

237241
self.zu = np.array([zu])
238242
self.zl = np.array([zl])

0 commit comments

Comments
 (0)