29 - 11 - 2020

Automation

Block Sequence

License: Industrial


The block has a task to switch digital outputs in sequence, which is described in inputs Seq1...Seq8. For example, if the inputs Seq1..Seq8 are with values 8, 7, 6, 5, 4, 3, 2, 1, then on every front of input Next from low to hight level, one of the digital outputs Out1..Out8 will become to hight level in sequence Out8, Out7, Out6, Out5, Out4, Out3, Out2, Out1. Some of the inputs can be not connected. If the input Reset become to hight level, the sequence will be reset. When input SetOut become from low to hight level, the current sequent position will be set with value of input Out. Current integer value of digital output can be read from output CurrOut. When the switching of sequence is finished, the output OnEnd become to hight value for 1 sec.

 

Block TimeSchedule:

License: Hobby, Industrial

The block is very powerful and allows to be created complicated time periods to manage devices and processes by a time.

An unlimited number of time programs can be added using the block's Settings parameter. The output of the block Out will be at a high level if at least one of the programs (the rows in the grid) is active at the moment. To the list of programs, the output Out is their logical OR. Programs can be disabled using checkbox at first column of the grid Disable;

The elements of each program are: Program ID, Program Name and a few groups defining the program's working on certain criteria. Each group has a checkbox specifying whether a group setting will be used when the program is running:

Program Groups:

  • Months - during which months the program will run;
  • Day of week - which days of the week the program will run;
  • Day - whether to work on a Even, Odd day, or if the Per days option is chosen - per how many days it will work;

  • Calendar - can be set specific days of the year in which the program will work. All days are deactivated on default. A comment can be set on a certain day;
  • Time Schedule - Can be specified how long the program will run in hours. In this time period, can be specified internal periods during which the program will run. For example, if is set a period of 9:00h to 21:00h and an internal Period of 10 minutes, with a Time On time of 2 minutes, this means that in the 9:00h..21:00h period, the program will be switched ON for 2 minutes on each 10 min;

If more than one time group is checked, then the program will work in logical AND of all the groups used.

Other block's parameters:
PreliminaryOutSec - If we set a value in this parameter, then the output of the block - PreliminaryOut will Turn ON as many seconds as specified in the parameter before the program runtime occurs.

Block's outputs:

  • Out - becomes to a high level if at least one program works;
  • PreliminaryOut - Turn ON PreliminaryOutSec seconds before the output Out;
  • RunTimeSec - shows how many seconds the output Out will be at high level;
  • LastRun - DateTime of the last run of output Out;
  • NextRun - DateTime of the next run of output Out;
  • RunToday - how many times the block has worked today;
  • RunUpToDate - how many times the block has worked;

Strings

Block GetStr

License: Hobby, Industrial

The block returns the substring, which is in a position specified by the PosStr parameter and separated with symbol specified in the Separator parameter. For example, if the input InStr is: The world;is;nice!, the parameter PosStr is 3, and Separator is ;, then the result at block's out will be nice!

Block's Parameters:

  • Pos - position of expectes substring;
  • Separator - separator of substrings, can be only one character or it's decimal ASCII value;

  

Block StrConst

License: Hobby, Industrial

 

The block has one parameter Const. The output of the block is equal to its parameter.

Parameters:

  • Const - a constant value of the output of the block;

 

Block StrCompare

License: Hobby, Industrial

The block compares the string from block's input InStr with string from the parameter CompareWith. If the both strings are equal, the output of the block will be at high level.

 

Block StrFormat

License: Hobby, Industrial

Using parameter Inputs, we can  add unlimited number of inputs to the block with different data types - Analog, Digital, String, Integer, DateTime. At the block's parameter Text we can use the names of block's inputs as TAGs. When the block work, it will replace the TAGs with values from the associated block's inputs.

For example, we add inputs with names Date(DateTime), Town(String), Temp(Analog). The Text parameter is: The air temperature at town: <Town> at date:<Date;dd MMM yyyy hh:mm:ss> is <Temp;1>

