15 - 08 - 2018

Text Formatting strategy

Text Formatting strategy:

Most of the blocks are designed to be universal and inputs with different types of signals can be added to them. Sometimes we need to format text with the values of the inputs. For example, fs we are monitoring one temperature sensor and two PIR sensors (infrared sensors) and if there is an event as opened door, the diagram have to send an e-mail with values of the temperature and PIR sensors. We have to add a MailSender block to the diagram with three inputs:


- PIR1 (digital value);

- PIR2 (digital value);

- Temp (analog value);

The BODY of the sending e-mail can be:

Current temperature is 23.5 [C]
The bedroom door is: Closed
The living room door is: Open

This can be achieved by adding formatting tags to the text, which will change the contents of tags to the value of the inputs. For example:

Current temperature is <Temp;2> [C]
The bedroom door is: <PIR1;Open;Closed>
The living room door is: <PIR2;Open;Closed>

When the time comes to send an email, the following will happen:
- Tag <Temp;2> will be replaced with value of input Temp with two digits after the decimal separator;
- If the PIR1 or PIR2 inputs are at high level, their tag will be replaced with the Open string, if they are at a low level, they will be replaced with the Closed String;

Formats:
The formats for the different input types are described below. The basic rules are:
- tags always start with < and end with >
- the first parameter in the tag is always the name of the input, the parameters after the name are separated by ;
- all the parameters after the InputName are not required;

1. Digital values:
<InputName;OnValue;OffValue;WholeStringLen;LeftFillChar;RightFillChar>
- InputName - name of the input;
- OnValue - the value of the TAG if the input is in high level. If this parameter is not added, the TAG will be replaced with the default value On
- OffValue - the value of the TAG if the input is in low level. If this parameter is not added, the TAG will be replaced with the default value Off
- WholeStringLen - if this parameter is entered, the tag will be replaced by a string with the specified length;
- LeftFillChar - only one character can be entered for this parameter. The TAG will be replaced with a string with added LeftFillChar on the left side, until the length WholeStringLen is reached;
- RightFillChar - only one character can be entered for this parameter. The TAG will be replaced with a string with added RightFillChar on the right side, until the length WholeStringLen is reached;

2. Analog values:
<InputName;DigitsAfterDecimalSeparator;DecimalSeparator;WholeStringLen;LeftFillChar;RightFillChar>
- InputName - name of the input;
- DigitsAfterDecimalSeparator - digits after the decimal separator. Default value is 2;
- DecimalSeparator - this parameter can be only one character and is the decimal separator. The default value is a dot: .
- WholeStringLen - if this parameter is entered, the tag will be replaced by a string with the specified length;
- LeftFillChar - only one character can be entered for this parameter. The TAG will be replaced with a string with added LeftFillChar on the left side, until the length WholeStringLen is reached;
- RightFillChar - only one character can be entered for this parameter. The TAG will be replaced with a string with added RightFillChar on the right side, until the length WholeStringLen is reached;

3. Integer values:
<InputName;FormatType;WholeStringLen;LeftFillChar;RightFillChar>
- InputName - name of the input;
- FormatType, this parameter can be 0 - Decimal, 1 - Binary, 2 - Hex. It specifies whether the value of the input should be converted to decimal, binary or HEX string. Default value of the parameter is 0;
- WholeStringLen - if this parameter is entered, the tag will be replaced by a string with the specified length;
- LeftFillChar - only one character can be entered for this parameter. The TAG will be replaced with a string with added LeftFillChar on the left side, until the length WholeStringLen is reached;
- RightFillChar - only one character can be entered for this parameter. The TAG will be replaced with a string with added RightFillChar on the right side, until the length WholeStringLen is reached;

4. String values:
<InputName;WholeStringLen;LeftFillChar;RightFillChar>
- InputName - name of the input;
- WholeStringLen - if this parameter is entered, the tag will be replaced by a string with the specified length;
- LeftFillChar - only one character can be entered for this parameter. The TAG will be replaced with a string with added LeftFillChar on the left side, until the length WholeStringLen is reached;
- RightFillChar - only one character can be entered for this parameter. The TAG will be replaced with a string with added RightFillChar on the right side, until the length WholeStringLen is reached;

