Sending a machine command

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

Sending a machine command

mapp Services V5.16

Requirement

A machine must heat up to a certain temperature before it can begin production. The process of heating up takes half an hour. When the operator arrives at the beginning of a shift, he must manually switch on the heat and then wait half an hour before the machine is productive. Now it is possible to send a text message to the machine that triggers the heating process remotely. The operator can send the message half an hour before the beginning of his shift, and the machine will be ready for production right when the shift begins.

Solution

Component list

MpTweetCore (own MpLink): This component establishes a connection to a specified modem that makes it possible to transmit and receive messages.

MpTweetCommandRequestCheck (MpLink from MpTweetCore): Checks whether a transmitter's request is pending

MpTweetCommandRequestDone (MpLink from MpTweetCore): Indicates whether a request has been executed successfully

Connection diagram

mptweetusecase_1_connection

 

 

Configuration

The MpTweetCore configuration is added.

In order for the machine to switch on preheating on command, a request called "Preheat" is created under Requests. Since the request is for a command to be executed, the Type is set to "Command Request". If the machine operator sends a message, which is specified under Request Message, the machine begins preheating. Once the machine reaches the desired temperature, the message specified under Return Message is returned to the sender.

For information about configuring the modem, see section Basic concept.

mptweetusecase_1_configuration

Using mapp components

Component MpTweetCore is added in order to establish a connection with the modem specified in the configuration. Function MpTweetCommandRequestCheck checks whether any requests are pending. MpTweetCommandRequestDone specifies whether a request has been executed successfully and can inform the transmitter of this. In order for these two functions know which request to check, the "Preheat" ID defined in the configuration is specified on input "RequestID".

After the components are added, they are connected to each other as described under "Connection diagram" and then configured.

Switching on the heating must be implemented in the application, and might look something like this:

PROGRAM _CYCLIC
IF (MpTweetCommandRequestCheck(gTweet, 'Preheat')) THEN
        HeatingZone.Enable             := TRUE;
        HeatingZone.SetTemperature     := HMI.SetTemperature;
    END_IF
IF (MpTweetCommandRequestCheck(gTweet, 'Preheat')) AND (HeatingZone.TemperatureReached) THEN
        MpTweetCommandRequestDone(gTweet, 'Preheat', mpTWEET_CMD_REQUEST_SUCCESS);
    END_IF
END_PROGRAM
PROGRAM _CYCLIC
IF (MpTweetCommandRequestCheck(gTweet, 'Preheat')) THEN
        HeatingZone.Enable             := TRUE;
        HeatingZone.SetTemperature     := HMI.SetTemperature;
    END_IF
IF (MpTweetCommandRequestCheck(gTweet, 'Preheat')) AND (HeatingZone.TemperatureReached) THEN
        MpTweetCommandRequestDone(gTweet, 'Preheat', mpTWEET_CMD_REQUEST_SUCCESS);
    END_IF
END_PROGRAM