Historian

Historian

Previous chapter Next chapter Display all Display all Hide all Hide all
© Ing. Punzenberger COPA-DATA GmbH. For any questions regarding the documentation please contact: documentation@copadata.com

The zenon Historian is used to record historical data. The values can be recorded cyclically, event triggered or on change.

  • For the cyclic recording you define a scan rate (e.g. every five minutes). In this scan rate the values of the linked variables are written into the archive.
  • For the event triggered archiving you define a bit variable. Whenever the value of this variable changes to 1, the values of the linked variables are written into the archive.
  • With on change recording the values of the linked variables are written into the archive, whenever they change their values.

The raw data of a basic archive can subsequently be compressed in an aggregated archive.

You will find the Historian in the Project Manager.

Other topics in this chapter

Creating a basic archive

The screen Archive revision

Archives in the Runtime

Create an aggregated archive

The aggregated archive in the Runtime

Lot archiving

Lot archives in the Runtime

Evacuating archives to SQL database


Creating a basic archive

Historian -> Creating a basic archive

The project created in the basic tutorial is used as a basis for the examples in this tutorial.

We now are creating a basic archive, that will record the values of our motors cyclically every ten seconds.

  • Right click Historian it in order to open the context menu.

  • Select the entry Archive new.
  • The following dialog box opens.

Other topics in this chapter

Properties of the basic archive

Runtime behavior of the basic archive

Recording type in the base archive

Saving the basic archive

Options of the basic archive


Properties of the basic archive

Historian -> Creating a basic archive -> Properties of the basic archive

Previous chapter Next chapter Display all Display all Hide all Hide all
© Ing. Punzenberger COPA-DATA GmbH. For any questions regarding the documentation please contact: documentation@copadata.com

  • For the term and the name of our archive enter BA – BASIC ARCHIVE, as shown in the illustration above.
  • With the context menu and the command Add variable you open the variables list.
  • Select all variables from our four motors and close the variable list with OK.

info Information

You either can doubleclick each single variable to get it to the lower part of the dialogbox or you select all the variables and then press the button Add.

Now your dialogbox should look like the one above, you can open the variable list with +.


Runtime behavior of the basic archive

Historian -> Creating a basic archive -> Runtime behavior of the basic archive

Previous chapter Next chapter Display all Display all Hide all Hide all
© Ing. Punzenberger COPA-DATA GmbH. For any questions regarding the documentation please contact: documentation@copadata.com

On the second page of the dialogbox we configure the runtime behaviour of our basic archive.

  • Set Start and end to At start and end of Runtime, so we don‘t have to start and to stop the archive by hand (i.e. with functions). Thus no settings in Execute function at are necessary.
  • The Start of the Scan and storage cycle should contain a time in the past, so that the archive is started automatically with the next start of the Runtime.


Recording type in the base archive

Historian -> Creating a basic archive -> Recording type in the base archive

Previous chapter Next chapter Display all Display all Hide all Hide all
© Ing. Punzenberger COPA-DATA GmbH. For any questions regarding the documentation please contact: documentation@copadata.com

The third page of the dialogbox allows us to set the recording type.

  • Select the cyclic scan type.
  • Enter a cycle of 10 seconds.

With these settings the current values of the linked variables with the according time stamps are written to the archive every ten seconds.


Saving the basic archive

Historian -> Creating a basic archive -> Saving the basic archive

Previous chapter Next chapter Display all Display all Hide all Hide all
© Ing. Punzenberger COPA-DATA GmbH. For any questions regarding the documentation please contact: documentation@copadata.com

On the fourth page of this dialogbox we define, how the archive files should be saved.

  • We save our basic archive in the Internal database (i.e. in the zenon format). So we can use the data stored there in other modules (e.g. Report Generator or Extended Trend Module) later.
  • Set the saving cycle to two minutes.

We therefore get separate files every two minutes. As we set the scan cycle to ten seconds, we will get twelve values of each linked variable in one archive file.

info Information

Generally speaking this setting has hardly any effect, if you only work with basic archives. You always access archive data with filters (e.g. time filters) and zenon automatically takes care that the correct files are opened.

But already here your define the scan rate for an aggregated archive!

  • In the section Evacuation you define that our archive files should no be evacuated. The files should be kept for one day.

