HyperWorks Solvers

USRMES

USRMES

Previous topic Next topic No expanding text in this topic  

USRMES

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

Subroutine Type

Utility/Data Access

Definition

The USRMES utility subroutine allows you to output custom messages during MotionSolve execution.

Use

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

Calling Syntax

Fortran

CALL USRMES (MSGFLG, MESAGE, ID, MSGTYP)

C

c_usermes (msgflg, message, id, msgtyp)

Python

py_usermes (msgflg, message, id, msgtyp)

Matlab

m_usermes (msgflg, message, id, msgtyp)

Input Arguments

[integer] ID

The identifier of the corresponding user-defined element that is invoking USRMES.

 

[logical] MSGFLG

A value that when true (or nonzero for C/C++), causes MotionSolve to call the USRMES utility subroutine.

 

[character*(*)] MESSAGE

A character string or a string variable that contains the message printed to the output files when MSGFLG is true/non-zero.

 

[character*(*)] MSGTYPE

A character string or a string variable that contains the type of message that is being output.  There are eight message types supported.

INFO - information.

INFO_NOPAD – information without the USERMES: USER [id] padding.

INFO_LOG – information written only to the LOG file and not to screen.

WARN - warning.

WARN_NOPAD – warning without the USERMES: USER [id] padding.

WARN_LOG – warning written only to the LOG file and not to screen.

ERROR – error.

FAULT – fatal error.

For any other type of MSGTYPE that is not supported, an information message with MSGTYP = “INFO” is issued.

FAULT - fatal errors.

For other types of MSGTYPE, information message is issued.

Output Values

No values are returned to the calling subroutine.

Example

The following Python script illustrates the use of the USRMES sub routine to output customized messages.

def VARSUB(id, time, par, npar, dflag, iflag):

 

    #The user message is specified below
    py_usrmes(1This is a padded info message1234INFO)
    
    if iflag:
        py_set_discrete_interface()
    ipar = []    
    ipar.append(int(par[1]))
    [dif, errflg] = py_sysfnc(DIF, ipar)
    [dif1, errflg] = py_sysfnc(DIF1, ipar)
    value = 0.01*dif+0.0001*dif1
    return value

Using the above script, the table below illustrates the format of the user message that is written out to the log file and on-screen during the simulation.

MSGTYP

Code and Output

INFO

py_usrmes(1, “This is a padded info message”, 1234, “INFO”)

USRMES:USER [1234]

INFO: This is a padded info message.

INFO_NOPAD

py_usrmes(1, “This is a non-padded info message”, 1234, “INFO_NOPAD”)

INFO: This is a non-padded info message.

INFO_LOG

py_usrmes(1, "This is a padded info message written only to the log file", 1234, "INFO_LOG")

USRMES:USER [1234]

INFO: This is a padded info message written only to the log file.

WARN

py_usrmes(1, “This is a padded warning message”, 1234, “WARN”)

USRMES:USER [1234]

WARNING: This is a padded warning message.

WARN_NOPAD

py_usrmes(1, "This is a non-padded warning message", 1234, "WARN_NOPAD")

WARNING: This is a non-padded warning message.

WARN_LOG

py_usrmes(1, "This is a padded warning message written only to the log file", 1234, "WARN_LOG")

USRMES:USER [1234]

WARNING: This is a padded warning message written only to the log file.

ERROR

py_usrmes(1, "This is a padded error message", 1234, "ERROR")

USRMES:USER [1234]

ERROR: This is a padded error message.

ERROR_NOPAD

py_usrmes(1, "This is a non-padded error message", 1234, "ERROR_NOPAD")

ERROR: This is a non-padded error message.

FAULT

py_usrmes(1, "This is a padded fatal error message", 1234, "FAULT")

USRMES:USER [1234]

FAULT: This is a padded fatal error message.

FAULT_NOPAD

py_usrmes(1, "This is a non-padded fatal error message", 1234, "FAULT_NOPAD")

FAULT: This is a non-padded fatal error message.

See Also:

Data Access Subroutines