HyperWorks Solvers

Spline

Spline

Previous topic Next topic No expanding text in this topic  

Spline

Previous topic Next topic JavaScript is required for expanding text JavaScript is required for the print function  

Model Element

Class Name

Spline

Description

Splines are piecewise polynomial functions that possess a user controlled degree of smoothness. In mathematics, they are often used for fitting and interpolating measured data. Reference_Spline defines a spline with two or three independent variables, i.e. the data can be a curve or a surface.

Attribute Summary

Name

Property

Modifiable by command?

id    

Int ()

 

label

Str ()

 

x

Double (count=0)

y

Double (count=0)

z

Double (count=0)

 

linear_extrapolate

Bool (False)

file

String ()

block

String ()

function

Function ("SPLINE_READ")

 

Usage

MotionSolve provides four different ways for defining splines.

#1: Spline for X-Y data

Spline (x=list, y=list, optional_attributes)

 

#2: Spline for X-Y-Z data

Spline (x=list, y=list, optional_attributes)

 

#3: Spline data read from a file by a compiled user subroutine

Spline (file=string, function=userString, routine=string, optional_attributes)

 

#4: Spline data read from a file by a Python function

Spline (file=string, function=userString, routine=functionPointer, optional_attributes)

Attribute Description

Spline for X-Y data

x

List of numeric values

Specifies the list of the X values of the spline.

The x attribute is mandatory

Requirements:

len (x) ≥ 4

y

List of numeric values

Specifies the list of the Y values of the spline.

The y attribute is mandatory.

Requirements:

len (y) ≥ 4
len (x) = len (y)

Spline for X-Y-Z data

x

List of numeric values

Specifies the list of the X values of the spline.

The x attribute is mandatory

Requirements:

len (x) ≥ 4

z

List of numeric values

Specifies the list of the Z values of the spline.

The z attribute is optional.

y

List of numeric values

Specifies the list of the Y values of the spline.

The y attribute is mandatory.

Requirements:

When Z is specified:
y is a matrix of dimensions (M,N) specified as a two-dimensional list
M is the number of z values
N is the number of x values
Each row corresponds to one value of z.
When z is not specified
y is a matrix of dimensions (1,N) specified as a one-dimensional list
N is the number of x values
There must be at least 4 numbers in each row
All rows must have the same length

Spline data read from a file by a compiled user subroutine

file

String

Specifies the path and name of the file containing the spline data.  Use only when the data is contained in an external file.

The file attribute is mandatory.

function

String

The list of parameters that are passed from the data file to the user-defined subroutine.

The function attribute is mandatory

routine

String

Specifies an alternative name for the user subroutine. The name consists of two pieces of information, separated by “”. The first is the pathname to the shared library containing the function that computes the response of the user-defined Surface. The second is the name of the function in the shared library that does the computation.

An example is: routine=”/staff/Altair/engine.dllmySplineRead

”/staff/Altair/ engine.dll is the dll
“mySplineRead” is the function within this DLL that performs the calculations

The attribute routine is optional.

When not specified, routine defaults to Spline_Read.

The attribute routine is optional.

block

String

Specifies the block name containing the spline data.  A single file may contain several blocks of data.

This parameter is optional.  Use only when the data is contained in an external file with many blocks of data.

The block attribute is optional.

Spline data read from a file by a Python function

file

String

Specifies the path and name of the file containing the spline data.  Use only when the data is contained in an external file.

The file attribute is mandatory.

function

String

The list of parameters that are passed from the data file to the user-defined subroutine.

The function attribute is mandatory

routine

Pointer to a callable function in Python

An example is: routine=my_Spline_Read

my_Spline_Read is a Python function or method that can be called from wherever the model resides.

The attribute routine is optional.

When not specified, routine defaults to Spline_Read.

block

String

Specifies the block name containing the spline data.  A single file may contain several blocks of data.

This parameter is optional.  Use only when the data is contained in an external file with many blocks of data.

The block attribute is optional.

Optional Attributes – Available to all description methods

id

Integer

Specifies the element identification number.  This number must be unique among all the Spline objects in the model.

This attribute is optional. MotionSolve will automatically create an ID when one is not specified.

Range of values: id > 0

label

String

Specifies the name of the Spline object.

This attribute is optional. When not specified, MotionSolve will create a label for you.

linear_extrapolate

Boolean

A logical flag that specifies how MotionSolve is to deal with the situation when the independent coordinate falls out of the range of data provided. Select either True or False.

True indicates that MotionSolve is to use linear extrapolation to estimate the spline value.
False indicates that MotionSolve should not extrapolate; instead it should return an error.

This attribute is optional. When not specified, MotionSolve will set linear_extrapolate = True

Comments

1.See Properties, for an explanation about what properties are, why they are used and how you can extend these.
2.For a more detailed explanation about Spline, see the Comments in the XML syntax section

Example

1.XML vs. Python syntax for the same model.

XML Syntax

Python Syntax

time = [ 0, .1, .2, .3, .4, .5, .6, .7, .8, .9, 1]

swa = [1.09, 6.88, 2.52, 3.02, 3.30, 3.23,-.0891,-4.20, 3, 2.05, 0]

spl1 = Spline (label="SWA vs. Time", x=time, y=swa)

 

xval = [ 0, 0.25, 0.5, 0.75, 1]

zval = [ 0.0, 1.0, 20.0 ]

yval = [[0, 0.5, 0, 0.5, 0]

       [0, 0.7, 0, 0.7, 0]

       [0, 0.9, 0, 0.9, 0]]

spl2 = Spline (label="jagged surface", x=xval, y=yval, z=zval)

dll = “./wheel.dll”

fnam = “./wheel_1.dat”

blk = “wheel angle”

spl3 = Spline (label="SWA vs. Time", routine=dll, file=fnam, block=blk)