info Information

zenon writes the archives in a ring buffer, which we define here. This should guarantee that we have no data overflow on the harddisk. If you export or evacuate (i.e. before they are deleted, they are automatically exported as dBase or text files) archives, you have to care for the space on the harddisk on your own.


Options of the basic archive

Historian -> Creating a basic archive -> Options of the basic archive

Previous chapter Next chapter Display all Display all Hide all Hide all
© Ing. Punzenberger COPA-DATA GmbH. For any questions regarding the documentation please contact: documentation@copadata.com

On the fifth and last page of this dialogbox we define, how the different entries should be handled in aggregated archives of this archive.

  • Activate the option Calculation in aggregated archives for. Now not all the values in the basic archive automatically are used for the calculations in the aggregated archives, but only the ones you selected.
  • Deactivate the option INVALID bit (alternate value), so that alternate values are no longer used for the calculations in aggregated archives.
  • Now you can confirm the settings with OK and close the dialog.


The screen Archive revision

Historian -> The screen Archive revision

In order to see archived data in the Runtime, we need a new screen.

  • Create a new screen named Archive.
  • Under Screen type select the entry Archive revision.
  • Select the frame MAIN.

When the screen opens in the Editor, the contents of the menu Control elements changes. These control elements are predefined dynamic elements especially designed for the operation of the archive screen.

  • Draw the desired control elements into the screen and save it.

info Information

With the command Add templatet... in the menu Control elements you can create a standard archive screen with only one mouse click. The default screen can of course be edited lateron.

Other topics in this chapter

Screen switch - ARCHIVE


Screen switch - ARCHIVE

Historian -> The screen Archive revision -> Screen switch - ARCHIVE

Previous chapter Next chapter Display all Display all Hide all Hide all
© Ing. Punzenberger COPA-DATA GmbH. For any questions regarding the documentation please contact: documentation@copadata.com

The filters are not defined in the screen but in the settings of the function Screen switch, which opens the screen. This allows you to access the same screen with several functions that have different filter options.

  • Create a function Screen switch and select the screen Archive.
  • Select the archive BA – BASIC ARCHIVE.

  • Now press the button Filter.
  • In the filter dialogbox opening now you can select the entries you want to be displayed.

The following filter options are available:

Status | You can filter on the following states: MAN_VAL: values edited by hand SPONT: Value from the control unit INVALID: alternate values set by zenon
Variable | Select the variables to be displayed with their archived values.
Value | Select the range of values to be displayed.

On the second page of the dialogbox we can set the time filters.

The settings of the time filters are divided into two groups:

Time format

Here you can set the time period to be displayed.

Filter type

Here you define the design of the filterbox for the Runtime, to make it easier for the user to use the filter options online.

As soon as you select any option different than Default, in the Runtime an overview calendar or a list of existing lots is displayed instead of the standard filterbox.
  • Open the screen BB_START and add a new button with the text Archives.
  • Link the created functions to these two buttons.


Archives in the Runtime

Historian -> Archives in the Runtime

Now it’s time to have a look at our new archive in the Runtime.

info Information

If your Runtime is already running, you have to stop and restart it. Reloading is not sufficient here, because in the configuration of the archive we defined, that it should be started and stopped with the Runtime. If you only reload the changes, you archive would simply not been started.
  • Start the Runtime.
  • Open the Windows Explorer.
  • Open the directory C:\example\PROJECT1\<computer name>\PROJECT1.

As a default the archive files are stored in this directory.

First you will find a file BA.ARX. That is the file, to which values are written at the moment. We call this file the alpha archive. For our archive this file is closed and renamed every two minutes, then a new, empty file with this name is created.

The historic files have names consisting of the short term of the archive and the current date and time.

info Information

For the time in the file name, Greenwich Mean Time is used.

info Information

Usually you do not have to be able to interpret the files names. You always access archive data with filters (e.g. time filters) and zenon automatically takes care that the correct files are opened.

But on exporting archives you can have the names for the export files generated automatically, where again this name convention is used.

Switch to the Runtime.

  • Open the archive screen.

info Information

If some of the columns are too narrow, simply click the button diagram window… and change the width of the according columns in the dialogbox.