If the block's inputs have values: Date: 01.01.2019 12:33:52, Town: London, Temp: 12.5, the block's output Out will be:

The air temperature at town: London at date: 01.01.2019 12:33:52 is 12.5

 

More for how to format strings can be read here:

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

 

Block's inputs:

  • DoFormat - if the input is connected, the output Out will be updated when the input becomes to high level. In other case the output will be updated many times per second;

 

 

 

Analog library

Block Around:

License: Hobby, Industrial

The block compares the inputs signal In with parameter AroundVal. The output IsAround will become to high value depending from parameter AroundType:

  • If AroundType=Around, output will be in high value when absolute value of (In-AroundVal)>=Difference;
  • If AroundType=AroundAndOver, output will be in high value when (In+Difference)>AroundVal;
  • If AroundType=AroundAndUnder, output will be in high value when (In-Difference)<AroundVal;

Parameter Difference is allowed fluctuation of input signal.

If the input SetAround becomes to high value, then parameter AroundVal will get the value of the input Around. The block will stop to work in low level of parameter Checking. If the input Checking is not connected, the block will work permanently.

Parameters:

  • AroundType;
  • AroundVal;
  • Difference;

 

Block CheckForChanges:

License: Hobby, Industrial

The block has an analogue input X, digital output Y and two parameters: CheckedDifference and CheckedSecs. If the changes of input X for last CheckedSecs seconds is under the value entered in parameter CheckedDifference, then the output Y will become to high value. For example the values of parameters are CheckedDifference=3.0, CheckedSecs=20, the input signal X for last 20 seconds moves from 55.0 to 57.0, the changes of input signal is under parameter CheckedDifference=3.0>(57.0-55.0)=2.0, this is the reason because the output Y will  become to high level. If the input Checking is in low level, the block doesn't work. If the input Checking is not conencted, then the block will work permanently.

Parameters:

  • CheckedDifference;
  • CheckedSecs;

 

Block AnalogSwitch:

License: Hobby, Industrial

The block has 4 analogue switches A, B, C, D. Every switch has two inputs, A has inputs A1, A2, B has inputs B1, B2 and etc. Which input to be connected to the output depends on value of input Index. If it is 1, the output of switch gets value of first input, if it is 2, the output gets second input value. 

Parameters: The block has not parameters.

 

Block AnalogSwitch8:

License: Hobby, Industrial

The block has one analogue switch with 8 inputs. Which input to be connected to the output depends on the value of the  input Index (1..8).

Parameters: The block has not parameters.

 

Block AnalogConst:

License: Hobby, Industrial

This block is very simple. Its output Y gets  the value of its parameter Const.

Parameters:

  • Const;

 

Block Between:

License: Hobby, Industrial

The block compares the value of the input CheckedX and the two inputs X1, X2. The outputs of the block become to high value when:

  • Larger - CheckedX is over X1 and X2;
  • Between - X1<=CheckedX<=X2;
  • Less - CheckedX is under X1 and X2;

 

Block AnalogInfo

License: Hobby, Industrial



The block analyzes the input signal X and sets the outputs of the block according to whether the input is positive, negative or zero.

Block's outputs:

  • Positive - is at high level if the input X has a positive value;
  • Zero - is at high level if the input X is zero;
  • Positive - is at high level if the input X has a negative value;

 

 

Triggers library

Block TriggerRS

License: Hobby, Industrial

The block represents the classic electronic RS trigger:

http://en.wikipedia.org/wiki/Flip-flop_(electronics)

It has Set input, the high front in this input sets the output Q to a high level. A high front in Reset input clears the output Q to low level. Output NotQ is negative value of the output Q. If the input EnableOuts is connected and is in low level, the the both outputs of block are in low level too.

 

Block TriggerT

License: Hobby, Industrial

The block represents the classic electronic T flip-flop trigger:

Every high front in input T flips the output Q from low level to high level and vice versa. This is the reason because we can use this block as digital devider by factor 2. A high front in Reset input clears the output Q to a low level. Output NotQ is negative value of an output Q.

 