5. DateTime values:
<InputName;DateTimeFormat;WholeStringLen;LeftFillChar;RightFillChar>
- InputName - name of the input;
- DateTimeFormat - this ia a format of the DataTime input value and is described below, by default is: dd.MM.yyyy
- WholeStringLen - if this parameter is entered, the tag will be replaced by a string with the specified length;
- LeftFillChar - only one character can be entered for this parameter. The TAG will be replaced with a string with added LeftFillChar on the left side, until the length WholeStringLen is reached;
- RightFillChar - only one character can be entered for this parameter. The TAG will be replaced with a string with added RightFillChar on the right side, until the length WholeStringLen is reached;

 

All the possible elements of the DateTimeFormat parameter are:

d - One-digit or two-digit day
dd - Two-digit day
ddd - Three-character day of the week abbreviation (for example, Mon or Tue)
dddd - Full day of the week name (for example, Monday or Tuesday)
h - One-digit or two-digit hour in 12-hour format
hh - Two-digit hour in 12-hour format
H - One-digit or two-digit hour in 24-hour format
HH - Two-digit hour in 24-hour format
m - One-digit or two-digit minute
mm - Two-digit minute
M - One-digit or two-digit month
MM - Two-digit month
MMM - Three-character month abbreviation (for example, Jan or Feb)
MMMM - Full month name (for example, January or February)
s - One-digit or two-digit second
ss - Two-digit second
y - One-digit year
yy - Two-digit year
yyyy Four-digit year

Examples for DateTimeFormat if the DateTime value is 27 July 2018 18:24:35
- dd.MM.yyyy will be replaced with 27.07.2018
- dd MMM yyyy hh:mm:ss will be replaced with 27 Jul 2018 18:24:35

 

WEB Camera

Working with WEB cam

To see an image from WEB cam at the diagram is very easy, just click a third top icon Other and add a WebCam.

 

Resize it to needful size, click the right mouse button over it and choose at the property WebCam one of the installed WEB cams on your computer. When the diagram runs, the image from the selected camera will be shown on screen.

 

 

 

 

Technical problems

AltonaLab is free for use and the latest release seems stable. I have been using it for several years at home for the house’s Home Automation needs. I have also implemented it at my weather monitoring website where it reads many sensors in real time and then saves their information in an XML file.

 

If you encounter some problems, please, report it.

 

Diagram properties

Properties of the diagram:

Right mouse button click over the diagram opens an interface for diagram properties:

  • CanvasHeight / CanvasWidth - the height and the widht of the diagram;
  • ColorBackGround - color of the background;
  • Grid Height / Grid Width - the height and the width of invisible grid, which is used from all the controls and blocks for alignment.
  • Locked - when this parameter is checked, all the blocks and controls can't be moved with the mouse.
  • LockedCanvasHeight / LockedCanvasWidth - when the diagram is locked, the application uses this parameters to determine diagram's size. This is a tricky way to hide all the blocks and contours which are outside the visible area and only controls to be shown.
  • ZoomFactor - zoom of the diagram;

 

TCP/IP Server

The application has a TCP/IP Server which makes it a very powerful instrument for remote control and remote monitoring. The server can be started from the TCP/IP Server icon from main application bar. The default port of the server is 707. It can be changed from Settings - TCP/IP Server. All the messages from TCP/IP server are shown on the right blue area with dark blue color.

Up to now two blocks that can work with TCP/IP Server have been developed. They allow the application to obtain information from a mobile phone with Android operating system. This information can be the data from the phone’s sensors, such as orientation, magnetic field, GPS, temperature, etc. An android application with several buttons is represented as a block with digital outputs and is suitable for remote control. The feedback from the SCADA can be sent to the phone as analog signal values. You can find these block in the Android blocks library.

 

When the TCP/IP server starts for first time, Windows FireWall will ask the user for allowance for internet access and the user has to allow it.