Professional Documents
Culture Documents
Conductor
Conductor
Student
Preface............................................................................................................3
Model description..........................................................................................4
First step: QuickField problem creation.......................................................5
Second step: Geometrical model drawing....................................................7
Third step: Mesh building and geometrical objects labeling........................9
Fourth step: Labels creation and definition.................................................11
Fifth step: Problem solving and results viewing.........................................12
Sixth step: Problem parameters iteration....................................................14
Result tables.................................................................................................17
Bonus Step: Field pictures and graphs........................................................20
Resulting field pictures................................................................................22
Result graphs................................................................................................23
Preface.
This example describes the step-by-step process of creation Microsoft Word document
interacting with QuickField server and obtaining the results of field analysis. It is
divided in several steps. Each step ends by a button. By pressing this button you may
see how the just written code works.
This example is fully compatible with Students and Professional versions of QuickField
5.1 and higher. Free Students QuickField may be downloaded from QuickField Support
site www.quickfield.com. To display the graphs you should have Microsoft Graph
installed. Microsoft Graph is included into any Microsoft Office suite.
Main content of this document is in the macros therefore macros should be enabled. You
have to enable running macros in the menu Tools -> Macro -> Security -> Security
Level. If the settings were set to High you may need to change the Security level
Medium or Low, then close the document and open it again.
For more information about changing the security level with MS Word please refer to Microsoft Office
Help, the topic "Protection from documents that might contain viruses".
Model description.
Copper conductor with round cross-section 2 mm
diameter is placed to the origin of coordinates. It
carries electric current with variable frequency
and amplitude, but as a default we will assume 50
Hz and total current 100 Amperes.
Cylindrical shield with internal radius 4 mm
surrounds the conductor. We will analyze
dependence of the electric field parameters from
the shield thickness in the range 0.5 mm to 5.5
mm, and its material electrical conductivity and
magnetic permeability.
We will also compare results for shield with shortcircuited ends (zero voltage), open ends (zero total
current) and without shield.
To measure the field characteristics we will use the tester steel rod with 1 mm radius.
Distance between the centers of tester and conductor is 12 mm.
We will measure the following values:
Tester voltage
Flux density
Joule heat density in the conductor and in the shield
To measure the voltage and flux density we will use the point with coordinates (0.0112,
0) in the vicinity of the tester surface.
The model is surrounded by the cylindrical boundary with radius 10 cm and zero
Dirichlet boundary condition (A=0). Space between conductor, shield and tester is filled
by air. The physical setup corresponds to Time-Harmonic Magnetic formulation of
QuickField.
If you use Students QuickField it is recommended to restrict the finite-element mesh
size. For doing that you should set manual mesh steps: at the outer shield boundary 2
mm, at the outer tester surface 1 mm, at the external problem boundary - 5 cm.
Central part of this model setup is shown in the picture above.
Prb
Mdl
Prb
Mdl
As QuickField.Problem
As QuickField.Model
= QF.Problems.Add
= QF.Models.Add
If you click the button twice without closing QuickField then two examples of problems
and models will be created. To avoid this you should close all open QuickField
documents prior to creation of new ones. Following strings do that:
QF.Problems.Close
QF.Models.Close
Last two strings add two arcs of 3.1416 each, i.e. draw a circle with 0.002-meter
radius.
Arguments of functions AddEdge are the objects of Point class. Correct ways of getting
these objects are Application object methods PointXY or PointRA. Do not forget to
mention Application object (QF.) while using its methods.
Drawing procedures for internal and external surfaces of shield, tester and external
boundary are similar to described above:
' Draw Shield
Mdl.Shapes.AddEdge QF.PointXY(0, 0.004), _
QF.PointXY(0, -0.004), 3.1416
Mdl.Shapes.AddEdge QF.PointXY(0, -0.004), _
QF.PointXY(0, 0.004), 3.1416
Mdl.Shapes.AddEdge QF.PointXY(0, 0.005), _
QF.PointXY(0, -0.005), 3.1416
Mdl.Shapes.AddEdge QF.PointXY(0, -0.005), _
QF.PointXY(0, 0.005), 3.1416
' Draw Tester
Mdl.Shapes.AddEdge QF.PointXY(0.012, 0.001), _
QF.PointXY(0.012, -0.001), 3.1416
Mdl.Shapes.AddEdge QF.PointXY(0.012, -0.001), _
QF.PointXY(0.012, 0.001), 3.1416
' Draw Boundary
Mdl.Shapes.AddEdge QF.PointXY(0, 0.1), _
QF.PointXY(0, -0.1), 3.1416
Mdl.Shapes.AddEdge QF.PointXY(0, -0.1), _
QF.PointXY(0, 0.1), 3.1416
We are interested in analysis not the full model, but only its central part with conductor
and tester. Convenient level of scaling could be defined by the parameters of the Zoom
method, or alternatively by call without parameters, but before the addition of the
external boundary. Respectively Win should be defined and initialized before this point.
' Set properly scale
Win.Zoom
After each step of this document you can see a button launching the code created at this
step. For example, the button after this second step corresponds to the following
procedure:
Private Sub CommandButton2_Click()
CreateProblem
DrawModel
End Sub
If you create your own document according to our instructions then instead of adding
new buttons you may edit the code of existing one.
Second Step
It is possible to set the steps of discretization for edges or blocks instead of vertices. In
this case the code will be little bit shorter.
Mesh generation
Now Students version is able to build the mesh according to its restrictions:
' Build mesh
Mdl.Shapes.BuildMesh
Last operation required is label assignment to those blocks, vertices and edges, which
should have physical properties defined.
Shapes labeling
All the blocks should be labeled:
Mdl.Shapes.Blocks.Nearest(QF.PointXY(0, 0)).Label = _
"Conductor"
Mdl.Shapes.Blocks.Nearest(QF.PointXY(0, 0.003)).Label = "Air"
Mdl.Shapes.Blocks.Nearest(QF.PointXY(0, 0.0045)).Label = _
"Shield"
Mdl.Shapes.Blocks.Nearest(QF.PointXY(0, 0.01)).Label = "Air"
Mdl.Shapes.Blocks.Nearest(QF.PointXY(0.012, 0)).Label = _
"Tester"
Two edges forming the external boundary should be labeled to set the zero Dirichlet
boundary condition:
Mdl.Shapes.Edges.Nearest(QF.PointXY(0.1, 0)).Label = "Bound"
Mdl.Shapes.Edges.Nearest(QF.PointXY(-0.1, 0)).Label = "Bound"
10
It is possible now to save the model (the name was assigned to it at the previous step).
Mdl.Save
Third Step
11
=
=
=
=
=
"Air"
"Conductor"
"Shield"
"Tester"
"Bound"
Prb.Save
Fourth Step
12
Then we may check local parameters in the vicinity of the tester surface. Object of
FieldPointHE class related to some point should be declared. Local field characteristics
may be obtained from this object properties:
Dim FP As QuickField.FieldPointHE
Set FP = Prb.Result.GetLocalValues(QF.PointXY(0.0112, 0))
V = FP.ElectroPotential.R
B = FP.FluxDensity.RMS
13
Result display
At the next step we will insert calculated values into this document. Here we display the
calculated values by simple Message Box:
MsgBox "Potential = " & Format(V, "0.00000") & " V"
& vbCrLf & _
"Flux density = " & Format(B, "0.00000") & " T" _
& vbCrLf & _
"Shield thickness = 1 mm" & vbCrLf & _
"Joule heat = " & Format(P, "0.000") & " W", , _
"Conductor tester"
14
A.
Current frequency: 50
Hz.
Parameter accepting
Following simple code accepts the values entered in the Edit Boxes above:
Private Sub GetParameters()
Dim I As Double, f As Double
Dim TB As TextBox
' Get current value
Set TB = TextBox1
If IsNumeric(TB.Value) Then
I = CDbl(TB.Value)
Else
I = 100
End If
' Get frequency value
Set TB = TextBox2
If IsNumeric(TB.Value) Then
f = CDbl(TB.Value)
Else
f = 50
End If
End Sub
Preparations to iteration
Results will be displayed in tables. Columns will correspond to the cases of short-circuit
shield, open end shield and absence of the shield. First group of tables shows the field
dependence upon the thickness of copper and steel shields, next group of tables is
related to variable conductivity of the shield with fixed size, and the last group of tables
is related to variable magnetic permeability of the shield with fixed size.
We will observe three parameters voltage in the tester (steel rod at some distance from
the conductor with current) beyond the shield, flux density in some fixed point of the
tester and density of Joule losses in the conductor and screen (losses in the tester may be
neglected).
There were no parameters used in the previous steps. Thats why we may copy
procedures
CreateProblem,
DrawModel,
MeshAndLabel,
DefineData,
SolveAndGetResult and name new procedures respectively:
Private
Private
Private
Private
Sub
Sub
Sub
Sub
CreateProblem6()
DrawModel6()
MeshAndLabel6()
DefineData6(Optional
Optional
Optional
Private Sub SolveAndGetResult6(V
P
15
Iterations
Following changes should be made:
1. In CreateProblem6 the string displaying the main menu of QuickField should
be removed.
2. In GetParameters local variables f and I should be converted to global ones,
and frequency in CreateProblem6 should be set to f instead of 50 Hz.
3. Closing of all old models should be transferred from CreateProblem6 into
DrawModel6.
4. The code of closing postprocessor window (if it is open) should be added to
DrawModel6:
If Not Prb.Result Is Nothing Then Prb.Result.Close
5. The code of window display and scale setting should be removed from
DrawModel6.
6. External shield radius should be set equal to (0.004 + L) instead of 0.005
there L is the shield thickness.
...
...
Mdl.Shapes.Blocks.Nearest _
(QF.PointXY(0, 0.004 + L / 2)).Label = "Shield"
9.
10. The code for changing of the postprocessor window settings in the procedure
SolveAndGetResult6 is no longer needed and may be deleted.
Result placing into tables
Now we have to iterate shield parameters and insert results into the tables. It is more
convenient to prepare tables beforehand than create them in VBA code. In this
16
example the tables are already prepared, and you can see them in Result tables
section.
Procedure SaveValues inserts the results of one solved problem into the tables. E.g.
if Table = 2, Row = 4, Col = 3, then V, B and into P will be inserted to the cell
(4, 3) of tables 4, 5 and 6 respectively
Private Sub SaveValues(Table As Integer, _
Row As Integer, Col As Integer, _
V As Double, B As Double, P As Double)
Tables((Table - 1) * 3 + 1).Cell(Row, Col).Select
Selection.Text = Format(V, "0.0000")
Tables((Table - 1) * 3 + 2).Cell(Row, Col).Select
Selection.Text = Format(B, "0.0000")
Tables((Table - 1) * 3 + 3).Cell(Row, Col).Select
Selection.Text = Format(P, "0.0000")
End Sub
Procedure SaveValuesAir inserts the results calculated without shield into
the
tables.
Main procedure CommandButton6_Click is relatively long, but simple. It creates the
problem and then in the loop the geometry and data are defined, mesh built, problem
solved and results are stored in the tables. If you have minimal experience in Visual
Basic programming you may create this procedure by yourself.
Sixth Step
17
Result tables.
Variable shield thickness.
Table 1. Tester voltage V vs. shield thickness.
Shield
thickness
0.0005
0.0015
0.0025
0.0035
0.0045
0.0055
Short-circuited shield
Copper
Steel
0.0244
0.0233
0.0183
0.0143
0.0131
0.0140
0.0095
0.0046
0.0073
0.0042
0.0058
0.0013
Open-ended shield
Copper
Steel
0.0255
0.0255
0.0253
0.0254
0.0253
0.0255
0.0255
0.0256
0.0256
0.0259
0.0254
0.0255
Without
shield
Open-ended shield
Copper
Steel
0.0018
0.0018
0.0018
0.0018
0.0017
0.0018
0.0016
0.0016
0.0016
0.0017
0.0017
0.0017
Without
shield
Open-ended shield
Copper
Steel
8.0198
16.4561
7.3687
107.0687
7.3743
101.8588
7.3853
78.6607
7.4027
62.7635
7.4261
72.9334
Without
shield
0.0255
Shield
thickness
0.0005
0.0015
0.0025
0.0035
0.0045
0.0055
Short-circuited shield
Copper
Steel
0.0017
0.0017
0.0013
0.0010
0.0009
0.0010
0.0006
0.0003
0.0005
0.0003
0.0004
0.0001
0.0017
Shield
thickness
0.0005
0.0015
0.0025
0.0035
0.0045
0.0055
Short-circuited shield
Copper
Steel
8.5478
38.6788
8.3062
54.9524
8.1790
36.6359
7.9918
53.2250
7.8603
45.7212
7.7672
53.9812
7.3669
18
Shield
conductivity
0.7e+7
1.7e+7
2.7e+7
3.7e+7
4.7e+7
5.7e+7
6.7e+7
Shortcircuited
shield
0.0163
0.0134
0.0129
0.0127
0.0126
0.0126
0.0125
Open-ended
shield
Without
shield
0.0255
0.0255
0.0255
0.0255
0.0255
0.0255
0.0255
0.0255
Shield
conductivity
0.7e+7
1.7e+7
2.7e+7
3.7e+7
4.7e+7
5.7e+7
6.7e+7
Shortcircuited
shield
0.0012
0.0010
0.0009
0.0009
0.0009
0.0009
0.0009
Open-ended
shield
Without
shield
0.0019
0.0019
0.0019
0.0019
0.0019
0.0019
0.0019
0.0017
Shield
conductivity
0.7e+7
1.7e+7
2.7e+7
3.7e+7
4.7e+7
5.7e+7
6.7e+7
Shortcircuited
shield
66.9630
37.5528
27.1427
22.1130
19.1763
17.2579
15.9092
Open-ended
shield
Without
shield
63.1161
78.5154
67.9755
57.0525
48.7496
42.5992
37.9587
7.3669
19
Shield
permeability
1
3.16
10
31.6
100
316
1000
Shortcircuited
shield
0.0254
0.0254
0.0254
0.0253
0.0249
0.0224
0.0163
Open-ended
shield
Without
shield
0.0254
0.0255
0.0255
0.0255
0.0255
0.0255
0.0255
0.0255
Shield
permeability
1
3.16
10
31.6
100
316
1000
Shortcircuited
shield
0.0019
0.0019
0.0019
0.0019
0.0018
0.0017
0.0012
Open-ended
shield
Without
shield
0.0019
0.0019
0.0019
0.0019
0.0019
0.0019
0.0019
0.0017
Shield
permeability
1
3.16
10
31.6
100
316
1000
Shortcircuited
shield
8.1573
8.1812
8.2730
8.7208
11.5936
29.1090
66.9630
Open-ended
shield
Without
shield
8.0198
8.0204
8.0265
8.0872
8.6929
14.6182
63.1161
7.3669
20
Image copying
GetPicture method from class FieldWindow copies a picture to the clipboard.
Win.GetPicture
21
Selection.Paste
Selection.MoveLeft Extend:=wdExtend
With Selection.InlineShapes(1)
.Width = .Width * 0.7
.Height = .Height * 0.7
.AlternativeText = "My Picture"
End With
Draw Graphs
22
Result graphs.
23