ActiveField™ Help    

Main QuickField Site  

Free Downloads  

Contacts  

ActiveField Technology
What's New
Objects Overview
Hierarchy Chart
How to Start: Application Object
How to work with Problems
How to work with Model
How to work with Data
How to Analyze Results

Objects

Properties

Methods

Parametric Simulation Samples

SRM Electric Motor

SRM Electric Motor

You can download example's files here.

Last years switched reluctance motors (SRM) become a common solution in the application where deep regulation is required. Some people eve says that SRM opens a new era in electrical drives. Switched reluctance motor is a combination of a simple brushless motor and a controlling electronic unit. The motor itself consists of salient pole steel rotor with no winding, and salient pole stator with a coil on each pole. Depends upon a algorithm of control system, the motor can behave in a different way according to customer needs.

Design of an SRM motor and control system rely on knowing  of the torque and flux linkage as a function of the current and rotor position. The only way to obtain such dependency is numerical modeling of non-linear magnetic field with various rotor position and current in the stator coil. That work can be easy done by QuickField Workbench.  The SRM sample allows to get T = f ( I, phi) and F = f ( I, phi) dependencies for any SRM motor, no regards the number of slots and poles and geometrical shape.

To find a torque and flux for a given rotor position and coil current we should solve a problem of magnetostatic to find magnetic field distribution. The only boundary condition needed is the zero Dirichlet condition on the outer surface of the stator. The filed sources are given current in the forward and back coil halves, marked with blue and red on the sketch above. We take into account steel saturation by defining B-H curves for stator and rotor core.

To achieve high degree of generality, we build the SRM.dll rely upon the geometric model prepared in advance by interactive QuickField model editor and stored to the ..\SRM_Files\SRM_Basic.mod file. Also the physical data (boundary conditions, B-H curves for rotor and stator core, magnetic permeability of air and copper) are also prepared in advance and stored to the ..\SRM_Files\SRM_Basic.dms file. Therefore, writing the SRM.dll code we can concentrate on getting output parameters.

The only geometrical manipulation we have to do programmatically is rotation of the rotor to the desired position. When needing to model another motor, say with different pole number, we only have to replace the geometrical model ../SRM_Files/SRM4_Basic.mod to another one with the same name.

Below we first discuss how to use the SRM model supplied with QuickField in the Workbench environment, and then briefly describe creating of such a model by Workbench application wizard and its programming.

Using the SRM model

To try the SRM model supplied with QuickField, do the following steps:

  1. Run Workbench (Start->Programs->Tera Analysis->Tools->Workbench)
  2. Only once: register the SRM as an exploring object if you do not do that before.
    To register the new object, press the Register New ExploringObject button and find the name and location of the SRM.dll. QuickField installation program puts it to the ..\ActiveField\Examples\SRM folder.
  3. Open new modeling session by pressing the New Session button. If the SRM.dll was properly registerd, its icon appears in the list of registered exploring objects. When you click it, the All Parameters pages appears with SRM sketch and list of parameters.

    According to the SRM design the list contains 3 parameters:

    • Rotor Position (Phi);
    • Stator Coil Current (Ia)
    • Air Gap Diameter (Da)

    The first two parameters intended to be variable, and the last one is used by postprocessor when building a contour for calculation torque.

    Click on the desired item in the Variable column to declare the parameter to be variable or not.

  4. Switch to the Variable Parameters page. If you have chosen both rotor position and stator coil current to be variable on previous step, you see the following:

    For each parameter you can choose the Iteration type from the list. Now two iterators are available: the linear iterator divides given range into equal parts whereas the random one allows to distribute each point individually.

  5. When you are ready with input parameter and iteration data, switch to the Result tab and press the Solve button. The results will appear in the table when calculated.

    During calculation you cam show and hide QuickField by Show QF button, select the output quantity to display in the table, display xy-plot in a separate window. Also, the calculation could be aborted at any time by the Stop button.

  6. When calculation finishes it is good time to save current modeling session to be able review input and calculated data next time. If you have Microsoft Excel installed, you can export the result table into an Excel spreadsheet.

  7. When you need to model another SRM machine, prepare its geometry model with QuickField model editor interactively, and put its copy into the SRM_Files directory under you folder where the SRM.dll lives.
    Every SRM model should have a block labeled as "Rotor" that will be rotated on each iteration and a pair of block labeled as "Winding+" and "Winding-". The last represent forth and back sides of a stator coil on each pole. All these coils are considered as connected in parallel.

