You are not logged in.
Pages: 1
Topic closed
Just wondering if it is possible to have different sample times for individual inputs or is this locked to only 1 configured in the *.rio file?
Offline
Hey dmac101,
thank you for your question.
In DbDrv configuration files it is possible to set different sample time for each "Group". See DbDrv driver user guide (p. 7/8) for more details.
Tip: if you want to force the read/write operation between two samples create an additional flag and append "__Trigger" string to the signal reference. Rising edge on this flag will force the read/write operation (see user guide above for more details - p. 10/11.)
I hope the above is useful to you.
Regards, Tomas
Offline
Thanks tomáš čechura,
I now have a level of understanding however I am struggling a little with the modes as well as how to implement the aux signals correctly for trigger, etc.
Offline
Hey dmac101,
there are also 3 simple examples on data exchange between databases and Rex Control System - these can be useful for you.
Let me know if you need anything else.
Regards, Tomas
Offline
Hey tomáš čechura,
The simple examples are pretty straight forward and make sense. The archive export on the other hand is where I am coming unstuck.
I am failing to understand the correlation between the *.rio file and the ACD/ALB blocks in the task file and how this translates to the values that are stored in the DB table
Thanks
dmac101
Offline
Hey dmac101,
typical database usecase can be as follows:
"I would like to watch my process value (i.e. temperature) and generate alarms with timestamps to my database every time the temperature gets below 0°C."
Archiving subsystem can handle alarms and archives and Database driver configured by *.rio file configures access to the database and which values are imported/exported from/to database.
Of course, it is possible to use just database driver separately without using Archiving subsystem as it is shown in one of the examples mentioned above.
If you are still in troubles, please, post your usecase and I will try to think of some suitable solution for you.
Cheers, Tomas
Offline
apologies for my lack of understanding here, but what is "usecase"?
Offline
if I create a Goto label and point it to the database I can store the values based on the defined sample time in the *.rio file. With the current measure being temperature there can be long periods of no change in value so it seems an awful waste of DB storage when using a fixed sample period. I then started to look at the "MySQL_archive_export" example and incorporate this into my project. The ADC block in this example seemed to just what I was looking for. Below is my *.rio file and settings from ADC block, with my SQL database the same as the one I used in my working example.
From what I understand the critical thing with this is to ensure that the "Items" used in the *.rio match the ID used in the block.
or have I missed something?
*.rio
ODBC {
Connection "DRIVER=MySQL;SERVER=MySQL server;PORT=3306;DATABASE=scada;UID=myUID;PWD=MyPWD;"
Archive{
Mode 0
SQL "test"
ArchiveID 0
Items 10
}
}
ACD_TRon
acls 8: Double
arc 1
id 10
tmin 0.1
tmax 5
TR on
Desc Simulated temperature signal, TR=on
Offline
Hey!
By expression "use case" I meant some short description of your application.
Your code posted above seems to be good except "Mode 0" in your *.rio file:
Mode – Defines the structure of reading/writing from/to the database. The options are:
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,
...; )
The numbering of Archives is quite confusing, note the different numbering of archives in the project main file, which is the numbering you use e.g. in ACD:arc parameter. In the .rio file the archives are numbered from 0. The id parameters of individual blocks are referred to as Items in the .rio file. See the screenshots which I hope make the numbering clear. It will be unified in future version.
Hope it helps.
Cheers, Tomas
Offline
Thanks Thomas,
that makes more sense.
I have changed to mode 1, still not working correctly. I get the following error in rex view
DBDRV: Arc:ReadXxxItem() return=-106)
Is the Archive name in the EXE block used for anything other than a reference for the programmer? or is this used in the rio file as well?
Offline
This error means "invalid parameter". For full list of Error code meanings go to Function block documentation - Appendix B.
The name is used only as a reference. The .rio file uses archives IDs as described in my previous post.
It seems that you are trying to read something either with wrong name or at a wrong place. Can you share your project files so I can have a look at it?
Cheers, Tomas
Offline
Thanks Tomas,
I have decided to go back to basic and have tried again with the MySQL simple and MYSQL archive examples.
I now have passed the simple test, and mostly passed with the archive example. From what I now understand (please correct me if I am wrong), there seems to be a couple of typos in the rio file for this example. the alarms archive refers to items 50,60 however the ID's for the Boolean alarm blocks are 50 & 51.
Also with the insert into temperature archive, the items referenced in the rio file are 1,10 where the archive compression blocks are ID's 1 & 2.
have I understood this correctly or have I missed something?
The readme for the archive example (great to see the sql table structure in the readme, it has really helped) has a column defined for "Value". I am not sure where this comes from. is this the description field in the compression block?
I am not getting any data written to the value field in my "alarm_archive" table.
Regards, Darren
Offline
The Items line in the .rio file defines intervals. It is not a list. "Items 50,60" thus means all IDs from 50 to 60 and 51 and 52 fall into this interval. The same holds for the temperature archive. See page 10 of https://www.rexcontrols.com/media/DOC/E … rv_ENG.pdf
Offline
Pages: 1
Topic closed