USRMES

Utility/Data Access SubroutineUSRMESユーティリティサブルーチンでは、MotionSolveの実行時にカスタムメッセージを出力できます。

使用

この関数は、任意のユーザー定義のサブルーチンから呼び出すことができます。

フォーマット

Fortranの呼出し構文
CALL USRMES (MSGFLG, MESAGE, ID, MSGTYP)
C/C++の呼出し構文
c_usrmes (msgflg, message, id, msgtyp)
Pythonの呼出し構文
py_usrmes (msgflg, message, id, msgtyp)
MATLABの呼出し構文
m_usrmes (msgflg, message, id, msgtyp)

属性

ID
[整数]
USRMESを呼び出している、対応するユーザー定義要素の識別子。
MSGFLG
[論理]
true(またはC/C++の場合はゼロ以外)でMotionSolveUSRMESユーティリティサブルーチンを呼び出す値。
MESSAGE
[character*(*)]
MSGFLGがtrue/ ゼロ以外のときに出力ファイルに出力されるメッセージを含む文字列または文字列変数。
MSGTYPE
[character*(*)]
出力されるメッセージのタイプを含む文字列または文字列変数。8つのメッセージタイプがサポートされています。
INFO
情報。
INFO_NOPAD
USERMES: USER [id]パディングのない情報。
INFO_LOG
LOGファイルにのみ書き込まれる(画面には書き込まれない)情報。
WARN
警告。
WARN_NOPAD
USERMES: USER [id]パディングのない警告。
WARN_LOG
LOGファイルにのみ書き込まれる(画面には書き込まれない)警告。
ERROR
エラー。
FAULT
致命的なエラー。

他のサポートされていないMSGTYPEのタイプの場合は、MSGTYP = "INFO"で情報メッセージが発行されます。

FAULT
致命的なエラー。

他のMSGTYPEのタイプの場合は、情報メッセージが発行されます。

下のPythonスクリプトは、カスタマイズされたメッセージを出力するためのUSRMESサブルーチンの使い方を示しています。

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

上のスクリプトを使用した場合に、シミュレーション中にログファイルと画面に書き出されるユーザーメッセージのフォーマットを以下の表に示します。

MSGTYP コードと出力
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]
警告: This is a padded warning message.
WARN_NOPAD
py_usrmes(1, "This is a non-padded warning message", 1234, "WARN_NOPAD")
警告: 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]
警告: 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.