USRMES

Utility/Data Access SubroutineThe USRMES utility subroutine allows you to output custom messages during MotionSolve execution.

Use

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

Format

Fortran Calling Syntax
CALL USRMES (MSGFLG, MESAGE, ID, MSGTYP)
C/C++ Calling Syntax
c_usrmes (msgflg, message, id, msgtyp)
Python Calling Syntax
py_usrmes (msgflg, message, id, msgtyp)
MATLAB Calling Syntax
m_usrmes (msgflg, message, id, msgtyp)

Attributes

ID
[integer]
The identifier of the corresponding user-defined element that is invoking USRMES.
MSGFLG
[logical]
A value that when true (or nonzero for C/C++), causes MotionSolve to call the USRMES utility subroutine.
MESSAGE
[character*(*)]
A character string or a string variable that contains the message printed to the output files when MSGFLG is true/non-zero.
MSGTYPE
[character*(*)]
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.

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(1,"This is a padded info message",1234,"INFO")
    
    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.