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 2017-02-06 16:40:44

hubc
Member
Registered: 2016-09-05
Posts: 60

Enable/disable database reading/writing

If I would like to use special signals to enable/disable database reading/writing - how do I do that?
I see proper signals in documentation, but what is the proper string defining my db action (for example archive, alarm)?
It starts from DB__   - what is next? The "Items" field from .rio config file?

Hubert

Offline

#2 2017-02-07 15:01:33

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

Re: Enable/disable database reading/writing

If the signal is "DB__temperature", then the signal to disable reading/writing is "DB__temeperature_Disable". Bring TRUE to its input and reading/writing will stop. See the database driver manual.

Best regards,
Jaroslav

Offline

#3 2017-02-09 12:53:35

hubc
Member
Registered: 2016-09-05
Posts: 60

Re: Enable/disable database reading/writing

Hi Jaroslav,

problem is, that I don't have any groups with name like 'DB__temperature' - I only save data from archives.
So in ODBC config window I have set up only 'Archives' tab - there are columns: 'mode', 'archiveID', 'Items' - there is no name of the signal..


Regards
Hubert

Offline

#4 2017-02-14 09:48:26

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

Re: Enable/disable database reading/writing

Hi Hubert,
thanks for the explanation, now I understand. In this mode the database driver copies all the contents of the archives to the database as soon as the connection is established. Therefore in this case it is necessary to prevent data from being stored in the archives.

Can you please describe your application in more detail? Why do you need to disable database writing? What function blocks are you using (ALB, ACD, TRND)? I should be able to give you some hints then.

Kind regards
Jaroslav

Offline

#5 2017-02-14 15:25:11

hubc
Member
Registered: 2016-09-05
Posts: 60

Re: Enable/disable database reading/writing

Hi Jaroslav,

reason is the same like with me previous topic - disable modbus reading and enable them again.

It happened once for now, some errors shows up:

severity	message
Warning	DBDRV: Archive read underflow(idx=0, arcID=1)
Error	DBDRV: SQL request failed (idx=0, result=-1, sql='INSERT INTO TrndArchiveInstant (Time, GroupID, Value1, Value2, Value3) VALUES("2017-02-06 08:50:00.309934", 1206, -25.5349, -157.562, 672.131)')
Error	DBDRV: SQL error detail (code=0, state='08S01', string='[FreeTDS][SQL Server]Communication link failure')
Error	DBDRV: SQL request failed (idx=0, result=-1, sql='INSERT INTO TrndArchiveInstant (Time, GroupID, Value1, Value2, Value3) VALUES("2017-02-06 08:50:00.309934", 1209, 7.38731, 11.8283, 10.3945)')
Error	DBDRV: SQL error detail (code=0, state='08S01', string='[FreeTDS][SQL Server]Communication link failure')
Error	DBDRV: SQL request failed (idx=0, result=-1, sql='INSERT INTO TrndArchiveInstant (Time, GroupID, Value1, Value2, Value3) VALUES("2017-02-06 08:50:00.309934", 1208, 0, 0, 0)')
Error	DBDRV: SQL error detail (code=0, state='08S01', string='[FreeTDS][SQL Server]Communication link failure')

and nothing is stored in my database. No archives no alarms.
I would like to monitor for such issues and in case of errors restart saving to db to fix this.

And I'm using TRND and ALNI blocks.

Regards
Hubert

Offline

#6 2017-02-17 07:34:55

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

Re: Enable/disable database reading/writing

Hi Hubert,
thanks for the update. I checked this with our developers and I have no workaround for you other than restarting RexCore in such a case.

This is a serious problem and we'll improve that. Thanks for pointing it out!

Kind regards,
Jaroslav

Offline

#7 2017-02-21 14:11:40

hubc
Member
Registered: 2016-09-05
Posts: 60

Re: Enable/disable database reading/writing

Hi Jaroslav,

OK, thank you for info. I'm waiting for improvements smile

