e2nIEE / pandapower
Showing 1 of 1 files from the diff.

@@ -132,7 +132,7 @@
Loading
132 132
    length_km = line["length_km"].values
133 133
    parallel = line["parallel"].values
134 134
    base_kv = ppc["bus"][from_bus, BASE_KV]
135 -
    baseR = np.square(base_kv) / (3 * net.sn_mva) if mode == "pf_3ph" else   np.square(base_kv) / net.sn_mva 
135 +
    baseR = np.square(base_kv) / (3 * net.sn_mva) if mode == "pf_3ph" else np.square(base_kv) / net.sn_mva 
136 136
    branch[f:t, F_BUS] = from_bus
137 137
    branch[f:t, T_BUS] = to_bus
138 138
    branch[f:t, BR_R] = line["r_ohm_per_km"].values * length_km / baseR / parallel
@@ -258,7 +258,7 @@
Loading
258 258
    mode = net["_options"]["mode"]
259 259
    trafo_model = net["_options"]["trafo_model"]
260 260
261 -
    r, x = _calc_r_x_from_dataframe(mode,trafo_df, vn_lv, vn_trafo_lv, net.sn_mva)
261 +
    r, x = _calc_r_x_from_dataframe(mode, trafo_df, vn_lv, vn_trafo_lv, net.sn_mva)
262 262
    if mode == "sc":
263 263
        y = 0
264 264
        if isinstance(trafo_df, pd.DataFrame):  # 2w trafo is dataframe, 3w trafo is dict
@@ -270,7 +270,7 @@
Loading
270 270
            r *= kt
271 271
            x *= kt
272 272
    else:
273 -
        y = _calc_y_from_dataframe(mode,trafo_df, vn_lv, vn_trafo_lv, net.sn_mva)
273 +
        y = _calc_y_from_dataframe(mode, trafo_df, vn_lv, vn_trafo_lv, net.sn_mva)
274 274
    if trafo_model == "pi":
275 275
        return r, x, y
276 276
    elif trafo_model == "t":
@@ -298,7 +298,7 @@
Loading
298 298
    return r, x, y
299 299
300 300
301 -
def _calc_y_from_dataframe(mode,trafo_df, vn_lv, vn_trafo_lv, sn_mva):
301 +
def _calc_y_from_dataframe(mode, trafo_df, vn_lv, vn_trafo_lv, sn_mva):
302 302
    """
303 303
    Calculate the subsceptance y from the transformer dataframe.
304 304
@@ -311,17 +311,19 @@
Loading
311 311
        **subsceptance** (1d array, np.complex128) - The subsceptance in pu in
312 312
        the form (-b_img, -b_real)
313 313
    """
314 -
   
314 +
315 315
    baseR = np.square(vn_lv) / (3*sn_mva) if mode == 'pf_3ph' else np.square(vn_lv) / sn_mva
316 316
    vn_lv_kv = get_trafo_values(trafo_df, "vn_lv_kv")
317 -
    pfe = get_trafo_values(trafo_df, "pfe_kw") * 1e-3
317 +
    pfe = (get_trafo_values(trafo_df, "pfe_kw") * 1e-3) / 3 if mode == 'pf_3ph'\
318 +
        else get_trafo_values(trafo_df, "pfe_kw") * 1e-3
318 319
    parallel = get_trafo_values(trafo_df, "parallel")
319 320
320 321
    ### Calculate subsceptance ###
321 -
   
322 -
    vnl_squared = (vn_lv_kv ** 2)/3 if mode == 'pf_3ph' else  vn_lv_kv **2
322 +
323 +
    vnl_squared = (vn_lv_kv ** 2)/3 if mode == 'pf_3ph' else vn_lv_kv ** 2
323 324
    b_real = pfe / vnl_squared * baseR
324 -
    i0 = get_trafo_values(trafo_df, "i0_percent")
325 +
    i0 = get_trafo_values(trafo_df, "i0_percent") / 3 if mode == 'pf_3ph'\
