Messaging Mapping

Messaging mapping allows you to overwrite MotionSolve standard messages in the log file, or to append additional comments to the standard MotionSolve message.

You can customize messages by defining a CustomMessage element in the XML mapping file as shown in the figure below. Based on the definition of the custom message, the log file will contain customized information. Only messages with an ID tag can be customized.

Figure 1. <CustomMessage/> Element in the Mapping XML and the Corresponding Log File as the Output

The general syntax for the CustomMessage element is:

  ID                  = "integer"
  TYPE                = { "INFO" | "WARNING" | "ERROR" }
  ACTION              = { "APPEND" | "OVERWRITE" | "DISABLE" }
  TITLE               = { "ON" | "OFF" }
  WARN_COUNT          = "integer"
Attributes Description
ID Specifies a unique ID for the message. This must match with the message ID written by MotionSolve.
TYPE Specifies the type of the message (WARNING, ERROR, or INFO). The default is set to INFO.
ACTION Message action (APPEND, OVERWRITE, or DISABLE). The default is set to APPEND.

APPEND appends the custom message after the standard message.

OVERWRITE uses the custom message instead of the standard message.

DISABLE disables the message (both standard and custom message).

TITLE Specifies whether to enable or disable the title of the message. The default is ON.
WARN_COUNT Specifies how many times a specific warning is to be printed. The default values is -1, which represents infinity. This is applicable only to messages of the type WARNING.

Create a Custom Messaging API

Edit the <Messaging/> element in the MotionSolve XML input file as shown below:

Figure 2. Editing the XML file to Declare Custom Messaging

Edit the <Messaging/> Element in the MotionSolve XML Input File

  1. Specify the usersub DLL and function name.
  2. Pass an optional param_string to MESSAGE_SUB.
  3. Write a MESSAGE_SUB user-subroutine (C or Fortran):
    Figure 3. Example of MESSAGE_SUB in C and Fortran
    For example, the MESSAGE_SUB can be used to write a log file in XML format:
    Figure 4. Log File in XML Format