e2nIEE / pandapower

@@ -131,12 +131,13 @@
Loading
131 131
132 132
       - s: rated apparent power
133 133
       - cosphi: cosine phi of the
134 -
       - qmode: "ind" for inductive or "cap" for capacitive behaviour
134 +
       - qmode: "underexcided" (Q absorption, decreases voltage) or "overexcited" (Q injection, increases voltage)
135 135
       - pmode: "load" for load or "gen" for generation
136 136
137 137
    As all other pandapower functions this function is based on the consumer viewpoint. For active
138 138
    power, that means that loads are positive and generation is negative. For reactive power,
139 -
    inductive behaviour is modeled with positive values, capacitive behaviour with negative values.
139 +
    underexcited behavior (Q absorption, decreases voltage) is modeled with positive values,
140 +
    overexcited behavior (Q injection, increases voltage) with negative values.
140 141
    """
141 142
    if hasattr(s, "__iter__"):
142 143
        s = ensure_iterability(s)
@@ -154,12 +155,17 @@
Loading
154 155
155 156
156 157
def _pq_from_cosphi(s, cosphi, qmode, pmode):
157 -
    if qmode == "ind":
158 +
    if qmode in ("ind", "cap"):
159 +
        logger.warning('capacitive or inductive behavior will be replaced by more clear terms '
160 +
                        '"underexcited" (Q absorption, decreases voltage) and "overexcited" (Q injection, increases voltage).'
161 +
                        'Please use "underexcited" in place of "ind" and "overexcited" in place of "cap".')
162 +
    if qmode == "ind" or qmode == "underexcited":
158 163
        qsign = 1 if pmode == "load" else -1
159 -
    elif qmode == "cap":
164 +
    elif qmode == "cap" or qmode == "overexcited":
160 165
        qsign = -1 if pmode == "load" else 1
161 166
    else:
162 -
        raise ValueError("Unknown mode %s - specify 'ind' or 'cap'" % qmode)
167 +
        raise ValueError('Unknown mode %s - specify "underexcited" (Q absorption, decreases voltage) or '
168 +
                         '"overexcited" (Q injection, increases voltage)' % qmode)
163 169
164 170
    p = s * cosphi
165 171
    q = qsign * np.sqrt(s ** 2 - p ** 2)
@@ -207,8 +213,8 @@
Loading
207 213
208 214
def _cosphi_from_pq(p, q):
209 215
    """
210 -
    Analog to pq_from_cosphi, but other way around.
211 -
    In consumer viewpoint (pandapower): cap=overexcited and ind=underexcited
216 +
    Analog to pq_from_cosphi, but the other way around.
217 +
    In consumer viewpoint (pandapower): "underexcited" (Q absorption, decreases voltage) and "overexcited" (Q injection, increases voltage)
212 218
    """
213 219
    if p == 0:
214 220
        cosphi = np.nan
@@ -217,7 +223,7 @@
Loading
217 223
        cosphi = np.cos(np.arctan(q / p))
218 224
    s = (p ** 2 + q ** 2) ** 0.5
219 225
    pmode = ["undef", "load", "gen"][int(np.sign(p))]
220 -
    qmode = ["ohm", "ind", "cap"][int(np.sign(q))]
226 +
    qmode = ["ohm", "underexcited", "overexcited"][int(np.sign(q))]
221 227
    return cosphi, s, qmode, pmode
222 228
223 229

@@ -38,7 +38,7 @@
Loading
38 38
    n_buses = len(buses)
39 39
    c = c_inf + (1 - c_inf) * n_buses**(-1/2)
40 40
    p_mw = c * P_max1
41 -
    p_mw, q_mvar = pp.pq_from_cosphi(p_mw, powerfactor, qmode='ind', pmode="load")
41 +
    p_mw, q_mvar = pp.pq_from_cosphi(p_mw, powerfactor, qmode='underexcited', pmode="load")
42 42
43 43
    # create loads
44 44
    for i in buses:

@@ -902,9 +902,8 @@
Loading
902 902
#     OUTPUT:
903 903
#         **index** (int) - The unique ID of the created load
904 904
#
905 -
#     All elements are modeled from a consumer point of view. Active power will therefore always be
906 -
#     positive, reactive power will be negative for inductive behaviour and positive for capacitive
907 -
#     behaviour.
905 +
#     Load elements are modeled from a consumer point of view. Active power will therefore always be
906 +
#     positive, reactive power will be positive for under-excited behavior (Q absorption, decreases voltage) and negative for over-excited behavior (Q injection, increases voltage)
908 907
#     """
909 908
#     if bus not in net["bus"].index.values:
910 909
#         raise UserWarning("Cannot attach to bus %s, bus does not exist" % bus)
@@ -943,16 +942,16 @@
Loading
943 942
944 943
        **cos_phi** (float) - power factor cos_phi