326 +
        else get_trafo_values(trafo_df, "i0_percent")
325 327
    sn = get_trafo_values(trafo_df, "sn_mva")
326 328
    b_img = (i0 / 100. * sn) ** 2 - pfe ** 2
327 329
@@ -375,7 +377,7 @@
Loading
375 377
    for side, vn, direction in [("hv", vnh, 1), ("lv", vnl, -1)]:
376 378
        phase_shifters = tap_phase_shifter & (tap_side == side)
377 379
        tap_complex = np.isfinite(tap_step_percent) & np.isfinite(tap_pos) & (tap_side == side) & \
378 -
                      ~phase_shifters
380 +
            ~phase_shifters
379 381
        if tap_complex.any():
380 382
            tap_steps = tap_step_percent[tap_complex] * tap_diff[tap_complex] / 100
381 383
            tap_angles = _replace_nan(tap_step_degree[tap_complex])
@@ -403,7 +405,7 @@
Loading
403 405
    array[mask] = value
404 406
    return array
405 407
406 -
def _calc_r_x_from_dataframe(mode,trafo_df, vn_lv, vn_trafo_lv, sn_mva):
408 +
def _calc_r_x_from_dataframe(mode, trafo_df, vn_lv, vn_trafo_lv, sn_mva):
407 409
    """
408 410
    Calculates (Vectorized) the resitance and reactance according to the
409 411
    transformer values
@@ -412,8 +414,8 @@
Loading
412 414
    parallel = get_trafo_values(trafo_df, "parallel")
413 415
    vk_percent = get_trafo_values(trafo_df, "vk_percent")
414 416
    vkr_percent = get_trafo_values(trafo_df, "vkr_percent")
415 -
    tap_lv = np.square(vn_trafo_lv / vn_lv) * (3* sn_mva)  if mode == 'pf_3ph' else\
416 -
    np.square(vn_trafo_lv / vn_lv) * sn_mva  # adjust for low voltage side voltage converter
417 +
    tap_lv = np.square(vn_trafo_lv / vn_lv) * (3 * sn_mva) if mode == 'pf_3ph' else\
418 +
        np.square(vn_trafo_lv / vn_lv) * sn_mva  # adjust for low voltage side voltage converter
417 419
    sn_trafo_mva = get_trafo_values(trafo_df, "sn_mva")
418 420
    z_sc = vk_percent / 100. / sn_trafo_mva * tap_lv
419 421
    r_sc = vkr_percent / 100. / sn_trafo_mva * tap_lv
@@ -442,7 +444,7 @@
Loading
442 444
    hv_bus = get_trafo_values(trafo_df, "hv_bus")
443 445
    lv_bus = get_trafo_values(trafo_df, "lv_bus")
444 446
    nom_rat = get_values(ppc["bus"][:, BASE_KV], hv_bus, bus_lookup) / \
445 -
              get_values(ppc["bus"][:, BASE_KV], lv_bus, bus_lookup)
447 +
        get_values(ppc["bus"][:, BASE_KV], lv_bus, bus_lookup)
446 448
    return tap_rat / nom_rat
447 449
448 450
@@ -481,7 +483,7 @@
Loading
481 483
    f, t = net["_pd2ppc_lookups"]["branch"]["xward"]
482 484
    branch = ppc["branch"]
483 485
    baseR = np.square(get_values(ppc["bus"][:, BASE_KV], net["xward"]["bus"].values, bus_lookup)) / \
484 -
            net.sn_mva
486 +
        net.sn_mva
485 487
    xw_is = net["_is_elements"]["xward"]
486 488
    branch[f:t, F_BUS] = bus_lookup[net["xward"]["bus"].values]
487 489
    branch[f:t, T_BUS] = bus_lookup[net._pd2ppc_lookups["aux"]["xward"]]
Files Coverage
pandapower 87.69%
setup.py 0.00%
Project Totals (162 files) 87.61%

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