Dynamic OPC path

Is there a way to have dynamic OPC path for a tag ?

In PLC I have a tag array structure:
Tag BatchDuration path= [PLC]BATCH_REPORT[X].BATCH_DURATION
Tag BatchStartTime path= [PLC]BATCH_REPORT[X].BATCH_START
etc. etc.
where x (batch number) =1…100

I want to address individual batch from Ignition client.

But it looks like there is no way to change X dynamically ? For example by some reference tag.
path= [PLC]BATCH_REPORT[{BATCH_NO}].BATCH_DURATION

I could import ALL batch report tags into project and then change which tag I am accessing from
user interface, but that would import tens of thousands tags (for all 100 saved batches), when I only need data from one batch at a time.

I think the most dynamic you can get without using system.tag.configure to actually reconfigure/edit your tags is a UDT where you use a parameter to construct the OPC Item Path.

Probably not as dynamic as you’re looking for.

Alternate approach could be to use memory tags and do a bulk system.opc.readValues to populate them for each batch you are going to deal with.

Another alternative is to have the plc handle the writing of batch data into temporary tags which igntion reads. Igntion writes to an index tag telling the plc which batch to read, then writes to a bool to tell it to move that batch data into the temp tags for igntion. It’s a bit slower as you then have the plc as the middle middle man, but it might solve your issue.

I may be off with the use case, but I would suggest doing a parameterized path like Kevin mentioned, but I don’t think it would be as difficult as he thinks to make it change. In 8.x, parameters can be written to like normal tags. Having a reference tag configured like the following will allow you to easily bind to the parameter and change it on the fly like any other tag:

I am attaching an export of my definition here. If you bind any component to the opcItemPath of the members in a UDT Instance, you change the value of _conf/motor_number you can see how everything updates. Example.json (1.5 KB)

Depending on how many parameters are needed, you will want to add a number of protections around this to ensure that the tags referenced are the ones you want. As tag writes are asynchronous, there is no guarantee that all values will populate at the same time.

Garth

4 Likes

I have tried with UDT parameters, and it works if I change the parameter manually.
But I cant bind parameter to a tag. It works only one way - when I change parameter,
the tag connected to that parameter updates. But not the other way.

Searching in the forums I have found similar request and it looks like 10 years ago that was not possible. Has that changed since ?

Binding to parameters wasn’t possible in 7.x versions of Ignition, but it is possible in 8.x albeit not directly. You have to create a Reference type memory tag in 8.x to reference the parameter which will allow you to directly modify the parameter (see above screenshot and example).

Garth

Got it working. Thanks.
Just had to write [.]/Parameters.BatchReportNo instead of [.]…/Parameters.BatchReportNo

Wow, I knew all of that but it never clicked that I could actually use it in that way to make dynamic changes to my tag opcitempaths. That’s awesome :smiley:
Damn, that would be far better I think for my recipe editor tags… Next time!