How the SRM model was created

In the rest of this topic we discuss how to create an exploring object for Workbench such as SRM.dll. To do that you should be familiar with programming in Visual Basic and with QuickField object model principles. You also have Microsoft Visual Basic 6.0 installed on your computer before installing QuickField.

Creating of a new exploring object consists of two main steps: creating the skeleton of code with the QuickField Exploring Object Wizard and customization the automatically generated code.

Creating a skeleton of  code using QuickField Exploring Object Wizard.

That process is described in full details in the Lesson 3 of the ActiveField tutorial. Below we describe only the things, that are specific for the SRM model.

The input parameters are:

Description

Notation

Unit

Value

Min

Max

Default

Rotor Position

Phi

deg

0

360

0

Stator Coil Current

Ia

A

0

10000

5000

Air Gap Middle Diameter

Da

mm

0

1000

177.75

The first parameter - rotor position - is of geometrical type. That means that the geometry model should be rebuild and remeshed each time the parameter value changes. The second parameter is of physical type. When its value changes, the problem is solved again using the same geometry. The last parameter - air gap middle diameter - is of the postprocessor type. When it changes by Workbench (if we want that), the QuickField will neither generate new model nor solve another problem.  Such parameter is using only for analyzing results.

We also declare two output parameters:

Name

Notation

Unit

Value

Mechanical Torque

M

N*m

Torque of the motor

Pole Flux

F

Wb

The magnetic flux trough one pole

 Customization the code written by the wizard.

In the code modules created by wizard the subroutines that are most likely candidates to modification are separated in a special module named Custom.  In our case it is stored in the SRM.bas file. There are four procedures defined:

  • ModifyModel - the place for code modifying the geometry model according to current values of input parameters;
  • SetLabel - called by framework each time one of the physical parameter changes its value. Its primary goal is setting values for labels of blocks, edges, and  vertices.
  • Calculations - good place for writing code calculating output parameters.
  • BuildContour - an auxiliary subroutine that can be used for creating a contour, if the integral values used for calculation of output parameters.

The main task of our ModifyModel subroutine is selecting the rotor and rotation it on the desired position. The following code does that:

''' Local variables for all input parameters
Dim Phi As Double
Phi = theParameters("Rotor Position").Value

''' ----------------------------------------
''' TODO: Modify QuickField model (Mdl) here
Const PI As Double = 3.1415926
Dim rotor As ShapeRange
Set rotor = Mdl.Shapes.LabeledAs(Block:="Rotor")
If Not rotor Is Nothing Then
    rotor.Move qfRotation, PointXY(0, 0), Phi / 180 * PI
End If

Please note that we do not need rebuild the mesh and save modified model - the framework does it for us automatically.

The SetLabel function is called each time when one of the "physical" parameter changes. This subroutine have not to set all properties to all labels. Instead, it changes only the value of total current for block labels "Winding+" and "Winding-"

Case "Stator Coil Current"
''' ----------------------------------------
    Dim     Ia As Double
    Ia = theParameters("Stator Coil Current").Value
   
   ''' TODO: Edit QuickField label corresponding
        'Stator Coil Current' parameter
    ''' Probable code for Block label:
    ''' - uncomment code below
    ''' - for Vertex and Edges use 'qfVertex' or 'qfEdge' constants
    ''' - replace 'Air' with your QuickField label name
    '''

   