Block TriggerD

License: Hobby, Industrial

The block represents the classic electronic D flip-flop trigger:

A high front in input SetD will set the output Q with the value of input D. A High front in Reset input clears the output Q to a low level. An output NotQ is negative value of an output Q.

 

Block MemoryUni

License: Hobby, Industrial

The block can remember an information from different kind of signlas. The user can add many twin-sets of inputs/outputs using parameter InOut. When the input Set becomes to high level, the values of inputs will appear to corresponding outputs of the block and will be remembered. Hight level of input Reset clears all the outputs.

Parameters:
InOut – the parameter is used to add twin inputs/outputs;

ModBus

Modbus:

Modbus is a very important Client/Server type protocol, wide used in industrial automation. The structure of the communication frame is:

  • TransactionID - 2 bytes, every sent packet is idetified with unical ID
  • ProtocolID - 2 bytes, it is usualy 0;
  • Length - 2 bytes, the length of the next bytes in the packet;
  • UnitID - 1 byte, every connected device to the ModBus server need to has an unical ID;
  • FC - 1 byte, the code of the ModBus command;
  • Data - number of bytes is different for every command;

ModBus function codes:

Every device Client or Server has 4 separated memories. Every memory starts from address Zero. Various ModBus commands can only access the memory for which they are intended.

List of the ModBus memories:

  • Coils
  • DiscreteInputs
  • HoldingRegisters
  • InputRegisters


Block ModBusClient

License: Industrial

All the block settings are in the Setings parameter. Its elements are as follows:

  • Communication - TCP/IP or ComPort communication can be selected. In case of TCP/IP, the settings are IP address and IP Port of the ModBus server, in case of ComPort communication - ComPort and a BaudRate. In TCP/IP communication DeviceID is the same for all ModBus commands. In ComPort communication, DeviceID can be set from the bottom grid and can be different for the different commands, because on a RS485 bus there may be a large number of devices with different DeviceIDs, which to be controled from one ModBusClient block.
  • Use zero based addressing - for some device manufactures, address 0001 is intepreted as address 0000. For example, for Advantech devices, the parameter has to be checked;
  • CRC - the checked parameter adds 2 bytes for CRC at the end of the communication frame;
  • Packets with header - for some devices, the communication header can be removed from the communication frame of the packet. The header means TransactionID(2 bytes), ProtocolID(2 bytes), Length(2 bytes);
  • WithLOG - when the parameter is checked, all the communication packets are written at the application LOG file: c:\AltonaLab\LogFiles\. Please use this parameter only to investigate the communication issues;

ModBus commands settings:
"Add" button opens the interface of the command:

  • Name - description of the command;
  • Block's In/Out prefix - each new added command adds a group of inputs or outputs to the block.  The names of the group of Inputs/Outputs begin with the same text prefix;
  • ModBus command - combo box to select a ModBus command;
  • Starting address - starting address of the ModBus memmory, been affected from the command;
  • Num In/Out - number of inputs/outputs of the command;
  • Scan rate [milliseconds] - every new added command adds a digital input of the Block with Command prefix and suffix _SendCommand. If this input is connected, the command will be send only if the input becomes to high level. If the input is not connected, the command will be send per Scan rate milliseconds;
  • Swap Hi/Lo data bytes - for some device manufactures, Hi and Low bytes of the data types as WORD has to be swapped. This affects only bytes in Data of the communication frame and not affects the frame header;

There are some restrictions between Modbus command and Data type as:

  • For commands for Coil and Discrete inputs, only Boolean data type can be set;
  • For Holding registers and Input registers memories, the data type can be Boolean, Word, Float, Double, Int;

Block's outputs for system use:

  • CommunicationError - in case the packet is not send or there is not respond from sent packet, the output becomes to a high level;
  • DeviceExceptionCode - if the sent command is wrong, the ModBus Server responds with error code;
  • DeviceExceptionCode - the corresponding text of the received error code;