Regarding restarting RexCore - is there some other way doing it (from the project level) than using 'External program call'?

Regards
Hubert

edit:

Is there some general DB__ flag for checking for any errors? Right now I can't find any way to detect that there is some problem with database writing.

AND unfortunately previous error happened again - so it was not just one time issue.

Last edited by hubc (2017-02-21 14:17:27)

Offline

#8 2017-02-24 10:39:19

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

Re: Enable/disable database reading/writing

Hi Hubert,
I'm sorry to hear you are having such troubles.

At the moment the EPC block is the only mechanism to restart RexCore from your algorithm.

No general DB__ flag is available in the current version. The only workaround I can think of is to add some auxiliary signal to write to the database. If you write it directly from the algorithm, not through the archiving subsystem, you can use special flags, e.g. _Fresh, as described in section 3.2 of the DbDrv manual. This is quite similar to the special flags of the Modbus driver you are already using.

What type of connection to the database server are you using. Is it some potentially unstable connection (wifi, 3G cellular etc.)? I'd like to investigate the root cause of this issue.

Hope this helps, let me know.

With kind regards,
Jaroslav

Offline

#9 2017-03-01 12:53:44

hubc
Member
Registered: 2016-09-05
Posts: 60

Re: Enable/disable database reading/writing

Hi Jaroslav,

My RexCore device is connected by wire (ethernet) to the same local network as the MS SQL server. They are on different subnets, so traffic goes through router and that's all.

I have no idea what is the cause of this issue. Is it possible to tell something from RexCore Errors?
Error messages always looks the same:

SQL error detail (code=0, state='08S01', string='[FreeTDS][SQL Server]Communication link failure')

Regards
Hubert

Offline

#10 2017-03-09 08:03:54

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

Re: Enable/disable database reading/writing

Hi Hubert,
thanks for the information. I cannot tell what is the problem. We have added the possibility to monitor database connection status and force reinitialization of the connection from the algorithm. Both will be available in nearest release.

Offline

#11 2017-03-09 12:36:32

hubc
Member
Registered: 2016-09-05
Posts: 60

Re: Enable/disable database reading/writing

Hello Jaroslav,

I'm glad to hear that!
When do you plan this release?

Regards
Hubert

Offline

#12 2017-03-13 13:15:22

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

Re: Enable/disable database reading/writing

Hi Hubert,
no specific date can be provided at the moment. Thanks for understanding and patience.

Best regards
Jaroslav

Offline

#13 2017-06-21 07:15:09

hubc
Member
Registered: 2016-09-05
Posts: 60

Re: Enable/disable database reading/writing

Hello Jaroslav,

any updates on this topic? smile

Hubert

Offline

#14 2017-06-26 13:53:45

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

Re: Enable/disable database reading/writing

Hi Hubert,
yes, since version 2.50.4 the database driver supports "DB__Connect" output flag which you can use to reinitialize connection to the database server. Bring it to OFF and after a while back to ON and it will reconnect.

The "DB__Connected" input flag tells you the status of the connection to the server.

Hope this helps, let me know.

Kind regards
Jaroslav

Offline

#15 2017-07-06 13:08:18

hubc
Member
Registered: 2016-09-05
Posts: 60

Re: Enable/disable database reading/writing

Hi Jaroslav,

I'm happy to hear that!
Already updated my rex and put some rule to monitor DB__Time_Age flag.

I'll let you know if that will solve my issues!

Hubert

Offline

#16 2017-07-11 18:54:02

hubc
Member
Registered: 2016-09-05
Posts: 60

Re: Enable/disable database reading/writing

Hi everybody,

I am running my rex project with new DB__Connect flag for a few days now, and it seems to work exactly as supposed.

I noticed some DB errors (probably during backup tasks), but everything got back to working state, just as it supposed.

So I can say that my problem is solved!
Thanks!

Hubert

Offline

Board footer

Powered by FluxBB