This site uses Cookies. By using the site you accept our usage of Cookies. Dismiss More info

Support PLC Engine

Support PLC Engine Logic Tables

Tani PLC Engine

You can create mand logic tables with the wizards. This text presents logic tables which are so short for a wizard. Or an wizard will need to many parameters.

Overview: Counters, subroutines, CSV file write, CSV file read, create structure array, decode structure array, sequence chains.

All examples are basing on memory variables. But all can run on controller or OPC variables also.
PLC Engine version 1.9 has been used for the creation of the examples.

Simple counter:
In a timer running once a second a variable named Counter is read, one is added, the result is written back to the same counter variable.

Tani PLC Engine simple counter
Download the example: Counter.table.

A subroutine will contain logic functions. It can be used multiple.
Ideally all logic elements in the subroutine will be configured with the given parameters. But no technical things will limit this.

Tani PLC Engine subroutine call
Tani PLC Engine subroutine
Download the example: Subroutine.table, SubroutineUsage.table.

Write data into a CSV file:
A CSV file (Comma Separated File) is a text file containing multiple lines of coherent values.
CSV files can be used for multiple things. Microsoft Excel and OpenOffice Calc and lot of more programs accept CSV files as input and output.

This example adds a line to the CSV file each time the variable Counter 1/s is changing. If this becomes true the actual time is added also.
This example uses the semicolon for the value separator and the Windows line end.

Tani PLC Engine CSV file
Download the example: WriteCSV.table.

Read data from CSV file and dispatch them to the PLC:
This example checks for new files beginning with the name prefix of "Datafile*.*". If this becomes true the file content will be read.
It will be assumed that the file content is in csv file style and will contain three numbers. The numbers are read from the file content and will be written into the plant. On success the file will be removed.
On case of a PLC writing error an error bit will be set.
If all of this will be programmed in one big logoc table it will work - but it is not easily to read and understand.

Tani PLC Engine CSV read
Download the example: ReadCSV.table.

Such logic can be better realized in a sequence chain. This will require some local variables, but it is much easier to start up in the plant.
One step checks for the new file with the correct name prefix. The name will be written in a variable, other files are ignored.
The next step reads the file, decodes its content and writes the data into the plant. The file name is taken from the local vaiable.
The last step will remove the file if no error did occur.
Any error management can be realized in more steps. Possibly it will be waited here for an user reaction. The file name can be displayed to the user. In this example the error steps are mostly empty, they only are switching to the next step.

Tani PLC Engine CSV read step wait file
Tani PLC Engine CSV read step read file
Tani PLC Engine CSV read step error entry
Tani PLC Engine CSV read step error management
Tani PLC Engine CSV read step remove file
Download the example: ReadCSVChain.table.

If the implementation uses subroutines it increases the view of sight. So the file content decoding and the delivering of the results can be realized in a subroutine. The logic can be used in multiple logic tables

Create a structure from some values:
The ProducedPieces counter is read. If its value will change the new value is given into the structure Plant statistics. Additionally the current timestamp is added. Additionally the good pieces value is calculated and written into the structure. The created structure is stored.

Tani PLC Engine structure creation
Download the example: StructureCreate.table.

The opposite function for the structure creation exists also, it separates the single values back from a structure.
If stacked structures are used the structure creation or structure decode need to be used more than once.

Structure array creation:
Struktures can be more complex. This example fills a structure containing a list of plant stati. The result will be stored in a variable
Tani PLC Engine structure arrays
Download the example: StructureArrayCreate.table.

Stucture array decode:
This example gets some values back from the structure creation array example above.
Tani PLC Engine structure array decode
Download the example: StructureArrayDecode.table.

Sequence chains:
Sequence chains are simplifying processes. In a sequence chain one step is active only.
This example uses the bit trigger vor handling the result of comparisons.
All steps of a sequence chain need to me in the same group. Other groups con contain more sequence chains.

The initial step, mostly this is the first step. The prerequisites of the sequence chain are initialized here.
Tani PLC Engine sequence chain init
Here it will be waited for the machine becoming ready.
Tani PLC Engine sequence chain wait ready
Now the machine does its job and handles the product. This example waits for the machine status becoming success only. Normally here and in further steps the machine is handled.
Tani PLC Engine sequence chain work
The last step combines all paths together again. Sometomes the counter of produced pieces is incremented here.
Tani PLC Engine sequence chain last step
It can be usefully havong an error step. This exampe does nothing special for errors.
Download the example: SimpleSequenceChain.table.