Excel with MagNet

This Gallery page provides a good example of how you can customize and automate the construction of your models, and how easily this can be accomplished using MagNet’s ActiveX® capabilities in tandem with Microsoft® Excel. The data (column F in the illustration to the left) entered in the Excel spreadsheet is used to build a Switch Reluctance Motor (SRM) in MagNet. To the right of the data in column F are the lists of possible values for the Stator Poles, Length Unit, Rotor Poles, and Lamination Materials, along with the permissible Stator Poles-to-Rotor Poles combinations. What follows is a description of the various stages in the process.


Results

Click image to see full size version
Step #1

The data is first extracted from the Excel spreadsheet, assigned to variables (indicated in bold), and then these values (except for length unit and lamination material) are validated to make sure that they conform to the characteristics of a Switch Reluctance Motor:
  • length unit - Unit
  • number of stator poles - ns (validated)
  • stator outer radius - stator (validated)
  • radius of stator slot bottom - statslotr (validated)
  • stator pole arc (in mechanical degrees) - betaS (validated)
  • number of turns/coil - turns (validated)
  • peak winding current (A) - AMP (validated)
  • airgap length - gap (validated)
  • active length of motor - Length (validated)
  • number of rotor poles - nr (validated)
  • rotor outer radius - r1 (validated)
  • radius of rotor slot bottom - r0 (validated)
  • rotor pole arc (in mechanical degrees) - betaR (validated)
  • lamination material - Material

Click image to see full size version
Step #2

Once the data has been validated, MagNet is opened. It sets the default length unit (in this example, millimetre) and then proceeds to build the Stator component using the following variables, scripting commands, and constants:

    Variables

    • r1 = 50.00
    • gap = 2.00
    • ns = 4
    • Material = MU3

    Scripting commands - addRotation, deleteSelection, makeComponentInALine, newArc, newCircle, newLine, redraw, selectAt, selectAtWithObjectCode, selectScaledToFit, viewAll

    Constants - infoSetSelection, infoSliceSurface

NOTE A description of each of the scripting commands listed above can be found in the MagNet help file.

Click image to see full size version
Step #3

The second component created for the SRM is the Rotor component using the following variables, scripting commands, and constants:

    Variables

    • nr = 6
    • r0 = 30.00
    • r1 = 50.00
    • Material = MU3

    Scripting commands - deleteSelection, getCurrentView, getDocument, makeComponentInALine, newArc, newLine, redraw, selectAll, selectAt

    Constants - infoSetSelection, infoSliceLine, infoSliceSurface

NOTE A description of each of the scripting commands listed above can be found in the MagNet help file.

Click image to see full size version
Step #4

Finally, the model is completed when the racetrack coils are created for each Stator Pole, coil turns and currents are assigned to the coils, and an air box component is created to surround the SRM model. The following variables, scripting commands, and constants were used:

    Variables

    • ns = 4
    • Length = 80.00

    Scripting commands - deleteSelection, getCurrentView, getDocument, getSlice, makeCoil, makeComponentInALine, makeComponentInAnArc, moveInALine, newCircle, newLine, redraw, rotateComponent, selectAll, selectAt, selectDeviceObject, viewAll

    Constants - infoSetSelection, infoSliceArc, infoSliceLine, infoSliceSurface

NOTE A description of each of the scripting commands listed above can be found in the MagNet help file.

Click image to see full size version
Step #5

An animation of the magnetostatic fields, which consists of a contour plot of the “flux function” and a shaded plot of the “|B| smoothed” field, is created using the following scripting commands:

    Scripting commands - createAnimation, createAnimationFrame, setScaledToFit, solveStatic2D, viewMagnetostaticFields

NOTE A description of each of the scripting commands listed above can be found in the MagNet help file.