MODFNC

Utility/Data Access SubroutineRetrieves the model data as specified in the XML solver input file.

Use

The function can be called by any user-defined subroutine.

Format

Fortran Calling Syntax
MODFNC(ELEMENT, ID, ATTRIBUTE, OUTPUT, INFO)
C/C++ Calling Syntax
c_modfnc (element, id, attribute, output, info)
Python Calling Syntax
[output, info] = py_modfnc(element, id, attribute)
MATLAB Calling Syntax
[output, info] = m_modfnc(element, id, attribute)

Attributes

ELEMENT
[string]
The name of the XML element.
ID
[integer]
The identifier of the element.
Attribute
The name of the attribute associated with the XML element.

Output

OUTPUT
[string]
The value of the attribute, casted as a character string.
INFO
[integer]
Information about the call status or return value type. A negative value indicates failure in obtaining the model data. A positive value provides the type of the return value as shown in the table below.
ATTRIBUTE
[string]
-1
The element name is unrecognized or unsupported.
-2
The ID not found or invalid.
-3
The attribute name unrecognized or unsupported.
0
The output string contains a logical FALSE, ("FALSE").
1
The output string contains a logical TRUE, ("TRUE").
2
The output string contains an integer, for example, "30101".
3
The output string contains an array of integers, for example "1 2 3".
4
The output string contains a double, for example, "1.234".
5
The output string contains an array of doubles, for example, "1.234 56.789".
6
The output string contains a single character, for example, "R".
7
The output string contains an array of characters, for example, "Wheel Left".

Example

To access the body_id of the marker with id=30101010 in the XML file as follows:

<Reference_Marker
     id                  = "30101010"
     body_id             = "30101"
     body_type           = "RigidBody"
  />

from a Fortran user subroutine you may call

CALL MODFNC('Reference_Marker',30101010,'body_id', STRG,INFO)
CALL STR2INTARY(STRG, ARRAY, NSIZE, ISTAT)

In this example, the STRG returns a value of '30101' and the INFO returns a value of 2, indicating a single integer. The subsequent call to STR2INTARY using STRG as input yields an output ARRAY(1)=30101, NSIZE=1, and ISTAT=0 (normal return).

Comments

  1. Input is case-insensitive.
  2. You are responsible for providing sufficient storage in the output string.
  3. The following model and command elements can be queried using the MODFNC data access sub routine:
    Element class Element Name
    Reference Reference_Marker, Reference_Spline, Reference_Variable, Reference_Matrix, Reference_FlexData, Reference_Array, Reference_ParamCurve, Reference_DeformCurve, Reference_ParamSurface, Reference_DeformSurface, Reference_String, Reference_2DCluster
    Post Post_Graphic, Post_Request
    Constraint Constraint_Joint, Constraint_JPrim, Constraint_Mate, Constraint_Coupler, Constraint_PTCV, Constraint_PTdCV, Constraint_PTdSF, Constraint_CVCV, Constraint_PTSF, Constraint_CVSF, Constraint_SFSF, Constraint_Gear, Constraint_UserConstr, Constraint_General
    Force Force_Gravity, Force_SpringDamper, Force_Bushing, Force_Beam, Force_Field, Force_MultiPoint, Force_FlexModal, Force_Scalar_TwoBody, Force_Contact, Force_PTdSF, Force_StateEqn, Force_Penalty, Force_JointFriction, Force_Vector_OneBody, Force_Vector_TwoBody
    Body Body_Rigid, Body_Flexible, Body_Point
    Motion Motion_Marker, Motion_Joint
    Control Control_Diff, Control_SISO, Control_StateEqn, Control_PlantInput, Control_PlantOutput
    Param Param_Transient, Param_Static, Param_Linear, Param_Simulation, Param_Unit
    Sensor Sensor_Event, Sensor_Evaluate, Sensor_Proximity
    JointInitialVel JointInitialVel_Rev, JointInitialVel_Trans, JointInitialVel_Cyl
    Simulate (Command) Simulate
  4. The output string may be processed by calling STR2INTARY or STR2DBLARY, to convert the output from strings to integer(s), for info = 2, 3, or to convert the output from strings to double(s), for info = 4, 5.