Commands for TCP ASCII Communication

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.

  • execute command: for triggering a project to run and obtaining the judgement result and measurement result of the 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.

  • The return/judge/value command can only be sent after the project is triggered to run successfully by the trigger command.

  • After making changes in the Mech-MSR’s Output management window, you should re-send the trigger command to trigger the project to run, and then send other commands to obtain relevant results. If the project is not triggered to run again, the obtained results will not be updated as modified.

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.

project number
Drag the projects to adjust the project order, and then click the solution name and select Reset Project IDs from the right-click menu to update the project IDs.

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

trigger, project ID

Triggers a project to run.

Triggers the project with an ID value of 1 to run:

trigger, 1

trigger, project ID 1, project ID 2, project ID 3

Triggers multiple projects to run.

Triggers projects with ID values of 1, 2, and 3 to run:

trigger, 1, 2, 3

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].

return command format

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

return, project ID

Used to obtain the running result of the project.

Command to send for obtaining the running result of project 1:

return, 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

%judge

0

It indicates that the overall quality judgment result of project 1 is OK.

%judge

1

It indicates that the overall quality judgment result of project 1 is NG.

%judge,%value[%id],%judge[%id]

0,0.0224,0,54.0000,1

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.

1,invalid,1

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.

%judge,%value[2],%judge[2]

0,invalid,invalid

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:

  • In Mech-MSR’s Output Management window, no measurement item with an ID value of 2 is added in the Communication output tab.

Solutions:

  • Ensure that there is a measurement item with an ID value of 2 under the Communication output tab of Mech-MSR’s Output Management window.

  • Change the Data format of return commands to ensure that valid results can be returned.

See Measured values and judgment results to learn the basic conditions for Mech-MSR returning results to an external device.

Execute Command

The execute command combines the functionality of the trigger and return commands. It can be used to trigger a project to run and obtain both the judgment results and measurement results of the project.

Send a Command

The sent execute command should consist of execute, project ID, and string delimiter.

  • execute: 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 “execute” from the project ID. The default value is the English comma (,).

The table below illustrates the format of execute commands.

Format Description Example

execute, project ID

Triggers a project to run and obtains the judgement results and measurement results of the project.

Triggers the project with an ID of 1 to run and obtains the judgement results and measurement results of the project:

execute, 1

The execute command (command code 1) can only be used for triggering one project to run and obtaining the judgement result and measurement result of the project.

Check the Returned Results

In the example of project 1, after the external device sends execute, 1 command, Mech-MSR will return the results according to the Data format of return commands set in the Communication Configuration window. See Returned Results of Return Command for details.

If the command execution fails, an error code -1, -2, -3 or -4 will be returned. See Error Codes for possible causes and solutions.

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

judge, project ID

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:

judge, 1

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

0,0,0

(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.

1,1,1

(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

value, project ID

Used to obtain the measured values of a specified project.

Command to send for obtaining the measured values of project 1:

value, 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

0,54.0000

(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.

1,54.0000

(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.

1,invalid

(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:

  • There are no measurement results for this measurement item.

Solutions:

  • Check the measurement and ensure that the project can output valid results.

See Measured values and judgment results to learn the basic conditions for Mech-MSR returning results to an external device.

We Value Your Privacy

We use cookies to provide you with the best possible experience on our website. By continuing to use the site, you acknowledge that you agree to the use of cookies. If you decline, a single cookie will be used to ensure you're not tracked or remembered when you visit this website.