Set Lbs = Prb.DataDoc.Labels(qfBlock) 'Select block labels collection
   
Set Lab = Lbs("Winding+") 'Get label
   
Set LabCnt = Lab.Content 'Get label content
   LabCnt.Loading = Ia
    LabCnt.TotalCurrent = True
    Lab.Content = LabCnt 'Update label content

    Set Lab = Lbs("Winding-") 'Get label
   
Set LabCnt = Lab.Content 'Get label content
   LabCnt.Loading = -Ia
    LabCnt.TotalCurrent = True
    Lab.Content = LabCnt 'Update label content
    ''' ----------------------------------------

The two subroutines above organize model creation, modification and solving. Now we modify the routines extracting output parameters. The key subroutine doing that is Calculations. As distinction from the code generated by wizard, we need three different contours for calculating three integral values: the torque and the flux linkages with left and right halves of stator coil. Let us put the code for creating each contour in a separate subroutine: BuildContourTorque, .BuildContourWplus, BuildContourWminus.

The Calculation routine

''' ----------------------------------------
''' TODO:
''' - if you have point output parameters:
''' Replace 'PointXY(0, 0)' by a Point you need accordingly input parameters
''' - if you have no point output parameters:
''' Remove these code linesDim Cnt As QuickField.Contour

' Mechanical torque

Set Cnt = BuildContourTorque(Res)
Pt.Value(1) = Res.GetIntegral(qfInt_MaxwellTorque, Cnt).Abs
' Pole Flux
Set Cnt = BuildContourWplus(Res)
Pt.Value(2) = Res.GetIntegral(qfInt_FluxLinkage, Cnt).Abs
Set Cnt = BuildContourWminus(Res)
Pt.Value(2) = Abs(Pt.Value(2) - Res.GetIntegral(qfInt_FluxLinkage, Cnt).Abs)
''' ----------------------------------------

Each subroutine that builds a contour is very simple:

  1. The contour surrounding the rotor for calculation of the torque:

Private Function BuildContourTorque(Res As QuickField.Result)
    Dim Wnd As QuickField.FieldWindow 'Result field window object
    ' Get FieldWindow object
    Set Wnd = Res.Windows(1)
    ' Get new Contour object
    Dim Cnt As QuickField.Contour
    Set Cnt = Wnd.Contour
   
    ''' ----------------------------------------
    ''' TODO: Build Contour here
    Dim Ra As Double
    Ra = theParameters("Air Gap Diameter").Value / 2#
    Cnt.AddLineTo PointXY(Ra, 0), 0
    Cnt.AddLineTo PointXY(-Ra, 0), 3.1415926
    Cnt.AddLineTo PointXY(Ra, 0), 3.1415926
    ''' ----------------------------------------
    Set BuildContourTorque = Cnt
End Function

  1. The next two functions builds contours for flux calculation:

Private Function BuildContourWplus(Res As QuickField.Result) As QuickField.Contour
    Dim Wnd As QuickField.FieldWindow 'Result field window object
    ' Get FieldWindow object
   
Set Wnd = Res.Windows(1)
    ' Get new Contour object
   
Dim Cnt As QuickField.Contour
    Set Cnt = Wnd.Contour
    Cnt.Delete True
    Cnt.AddBlock "Winding+"
    Set BuildContourWplus = Cnt
End Function

Private Function BuildContourWminus(Res As QuickField.Result)
    Dim Wnd As QuickField.FieldWindow 'Result field window object
    ' Get FieldWindow object
   
Set Wnd = Res.Windows(1)
    ' Get new Contour object
   
Dim Cnt As QuickField.Contour
    Set Cnt = Wnd.Contour
    Cnt.Delete True
    Cnt.AddBlock "Winding-"
    Set BuildContourWminus = Cnt
End Function

Now we can compile our SRM project as SRM.dll file (File->Make SRM.dll.. command) and use it for calculation.