Every added command adds a group of Inputs\Outputs of the block. Two of them are with special purpose:

  • Digital input with name of a Command prefix and a sufix _SendCommand - if the input is connected and becomes to high value, the command will be send;
  • Digital output with name of a Command prefix and a sufix OnCommand - becomes at high level when the respond of the command is received and if there are outputs of the block associated with the command - are updated;

 

Block ModBusServer

License: Industrial

The block can open a TCP/IP port or serial ComPort and an unlimited number of devices can connect to it using ModBus protocol.

All the block settings are available at the Setings parameter.

Server settings are:

  • Server memory - four separated Server memories, each with an Starting address and Memory size;
  • Communication - can be set as TCP/IP or ComPort;
  • DeviceID - the ID of the ModBus Server at Ethernet or RS485 network;
  • Use zero based addressing - for some device manufactures, address 0001 is intepreted as address 0000. For example, for Advantech devices, the parameter has to be checked;
  • WithLOG - when the checkbox is checked, all the communication packets are written at the application LOG file: c:\AltonaLab\LogFiles\. Please use this parameter only to investigate the communication issues;
  • The bottom grid is used to add read/write operations to the Server memory. This happens with button Add;

Read/Write operations to Server memories:

 

  • Every added Read operation appears as block's outputs, every Write operation appears as block's inputs;
  • Each operation adds to block two system inputs/outputs - a digital input with name formed with In/Out Prefix plus text _DoProcess, a digital output formed with In/Out Prefix plus text _OnReady. When the digital input becomes to high level, the values of the inputs related to the operation are saved to the server memory;
  • The outputs of the block, related to a Read operation, show the current status of the server memory. If a ModBus command is received, which affects a memory related to the outputs of the block, the outputs will be refreshed automaticaly;
  • For Write operations, values from related inputs are saved to the server memory;

Settings of the Read/Write operation are:

  • Name - name of the operation;
  • Block's In/Out prefix - every Read/Write operation appears as Block's Outputs/Inputs, which names are formed using In/Out prefix. Additional two digital system In/Out will be added to the block. The digital input is formed by the name Prefix plus _DoProcess, the digital output is formed by the name Prefix plus _OnReady. When the system digital input becomes to high value, the operation will be executed. The system digital output becomes to high value when in case of executed operation or if ModBus server receives a command, which changes the Server memory related to the data of the current operation;
  • Server memory - can be - Coils, DiscreteInputs, HoldingRegisters, InputRegisters;
  • Read/Write - for Coils and HoldingRegisters can be Read or Write, for DiscreteInputs and InputRegistes can be only Write;
  • Memory Data type - for Coils and DiscreteInputs can be only Boolean, for HoldingRegisters and InputRegisters can be Boolean, Word, Float, Double, Int. The setting determines how the memory is interpreted;
  • Block IO Data type - some Memory Data type as WORD can be operated as Analog or Integer block's inputs/outputs;
  • Starting address - starting address of the ModBus Server memory, been affected from the command;
  • Num In/Out - number of inputs/outputs of the operation;
  • Swap Hi/Lo data bytes - for some device manufactures, Hi and Low bytes of the data types as WORD has to be swapped. This affects only bytes in Data of the communication frame and not affects the frame header;
  • Dump memory color - the memory bytes affected from the operation are shown with this color at the Memory Dump interface;

Memory Dump:
If the block's input Dump becomes to high level, a Memory Dump interface will be open:

The interface shows byte content from all four server memories. Elements of the interface are:

  • Server memory combo box - one of the four server memories can be selected;
  • The grid shows all the Read/Write operations from the memory selected at the combo box above;
  • HEX Address - shows the addresses at bottom area in HEX or Decimal numbers;
  • HEX Memory - shows the memory bytes in HEX or Decimal numbers;
  • When one of the memory byte is clicked with mouse, the values of the data types located at the clicked address are shown at text controls as - Binary, Word, Float...
  • Affected memory bytes from Read/Write operations are shown with operation's Dump memory color setting;