12 - 09 - 2024

Internet library

Block MailSender

License: Hobby, Industrial

The difficult question about how to send an e-mail is easy resolved with the block SendMail. When the input DoSend become to hight value, the block will try to send an e-mail.

 

Parameters related with Mail Server:

  • Server - host address of mail server. For example smtp.gmail.com
  • Port - port of the mail server. 25 is SMTP port without SSL connection, 465 is SMTP port with SSL connection;
  • UserName - User name of the mail account, for gmail is e-mail addres. For expample This email address is being protected from spambots. You need JavaScript enabled to view it.
  • PassWord - password of the mail account;
  • SenderEMail - e-mail of the mail account: This email address is being protected from spambots. You need JavaScript enabled to view it.
  • SSL - Yes/NO regarding using of SSL connection or not;

Parameters related with sending e-mail:

  • RecipientMail - e-mail address of the recipient;
  • RecipientName - name of the recipient
  • Subject - the subject of the e-mail;
  • Body – the text of the e-mail. It can be multiline;
  • AttachedFile - full path and name of the attached file. Optional;
  • MinPeriodToSendMail - a minimal period in seconds, which protect an e-mail account from sending too many e-mails. If several events OnSend occured in this period, ony the first will be send. When the period expired, a new e-mail can be send.

The block SendMail has a parameter Inputs, which allows many inputs with Digital, Analog, Integer and String data type to be added to the block. These inputs allow some parameters to be changed from the running diagram. The paremeters are: RecipientMail, RecipientName, Subject, Body, AttachedFile. If in the text of the the mentioned parameters is included a name of the block's input in brakets <>, then the value of input will appears into the text of the parameter.


Let see how the demo diagram SendMail.nsm works. The value of parameter Body is:
Temperature=<Temp;2>
The yard lamp is <Lamp>
Electrical boiler is currently <Boiler>
The season is <Season>

When the input DoSend becomes to hight value, the tags with <Block input name> will be changed with theirs values, so the result mail's body would be:

Temperature=12.45
The yard lamp is On
Electrical boiler is currently Off
The season is Summer

Pelase note:

  • for Analog input type, after name of input, number of digits after dot can be added: <Temp;2> means two digits after dot in replaced string in mail's body;
  • for Digital input type is possibe to be added meaning of Hight or Low value of the input signal: <Lamp;Turn on;Turn off>

About how to format text you can read more at article Text Formatting conception:

https://scada.altonalab.com/index.php/en/conceptions/text-formatting-strategy

The same strategy can be used to format text at block's parameters RecipientMail, RecipientName, Subject, Body.


At the demo diagram, the value of parameter RecipientMail is <mail>. This means when the input DoSend becomes to hight value, the value of parameter RecipientMail will be gotten from the value of input mail.

How to send e-mail by GMail account: this is easy, just log into your GMail account using the internet browser, then find the setting Less secure app access and turn it ON. The can happen with the URL below:

https://myaccount.google.com/lesssecureapps

The needful parameters in the block MailSender, related to the GMail account have to be set as is shown below:

  • Server: smtp.gmail.com
  • Username: Your email address (for example: This email address is being protected from spambots. You need JavaScript enabled to view it. )
  • Password: Your Gmail email password
  • SMTP port: 465
  • SSL: yes


In order to store a copy of outgoing emails in your Gmail or Google Apps Sent folder, log into your Gmail or Google Apps email Settings and: 6.Click on the Forwarding/IMAP tab and scroll down to the IMAP Access section: IMAP must be enabled in order for emails to be properly copied to your sent folder.

Sending Limits:
Google limits the amount of mail a user can send, via its portable SMTP server. This limit restricts the number of messages sent per day to 99 emails; and the restriction is automatically removed within 24 hours after the limit was reached.


Block FTPUploader

License: Hobby, Industrial

The block is very powerful, it allows the complicated infromation from the diagram to be uploaded to the FTP server and to build an OnLine WEB site very easy. The block is perfect for WEB publisher.

Parameters:

Parameters

  • CommunicatePerMin - if the input DoSend is not connected, the block will upload to FTP server on every CommunicatePerMin minutes. If the DoSend input is connected, the upload will happend only when the input becomes to hight level.
  • FTP Parameters: FTP Server (IP or URL of the server), FTP Port, FTP User, FTP Password;
  • FTP Secure parameters: TLS, SSL - for some secured FTP connections, some of this parameters have to be checked;
  • FTP Folder - the FTP User has to have an access to this FTP folder;
  • For upload - this parameter opens an interface with three parts:

Available controls - this is a table, where the names of all the controls from the diagram are displayed. If the checkbox of the first column is checked, the image of the control will be converted to an image file and will be uploaded to FTP server. The name of the file is the same as the name of the control. If other name is needed of the file, double click over the table cell of the column "FTP File Name:" and change the name of the file. Default file extention is JPG, it can be changed to BMP - with double click over the cell of the table from column "File extention:". If a rectangular area from the diagram is needed to be uploaded to FTP server as picture, add a Frame from Other top icon and check it at list of Available controls, then all the image inside it will be converted as image file.

Files for upload - all the added files at this table will be uploaded to FTP server.

Files from folder - this group has two settings:
- Local folder with files for upload. With the current example c:\xxx\*.zip - all the ZIP files from the computer folder c:\xxx will be uploaded to the FTP server.
- Upload to FTP folder - where the files will be uploaded;

