26 - 09 - 2017

Android library

Settings:

The SCADA application allows mobile devices to be connected remotely via TCP/IP internet protocol and to monitoring and control a wide range of processes and external hardware. The communication is protected with password.

In order to use remote connected android devices, the SCADA software needs some settings:

  • Settings of the TCP/IP Server: From icon TCP/IP Server, the port of the server has to be set:

  •  Allowed android devices: The number of allowed devices, which can communicate with SCADA software is limited from the current licence. Before using the android device, it must be registered in the system. This happends from icon Allowed android devilce of the SCADA software.  Every android device has an unical number, it has to be added to the interface below. For this purpose, the TCP/IP server of the SCADA software has to be ran, then go to Settings interface of AltonaLab android application and push the button Register to Host. The unical number of the device will appear in Android bevice ID edit of the interface below. The descriprion of the device has to be written by hand. The third element of the added device is its SCADA ID. This is an unical number for internal use of SCADA software. When a new TCP/IP command arrived from android device, the output OnReceived of the block AndroidRemoteControl become to hight value and the output ReceivedScadaID gets the SCADA ID of the device from which the TCP/IP comand arrived.

  • Starting the TCP/IP Server:

  • Start the TCP/Server automaticaly: In case the TCP/Server has to be ran when the SCADA software ran, then into "COMMON" section of AltonaLab.INI file has to be added StartTCPServer=1

[COMMON]
StartTCPServer=1

  • Windows FireWall - the port of the TCP/IP server of the SCADA software has to be excluded from Windows FireWall restrictions.
  • Internet router Port Forwarding - usualy the SCADA application works behind interner router and has internal IP address. The mobile device will try to access the TCP/IP server of the SCADA application via external IP address of the internet router. In this case the port of the TCP/IP server has to be forwarded in internet router from external to internal IP address of the computer where SCADA software works.

 

Description of Android remote control application:

Each SCADA process can supports many groups of mobile devices with installed remote control application. This ability allows one mobile device to control one part of the process, other mobile device to control other part of the process. Mobile application is free to be downloaded but number of connected android devices depends on current SCADA licence.

The mobile application has two windows - working window and window for settings.

 

The window for settings has:

  • IP address and Port of the computer where SCADA works. This settings are important for TCP/IP protocol. IP address is computer's internet address. Port is a setting of TCP/IP Server, which have to be started on the SCADA software.
  • ObjectID and PassWord: this two parameters correspond with the same settings of the block AndroidRemoteControl from the SCADA's diagram. The communication protocol uses them to identify which command from mobile device, to which AndroidRemoteControl block to be processed - in case the diagram has a few AndroidRemoteControl blocks.

  • Button Register to host: before to push the button, please be sure IP and Port are set. When the button is pushed, the unical Android device ID from mobile phone will be send to SCADA and will be shown to the SCADA interface Allowed android devices, which is described above. If the mentioned interface is now activated, the android application will show an error message. SCADA's TCP/IP server has to be ran.

  • Button Get configuration: reads the settings from SCADA block AndroidRemoteControl for available buttons - parameter PhoneSettings, buttons settings. SCADA's TCP/IP server has to be ran.

  • Switch GPS: if the switch is On, GPS information about phone location will be send to SCADA software with every command from the android application.

The main interface has the next controls:

  • A text, which shows the data and time of the last connection with SCADA software and the condition of all inputs of the block AndroidRemoteControl from SCADA diagram. If some of this inputs are not connected, they will not be shown on this control. When the button Read is pressed, the command for reading AndroidRemoteControl block's inputs is sengind to SCADA application and the result of this reading is shown on the text control. If the user press some button to control digital outputs of the block AndroidRemoteControl, this action will reads the inputs of block too and shows thiers values.
  • All the buttons, which are set from parameter PhoneSettings of block AndroidRemoteControl, are shown under the text control. If one of the buttons is pressed, a command to SCADA application is sent and correcponding digital output of block AndroidRemoteControl becomes to hight level for 2 seconds.
  • The bottom button is Setttings, which opens the Settigns dialog.
     

Block AndroidRemoteControl

On the SCADA's side need to be added a block AndroidRemoteControl. Its parameters ObjectID and PassWord have to be equal with the same settings at android application. A SCADA diagram may has more than one block AndroidRemoteControl, but they have to be with different ObjectID parameters.

Block's parameters:

  •  PhoneSettings: with this parameter can be set two groups of values:
    - Monitoring values (block's inputs): every value, which we want to monitoring has to be added as block's input. On the android application it will appears on the blue text control over the buttons. The input can be from type - analog, digital, integer, string.
    - Buttons (block's outputs): every added output of the block will appears as button in the android application.

 

  • TextOut: This powerful parameter allows to be designed the appearance of the blue color text control of the android application. The text is multiline. For every block's input which is enclosed with <>, its value will be replaced in the text of the parameter TextOut. The final result of the text will be send on every command to android application and will be shown in blue text control. For example, if the TextOut is:
     
    Fan in bathroom is <FanBath;working;stopped>
    Outside temp: <Temp;2> [C]
    Humudity: <Hum;1> [% RH]
    Barometric pressure <AirPress> [hPa]
     
    Where Temp, Hum and AirPress are analog inputs, FanBath is a digital input. For every input, the text after ; gives the information how the input's value to be formated. For analog inputs, the number after ; means number of digits after decimal dot. If the name of input is not followed with a number, then its value will be presented with 3 digits after decimal dot. For digital inputs ;working;stopped means how the high/low value of input to be presented as text. If the name of input is not followed with texts for high and low states, then the digital value will be presented with texts On,Off. Inputs with types integer and string have not formating information.
     
    If the inputs from expample have the next values: Temp=19.8, Hum=77,  AirPress=1023, FanBath=1, then the result text will be:
    Fan in bathroom is working
    Outside temp: 19.80 [C]
    Humudity: 77.0 [% RH]
    Barometric pressure 1023 [hPa]

 

Block's outputs:

  • OnReceived - when the SCADA software receives a command from the android application, then this output become to high lever for a while;
  • ReceivedScadaID - when the SCADA software receives a command from the android application, then this output gets the value ScadaID from allowed to work with SCADA software phone -  see the interface Andorid devices at the top of this article;
  • ReceivedLatituce, ReceivedLongitude - when the GPS switch from settings interface at android application is switched on, then with every command from the phone, a GPS coordinates will be received.
  • OnGPSReceived - becomes to high level when a GPS coordinates are received;

 

Block AndroidPhoneInfo

This mobile application obtains information from the Android mobile phone sensors (TCP/IP Server has to be started). The Android application is a file called EarthMagnetic.apk. As it is possible to connect multiple phones at one diagram, each of them should be represented with a separate AndroidPhoneInfo block. The system will recognize the phone and connect it to the appropriate block by its ObjectID. Set the same integer value in the android application and for the block parameter ObjectID. Per few seconds, the mobile phone sends information from sensors mentioned below to SCADA application:

  • Magnetic sensors - X, Y, Z;
  • Azimuth angle;
  • Pitch angle;
  • Roll angle;
  • Temperature;
  • GPS Latitude;
  • GPS Longitude;
  • Accuracy;
    When the data from mobile device is received, it is available on corresponding analog outputs on block AndroidPhoneInfo.

Parameters:

  • ObjectID - the ID of phone;

 

When a new data is received from the android device, the output OnReceiveData becomes to hight value.