def __init__(self, data): """ Arguments: data -- 2D Array Representing the PWC Curve """ data = units.floatList2D(data) data = data[data[:,0].argsort(),] # sort by first column for simulator simulator_.PWC_.__init__(self, data)
def __init__(self, data): """ Arguments: data -- 2D Array Representing the PWC Curve """ data = units.floatList2D(data) data = data[data[:, 0].argsort(), ] # sort by first column for simulator simulator_.PWC_.__init__(self, data)
def __init__(self, iNodes, iRef, oNodes, oRef, length, R0, L0, C0, G0=None, Rs=None, Gd=None, fgd=1e100, fK=1e9, M=6): """ Arguments: iNodes -- list/tuple or single string of input nodes iRef -- name of the input refrence node oNodes -- list/tuple or single string of output nodes iRef -- name of the output refrence node length -- length of the t-line in meters R0 -- DC resistance matrix or float from single T-Line (ohm/m) L0 -- DC inductance matrix or float from single T-Line (H/m) C0 -- DC capacitance matrix or float from single T-Line (F/m) G0 -- (optional) DC shunt conductance matrix (S/m) Rs -- (optional) Skin-effect resistance matrix (Ohm/m*sqrt(Hz)) Gd -- (optional) Dielectric-loss conductance matrix (S/m*Hz) fgd -- (optional) Cut-Off for Dielectric loss (Hz) fK -- (optional) Cut-Off for T-Line Model (Hz) M -- (optional) Order of Approximation of Curve Fit (unitless) """ warnings.warn("W-Element Model not complete.") # Makes it possible to send a single string for a non-coupled T-Line if isinstance(iNodes, str): iNodes = (iNodes, ) if isinstance(oNodes, str): oNodes = (oNodes, ) if len(iNodes) != len(oNodes): raise (RuntimeError, "Must have the same number of input and output nodes.") nodes = len(iNodes) # Do some parameter checking here that is tough to do in C, also # create zeroed matracies if G and/or R aren't defined. if nodes > 1: if G0 is None: G0 = array(zeros((nodes, nodes))) if Rs is None: Rs = array(zeros((nodes, nodes))) if Gd is None: Gd = array(zeros((nodes, nodes))) R0 = array(units.floatList2D(R0)) L0 = array(units.floatList2D(L0)) C0 = array(units.floatList2D(C0)) G0 = array(units.floatList2D(G0)) Rs = array(units.floatList2D(Rs)) Gd = array(units.floatList2D(Gd)) if (R0.shape[0] != nodes) or (R0.shape[1] != nodes): raise (RuntimeError, "R0 must be a square matrix with as many rows as nodes.") if (L0.shape[0] != nodes) or (L0.shape[1] != nodes): raise (RuntimeError, "L0 must be a square matrix with as many rows as nodes.") if (C0.shape[0] != nodes) or (C0.shape[1] != nodes): raise (RuntimeError, "C0 must be a square matrix with as many rows as nodes.") if (G0.shape[0] != nodes) or (G0.shape[1] != nodes): raise (RuntimeError, "G0 must be a square matrix with as many rows as nodes.") if (Rs.shape[0] != nodes) or (Rs.shape[1] != nodes): raise (RuntimeError, "Rs must be a square matrix with as many rows as nodes.") if (Gd.shape[0] != nodes) or (Gd.shape[1] != nodes): raise (RuntimeError, "Gd must be a square matrix with as many rows as nodes.") else: if G0 is None: G0 = 0.0 if Rs is None: Rs = 0.0 if Gd is None: Gd = 0.0 R0 = array((units.float(R0),)) L0 = array((units.float(L0),)) C0 = array((units.float(C0),)) G0 = array((units.float(G0),)) Rs = array((units.float(Rs),)) Gd = array((units.float(Gd),)) nodeNames = tuple([str(i) for i in iNodes] + [str(iRef)] + [str(i) for i in oNodes] + [str(oRef)]) simulator_.TLineW_.__init__(self, nodeNames, int(M), units.float(length), L0, C0, R0, G0, Rs, Gd, units.float(fgd), units.float(fK))
def __init__(self, iNodes, iRef, oNodes, oRef, length, R0, L0, C0, G0=None, Rs=None, Gd=None, fgd=1e100, fK=1e9, M=6): """ Arguments: iNodes -- list/tuple or single string of input nodes iRef -- name of the input refrence node oNodes -- list/tuple or single string of output nodes iRef -- name of the output refrence node length -- length of the t-line in meters R0 -- DC resistance matrix or float from single T-Line (ohm/m) L0 -- DC inductance matrix or float from single T-Line (H/m) C0 -- DC capacitance matrix or float from single T-Line (F/m) G0 -- (optional) DC shunt conductance matrix (S/m) Rs -- (optional) Skin-effect resistance matrix (Ohm/m*sqrt(Hz)) Gd -- (optional) Dielectric-loss conductance matrix (S/m*Hz) fgd -- (optional) Cut-Off for Dielectric loss (Hz) fK -- (optional) Cut-Off for T-Line Model (Hz) M -- (optional) Order of Approximation of Curve Fit (unitless) """ warnings.warn("W-Element Model not complete.") # Makes it possible to send a single string for a non-coupled T-Line if isinstance(iNodes, str): iNodes = (iNodes, ) if isinstance(oNodes, str): oNodes = (oNodes, ) if len(iNodes) != len(oNodes): raise (RuntimeError, "Must have the same number of input and output nodes.") nodes = len(iNodes) # Do some parameter checking here that is tough to do in C, also # create zeroed matracies if G and/or R aren't defined. if nodes > 1: if G0 is None: G0 = array(zeros((nodes, nodes))) if Rs is None: Rs = array(zeros((nodes, nodes))) if Gd is None: Gd = array(zeros((nodes, nodes))) R0 = array(units.floatList2D(R0)) L0 = array(units.floatList2D(L0)) C0 = array(units.floatList2D(C0)) G0 = array(units.floatList2D(G0)) Rs = array(units.floatList2D(Rs)) Gd = array(units.floatList2D(Gd)) if (R0.shape[0] != nodes) or (R0.shape[1] != nodes): raise ( RuntimeError, "R0 must be a square matrix with as many rows as nodes.") if (L0.shape[0] != nodes) or (L0.shape[1] != nodes): raise ( RuntimeError, "L0 must be a square matrix with as many rows as nodes.") if (C0.shape[0] != nodes) or (C0.shape[1] != nodes): raise ( RuntimeError, "C0 must be a square matrix with as many rows as nodes.") if (G0.shape[0] != nodes) or (G0.shape[1] != nodes): raise ( RuntimeError, "G0 must be a square matrix with as many rows as nodes.") if (Rs.shape[0] != nodes) or (Rs.shape[1] != nodes): raise ( RuntimeError, "Rs must be a square matrix with as many rows as nodes.") if (Gd.shape[0] != nodes) or (Gd.shape[1] != nodes): raise ( RuntimeError, "Gd must be a square matrix with as many rows as nodes.") else: if G0 is None: G0 = 0.0 if Rs is None: Rs = 0.0 if Gd is None: Gd = 0.0 R0 = array((units.float(R0), )) L0 = array((units.float(L0), )) C0 = array((units.float(C0), )) G0 = array((units.float(G0), )) Rs = array((units.float(Rs), )) Gd = array((units.float(Gd), )) nodeNames = tuple([str(i) for i in iNodes] + [str(iRef)] + [str(i) for i in oNodes] + [str(oRef)]) simulator_.TLineW_.__init__(self, nodeNames, int(M), units.float(length), L0, C0, R0, G0, Rs, Gd, units.float(fgd), units.float(fK))