945 944
946 -
        **mode** (str) - "ind" for inductive or "cap" for capacitive behaviour
945 +
        **mode** (str) - "underexcited" (Q absorption, decreases voltage) or "overexcited" (Q injection, increases voltage)
947 946
948 947
        **kwargs are passed on to the create_load function
949 948
950 949
    OUTPUT:
951 950
        **index** (int) - The unique ID of the created load
952 951
953 -
    All elements are modeled from a consumer point of view. Active power will therefore always be
954 -
    positive, reactive power will be negative for inductive behaviour and positive for capacitive
955 -
    behaviour.
952 +
    Load elements are modeled from a consumer point of view. Active power will therefore always be
953 +
    positive, reactive power will be positive for underexcited behavior (Q absorption, decreases voltage) and negative for
954 +
    overexcited behavior (Q injection, increases voltage).
956 955
    """
957 956
    from pandapower.toolbox import pq_from_cosphi
958 957
    p_mw, q_mvar = pq_from_cosphi(sn_mva, cos_phi, qmode=mode, pmode="load")
@@ -1227,14 +1226,15 @@
Loading
1227 1226
1228 1227
        **cos_phi** (float) - power factor cos_phi
1229 1228
1230 -
        **mode** (str) - "ind" for inductive or "cap" for capacitive behaviour
1229 +
        **mode** (str) - "underexcited" (Q absorption, decreases voltage) or "overexcited" (Q injection, increases voltage)
1231 1230
1232 1231
    OUTPUT:
1233 1232
        **index** (int) - The unique ID of the created sgen
1234 1233
1235 1234
    gen, sgen, and ext_grid are modelled in the generator point of view. Active power
1236 -
    will therefore be postive por generation, and reactive power will be negative for consumption
1237 -
    behaviour and positive for generation behaviour.
1235 +
    will therefore be postive for generation, and reactive power will be negative for
1236 +
    underexcited behavior (Q absorption, decreases voltage) and
1237 +
    positive for for overexcited behavior (Q injection, increases voltage).
1238 1238
    """
1239 1239
    from pandapower.toolbox import pq_from_cosphi
1240 1240
    p_mw, q_mvar = pq_from_cosphi(sn_mva, cos_phi, qmode=mode, pmode="gen")
@@ -3383,7 +3383,7 @@
Loading
3383 3383
    OPTIONAL:
3384 3384
        **check_existing** (bool, default: None) - Check for and replace existing measurements for\
3385 3385
            this bus, type and element_type. Set it to false for performance improvements which can\
3386 -
            cause unsafe behaviour
3386 +
            cause unsafe behavior
3387 3387
3388 3388
        **index** (int, default: None) - Index of the measurement in the measurement table. Should\
3389 3389
            not exist already.
Files Coverage
pandapower 87.72%
setup.py 0.00%
Project Totals (168 files) 87.65%

No yaml found.

Create your codecov.yml to customize your Codecov experience

Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading