示例#1
0
    def affectation_materiaux(self):
        """Méthode permettant d'attribuer la propriété des matériaux"""

        # Affectation de l'air (x,y)
        femm.mi_addmaterial('Air', 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0)
        femm.mi_addblocklabel(0, 0)
        femm.mi_selectlabel(0, 0)
        femm.mi_setblockprop('Air', 0, 1, '<None>', 0, 0, 0)
        femm.mi_clearselected()

        # Affectation du Cuivre (bobine positive) (Attention J en A/mm²)
        femm.mi_addmaterial('Cuivre-', 1, 1, 0,
                            -self.k_b * self.j_max * 1.0e-6, 0, 0, 0, 0, 0, 0,
                            0)
        femm.mi_addblocklabel(self.largeur / 4, 0)
        femm.mi_selectlabel(self.largeur / 4, 0)
        femm.mi_setblockprop('Cuivre-', 0, 1, 'incricuit', 0, 0, 0)
        femm.mi_clearselected()

        # Affectation du Cuivre (bobine négative)
        femm.mi_addmaterial('Cuivre+', 1, 1, 0, self.k_b * self.j_max * 1.0e-6,
                            0, 0, 0, 0, 0, 0, 0)
        femm.mi_addblocklabel(-self.largeur / 4, 0)
        femm.mi_selectlabel(-self.largeur / 4, 0)
        femm.mi_setblockprop('Cuivre+', 0, 1, 'incircuit', 0, 0, 0)
        femm.mi_clearselected()

        # Matériau non linéaire

        # Création d'un matériau linéaire
        femm.mi_addmaterial('Iron', 2100, 2100, 0, 0, 0, 0, 0, 0, 0, 0, 0)

        # Les points de la courbe BH
        bdata = [
            0.1, 0.2, 0.4, 0.7, 1., 1.2, 1.3, 1.4, 1.5, 1.55, 1.6, 1.65, 1.7
        ]
        hdata = [
            26.5, 37.8, 52.4, 71.9, 99.3, 136, 176, 279, 659, 1084, 1718, 2577,
            3670
        ]
        # Affectation des points de la courbe
        for n in range(0, len(bdata)):
            femm.mi_addbhpoint('Iron', bdata[n], hdata[n])

        # Les points de la courbe Pertes fer = f(B)
        pdata = [
            0.0176, 0.0683, 0.240, 0.602, 1.09, 1.51, 1.79, 2.14, 2.56, 2.77,
            2.96, 3.13, 3.29
        ]
        self._interp_pertes_fer = interp1d(bdata,
                                           pdata,
                                           bounds_error=False,
                                           fill_value=(pdata[0], pdata[-1]))

        # Affectation du matériau
        femm.mi_addblocklabel(self.largeur / 2 - self.l_dent / 4, 0)
        femm.mi_selectlabel(self.largeur / 2 - self.l_dent / 4, 0)
        femm.mi_setblockprop('Iron', 0, 1, '<None>', 0, 0, 0)
        femm.mi_clearselected()
    def affectation_materiaux(self):
        """Méthode permettant d'attribuer la propriété des matériaux"""

        # Affectation de l'air (x,y)
        femm.mi_addmaterial('Air', 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0)
        femm.mi_addblocklabel(0, 0)
        femm.mi_selectlabel(0, 0)
        femm.mi_setblockprop('Air', 0, 1, '<None>', 0, 0, 0)
        femm.mi_clearselected()

        # Affectation du Cuivre (bobine positive) (Attention J en A/mm²)
        femm.mi_addmaterial('Cuivre+', 1, 1, 0, self.k_b * self.j_max * 1.0e-6,
                            0, 0, 0, 0, 0, 0, 0)
        femm.mi_addblocklabel(self.largeur / 4, 0)
        femm.mi_selectlabel(self.largeur / 4, 0)
        femm.mi_setblockprop('Cuivre+', 0, 1, 'incricuit', 0, 0, 0)
        femm.mi_clearselected()

        # Affectation du Cuivre (bobine négative)
        femm.mi_addmaterial('Cuivre-', 1, 1, 0,
                            -self.k_b * self.j_max * 1.0e-6, 0, 0, 0, 0, 0, 0,
                            0)
        femm.mi_addblocklabel(-self.largeur / 4, 0)
        femm.mi_selectlabel(-self.largeur / 4, 0)
        femm.mi_setblockprop('Cuivre-', 0, 1, 'incircuit', 0, 0, 0)
        femm.mi_clearselected()

        # Matériau non linéaire

        # Création d'un matériau linéaire
        femm.mi_addmaterial('Iron', 2100, 2100, 0, 0, 0, 0, 0, 0, 0, 0, 0)

        # Les points de la courbe BH
        bdata = [
            0., 0.2, 0.4, 0.7, 1, 1.2, 1.3, 1.4, 1.5, 1.55, 1.6, 1.65, 1.7,
            1.8, 1.91, 2, 2.1, 3.2454
        ]

        hdata = [
            0., 31.9, 44.9, 67.3, 106., 164., 235., 435., 1109., 1813., 2802.,
            4054., 5592., 9711., 16044., 31319., 88491., 1000000.
        ]

        # Affectation des points de la courbe
        for n in range(0, len(bdata)):
            femm.mi_addbhpoint('Iron', bdata[n], hdata[n])

        # Affectation du matériau
        femm.mi_addblocklabel(self.largeur / 2 - self.l_dent / 4, 0)
        femm.mi_selectlabel(self.largeur / 2 - self.l_dent / 4, 0)
        femm.mi_setblockprop('Iron', 0, 1, '<None>', 0, 0, 0)
        femm.mi_clearselected()
    def add(self):

        #ensure materials don't get added to the analysis more than once
        if self.add_count < 1:
            H, B = np.loadtxt(self.file, unpack=True)

            fe.mi_addmaterial(self.name, 0, 0, 0, 0, 0, self.lam_thickness, 0,
                              self.fill_factor, 0, 0, 0, 0, 0)

            for b, h in zip(B, H):
                fe.mi_addbhpoint(self.name, b, h)

            self.add_count += 1
        else:
            pass
def create_FEMM_materials(
    machine,
    surf_list,
    Is,
    Ir,
    BHs,
    BHr,
    is_mmfs,
    is_mmfr,
    is_stator_linear_BH,
    is_rotor_linear_BH,
    is_eddies,
    j_t0,
):
    """Add materials in FEMM

    Parameters
    ----------
    machine : Machine
        the machine to simulate
    surf_list : list
        List of surface of the machine
    Is : ndarray
        Stator current matrix [A]
    Ir : ndarray
        Rotor current matrix [A]
    BHs: ndarray
        B(H) curve of the stator
    BHr: ndarray
        B(H) curve of the rotor
    is_mmfs : bool
        1 to compute the stator magnetomotive force/stator magnetic field
    is_mmfr : bool
        1 to compute the rotor magnetomotive force / rotor magnetic field
    is_stator_linear_BH: bool
        1 to use linear B(H) curve according to mur_lin, 0 to use the B(H) curve
    is_rotor_linear_BH: bool
        1 to use linear B(H) curve according to mur_lin, 0 to use the B(H) curve
    is_eddies : bool
        1 to calculate eddy currents
    jt_0 : int
        Current time step for winding calculation
    
    Returns
    -------
    Tuple: dict, list
        Dictionary of properties and list containing the name of the circuits created
    """

    prop_dict = dict()  # Initialisation of the dictionnary to return

    rotor = machine.rotor
    stator = machine.stator

    materials = list()
    circuits = list()
    # Starting creation of properties for each surface of the machine
    for surf in surf_list:
        label = surf.label
        if "Lamination_Stator_bore" in label:  # Stator
            if is_stator_linear_BH == 2:
                mu_is = 100000  # Infinite permeability
            else:
                mu_is = stator.mat_type.mag.mur_lin  # Relative
            # Check if the property already exist in FEMM
            if "Stator Iron" not in materials:
                # magnetic permeability
                femm.mi_addmaterial(
                    "Stator Iron", mu_is, mu_is, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0
                )
                materials.append("Stator Iron")
            prop_dict[label] = "Stator Iron"
        elif "Lamination_Rotor_bore" in label:  # Rotor
            # Initialisation from the rotor of the machine
            if is_rotor_linear_BH == 2:
                mu_ir = 100000  # Infinite permeability
            else:
                mu_ir = rotor.mat_type.mag.mur_lin  # Relative
            # Check if the property already exist in FEMM
            if "Rotor Iron" not in materials:
                # magnetic permeability
                femm.mi_addmaterial(
                    "Rotor Iron", mu_ir, mu_ir, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0
                )
                materials.append("Rotor Iron")
            prop_dict[label] = "Rotor Iron"
        elif "Airgap" in label:  # Airgap surface
            if "Airgap" not in materials:
                femm.mi_addmaterial("Airgap", 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0)
                materials.append("Airgap")
            prop_dict[label] = "Airgap"
        elif "Ventilation" in label:  # Ventilation
            # Check if the property already exist in FEMM
            if "Air" not in materials:
                femm.mi_addmaterial("Air", 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0)
                materials.append("Air")
            prop_dict[label] = "Air"
        elif "Hole_" in label:  # Hole but not HoleMagnet
            # Check if the property already exist in FEMM
            if "Air" not in materials:
                femm.mi_addmaterial("Air", 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0)
                materials.append("Air")
            prop_dict[label] = "Air"
        elif "BarR" in label:  # Squirrel cage
            prop, materials = create_FEMM_bar(
                is_mmfr, rotor.mat_type.elec.rho, materials
            )
            prop_dict[label] = prop
        elif "WindR" in label:  # Rotor Winding
            prop, materials, circuits = create_FEMM_circuit_material(
                circuits, label, is_eddies, rotor, Ir, is_mmfr, j_t0, materials
            )
            prop_dict[label] = prop
        elif "WindS" in label:  # Stator Winding
            prop, materials, circuits = create_FEMM_circuit_material(
                circuits, label, is_eddies, stator, Is, is_mmfs, j_t0, materials
            )
            prop_dict[label] = prop
        elif "Magnet" in label and "Rotor" in label:  # Rotor Magnet
            prop, materials = create_FEMM_magnet(
                label, is_mmfr, is_eddies, materials, rotor
            )
            prop_dict[label] = prop
        elif "Magnet" in label and "Stator" in label:  # Stator Magnet
            prop, materials = create_FEMM_magnet(
                label, is_mmfs, is_eddies, materials, stator
            )
            prop_dict[label] = prop
        elif "No_mesh" in label:  # Sliding band
            prop_dict[label] = "<No Mesh>"
        elif "yoke" in label:
            prop_dict[label] = "<No Mesh>"

    # Set Rotor and Stator BH curves (if needed)
    if is_stator_linear_BH == 0:
        for ii in range(BHs.shape[0]):
            femm.mi_addbhpoint("Stator Iron", BHs[ii][1], BHs[ii][0])
    if is_rotor_linear_BH == 0:
        for ii in range(BHr.shape[0]):
            femm.mi_addbhpoint("Rotor Iron", BHr[ii][1], BHr[ii][0])

    return prop_dict, materials, circuits
