HyperWorks Solvers

SPLINE_READ

SPLINE_READ

Previous topic Next topic No expanding text in this topic  

SPLINE_READ

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

Subroutine Type

Modeling

Definition

Used to read x, y, and optionally z, data from a file for use with a Reference_Spline element.

Use

User-defined request calling a SPLINE_READ to obtain the x, y, and optionally z, vector to define a Reference_Spline element.

 

<Reference_Spline

    id              = "301001"

    usrsub_dll_name = "c:\work\test.dll"

    file_name       = "c:\data\spring1.dat"

    block_name      = "spring_force">

 </ Reference_Spline>

Calling Syntax

Fortran

SUBROUTINE SPLINE_READ (ID, FILE_NAME, BLOCK_NAME, ERRFLG)

 

C

void STDCALL SPLINE_READ (int *id, char *file_name, int file_name_len, char *block_name, int block_name_len, int *errflg)

 

Python

def SPLINE_READ(id, file_name, block_name):

    return errflag

 

MATLAB

function errflg = SPLINE_READ(id, file_name, block_name)

Input Arguments

[integer] ID

The user-defined Reference_Spline element identifier.

[CHARACTER*(*)] FILE_NAME

An array of dimension 132 containing the FILE_NAME argument value.

[CHARACTER*(*)] BLOCK_NAME

An array of dimension 132 containing the BLOCK_NAME argument value.

Output Values

[logical] ERRFLG

The variable to indicate the status of SPLINE_READ reading the data.  Using PUT_SPLINE, set it to TRUE if there are errors, and FALSE if there are no errors.  A return value of TRUE causes MotionSolve to stop relevant computations.

Example

1.The following example demonstrates the SPLINE_READ user subroutine using the Python scripting language:

2.In the example below, the SPLINE_READ subroutine is used to populate a Reference_Spline model element with values that are read from an external file data.txt.

a.  The model element:

<Reference_Spline

    id                  = "301001"

    label               = "Excite"

    interpreter         = "Python"

    script_name         = "read_curve.py"

    usrsub_fnc_name     = "SPLINE_READ"

    file_name           = "data.txt"

    block_name          = "dummy"

    linear_extrap       = "TRUE"

/>
 

b.  The external file data.txt contains a comma separated list of x, y values as shown below:

 

0,                    0

0.1,   4.045084972

0.2,   4.755282581

0.3,   1.545084972

0.4,   -2.938926261

0.5,   -5

0.6,   -2.938926261

0.7,   1.545084972

0.8,   4.755282581

0.9,   4.045084972

1,     1.07195E-14

1.1,   -4.045084972

1.2,   -4.755282581

1.3,   -1.545084972

1.4,   2.938926261

   

c.  The user subroutine SPLINE_READ is written in the Python scripting language and is shown below:

See Also:

PUT_SPLINE

Reference_Spline

Modeling Subroutines