With the default settings zenon allows you to edit archive entries manually.

  • Doubleclick an archive entry.

The following dialog opens.

  • Change the value to 999999.
  • Confirm the changes with OK.

This value is out of the value range of the variable, but it is accepted by zenon all the same. So here the measuring range of the variable is not checked.

The changed entry now has the new value and gets the status MAN_VAL. And the text color is blue.

But the changes have not yet been saved to the according archive files. This is indicated by the red title bar.

  • Click the button Save.

Now the new value is saved to the archive file and the title bar is light blue again.

info Information

You can undo the changes, if you try to switch to another screen of the same frame. Then you are asked, if you want to save the changes.

If you answer the question with No, the changes are not saved to the according archive file.

Other topics in this chapter

Online filter


Online filter

Historian -> Archives in the Runtime -> Online filter

Defining the filters directly in the Editor is not the only possibility. zenon also allows opening filters in the Runtime To do this we now will edit our function for opening the archive screen.

  • Switch back to the Editor with Alt-Tab.
  • Select the function Screen switch – Archive BA.
  • In the properties window click in the right column of General/Parameters.
  • Confirm the archive screen with OK.
  • Click on the button Filter.
  • Activate the option With filter dialog at the bottom of the box.
  • Deactivate the option All entries at the bottom of the box.

If you close the dialogbox right now with the button OK, you will get exactly this dialogbox in the Runtime when executing the function. But zenon offers still some more possibilities.

  • Switch to page Time.
  • Under Filter type select the setting Time days.

With this setting instead of the full dialog you only will get an overview calendar in the Runtime, from which you can select a single day. As a default a day lasts from 00:00 till 00:00.

  • Set the Offset to six hours.

Now our day lasts from 6:00 a.m. till 6:00 a.m. the next day.

  • Set the Length to sixteen hours.
  • Keep the option Subtract length.

Now the day lasts from 6:00 a.m. till 2:00 p.m., which is a morning shift.

  • Create new Runtime files.
  • Switch to the Runtime.
  • Reload the changed Runtime files.
  • Click on the button Archive.

The following filter dialog opens now.


Create an aggregated archive

Historian -> Create an aggregated archive

We now are creating an aggregated archive for our basic archive.

  • Right clicking on the entry BA – BASIC ARCHIVE opens a context menu.

  • Select the entry New Aggregated archive.

The following dialog box opens.

Other topics in this chapter

Properties of the aggregated archive

Runtime behavior of the aggregated archive

Recording type in the aggregated archive

Saving the aggregated archive

Options of the aggregated archive


Properties of the aggregated archive

Historian -> Create an aggregated archive -> Properties of the aggregated archive

Previous chapter Next chapter Display all Display all Hide all Hide all
© Ing. Punzenberger COPA-DATA GmbH. For any questions regarding the documentation please contact: documentation@copadata.com

  • For the term and the name of our archive enter FA – AGGREGATED ARCHIVE, as shown in the illustration above.


Runtime behavior of the aggregated archive

Historian -> Create an aggregated archive -> Runtime behavior of the aggregated archive

Previous chapter Next chapter Display all Display all Hide all Hide all
© Ing. Punzenberger COPA-DATA GmbH. For any questions regarding the documentation please contact: documentation@copadata.com

On the second page of the dialogbox we configure the runtime behavior of our aggregated archive.

The settings are the same as in the basic archive.


Recording type in the aggregated archive

Historian -> Create an aggregated archive -> Recording type in the aggregated archive

Previous chapter Next chapter Display all Display all Hide all Hide all
© Ing. Punzenberger COPA-DATA GmbH. For any questions regarding the documentation please contact: documentation@copadata.com

The third page of the dialogbox allows us to set the recording type.

No settings are needed here. Aggregated archives are also recorded on change. zenon recognizes the archive as an aggregated archive and automatically sets the scan type to on change. The scan rate is defined with the length of the basic archive files.


Saving the aggregated archive

Historian -> Create an aggregated archive -> Saving the aggregated archive

Previous chapter Next chapter Display all Display all Hide all Hide all
© Ing. Punzenberger COPA-DATA GmbH. For any questions regarding the documentation please contact: documentation@copadata.com

