Properties |
Methods |
Functional dependency in form of a cubic spline.
The Spline object represents the curve function, which describes some field dependent parameters. With magnetostatic problems, the Spline object represents the magnetization curve (B-H curve) of the media. With heat transfer problems Spline can be used to describe the thermal conductivity as a function of temperature, or a volume power density as a function of temperature.
You create a new Spline object or get an existing one using the appropriate property of the LabelBlockMS or LabelBlockHT object. The Spline object itself is a collection of Point objects, where X-Property of each point contains an argument value and the Y-Property is equal to a function value. Points in the Spline are ordered by increasing the argument value.
Like any collection, it provides a Count property returning the number of Points in the collection, the Item method that returns the Point object by its number (position in the collection). The Find method returns the index of a point with the nearest to the given argument value. The Add and Remove methods are used for adding a new point to the Spline or removing an existing one. The Modify method allows you to change a function value for an existing spline point. There is no way to change the argument value for a spline point. If you need that you have to remove the node and add another one.
The following table contains all the methods and properties of the Spline object
Navigation | |
Item method |
Returns the Point object by its one-based number.
|
Count property (read-only) |
Returns the total number of points in the Spline. |
Find (arg) method |
Returns the index of the Point with the smallest argument that is equal to or greater than arg. |
ValueAt (arg, derivative) method |
Returns the function value and its derivative at a given argument. |
General | |
ProblemType property (read-only) |
Returns the type of problem the Spline object is applicable to as QfProblemTypes. |
SplineType property (read-only) |
Returns the type of the Spline object as QfSplineType |
Manipulating with Points. | |
Add (p as Point) method
|
The Add method inserts the new point denoted by p parameter.
|
Remove (index) method |
Removes the point from the Spline. |
Modify (index, val) |
Sets the new value to a function of the given spline point. |
CheckSpline method |
Checks the function defined by the Spline from a physical point of view. The error code is generated if the curve does not have a physical sense. |
The following example creates a new label "ALNICO magnet1" for a magnetostatic problem, sets the coercive force value of the magnet first, then creates a new spline, fills it with points and assign the spline to the label content, and then assigns the whole content to the label.
Dim lb As QuickField.Label
Dim lbMS As QuickField.LabelBlockMS
Set lb = prb.Labels(qfBlock).Add
lb.Name = "ALNICO magnet1"
Set lbMS = lb.Content
With lbMS
.Polar = False
.Coercive = QF.PointRA(44000, 0)
Dim curve As Spline
Set curve = .CreateBHCurve ' Create a new spline
' We do not need to add the first point (0, -44000) -
' it will be inserted automatically
curve.Add QF.PointXY(0.121905, -39206)
curve.Add QF.PointXY(0.21943, -35370)
curve.Add QF.PointXY(0.266805, -33453.1)
curve.Add QF.PointXY(0.348365, -29091.2)
curve.Add QF.PointXY(0.408495, -24729.2)
curve.Add QF.PointXY(0.456152, -20367.2)
curve.Add QF.PointXY(0.495103, -16005.2)
curve.Add QF.PointXY(0.527358, -11643.3)
curve.Add QF.PointXY(0.557411, -7281.3)
curve.Add QF.PointXY(0.584952, -2572.67)
curve.Add QF.PointXY(0.6, 0)
End With
On Error GoTo BadSpline
curve.CheckSpline ' Check the spline
lbMS.Spline = curve ' Assign the created spline to a Label content
lb.Content = lbMS
BadSpline:
' continue