I have an OPC error each times I start a “DB to OPC” group. Once I pass this error everything goes as it should.
There’s a short explanation of what I’m doing. I’m trying to download in a PLC some value from a work table. This work table is build by a stored procedure. The “DB to OPC” group is triggered when the stored procedure is succesfully completed. Quite simple.
The thing is, each time I start the group to write in the PLC I got an error saying “Write_Canceled” for each tag. It took several seconds before showing this error, letting me think that maybe the execution timed out.
This error occured only once. The group is triggered async, so the second time it’s execute, on the same trigger, everything goes normaly without any error. All the next times the group is triggered I don’t have any error until the group is stoped and restarted. Also, I’m pretty sure the table builded by the stored procedure is valid for all the executions.
I really wish I can get rid of this start-up error. Hope my explanations are enought clear.
Thanks in advance.
Mio Vaillancourt-Thivierge
Perhaps it’s possible that the write is failing the first time because the OPC subscription has not fully initialized. This is unlikely, but is the only thing that comes to mind.
What are your trigger settings exactly? Are you only using the “only evalutate this group…(async)” option, or do you have an actual trigger- such as an action item that reads some field from the database?
If you’re only using the async mode, it may work better to have a separate trigger table/column in the database that is read by an action item. Then you can execute on change, but use the “prevent trigger caused by group start” option to avoid the first execution.
Regards,
I’m using the async option and a trigger on an action item. In fact it take a couple of condition before starting this group. More specificaly, an action item is reading a value in the database and an OPC item is confirming that the table use by the group is ready to operate. The trigger is on an other action item who’s checking if both condition are good. The table in the database read by the first action item is the same used to write in the PLC and it is the one builded previously by the stored procedure. Can that cause the problem?
I found that if I don’t select the “Only execute group once…” option I can write in the PLC but the group is execute three to five times and I still have the startup error.
Is anything else I can try?
Thanks in advance
Mio Vaillancourt-Thivierge
Hi,
Could you maybe export the group to CSV and send it to support@inductiveautomation.com, or post it here? I want to be sure that I understand how it is set up. Also, could you go to the Log Viewer and export the errors, so I can see where they’re coming from exactly?
Since the errors seem to be related to asynchronous writing, you could try switching it to use the synchronous write method, just to see if that changes anything. You can do that under Settings>Service Settings>OPC Settings.
Regards,
Hi,
I sure can send you the CSV but you already solve my problem!
As you said, I unchecked the “Use asynchronous writes” option in the services settings and everything seems alright now.
Do you still want the CSV?
Thanks a lot for your help, as usual you’re really efficient.
Mio Vaillancourt-Thivierge
No, I don’t think I need the CSV now, but… what version of FactorySQL are you using exactly? The writes, even if “async”, should block the group and not allow it to run multiple times- I wonder if something is wrong with that.
Regards,
I’m using version 4.2.11 with Kepware OPC server V5.4.
By the way, is it possible with a DB to OPC block group to use only some column of a table. For example, I would like to use only the “value” column and not the “adress” column of a table. I will choose wich “value” with a specific where clause on the adress but only use the block data item of the “value” in the group. I don’t know if you see what I’m trying to do? Is this something possible if the table have the same number of row than the number of item in the block data item?
Hope I’m clear, it’s been a long day!
Regards,
Mio Vaillancourt-Thivierge