On the fourth page of this dialogbox we define, how the archive files should be saved.

  • We save our aggregated archive in the Internal database (i.e. in the zenon format). So we can use the data stored there in other modules (e.g. Report Generator or Extended Trend Module) later.
  • Set the saving cycle to ten minutes. Thereby we get seperate files for every ten minutes.
  • In the section Ring buffer select that our archive files should no be evacuated. The aggregated archives should be kept for three days.


Options of the aggregated archive

Historian -> Create an aggregated archive -> Options of the aggregated archive

Previous chapter Next chapter Display all Display all Hide all Hide all
© Ing. Punzenberger COPA-DATA GmbH. For any questions regarding the documentation please contact: documentation@copadata.com

On the fifth and last page of this dialogbox for this example we need no entries. These options would influence the behavior of an aggregated archive of this archive. We do not want to create a following archive.


The aggregated archive in the Runtime

Historian -> The aggregated archive in the Runtime

For our little example there is no need to define a new function.

  • (Re)start the Runtime.
  • Open the archive screen.

The screen now shows – just as with our first Runtime start – the entries of the basic archive.

  • In the archive screen click on the button Open.

  • Click on the + in front of BA – BASIC ARCHIVE.
  • Select the aggregated archive and close the dialog with OK.

Added to the variable name you now can see the type of calculation.

[MA] | Maximum
[MI] | Minimum
[MW] | Average
[SU] | Sum


Lot archiving

Historian -> Lot archiving

A lot archive is commonly used in plants where there are no cyclical processes in the production. This means that there are no fixed pre-defined time processes in production. As an example we can take a bottling plant (different products, different production quantities and therefore times).

Compared to a usual archive a lot archive has two differences:

Defined start and stop time of the archive (Generally: not cyclic)

Defined lot name

We create a lot archive, which records the values of our temperature sensors for certain production cycles. The name of the lot is given by the variable lot name.

  • Create a new string variable with the name Lot name (data-string, internal driver).
  • Set the property Internal variable/Remanence of this variable to Remanent.
  • Set the property Addressing/String length to 20.

So zenon remembers the last value of this variable even if the Runtime is closed.

  • Select the "Archives" entry and click on it with the right mouse button to open the context menu.

  • Select the entry Archive new.

The following dialog box opens.

Other topics in this chapter

Properties of the lot archive

Runtime behavior of the lot archive

Scanning in lot archive

Saving the lot archive

Options of the lot archive

The lot filter


Properties of the lot archive

Historian -> Lot archiving -> Properties of the lot archive

  • For the term and the name of our archive enter BT – LOT ARCHIVE, as shown in the illustration above.
  • You open the variable list with the ... button next to lot variable. Here you select the variable Lot name and close the variables list with OK.
  • With the context menu in the section Linked variables and the command New variable you open the variables list.
  • Select the variables Temp[1,1], Temp[1,2], Temp[2,1] and Temp[2,2] and close the variable list with OK.

Now your dialogbox should look like the one above, you can open the variable list with +.


Runtime behavior of the lot archive

Historian -> Lot archiving -> Runtime behavior of the lot archive

Previous chapter Next chapter Display all Display all Hide all Hide all
© Ing. Punzenberger COPA-DATA GmbH. For any questions regarding the documentation please contact: documentation@copadata.com

On the second page of the dialogbox we configure the runtime behaviour of our lot archive.

  • Set Start and end to User defined, so that we can start and stop the lot archive by hand (i.e. with functions) with the start and end of the production cycle.


Scanning in lot archive

Historian -> Lot archiving -> Scanning in lot archive

The third page of the dialogbox allows to set the scan rate.


Saving the lot archive

Historian -> Lot archiving -> Saving the lot archive

On the fourth page of this dialogbox we define, how the archive files should be saved.

  • We save our basic archive in the Internal database (i.e. in the zenon format). So we can use the data stored there in other modules (e.g. Report Generator or Extended Trend Module) later.
  • In the section Evacuation you define that our archive files should no be evacuated. The files should be kept for five hours.

Settings in the section Cycle are not necessary, as starting and stopping of the archive files is done by hand (i.e. with functions). Therefore the value is ignored as far as the length of the files is concerned.