FTPUploader Demo diagram (FTP.nsm included in demo diagrams):

As is visible from the demo diagram, three controls are choosen to be uploaded to FTP server - they are checked in the table Available controls:
- Scope;
- WEBCam - the current image from the WEB can be easy published on WEB site;
- Frame - just add a frame to the diagram and all the image inside it will be uploaded to FTP server. A Frame can be added from third icon from top ribbon bar - Other;

 

Block InternetChecker

License: Hobby, Industrial

Tests the computer’s internet connection. The block tries to ping first URL, then second. If both do not reply the output gets low level which means there is no internet.

Block's Parameters:

  • FirstURL - the first internet address for ping;
  •  SecondURL - the second internet address for ping. Optional;
  • CheckPerMin - the first and second URL will be checked at a period of the entered number of minutes;
  • WithOutStringInRes – Some WiFi routers would return to the computers an HTML with information that the connection is lost when this happens. If the text in this parameter exists in the returned text from the URL this would mean the router has lost connection;
  • ShowMessageOnCheck - Show a text message on the right blue area of the application whenever a connection check occurs;
  • WriteHTMLToFile - Write the received HTML to a file called NiSimIChecker.txt in the current directory of NiSim.exe;

 

Block TelnetSender

License: Industrial

 

Some devices are managed with plain text sent by TCP/IP protocol. For this purpose, we can use the TelnetSender block. To set the sent commands, we use the Settings parameter. Each command is a separated row at the grid. Click the Add button, then in the newly added row with a double mouse click in each cell you set:

  • Disable - if the row is disabled, the command will be not send to the received;
  • Name - name of the command. When all the settings are confirmed, every command will be represented with a new digital input of a block with input name equal to the name of the command;
  • Description - just a text, which descripts the command;
  • Send Text - a text, which will be send, when the digital input of the block with the same name as the name of the command becomes to high level;

Block's parameters:

  • AddCrLf - if the parameter is checked, at the end of send text is added CR+LF(decimal 13, 10) bytes;
  • IP Address - the IP address of the text receiver;
  • Port - IP Port of the text receiver;
  • Settings - used to set all the sending commands;

Block's outputs:

  • OnSent - becomes to high level, when a new command is sent and is successfully received;
  • OnSendError - a new command is send, but it is not received. There are many reasons for that as IP Address or Port are wrong;

 

Block TelnetReceiver

License: Industrial

This block is used to connect to a Telnet server and to receive text commands from it. After analyzing the received commands and matching the received text with expected text, some output of the block passes to a high level.

To set the received commands, we use the Settings parameter. Each command is a separated row at the grid. Click the Add button, then in the newly added row with a double mouse click in each cell you set:

  • Name - name of the command. When all the settings are confirmed, every command will be represented with a new digital output of a block with output name equal to the name of the command. For example command with Name Cmd1 will create a new digital output with name Cmd1_Out.
  • ON String value - expected text of this command. If after connection to Telnet Server this text is received, the responded output of the block will become at high value;
  • TURN Off Type - may be one of the next values: By OFF String Value, By TimeOut. The responded digital output of the block connected to this command will be set to low level according to this setting. In case of By OFF String Value, the output will be cleared if the block receive the text which is set at column OFF String Value, in case of By TimeOut, the output will be cleared after seconds set at column TURN Off TimeOut;
  • OFF String Value - clears the responded digital output if TURN Off Type is By OFF String Value;
  • TURN Off TimeOut - clears the responded digital output if TURN Off Type is By TimeOut;

 Block's parameters:

  • AddCrLf - if the parameter is checked, at the end of send text is added CR+LF(decimal 13, 10) bytes;
  • IP Address - the IP address of the text receiver;
  • Port - IP Port of the text receiver;
  • Settings - used to set all the sending commands;
  • WithLog - if the parameter is checked, the received text from Telnet Server will be saved at LOG file, which is located at the subfolder LogFiles of the current path of the application AltonaLab.exe. This is an easy way to be seen what is the received text. When the diagram works in production, this parameter has to be unchecked, in other case the block will work slowly and the log file can grow too much;

Block's outputs:

  • OnReceived - becomes to high level, when a new text is received;
  • OnConnectionError - becomes to high level if the block can't connect to Telnet Server. There are many reasons for that as IP Address or Port are wrong;
  •  ReceivedStr - contains the last received from the block text;

 

 

Block PingIP

License: Hobby, Industrial

The block can be used to ping many devices in a local network. The devices have to be added at the block's parameter Settings - press the button Add and at every added row enter the device name and device's IP address from a local network. Every added device will add an output of the block with the same name. The block will ping every device. If the device is available, the output of the block will be in a high level, in other case it will be  in low level. The block will decide the device is not available after a few tries, number of tries are defined in parameter NumTrials;

Block's parameters:

  • Settings - to add the name and IP address of every device from a local network, which will be checked;
  • NumTrials - if the device is pinged and it is not available, the block will check it NumTrials number of ties;
  • TrialTimeOutSec - if the device is not available, this is the time between two pings;
  • ScanRateSec - if the input Ping is not connected, this is the time between pings of the network  devices;

 

Block's inputs:

  • Ping - if the input is connected, the block will ping the devices when the input becomes to a high level;

 

Block's outputs:

  • OnPing - when the ping of all the devices is passed, the output becomes to a high level for a short time;