Commands Supported by TCP ASCII Communication and Returned Status Codes
When TCP ASCII communication is used, the external device should use the following types of commands to trigger the Mech-MSR project to run and obtain the corresponding results.
-
trigger command: for triggering a project or projects to run.
-
return command: for obtaining the judgment result and measurement result of a specified project.
-
judge command: for obtaining the overall quality judgment result of a specified project or the quality judgment result of individual measurement items.
-
value command: mainly for obtaining the measured values of a specified project.
|
Trigger Command
The trigger
command is used to trigger Mech-MSR projects to run. Multiple projects can be triggered to run at the same time.
Step 1: Determine Project ID
In the Project List area of Mech-MSR’s home interface, check the ID of the project to be triggered.
|
Step 2: Send a Command
The sent trigger
command should consist of trigger, project ID, and string delimiter.
-
trigger: the exact command name, case-sensitive.
-
Project ID: the ID of the project to be triggered in the Mech-MSR solution.
-
String delimiter: The symbol that separates “trigger” from the project ID. The default value is the English comma (,). You can change it in Mech-MSR’s Communication Configuration window under the Other data formats parameter.
The table below illustrates the format of trigger
commands.
Format | Description | Example |
---|---|---|
|
Triggers a project to run. |
Triggers the project with an ID value of 1 to run:
|
|
Triggers multiple projects to run. |
Triggers projects with ID values of 1, 2, and 3 to run:
|
For projects newly created under a solution, you need to close and reopen the solution before triggering the project to run using this command. |
Step 3: Check the Returned Results
After a trigger
command is sent, if the received status code is 0
, the command has been executed successfully.
If command execution fails, an error code -1
or -4
will be returned. See Error Codes for possible causes and solutions.
Return Command
After sending a trigger command to trigger the project to run, use the return
command to obtain the running results of the project. You can use the return
command to get the results of only one Mech-MSR project at a time.
Step 1: Determine the Format of Returned Results
In Mech-MSR’s Communication Configuration window, set the Data format of return commands according to actual needs.
The default data format is %judge,%value[%id],%judge[%id]
.
Step 2: Send a Command
The sent return
command should consist of return, project ID, and string delimiter.
-
return: the exact command name, case-sensitive.
-
Project ID: The ID of the project triggered by the trigger command in the Mech-MSR solution.
-
String delimiter: The symbol that separates “return” from the project ID. The default value is the English comma (,).
The table below illustrates the format of return
commands.
Format | Description | Example |
---|---|---|
|
Used to obtain the running result of the project. |
Command to send for obtaining the running result of project 1:
|
Ensure that the specified project has been triggered to run by the trigger command, or else the result cannot be obtained normally after the return command is sent.
|
Step 3: Check the Returned Results
In the example of project 1, after the external device sends return, 1
command, Mech-MSR will return the results according to the Data format of return commands set in the Communication Configuration window.
If the command execution fails, an error code -1
, -2
, -3
or -4
will be returned. See Error Codes for possible causes and solutions.
Data format of return commands | Returned results (example) | Description |
---|---|---|
|
|
It indicates that the overall quality judgment result of project 1 is OK. |
|
|
It indicates that the overall quality judgment result of project 1 is NG. |
|
|
It indicates that the overall quality judgment result of project 1 is OK, and in this project, only two measurement items are specified to be output. The first measurement item in sequence has a value of 0.0224 and is judged as OK, and the second measurement item has a value of 54.0000 and is judged as NG. |
|
It indicates that the overall quality judgment result of project 1 is NG. In this project, only one measurement item is specified to be output. The measurement item has no measurement result, and thus invalid is returned, and the value of the measurement item is judged as NG. |
|
|
|
It indicates that the overall quality judgment result of project 1 is OK, and both the value of measurement item 2 and the corresponding judgment result are invalid. Possible cause:
Solutions:
|
See Measured values and judgment results to learn the basic conditions for Mech-MSR returning results to an external device. |
Judge Command
After sending a trigger command to trigger the project to run, use the judge
command to obtain the judgment results of the specified Mech-MSR project or individual measurement items.
Step 1: Send a Command
The sent judge
command should consist of judge, project ID, and string delimiter.
-
judge: the exact command name, case-sensitive.
-
Project ID: The ID of the project triggered by the trigger command in the Mech-MSR solution.
-
String delimiter: The symbol that separates “judge” from the project ID. The default value is the English comma (,).
The table below illustrates the format of judge
commands.
Format | Description | Example |
---|---|---|
|
Used to obtain the overall quality judgment result of the specified project and the judgment results of individual measurement items. |
Command to send for obtaining the overall judgment result of project 1 and the judgment results of individual measurement items:
|
Step 2: Check the Returned Results
In the example of project 1, after an external device sends judge, 1
, Mech-MSR will return the overall quality judgment result of the project and the quality judgment results of individual measurement items according to the set quality judgment rule and communication output in the Output Management window.
If the command execution fails, an error code -1
, -2
, -3
or -4
will be returned. See Error Codes for possible causes and solutions.
Returned result | Description |
---|---|
(example) |
The first 0 indicates that the overall judgment result of project 1 is OK, and the next two 0s indicate that 2 measurement items have been set to be output for the project, and the judgment result of both is OK. |
(example) |
The first 1 indicates that the overall judgment result of project 1 is NG, and the next two 1s indicate that 2 measurement items have been set to be output for the project, and the judgment result of both is NG. |
See Judgment results to learn about the basic conditions for Mech-MSRreturning results to an external device. |
Value Command
After sending a trigger command to trigger the project to run, use the value
command to obtain the measured values of the specified project.
Step 1: Send a Command
The sent value
command should consist of value, project ID, and string delimiter.
-
value: the exact command name, case-sensitive.
-
Project ID: The ID of the project triggered by the trigger command in the Mech-MSR solution.
-
String delimiter: The symbol that separates “value” from the project ID. The default value is the English comma (,).
The table below illustrates the format of value
commands.
Format | Description | Example |
---|---|---|
|
Used to obtain the measured values of a specified project. |
Command to send for obtaining the measured values of project 1:
|
Step 2: Check the Returned Results
In the example of project 1, after an external device sends value, 1
, Mech-MSR will return the overall quality judgment result of the project and the values of each measurement item according to the set quality judgment rule and communication output in the Output Management window.
If the command execution fails, an error code -1
, -2
, -3
or -4
will be returned. See Error Codes for possible causes and solutions.
Returned result | Description |
---|---|
(example) |
0 indicates that the overall judgment result of project 1 is OK, and the value of measurement item 1 is 54.000. This project only specifies the output of one measurement item. |
(example) |
1 indicates that the overall judgment result of project 1 is NG, and the value of measurement item 1 is 54.0000. This project only specifies the output of one measurement item. |
(example) |
1 indicates that the overall judgment result of project 1 is NG. This project only specifies the output of one measurement item, but the measurement item does not have a corresponding value. Thus, the returned value is invalid. Possible cause:
Solutions:
|
See Measured values and judgment results to learn the basic conditions for Mech-MSR returning results to an external device. |
Error Codes
The possible causes and solutions for returned error codes are shown in the table below.
Error code | Description | Possible cause | Solution |
---|---|---|---|
|
Indicates that the project ID does not exist. |
|
|
|
Indicates no results. |
|
|
|
If the project has not finished running within 10 seconds after a command is sent, this error code will be returned. |
The project execution time is too long, exceeding the timeout period (10 seconds). |
Check if the execution time of the project is longer than 10 seconds, and check if the execution time is abnormal. If there is an exception, figure out the reason for the excessive project execution time and fix it; if it is normal, try solving the problem as follows:
|
|
Indicates that an illegal command was sent. |
|
|