But the value has an impact on how many archive files are stored. The diverse length of archive files is not regarded. zenon calculates the number of archives to be stored in the following way:

5 hours (Keep archives / 15 minutes (Cycle) = 20 files to be stored.


Options of the lot archive

Historian -> Lot archiving -> Options of the lot archive

On the fifth and last page of this dialogbox for this example we need no entries. These options would only influence the calculation of an aggregated archive. We do not want to create a following archive.


The lot filter

Historian -> Lot archiving -> The lot filter

The lot filters are defined - as we have already seen with the other filter options - with the function Screen switch.

  • In the functions administration select the function Screen switch and then the screen ARCHIVE.
  • Select the archive BT – LOT ARCHIVE.
  • Now press the button Filter.

Beside the first two pages of this filter dialog, which we already know, a third page especially for the access to lot archives is available.

  • Activate the option Filter on lots active.

Now this dialog offers us three possibilities to filter on certain lots.

Lot | Here you can directly enter one or more lot names. | is used as a separator. Wildcards are supported in the single lot names (* or ?).
Last closed lots | Here you can define the number of the last completely recorded lots to be displayed.
Time limits: | With this setting you define, how the lots to be displayed should be handled in combination with a time filter.
  • Activate the option Last closed lots and keep the number 1.
  • Close the dialog with OK.
  • Open the screen BB_START and add a new button with the text Lots.


Lot archives in the Runtime

Historian -> Lot archives in the Runtime

Other topics in this chapter

Preparatory work

The lots in the Runtime


Preparatory work

Historian -> Lot archives in the Runtime -> Preparatory work

We need some preparatory work, before we can test our lot archive in the Runtime. In order to create some lots, we have to be able to start and stop the archive. Usually this is done with a variable from the PLC. If shifts are to be displayed as lots, for example, this can also be time triggered. In our example we will do this by hand.

  • Create a new function Archive: start from the Archive – Functions.
  • As parameter select BT – LOT ARCHIVE.
  • Close the dialog with OK.
  • Create a new function Archive: stop from the Archive – Functions.
  • As parameter select BT – LOT ARCHIVE.
  • Close the dialog with OK.

As we now have the functions for the control of our lot archiving, we still need some buttons for our new functions.

  • Open the start screen in the Editor.
  • Add two text buttons and enter the according texts for them.
  • Link the buttons to the new functions.
  • Add a new element Link text and link it to the variable lot name.
  • Set the property Set value / Set value via to Element.


The lots in the Runtime

Historian -> Lot archives in the Runtime -> The lots in the Runtime

Previous chapter Next chapter Display all Display all Hide all Hide all
© Ing. Punzenberger COPA-DATA GmbH. For any questions regarding the documentation please contact: documentation@copadata.com
  • Start the Runtime or reload the changes.
  • Start the lot archive with the according button in the start screen.
  • Enter lot 1 as lot name.

Whenever the archive is stopped, zenon reads the contents of this variable and assigns it to the lot as a name.

  • Stop the lot archive with the according button in the start screen.
  • Switch to the archive screen with the button Lots.


Evacuating archives to SQL database

Historian -> Evacuating archives to SQL database

Often it is necessary to further process the data archived in zenon in external applications. In other cases a standardised way of data storage is prescribed. For this purpose zenon offers the possibility to store archive data in a SQL database. This functionality is similar to the already described evacuation to dBase or text files but has the advantage, that the archive data after the evacuation still are available in zenon for trends and reports.

Other topics in this chapter

Functionality

Engineering

Database structure

Connection to an Oracle database system


Functionality

Historian -> Evacuating archives to SQL database -> Functionality

Previous chapter Next chapter Display all Display all Hide all Hide all
© Ing. Punzenberger COPA-DATA GmbH. For any questions regarding the documentation please contact: documentation@copadata.com

For performance reasons, two different stages of data storage are distinguished when evacuating archive data to a SQL database. The short time data (according to the setting Keep archives in the dialog Save) are still saved to the local disc in ARX format. After the period stated here the contents of this file is written to the SQL database as a combined transaction and deleted on the local disc. If data from this archive are needed for trends or reports, the locally saved short time data are automatically combined with the zenon long time data of the SQL database to a continuous dataflow.


Engineering

Historian -> Evacuating archives to SQL database -> Engineering

Previous chapter Next chapter Display all Display all Hide all Hide all
© Ing. Punzenberger COPA-DATA GmbH. For any questions regarding the documentation please contact: documentation@copadata.com

In order to save the data of an archive in an SQL database select the ring buffer setting SQL database in the dialog Save and select the desired OLE-DB datasource.

For the selection of the OLE-DB datasource the according standard dialog is used.


Database structure

Historian -> Evacuating archives to SQL database -> Database structure

Previous chapter Next chapter Display all Display all Hide all Hide all
© Ing. Punzenberger COPA-DATA GmbH. For any questions regarding the documentation please contact: documentation@copadata.com

For each archive a table is generated in the database containing the evacuated archive data. Additionally a cross reference table for the whole project is generated containing the allocation between the variable names and the unique numerical variable IDs.

Other topics in this chapter

Format of the data table

Format of the cross reference table


Format of the data table

Historian -> Evacuating archives to SQL database -> Database structure -> Format of the data table

Previous chapter Next chapter Display all Display all Hide all Hide all
© Ing. Punzenberger COPA-DATA GmbH. For any questions regarding the documentation please contact: documentation@copadata.com

Format of the data table Project name_short name

Column

Type

Meaning

VARIABLE

int[4]

numerical variable ID

CALCULATION

int[4]

Type of data reduction in aggregated archives.

Up to 4 values are possible: Sum, average value, minimum, maximum.
When exporting the aggregated archive to a file (e.g. .csv), the values 1 to 4 are written as strings:

  • 1=Sum
  • 2=Average value
  • 3=Minimum
  • 4=Maximum

At evacuation or export to SQL the values are written as Integer in ASCII code:

  • 49=Sum
  • 50=Average value
  • 51=Minimum
  • 52=Maximum

TIMESTAMP_S

int[4]

Time stamp in UNIX time format

TIMESTAMP_MS

int[4]

Milliseconds for the time stamp

VALUE

float[8]

Value

STATUS

int[4]

Status flag of the value (zenon state)

GUID

char[36]

Contains the project GUID of the variable from another project or is ZERO if in the own project.

STRVALUE

varchar

varchar; the length depends on the longest string variable to be archived. For numerical variables this field has the value ZERO.

The name of the database table Projectname_VARIABLES is combined from the project name and the short name of the archive. The two parts are connected with an underscore character. So if the project name is ARV_IN_DB and the archive short name is A1, the table name will be ARV_IN_DB_A1.


Format of the cross reference table

Historian -> Evacuating archives to SQL database -> Database structure -> Format of the cross reference table

Previous chapter Next chapter Display all Display all Hide all Hide all
© Ing. Punzenberger COPA-DATA GmbH. For any questions regarding the documentation please contact: documentation@copadata.com
Column | Type | Meaning
VARIABLE | int[4] | numerical variable ID
NAME | varchar[128] | Name of the variable

The name of the cross reference table is combined from the project name and the suffix "VARIABLES". The two parts are connected with an underscore character. So if the project name is "ARV_IN_DB", the table name will be "ARV_IN_DB_VARIABLES".


Connection to an Oracle database system

Historian -> Evacuating archives to SQL database -> Connection to an Oracle database system

Previous chapter Next chapter Display all Display all Hide all Hide all
© Ing. Punzenberger COPA-DATA GmbH. For any questions regarding the documentation please contact: documentation@copadata.com

It is possible to outsource data into an Oracle data base, but under certain conditions.

attention Attention

If the table should be created directly from zenon in the SQL Server, the logged user has to have the authorization for CREATE Table. If the user does not have this authorization, tables cannot be created automatically.

attention Attention

In the Cross Refernece Table the user must be authorized to executet the statements INSERT, DELETE and SELECCT. (UPDATE ist not used, DELETE only used if a variable is added or removed.

attention Attention

Oracle must have an ODBC Oracle Client. It is an advantage, if the version number on the oracle server and on the client do not differ too much, because that could lead to unwished format-effects.

attention Attention

The time format of zenon is in GMT starting 1970 (DWORD). Oracle uses a differtent time stamp that has to be changed at oracle side with a trigger.