def __init__(self, begin=0, end=0, radius=0, label="", init_dict=None): """Constructor of the class. Can be use in two ways : - __init__ (arg1 = 1, arg3 = 5) every parameters have name and default values for Matrix, None will initialise the property with an empty Matrix for pyleecan type, None will call the default constructor - __init__ (init_dict = d) d must be a dictionnary wiht every properties as keys ndarray or list can be given for Vector and Matrix object or dict can be given for pyleecan Object""" if init_dict is not None: # Initialisation by dict check_init_dict(init_dict, ["begin", "end", "radius", "label"]) # Overwrite default value with init_dict content if "begin" in list(init_dict.keys()): begin = init_dict["begin"] if "end" in list(init_dict.keys()): end = init_dict["end"] if "radius" in list(init_dict.keys()): radius = init_dict["radius"] if "label" in list(init_dict.keys()): label = init_dict["label"] # Initialisation by argument self.begin = begin self.end = end self.radius = radius # Call Arc init super(Arc1, self).__init__(label=label)
def __init__(self, matrix=None, f=None, H=None, init_dict=None): """Constructor of the class. Can be use in two ways : - __init__ (arg1 = 1, arg3 = 5) every parameters have name and default values for Matrix, None will initialise the property with an empty Matrix for pyleecan type, None will call the default constructor - __init__ (init_dict = d) d must be a dictionnary wiht every properties as keys ndarray or list can be given for Vector and Matrix object or dict can be given for pyleecan Object""" if init_dict is not None: # Initialisation by dict check_init_dict(init_dict, ["matrix", "f", "H"]) # Overwrite default value with init_dict content if "matrix" in list(init_dict.keys()): matrix = init_dict["matrix"] if "f" in list(init_dict.keys()): f = init_dict["f"] if "H" in list(init_dict.keys()): H = init_dict["H"] # Initialisation by argument # matrix can be None, a ndarray or a list set_array(self, "matrix", matrix) # f can be None, a ndarray or a list set_array(self, "f", f) # H can be None, a ndarray or a list set_array(self, "H", H) # Call BHCurve init super(BHCurveMat, self).__init__()
def __init__(self, rho=1, epsr=1, alpha=1, init_dict=None): """Constructor of the class. Can be use in two ways : - __init__ (arg1 = 1, arg3 = 5) every parameters have name and default values for Matrix, None will initialise the property with an empty Matrix for pyleecan type, None will call the default constructor - __init__ (init_dict = d) d must be a dictionnary wiht every properties as keys ndarray or list can be given for Vector and Matrix object or dict can be given for pyleecan Object""" if init_dict is not None: # Initialisation by dict check_init_dict(init_dict, ["rho", "epsr", "alpha"]) # Overwrite default value with init_dict content if "rho" in list(init_dict.keys()): rho = init_dict["rho"] if "epsr" in list(init_dict.keys()): epsr = init_dict["epsr"] if "alpha" in list(init_dict.keys()): alpha = init_dict["alpha"] # Initialisation by argument self.parent = None self.rho = rho self.epsr = epsr self.alpha = alpha # The class is frozen, for now it's impossible to add new properties self._freeze()
def __init__(self, radius=1, center=0, point_ref=0, label="", init_dict=None): """Constructor of the class. Can be use in two ways : - __init__ (arg1 = 1, arg3 = 5) every parameters have name and default values for Matrix, None will initialise the property with an empty Matrix for pyleecan type, None will call the default constructor - __init__ (init_dict = d) d must be a dictionnary wiht every properties as keys ndarray or list can be given for Vector and Matrix object or dict can be given for pyleecan Object""" if init_dict is not None: # Initialisation by dict check_init_dict(init_dict, ["radius", "center", "point_ref", "label"]) # Overwrite default value with init_dict content if "radius" in list(init_dict.keys()): radius = init_dict["radius"] if "center" in list(init_dict.keys()): center = init_dict["center"] if "point_ref" in list(init_dict.keys()): point_ref = init_dict["point_ref"] if "label" in list(init_dict.keys()): label = init_dict["label"] # Initialisation by argument self.radius = radius self.center = center # Call Surface init super(Circle, self).__init__(point_ref=point_ref, label=label)
def __init__(self, begin=0, center=0, angle=1.57079633, label="", init_dict=None): """Constructor of the class. Can be use in two ways : - __init__ (arg1 = 1, arg3 = 5) every parameters have name and default values for Matrix, None will initialise the property with an empty Matrix for pyleecan type, None will call the default constructor - __init__ (init_dict = d) d must be a dictionnary wiht every properties as keys ndarray or list can be given for Vector and Matrix object or dict can be given for pyleecan Object""" if init_dict is not None: # Initialisation by dict check_init_dict(init_dict, ["begin", "center", "angle", "label"]) # Overwrite default value with init_dict content if "begin" in list(init_dict.keys()): begin = init_dict["begin"] if "center" in list(init_dict.keys()): center = init_dict["center"] if "angle" in list(init_dict.keys()): angle = init_dict["angle"] if "label" in list(init_dict.keys()): label = init_dict["label"] # Initialisation by argument self.begin = begin self.center = center self.angle = angle # Call Arc init super(Arc2, self).__init__(label=label)
def __init__(self, Alpha0=0, D0=1, H0=1, Zh=36, mat_void=-1, init_dict=None): """Constructor of the class. Can be use in two ways : - __init__ (arg1 = 1, arg3 = 5) every parameters have name and default values for Matrix, None will initialise the property with an empty Matrix for pyleecan type, None will call the default constructor - __init__ (init_dict = d) d must be a dictionnary wiht every properties as keys ndarray or list can be given for Vector and Matrix object or dict can be given for pyleecan Object""" if mat_void == -1: mat_void = Material() if init_dict is not None: # Initialisation by dict check_init_dict(init_dict, ["Alpha0", "D0", "H0", "Zh", "mat_void"]) # Overwrite default value with init_dict content if "Alpha0" in list(init_dict.keys()): Alpha0 = init_dict["Alpha0"] if "D0" in list(init_dict.keys()): D0 = init_dict["D0"] if "H0" in list(init_dict.keys()): H0 = init_dict["H0"] if "Zh" in list(init_dict.keys()): Zh = init_dict["Zh"] if "mat_void" in list(init_dict.keys()): mat_void = init_dict["mat_void"] # Initialisation by argument self.Alpha0 = Alpha0 self.D0 = D0 self.H0 = H0 # Call Hole init super(VentilationCirc, self).__init__(Zh=Zh, mat_void=mat_void)
def __init__(self, sin_list=list(), is_transpose=False, init_dict=None): """Constructor of the class. Can be use in two ways : - __init__ (arg1 = 1, arg3 = 5) every parameters have name and default values for Matrix, None will initialise the property with an empty Matrix for pyleecan type, None will call the default constructor - __init__ (init_dict = d) d must be a dictionnary wiht every properties as keys ndarray or list can be given for Vector and Matrix object or dict can be given for pyleecan Object""" if init_dict is not None: # Initialisation by dict check_init_dict(init_dict, ["sin_list", "is_transpose"]) # Overwrite default value with init_dict content if "sin_list" in list(init_dict.keys()): sin_list = init_dict["sin_list"] if "is_transpose" in list(init_dict.keys()): is_transpose = init_dict["is_transpose"] # Initialisation by argument # sin_list can be None or a list of ImportGenVectSin object self.sin_list = list() if type(sin_list) is list: for obj in sin_list: if obj is None: # Default value self.sin_list.append(ImportGenVectSin()) elif isinstance(obj, dict): self.sin_list.append(ImportGenVectSin(init_dict=obj)) else: self.sin_list.append(obj) elif sin_list is None: self.sin_list = list() else: self.sin_list = sin_list # Call ImportMatrix init super(ImportGenMatrixSin, self).__init__(is_transpose=is_transpose)
def __init__( self, coordinate=None, nb_node=0, tag=None, delta=1e-10, init_dict=None ): """Constructor of the class. Can be use in two ways : - __init__ (arg1 = 1, arg3 = 5) every parameters have name and default values for Matrix, None will initialise the property with an empty Matrix for pyleecan type, None will call the default constructor - __init__ (init_dict = d) d must be a dictionnary wiht every properties as keys ndarray or list can be given for Vector and Matrix object or dict can be given for pyleecan Object""" if init_dict is not None: # Initialisation by dict check_init_dict(init_dict, ["coordinate", "nb_node", "tag", "delta"]) # Overwrite default value with init_dict content if "coordinate" in list(init_dict.keys()): coordinate = init_dict["coordinate"] if "nb_node" in list(init_dict.keys()): nb_node = init_dict["nb_node"] if "tag" in list(init_dict.keys()): tag = init_dict["tag"] if "delta" in list(init_dict.keys()): delta = init_dict["delta"] # Initialisation by argument # coordinate can be None, a ndarray or a list set_array(self, "coordinate", coordinate) self.nb_node = nb_node # tag can be None, a ndarray or a list set_array(self, "tag", tag) self.delta = delta # Call Node init super(NodeMat, self).__init__()
def __init__(self, mat_type=-1, type_magnetization=0, Lmag=0.95, init_dict=None): """Constructor of the class. Can be use in two ways : - __init__ (arg1 = 1, arg3 = 5) every parameters have name and default values for Matrix, None will initialise the property with an empty Matrix for pyleecan type, None will call the default constructor - __init__ (init_dict = d) d must be a dictionnary wiht every properties as keys ndarray or list can be given for Vector and Matrix object or dict can be given for pyleecan Object""" if mat_type == -1: mat_type = Material() if init_dict is not None: # Initialisation by dict check_init_dict(init_dict, ["mat_type", "type_magnetization", "Lmag"]) # Overwrite default value with init_dict content if "mat_type" in list(init_dict.keys()): mat_type = init_dict["mat_type"] if "type_magnetization" in list(init_dict.keys()): type_magnetization = init_dict["type_magnetization"] if "Lmag" in list(init_dict.keys()): Lmag = init_dict["Lmag"] # Initialisation by argument # Call Magnet init super(MagnetFlat, self).__init__(mat_type=mat_type, type_magnetization=type_magnetization, Lmag=Lmag)
def __init__( self, Hbar=0.01, Wbar=0.01, Wins=0, cond_mat=-1, ins_mat=-1, init_dict=None ): """Constructor of the class. Can be use in two ways : - __init__ (arg1 = 1, arg3 = 5) every parameters have name and default values for Matrix, None will initialise the property with an empty Matrix for pyleecan type, None will call the default constructor - __init__ (init_dict = d) d must be a dictionnary wiht every properties as keys ndarray or list can be given for Vector and Matrix object or dict can be given for pyleecan Object""" if cond_mat == -1: cond_mat = Material() if ins_mat == -1: ins_mat = Material() if init_dict is not None: # Initialisation by dict check_init_dict(init_dict, ["Hbar", "Wbar", "Wins", "cond_mat", "ins_mat"]) # Overwrite default value with init_dict content if "Hbar" in list(init_dict.keys()): Hbar = init_dict["Hbar"] if "Wbar" in list(init_dict.keys()): Wbar = init_dict["Wbar"] if "Wins" in list(init_dict.keys()): Wins = init_dict["Wins"] if "cond_mat" in list(init_dict.keys()): cond_mat = init_dict["cond_mat"] if "ins_mat" in list(init_dict.keys()): ins_mat = init_dict["ins_mat"] # Initialisation by argument self.Hbar = Hbar self.Wbar = Wbar self.Wins = Wins # Call Conductor init super(CondType21, self).__init__(cond_mat=cond_mat, ins_mat=ins_mat)
def __init__(self, angle=1, height=1, point_ref=0, label="", init_dict=None): """Constructor of the class. Can be use in two ways : - __init__ (arg1 = 1, arg3 = 5) every parameters have name and default values for Matrix, None will initialise the property with an empty Matrix for pyleecan type, None will call the default constructor - __init__ (init_dict = d) d must be a dictionnary wiht every properties as keys ndarray or list can be given for Vector and Matrix object or dict can be given for pyleecan Object""" if init_dict is not None: # Initialisation by dict check_init_dict(init_dict, ["angle", "height", "point_ref", "label"]) # Overwrite default value with init_dict content if "angle" in list(init_dict.keys()): angle = init_dict["angle"] if "height" in list(init_dict.keys()): height = init_dict["height"] if "point_ref" in list(init_dict.keys()): point_ref = init_dict["point_ref"] if "label" in list(init_dict.keys()): label = init_dict["label"] # Initialisation by argument self.angle = angle self.height = height # Call Surface init super(PolarArc, self).__init__(point_ref=point_ref, label=label)
def __init__( self, Wwire=0.015, Wins_cond=0.015, Nwppc=1, Wins_wire=0, Kwoh=0.5, cond_mat=-1, ins_mat=-1, init_dict=None, ): """Constructor of the class. Can be use in two ways : - __init__ (arg1 = 1, arg3 = 5) every parameters have name and default values for Matrix, None will initialise the property with an empty Matrix for pyleecan type, None will call the default constructor - __init__ (init_dict = d) d must be a dictionnary wiht every properties as keys ndarray or list can be given for Vector and Matrix object or dict can be given for pyleecan Object""" if cond_mat == -1: cond_mat = Material() if ins_mat == -1: ins_mat = Material() if init_dict is not None: # Initialisation by dict check_init_dict( init_dict, [ "Wwire", "Wins_cond", "Nwppc", "Wins_wire", "Kwoh", "cond_mat", "ins_mat", ], ) # Overwrite default value with init_dict content if "Wwire" in list(init_dict.keys()): Wwire = init_dict["Wwire"] if "Wins_cond" in list(init_dict.keys()): Wins_cond = init_dict["Wins_cond"] if "Nwppc" in list(init_dict.keys()): Nwppc = init_dict["Nwppc"] if "Wins_wire" in list(init_dict.keys()): Wins_wire = init_dict["Wins_wire"] if "Kwoh" in list(init_dict.keys()): Kwoh = init_dict["Kwoh"] if "cond_mat" in list(init_dict.keys()): cond_mat = init_dict["cond_mat"] if "ins_mat" in list(init_dict.keys()): ins_mat = init_dict["ins_mat"] # Initialisation by argument self.Wwire = Wwire self.Wins_cond = Wins_cond self.Nwppc = Nwppc self.Wins_wire = Wins_wire self.Kwoh = Kwoh # Call Conductor init super(CondType12, self).__init__(cond_mat=cond_mat, ins_mat=ins_mat)
def __init__(self, name="", desc="", machine=-1, input=-1, init_dict=None): """Constructor of the class. Can be use in two ways : - __init__ (arg1 = 1, arg3 = 5) every parameters have name and default values for Matrix, None will initialise the property with an empty Matrix for pyleecan type, None will call the default constructor - __init__ (init_dict = d) d must be a dictionnary wiht every properties as keys ndarray or list can be given for Vector and Matrix object or dict can be given for pyleecan Object""" if machine == -1: machine = Machine() if input == -1: input = Input() if init_dict is not None: # Initialisation by dict check_init_dict(init_dict, ["name", "desc", "machine", "input"]) # Overwrite default value with init_dict content if "name" in list(init_dict.keys()): name = init_dict["name"] if "desc" in list(init_dict.keys()): desc = init_dict["desc"] if "machine" in list(init_dict.keys()): machine = init_dict["machine"] if "input" in list(init_dict.keys()): input = init_dict["input"] # Initialisation by argument # Call Simulation init super(Simu1, self).__init__(name=name, desc=desc, machine=machine, input=input)
def __init__(self, Zh=36, mat_void=-1, init_dict=None): """Constructor of the class. Can be use in two ways : - __init__ (arg1 = 1, arg3 = 5) every parameters have name and default values for Matrix, None will initialise the property with an empty Matrix for pyleecan type, None will call the default constructor - __init__ (init_dict = d) d must be a dictionnary wiht every properties as keys ndarray or list can be given for Vector and Matrix object or dict can be given for pyleecan Object""" if mat_void == -1: mat_void = Material() if init_dict is not None: # Initialisation by dict check_init_dict(init_dict, ["Zh", "mat_void"]) # Overwrite default value with init_dict content if "Zh" in list(init_dict.keys()): Zh = init_dict["Zh"] if "mat_void" in list(init_dict.keys()): mat_void = init_dict["mat_void"] # Initialisation by argument self.parent = None self.Zh = Zh # mat_void can be None, a Material object or a dict if isinstance(mat_void, dict): self.mat_void = Material(init_dict=mat_void) else: self.mat_void = mat_void # The class is frozen, for now it's impossible to add new properties self._freeze()
def __init__( self, W0=0.013, H0=0.02, W1=0.01, Wx_is_rad=False, Zs=36, init_dict=None ): """Constructor of the class. Can be use in two ways : - __init__ (arg1 = 1, arg3 = 5) every parameters have name and default values for Matrix, None will initialise the property with an empty Matrix for pyleecan type, None will call the default constructor - __init__ (init_dict = d) d must be a dictionnary wiht every properties as keys ndarray or list can be given for Vector and Matrix object or dict can be given for pyleecan Object""" if init_dict is not None: # Initialisation by dict check_init_dict(init_dict, ["W0", "H0", "W1", "Wx_is_rad", "Zs"]) # Overwrite default value with init_dict content if "W0" in list(init_dict.keys()): W0 = init_dict["W0"] if "H0" in list(init_dict.keys()): H0 = init_dict["H0"] if "W1" in list(init_dict.keys()): W1 = init_dict["W1"] if "Wx_is_rad" in list(init_dict.keys()): Wx_is_rad = init_dict["Wx_is_rad"] if "Zs" in list(init_dict.keys()): Zs = init_dict["Zs"] # Initialisation by argument self.W0 = W0 self.H0 = H0 self.W1 = W1 self.Wx_is_rad = Wx_is_rad # Call Slot init super(Slot19, self).__init__(Zs=Zs)
def __init__(self, B=None, H=None, mu=None, init_dict=None): """Constructor of the class. Can be use in two ways : - __init__ (arg1 = 1, arg3 = 5) every parameters have name and default values for Matrix, None will initialise the property with an empty Matrix for pyleecan type, None will call the default constructor - __init__ (init_dict = d) d must be a dictionnary wiht every properties as keys ndarray or list can be given for Vector and Matrix object or dict can be given for pyleecan Object""" if init_dict is not None: # Initialisation by dict check_init_dict(init_dict, ["B", "H", "mu"]) # Overwrite default value with init_dict content if "B" in list(init_dict.keys()): B = init_dict["B"] if "H" in list(init_dict.keys()): H = init_dict["H"] if "mu" in list(init_dict.keys()): mu = init_dict["mu"] # Initialisation by argument # B can be None, a ndarray or a list set_array(self, "B", B) # H can be None, a ndarray or a list set_array(self, "H", H) # mu can be None, a ndarray or a list set_array(self, "mu", mu) # Call Solution init super(SolutionFEMM, self).__init__()
def __init__( self, W0=0.0122, W3=0.0122, H0=0.001, H2=0.0122, R1=0.001, Zs=36, init_dict=None ): """Constructor of the class. Can be use in two ways : - __init__ (arg1 = 1, arg3 = 5) every parameters have name and default values for Matrix, None will initialise the property with an empty Matrix for pyleecan type, None will call the default constructor - __init__ (init_dict = d) d must be a dictionnary wiht every properties as keys ndarray or list can be given for Vector and Matrix object or dict can be given for pyleecan Object""" if init_dict is not None: # Initialisation by dict check_init_dict(init_dict, ["W0", "W3", "H0", "H2", "R1", "Zs"]) # Overwrite default value with init_dict content if "W0" in list(init_dict.keys()): W0 = init_dict["W0"] if "W3" in list(init_dict.keys()): W3 = init_dict["W3"] if "H0" in list(init_dict.keys()): H0 = init_dict["H0"] if "H2" in list(init_dict.keys()): H2 = init_dict["H2"] if "R1" in list(init_dict.keys()): R1 = init_dict["R1"] if "Zs" in list(init_dict.keys()): Zs = init_dict["Zs"] # Initialisation by argument self.W0 = W0 self.W3 = W3 self.H0 = H0 self.H2 = H2 self.R1 = R1 # Call SlotWind init super(SlotW16, self).__init__(Zs=Zs)
def __init__(self, Hc=1, alpha_Br=0, Brm20=1, mur_lin=1, init_dict=None): """Constructor of the class. Can be use in two ways : - __init__ (arg1 = 1, arg3 = 5) every parameters have name and default values for Matrix, None will initialise the property with an empty Matrix for pyleecan type, None will call the default constructor - __init__ (init_dict = d) d must be a dictionnary wiht every properties as keys ndarray or list can be given for Vector and Matrix object or dict can be given for pyleecan Object""" if init_dict is not None: # Initialisation by dict check_init_dict(init_dict, ["Hc", "alpha_Br", "Brm20", "mur_lin"]) # Overwrite default value with init_dict content if "Hc" in list(init_dict.keys()): Hc = init_dict["Hc"] if "alpha_Br" in list(init_dict.keys()): alpha_Br = init_dict["alpha_Br"] if "Brm20" in list(init_dict.keys()): Brm20 = init_dict["Brm20"] if "mur_lin" in list(init_dict.keys()): mur_lin = init_dict["mur_lin"] # Initialisation by argument self.Hc = Hc self.alpha_Br = alpha_Br self.Brm20 = Brm20 # Call MatMagnetics init super(MatMagnet, self).__init__(mur_lin=mur_lin)
def __init__(self, mat_type=-1, type_magnetization=0, Lmag=0.95, init_dict=None): """Constructor of the class. Can be use in two ways : - __init__ (arg1 = 1, arg3 = 5) every parameters have name and default values for Matrix, None will initialise the property with an empty Matrix for pyleecan type, None will call the default constructor - __init__ (init_dict = d) d must be a dictionnary wiht every properties as keys ndarray or list can be given for Vector and Matrix object or dict can be given for pyleecan Object""" if mat_type == -1: mat_type = Material() if init_dict is not None: # Initialisation by dict check_init_dict(init_dict, ["mat_type", "type_magnetization", "Lmag"]) # Overwrite default value with init_dict content if "mat_type" in list(init_dict.keys()): mat_type = init_dict["mat_type"] if "type_magnetization" in list(init_dict.keys()): type_magnetization = init_dict["type_magnetization"] if "Lmag" in list(init_dict.keys()): Lmag = init_dict["Lmag"] # Initialisation by argument self.parent = None # mat_type can be None, a Material object or a dict if isinstance(mat_type, dict): self.mat_type = Material(init_dict=mat_type) else: self.mat_type = mat_type self.type_magnetization = type_magnetization self.Lmag = Lmag # The class is frozen, for now it's impossible to add new properties self._freeze()
def __init__(self, Bmax=1.5, mur_0=8585, mur_1=21.79, a=0.255, init_dict=None): """Constructor of the class. Can be use in two ways : - __init__ (arg1 = 1, arg3 = 5) every parameters have name and default values for Matrix, None will initialise the property with an empty Matrix for pyleecan type, None will call the default constructor - __init__ (init_dict = d) d must be a dictionnary wiht every properties as keys ndarray or list can be given for Vector and Matrix object or dict can be given for pyleecan Object""" if init_dict is not None: # Initialisation by dict check_init_dict(init_dict, ["Bmax", "mur_0", "mur_1", "a"]) # Overwrite default value with init_dict content if "Bmax" in list(init_dict.keys()): Bmax = init_dict["Bmax"] if "mur_0" in list(init_dict.keys()): mur_0 = init_dict["mur_0"] if "mur_1" in list(init_dict.keys()): mur_1 = init_dict["mur_1"] if "a" in list(init_dict.keys()): a = init_dict["a"] # Initialisation by argument self.Bmax = Bmax self.mur_0 = mur_0 self.mur_1 = mur_1 self.a = a # Call BHCurve init super(BHCurveParam, self).__init__()
def __init__(self, unit=-1, init_dict=None): """Constructor of the class. Can be use in two ways : - __init__ (arg1 = 1, arg3 = 5) every parameters have name and default values for Matrix, None will initialise the property with an empty Matrix for pyleecan type, None will call the default constructor - __init__ (init_dict = d) d must be a dictionnary wiht every properties as keys ndarray or list can be given for Vector and Matrix object or dict can be given for pyleecan Object""" if unit == -1: unit = Unit() if init_dict is not None: # Initialisation by dict check_init_dict(init_dict, ["unit"]) # Overwrite default value with init_dict content if "unit" in list(init_dict.keys()): unit = init_dict["unit"] # Initialisation by argument self.parent = None # unit can be None, a Unit object or a dict if isinstance(unit, dict): self.unit = Unit(init_dict=unit) else: self.unit = unit # The class is frozen, for now it's impossible to add new properties self._freeze()
def __init__( self, rotor=-1, stator=-1, frame=-1, shaft=-1, name="default_machine", desc="", type_machine=1, init_dict=None, ): """Constructor of the class. Can be use in two ways : - __init__ (arg1 = 1, arg3 = 5) every parameters have name and default values for Matrix, None will initialise the property with an empty Matrix for pyleecan type, None will call the default constructor - __init__ (init_dict = d) d must be a dictionnary wiht every properties as keys ndarray or list can be given for Vector and Matrix object or dict can be given for pyleecan Object""" if rotor == -1: rotor = Lamination() if stator == -1: stator = Lamination() if frame == -1: frame = Frame() if shaft == -1: shaft = Shaft() if init_dict is not None: # Initialisation by dict check_init_dict( init_dict, ["rotor", "stator", "frame", "shaft", "name", "desc", "type_machine"], ) # Overwrite default value with init_dict content if "rotor" in list(init_dict.keys()): rotor = init_dict["rotor"] if "stator" in list(init_dict.keys()): stator = init_dict["stator"] if "frame" in list(init_dict.keys()): frame = init_dict["frame"] if "shaft" in list(init_dict.keys()): shaft = init_dict["shaft"] if "name" in list(init_dict.keys()): name = init_dict["name"] if "desc" in list(init_dict.keys()): desc = init_dict["desc"] if "type_machine" in list(init_dict.keys()): type_machine = init_dict["type_machine"] # Initialisation by argument # Call MachineDFIM init super(MachineSCIM, self).__init__( rotor=rotor, stator=stator, frame=frame, shaft=shaft, name=name, desc=desc, type_machine=type_machine, )
def __init__( self, mag=-1, struct=-1, name="", desc="", machine=-1, input=-1, init_dict=None ): """Constructor of the class. Can be use in two ways : - __init__ (arg1 = 1, arg3 = 5) every parameters have name and default values for Matrix, None will initialise the property with an empty Matrix for pyleecan type, None will call the default constructor - __init__ (init_dict = d) d must be a dictionnary wiht every properties as keys ndarray or list can be given for Vector and Matrix object or dict can be given for pyleecan Object""" if mag == -1: mag = Magnetics() if struct == -1: struct = Structural() if machine == -1: machine = Machine() if input == -1: input = Input() if init_dict is not None: # Initialisation by dict check_init_dict( init_dict, ["mag", "struct", "name", "desc", "machine", "input"] ) # Overwrite default value with init_dict content if "mag" in list(init_dict.keys()): mag = init_dict["mag"] if "struct" in list(init_dict.keys()): struct = init_dict["struct"] if "name" in list(init_dict.keys()): name = init_dict["name"] if "desc" in list(init_dict.keys()): desc = init_dict["desc"] if "machine" in list(init_dict.keys()): machine = init_dict["machine"] if "input" in list(init_dict.keys()): input = init_dict["input"] # Initialisation by argument # mag can be None, a Magnetics object or a dict if isinstance(mag, dict): # Check that the type is correct (including daughter) class_name = mag.get("__class__") if class_name not in ["Magnetics", "MagFEMM"]: raise InitUnKnowClassError( "Unknow class name " + class_name + " in init_dict for mag" ) # Dynamic import to call the correct constructor module = __import__("pyleecan.Classes." + class_name, fromlist=[class_name]) class_obj = getattr(module, class_name) self.mag = class_obj(init_dict=mag) else: self.mag = mag # struct can be None, a Structural object or a dict if isinstance(struct, dict): self.struct = Structural(init_dict=struct) else: self.struct = struct # Call Simulation init super(Simu1, self).__init__(name=name, desc=desc, machine=machine, input=input)
def __init__( self, mag=-1, struct=-1, name="", desc="", machine=-1, input=-1, init_dict=None ): """Constructor of the class. Can be use in two ways : - __init__ (arg1 = 1, arg3 = 5) every parameters have name and default values for Matrix, None will initialise the property with an empty Matrix for pyleecan type, None will call the default constructor - __init__ (init_dict = d) d must be a dictionnary wiht every properties as keys ndarray or list can be given for Vector and Matrix object or dict can be given for pyleecan Object""" if mag == -1: mag = Magnetics() if struct == -1: struct = Structural() if machine == -1: machine = Machine() if input == -1: input = Input() if init_dict is not None: # Initialisation by dict check_init_dict( init_dict, ["mag", "struct", "name", "desc", "machine", "input"] ) # Overwrite default value with init_dict content if "mag" in list(init_dict.keys()): mag = init_dict["mag"] if "struct" in list(init_dict.keys()): struct = init_dict["struct"] if "name" in list(init_dict.keys()): name = init_dict["name"] if "desc" in list(init_dict.keys()): desc = init_dict["desc"] if "machine" in list(init_dict.keys()): machine = init_dict["machine"] if "input" in list(init_dict.keys()): input = init_dict["input"] # Initialisation by argument # mag can be None, a Magnetics object or a dict if isinstance(mag, dict): # Call the correct constructor according to the dict load_dict = {"MagFEMM": MagFEMM, "Magnetics": Magnetics} obj_class = mag.get("__class__") if obj_class is None: self.mag = Magnetics(init_dict=mag) elif obj_class in list(load_dict.keys()): self.mag = load_dict[obj_class](init_dict=mag) else: # Avoid generation error or wrong modification in json raise InitUnKnowClassError("Unknow class name in init_dict for mag") else: self.mag = mag # struct can be None, a Structural object or a dict if isinstance(struct, dict): self.struct = Structural(init_dict=struct) else: self.struct = struct # Call Simulation init super(Simu1, self).__init__(name=name, desc=desc, machine=machine, input=input)
def __init__(self, line_list=list(), point_ref=0, label="", init_dict=None): """Constructor of the class. Can be use in two ways : - __init__ (arg1 = 1, arg3 = 5) every parameters have name and default values for Matrix, None will initialise the property with an empty Matrix for pyleecan type, None will call the default constructor - __init__ (init_dict = d) d must be a dictionnary wiht every properties as keys ndarray or list can be given for Vector and Matrix object or dict can be given for pyleecan Object""" if init_dict is not None: # Initialisation by dict check_init_dict(init_dict, ["line_list", "point_ref", "label"]) # Overwrite default value with init_dict content if "line_list" in list(init_dict.keys()): line_list = init_dict["line_list"] if "point_ref" in list(init_dict.keys()): point_ref = init_dict["point_ref"] if "label" in list(init_dict.keys()): label = init_dict["label"] # Initialisation by argument # line_list can be None or a list of Line object self.line_list = list() if type(line_list) is list: for obj in line_list: if obj is None: # Default value self.line_list.append(Line()) elif isinstance(obj, dict): # Call the correct constructor according to the dict load_dict = { "Segment": Segment, "Arc1": Arc1, "Arc2": Arc2, "Arc3": Arc3, "Arc": Arc, "Line": Line, } obj_class = obj.get("__class__") if obj_class is None: self.line_list.append(Line(init_dict=obj)) elif obj_class in list(load_dict.keys()): self.line_list.append( load_dict[obj_class](init_dict=obj)) else: # Avoid generation error or wrong modification in json raise InitUnKnowClassError( "Unknow class name in init_dict for line_list") else: self.line_list.append(obj) elif line_list is None: self.line_list = list() else: self.line_list = line_list # Call Surface init super(SurfLine, self).__init__(point_ref=point_ref, label=label)
def __init__(self, line_list=list(), point_ref=0, label="", init_dict=None): """Constructor of the class. Can be use in two ways : - __init__ (arg1 = 1, arg3 = 5) every parameters have name and default values for Matrix, None will initialise the property with an empty Matrix for pyleecan type, None will call the default constructor - __init__ (init_dict = d) d must be a dictionnary wiht every properties as keys ndarray or list can be given for Vector and Matrix object or dict can be given for pyleecan Object""" if init_dict is not None: # Initialisation by dict check_init_dict(init_dict, ["line_list", "point_ref", "label"]) # Overwrite default value with init_dict content if "line_list" in list(init_dict.keys()): line_list = init_dict["line_list"] if "point_ref" in list(init_dict.keys()): point_ref = init_dict["point_ref"] if "label" in list(init_dict.keys()): label = init_dict["label"] # Initialisation by argument # line_list can be None or a list of Line object self.line_list = list() if type(line_list) is list: for obj in line_list: if obj is None: # Default value self.line_list.append(Line()) elif isinstance(obj, dict): # Check that the type is correct (including daughter) class_name = obj.get("__class__") if class_name not in [ "Line", "Segment", "Arc1", "Arc2", "Arc3", "Arc", ]: raise InitUnKnowClassError( "Unknow class name " + class_name + " in init_dict for line_list") # Dynamic import to call the correct constructor module = __import__("pyleecan.Classes." + class_name, fromlist=[class_name]) class_obj = getattr(module, class_name) self.line_list.append(class_obj(init_dict=obj)) else: self.line_list.append(obj) elif line_list is None: self.line_list = list() else: self.line_list = line_list # Call Surface init super(SurfLine, self).__init__(point_ref=point_ref, label=label)
def __init__( self, mesh=None, parent_elem=None, parent_node=None, group_number=None, init_dict=None, ): """Constructor of the class. Can be use in two ways : - __init__ (arg1 = 1, arg3 = 5) every parameters have name and default values for Matrix, None will initialise the property with an empty Matrix for pyleecan type, None will call the default constructor - __init__ (init_dict = d) d must be a dictionnary wiht every properties as keys ndarray or list can be given for Vector and Matrix object or dict can be given for pyleecan Object""" if mesh == -1: mesh = Mesh() if init_dict is not None: # Initialisation by dict check_init_dict( init_dict, ["mesh", "parent_elem", "parent_node", "group_number"]) # Overwrite default value with init_dict content if "mesh" in list(init_dict.keys()): mesh = init_dict["mesh"] if "parent_elem" in list(init_dict.keys()): parent_elem = init_dict["parent_elem"] if "parent_node" in list(init_dict.keys()): parent_node = init_dict["parent_node"] if "group_number" in list(init_dict.keys()): group_number = init_dict["group_number"] # Initialisation by argument self.parent = None # mesh can be None, a Mesh object or a dict if isinstance(mesh, dict): # Check that the type is correct (including daughter) class_name = mesh.get("__class__") if class_name not in ["Mesh", "MeshFEMM", "MeshMat", "MeshForce"]: raise InitUnKnowClassError("Unknow class name " + class_name + " in init_dict for mesh") # Dynamic import to call the correct constructor module = __import__("pyleecan.Classes." + class_name, fromlist=[class_name]) class_obj = getattr(module, class_name) self.mesh = class_obj(init_dict=mesh) else: self.mesh = mesh # parent_elem can be None, a ndarray or a list set_array(self, "parent_elem", parent_elem) # parent_node can be None, a ndarray or a list set_array(self, "parent_node", parent_node) # group_number can be None, a ndarray or a list set_array(self, "group_number", group_number) # The class is frozen, for now it's impossible to add new properties self._freeze()
def __init__(self, element=None, node=None, submesh=list(), init_dict=None): """Constructor of the class. Can be use in two ways : - __init__ (arg1 = 1, arg3 = 5) every parameters have name and default values for Matrix, None will initialise the property with an empty Matrix for pyleecan type, None will call the default constructor - __init__ (init_dict = d) d must be a dictionnary wiht every properties as keys ndarray or list can be given for Vector and Matrix object or dict can be given for pyleecan Object""" if element == -1: element = Element() if node == -1: node = Node() if init_dict is not None: # Initialisation by dict check_init_dict(init_dict, ["element", "node", "submesh"]) # Overwrite default value with init_dict content if "element" in list(init_dict.keys()): element = init_dict["element"] if "node" in list(init_dict.keys()): node = init_dict["node"] if "submesh" in list(init_dict.keys()): submesh = init_dict["submesh"] # Initialisation by argument self.parent = None # element can be None, a Element object or a dict if isinstance(element, dict): self.element = Element(init_dict=element) else: self.element = element # node can be None, a Node object or a dict if isinstance(node, dict): self.node = Node(init_dict=node) else: self.node = node # submesh can be None or a list of Mesh object self.submesh = list() if type(submesh) is list: for obj in submesh: if obj is None: # Default value self.submesh.append(Mesh()) elif isinstance(obj, dict): self.submesh.append(Mesh(init_dict=obj)) else: self.submesh.append(obj) elif submesh is None: self.submesh = list() else: self.submesh = submesh # The class is frozen, for now it's impossible to add new properties self._freeze()
def __init__( self, W1=0.02, W2=0.03, H1=0.05, H2=0.15, R1=0.03, H3=0, H4=0, W3=0, Zs=36, init_dict=None, ): """Constructor of the class. Can be use in two ways : - __init__ (arg1 = 1, arg3 = 5) every parameters have name and default values for Matrix, None will initialise the property with an empty Matrix for pyleecan type, None will call the default constructor - __init__ (init_dict = d) d must be a dictionnary wiht every properties as keys ndarray or list can be given for Vector and Matrix object or dict can be given for pyleecan Object""" if init_dict is not None: # Initialisation by dict check_init_dict( init_dict, ["W1", "W2", "H1", "H2", "R1", "H3", "H4", "W3", "Zs"] ) # Overwrite default value with init_dict content if "W1" in list(init_dict.keys()): W1 = init_dict["W1"] if "W2" in list(init_dict.keys()): W2 = init_dict["W2"] if "H1" in list(init_dict.keys()): H1 = init_dict["H1"] if "H2" in list(init_dict.keys()): H2 = init_dict["H2"] if "R1" in list(init_dict.keys()): R1 = init_dict["R1"] if "H3" in list(init_dict.keys()): H3 = init_dict["H3"] if "H4" in list(init_dict.keys()): H4 = init_dict["H4"] if "W3" in list(init_dict.keys()): W3 = init_dict["W3"] if "Zs" in list(init_dict.keys()): Zs = init_dict["Zs"] # Initialisation by argument self.W1 = W1 self.W2 = W2 self.H1 = H1 self.H2 = H2 self.R1 = R1 self.H3 = H3 self.H4 = H4 self.W3 = W3 # Call SlotWind init super(SlotW60, self).__init__(Zs=Zs)
def __init__(self, geo=-1, elec=-1, simu=-1, init_dict=None): """Constructor of the class. Can be use in two ways : - __init__ (arg1 = 1, arg3 = 5) every parameters have name and default values for Matrix, None will initialise the property with an empty Matrix for pyleecan type, None will call the default constructor - __init__ (init_dict = d) d must be a dictionnary wiht every properties as keys ndarray or list can be given for Vector and Matrix object or dict can be given for pyleecan Object""" if geo == -1: geo = OutGeo() if elec == -1: elec = OutElec() if simu == -1: simu = Simulation() if init_dict is not None: # Initialisation by dict check_init_dict(init_dict, ["geo", "elec", "simu"]) # Overwrite default value with init_dict content if "geo" in list(init_dict.keys()): geo = init_dict["geo"] if "elec" in list(init_dict.keys()): elec = init_dict["elec"] if "simu" in list(init_dict.keys()): simu = init_dict["simu"] # Initialisation by argument self.parent = None # geo can be None, a OutGeo object or a dict if isinstance(geo, dict): self.geo = OutGeo(init_dict=geo) else: self.geo = geo # elec can be None, a OutElec object or a dict if isinstance(elec, dict): self.elec = OutElec(init_dict=elec) else: self.elec = elec # simu can be None, a Simulation object or a dict if isinstance(simu, dict): # Call the correct constructor according to the dict load_dict = {"Simu1": Simu1, "Simulation": Simulation} obj_class = simu.get("__class__") if obj_class is None: self.simu = Simulation(init_dict=simu) elif obj_class in list(load_dict.keys()): self.simu = load_dict[obj_class](init_dict=simu) else: # Avoid generation error or wrong modification in json raise InitUnKnowClassError( "Unknow class name in init_dict for simu") else: self.simu = simu # The class is frozen, for now it's impossible to add new properties self._freeze()