From 601f44f899321701f6dd49c78453008a34cdf39f Mon Sep 17 00:00:00 2001 From: Heiner92 Date: Sat, 2 Dec 2017 12:39:37 +0100 Subject: [PATCH] Added small fixes for issues #41 (ext2int error with new numpy versions; float->int) and #19 (incorrect display of losses when transformers are phase shifting) --- pypower/ext2int.py | 6 +++--- pypower/printpf.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pypower/ext2int.py b/pypower/ext2int.py index 6a829e0..8338476 100644 --- a/pypower/ext2int.py +++ b/pypower/ext2int.py @@ -91,9 +91,9 @@ def ext2int(ppc, val_or_field=None, ordering=None, dim=0): ## save data matrices with external ordering if 'ext' not in o: o['ext'] = {} - o["ext"]["bus"] = ppc["bus"].copy() - o["ext"]["branch"] = ppc["branch"].copy() - o["ext"]["gen"] = ppc["gen"].copy() + o["ext"]["bus"] = ppc["bus"].copy().astype(int) + o["ext"]["branch"] = ppc["branch"].copy().astype(int) + o["ext"]["gen"] = ppc["gen"].copy().astype(int) if 'areas' in ppc: if len(ppc["areas"]) == 0: ## if areas field is empty del ppc['areas'] ## delete it (so it's ignored) diff --git a/pypower/printpf.py b/pypower/printpf.py index e4bce75..5464b53 100644 --- a/pypower/printpf.py +++ b/pypower/printpf.py @@ -147,7 +147,7 @@ def printpf(baseMVA, bus=None, gen=None, branch=None, f=None, success=None, tap = ones(nl) ## default tap ratio = 1 for lines xfmr = find(branch[:, TAP]) ## indices of transformers tap[xfmr] = branch[xfmr, TAP] ## include transformer tap ratios - tap = tap * exp(1j * pi / 180 * branch[:, SHIFT]) ## add phase shifters + tap = tap * exp(-1j * pi / 180 * branch[:, SHIFT]) ## add phase shifters nzld = find((bus[:, PD] != 0.0) | (bus[:, QD] != 0.0)) sorted_areas = sort(bus[:, BUS_AREA]) ## area numbers