GAT Example: Water Tank: Remote Controlling and Notification with SMS

In this example we will deal with a water tank, which is a typical case of remote installation with needs for remote control and immediate notification of the persons in charge if something goes wrong.

To implement the needed functionality, we will use the ready-made procedures performed by the GAT device.

  GAT-1 example 2 preview

The scenario of this application is as follows:

The GAT device is used to supervise the water level in the tank and control the drain valve

The tank is equipped with a level sensor with voltage output
in the range of 0,0 to 10,0V for water level in the range of 0,0 to 2,5 meter. 
The sensor output is connected to Input #1 of the GAT device.

There is also a drain valve, used for watering.
This is controlled by the Output #1 of the GAT device.

 The functionality provided is as follows:

  • The administrator can start watering, by sending the message:
        WATER ON

    The device will activate the tank valve and reply with the message:   
        O.K.
        WATER ON

    The administrator can stop watering, by sending the message:
        WATER OFF

    The device will deactivate the valve and reply with the message:
        O.K.
        WATER OFF

    If the administrator does not send a watering stop message, the tank drain valve will close 30 minutes after the watering start message.

  • The administrator of the tank is able to check the GAT device with an unanswered telephone call. 
    If the device is functioning properly, it will answer with a telephone call to the administrator.

  • The administrator can ask the water level at any time by sending the message:
        0000 ID

    The GAT device will answer with a message like:
        2022/01/10,13:30:20
        WATER-TANK #1
        LEVEL:1.74m
        ID:
        GAT-1 version:1.2 SN:294E08

  • If the water level falls below a predetermined limit of 40cm,
    the GAT device will immediately send a warning message to the administrator:
        2022/01/10,13:30:20
        WATER-TANK #1
        LEVEL:0.38m
        WATER LEVEL LOW!


The above descripted functionality is implemented with the following program:

;~ FPwizard 07/18/22,20:00:01
;~ device: GAT-1

;~ Telephone Numbers list with 1 clients
TN
11111111
;~ #1 Administrator

;~ Inputs
;~ I1: Water Level
IM 1 1 ;~ I1 'Water Level' event Messages to client #1 'Administrator'
"" ;~ message on activation
"WATER LEVEL LOW!" ;~ message on deactivation
IT 1 100 ;~ I1 'Water Level' reaction Time: 10.00 sec
AIC 1 0 250 ;~ Input #1 'Water Level' Analog Calibration: Offset=0, Factor=250
AIT 1 40 50 ;~ I1 'Water Level' Analog Thresholds, Low=40, High=50

;~ Outputs
;~ O1: DRAIN VALVE

OC 1 ;~ O1 'DRAIN VALVE' Control Messages
"WATER ON" ;~ activation message
"WATER OFF" ;~ deactivation message
OP 1 1800 ;~ O1 'DRAIN VALVE' Pulse mode with duration: 1800 sec

;~ Extras

HD "%D,%T%nWATER-TANK #1%nLEVEL:%fA1m" ;~ Message Header
TCA 1 ;~ Telephone Call Answer mode

;~ FPwizard end


This application program has been produced with the help of the dialog window "Functional Parameters Wizard", which is part of the "GATcomm" support application.
The user can open the text editor window, start this dialog window and fill in the data in the input fields.
The application program is created by clicking the button "Apply" on this window.
Then he can upload the application program to the connected GAT device to test it and edit the program text or re-open the window to modify it.

The application program is uploaded to the device with 2 successive messages:

"GATcomm" example #3 upload screenshot 

The "GATcomm" application sends the messages in a "compressed" form,
with only the necessary spaces and line changes.

If we ask these settings through the "FP" command,
the device will answer us in a fairly understandable text format:

 GATcomm example #3 download screenshot

 

   * * * 

On this example, we used some ready-made features provided by the GAT device,
like the ability to calibrate the Analog Input Value
in the range of 0..250cm with a resolution of 1cm ( command "AIC" ),
and set the Analog Value Thresholds ( command "AIT"
to trigger the alert message after the Input state change from "1" to "0" at the level of 40cm.

Also we used some special characters in the message Header ( "HD" ),
to present the Water Level value in a nice way format. 

In a further example, we will use the GAT Automation Language
to develop a more sophisticated application with more features,
including the control of the water filling pump for the tank.