Announcement

REXYGEN forum has been moved. This one is closed.
Head over to the new REXYGEN Community Forum at https://forum.rexygen.com.

Looking forward to meeting you there!
 

#1 2016-04-11 20:51:18

scoobsalamander
Member
From: Belgium - Hulshout
Registered: 2015-10-27
Posts: 217

Problems configuring and using the database driver (DbDrv)

I was hoping to use the DbDrv to export all events and alarms. Once this data is in the MySQL dB it should be possible to insert a table in the HMI  (and a php script on the MySql server side to get the data to the webpage) ....

But I'm not very successfull with this. I can read and write to my remote database but once I try to write the Events and Alarms from one of the archives nothing happens.

This is the code I use in the .rio file ...

Archive { 
    Mode 1 
    SQL "alarm"
    ArchiveID 6 
    Items 4000,4003
  } 

The columns Time, AlarmID, Code, Level, Value are present in the database 'alarm'.

I arranged three ALB function blocks (ID 4000-4003) where I can simulate an alarm by toggling a CNB block. These alarms are showing in the archive but there is no write action to be seen in the System Log. At the same time I can sea other read and write tasks to the same database and these are working fine. It seems that the write function is not triggered by an alarm or event, did I miss something?

Offline

#2 2016-04-11 20:56:52

scoobsalamander
Member
From: Belgium - Hulshout
Registered: 2015-10-27
Posts: 217

Re: Problems configuring and using the database driver (DbDrv)

DbDrv driver manual wrote:

For the Archive section:
0 Nothing gets exported (used for disabling the item temporarily).
1 Only the alarms and events are exported (filtered by additional parameters).
The table in the database must contain the following columns:
Time, AlarmID, Code, Level, Value.
2 Only the trends are exported, i.e. the data stored by the TRND block. The
data is filtered by additional parameters. The table in the database must
contain the following columns: Time, GroupID, Value1, Value2, ...
3 Only the trends are exported, but on the contrary to the above the SQL
parameter has the meaning of a full SQL query, to which the values are
injected. The following placeholders can be used: ?T = time; ?I =itemID;
?1 =1st item; ?2 =2nd item; ... A plain question mark has the meaning
of next item in the following order: time, itemID, 1st value, 2nd value,
...; )

(filtered by additional parameters)....do you have an example of this?

Offline

#3 2016-04-12 07:20:51

scoobsalamander
Member
From: Belgium - Hulshout
Registered: 2015-10-27
Posts: 217

Re: Problems configuring and using the database driver (DbDrv)

OK,...my mistake. I forgot that their can be no white-space characters at the beginning of consecutive lines in the .rio file.

The numbering for the archives is also different. For the DbDrv you need to start counting from 0 however in the manual from the 'ARC' block it is written that you need to start counting from 1 as the zero archive is the internal system log...

manual'ARC' wrote:

The resulting archives sequence determines the order of allocation and initialization of
individual archives in the REX control system and also the index of the archive, which
is used in the arc parameter of the archiving blocks (see chapter 9). The archives are
numbered from 1 and the maximum number of archives is limited to 15 (archive no. 0 is
the internal system log).

manual'DbDrv' wrote:

ArchiveID – Number of archive to read the data from. The archives are numbered from
0 in the order of appearance in the configuration of REX executive (ARCHIVE blocks
connected to the EXEC block).

It is nice to see that this function is writing the complete archive to the database. Every cycle(task is running in one tick) a few entries are copied to the database until both are synced.

All entries in the MySQL db are having the number '33'  in the column 'Code', are these codes documented somewhere?


Now up to the next level....trying to visualize the alarms with a proper description on the HMI....

Last edited by scoobsalamander (2016-04-12 08:01:48)

Offline

#4 2016-04-12 15:09:35

jaroslav_sobota
Administrator
Registered: 2015-10-27
Posts: 535

Re: Problems configuring and using the database driver (DbDrv)

scoobsalamander wrote:

(filtered by additional parameters)....do you have an example of this?

You select the archive No. and the IDs to export. These are the filtering parameters.

Offline

#5 2016-04-12 15:25:00

jaroslav_sobota
Administrator
Registered: 2015-10-27
Posts: 535

Re: Problems configuring and using the database driver (DbDrv)

Hi scoobsalamander,
glad you solved it. Good job! It is a challenge to keep up with your pace ;-)

scoobsalamander wrote:

The numbering for the archives is also different. For the DbDrv you need to start counting from 0 however in the manual from the 'ARC' block it is written that you need to start counting from 1.

Thanks for mentioning this. Yes it is a bit confusing. We are aware of that and it will be unified in future versions. At the moment this is a feature, not a bug.

scoobsalamander wrote:

All entries in the MySQL db are having the number '33'  in the column 'Code', are these codes documented somewhere?

No they are not. This is an internal feature which is not fully implemented yet. Please ignore this column.

scoobsalamander wrote:

Now up to the next level....trying to visualize the alarms with a proper description on the HMI....

Hope you share your achievements with the community. Thanks!

Offline

Board footer

Powered by FluxBB