femm.mi_addmaterial('Magnet', 1.05, 1.05, 905659, 0, 0.667, 0, 0, 1, 0, 0, 0)

bdata = [
    0.000000, 0.290730, 0.428710, 0.589560, 0.796270, 1.020100, 1.198100,
    1.398900, 1.559600, 1.783500, 1.898500, 1.990700, 2.054400, 2.118400,
    2.147700, 2.177000, 2.206500, 2.241700, 2.271200, 2.289000, 2.312600,
    2.341000
]
hdata = [
    0.000000, 81.170000, 106.800000, 136.840000, 179.910000, 233.410000,
    283.710000, 344.750000, 402.920000, 536.640000, 670.100000, 893.800000,
    1290.400000, 2209.800000, 3233.700000, 4549.000000, 7297.800000,
    11554.000000, 18294.000000, 25071.000000, 36690.000000, 62037.000000
]
for n in range(0, len(bdata)):
    femm.mi_addbhpoint('Hiperco-50', bdata[n], hdata[n])

# Body
width = convert_measures(19)
halfWidth = width / 2
height = convert_measures(17.8)
halfHeight = height / 2

barHeight = convert_measures(2.8)

## Simulations

simulations = [0, halfWidth / 2, halfWidth]
gapSimulation = simulations[int(simulation)]

## stator arms
示例#6
0
femm.mi_addmaterial('Air', 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0);
femm.mi_addmaterial('Coil', 1, 1, 0, 0, 58*0.65, 0, 0, 1, 0, 0, 0);
femm.mi_addmaterial('LinearIron', 2100, 2100, 0, 0, 0, 0, 0, 1, 0, 0, 0);

# A more interesting material to add is the iron with a nonlinear
# BH curve.  First, we create a material in the same way as if we 
# were creating a linear material, except the values used for 
# permeability are merely placeholders.

femm.mi_addmaterial('Iron', 2100, 2100, 0, 0, 0, 0, 0, 1, 0, 0, 0);

# A set of points defining the BH curve is then specified.
bdata = [ 0.,0.3,0.8,1.12,1.32,1.46,1.54,1.62,1.74,1.87,1.99,2.046,2.08]; 
hdata = [ 0, 40, 80, 160, 318, 796, 1590, 3380, 7960, 15900, 31800, 55100, 79600];
for n in range(0,len(bdata)):
	femm.mi_addbhpoint('Iron', bdata[n],hdata[n]);

# Add a "circuit property" so that we can calculate the properties of the
# coil as seen from the terminals.
femm.mi_addcircprop('icoil', 20, 1);

# Apply the materials to the appropriate block labels
femm.mi_selectlabel(5,0);
femm.mi_setblockprop('Iron', 0, 1, '<None>', 0, 0, 0);
femm.mi_clearselected()

femm.mi_selectlabel(75,0);
femm.mi_setblockprop('Coil', 0, 1, 'icoil', 0, 0, 200);
femm.mi_clearselected()

femm.mi_selectlabel(30,100);