Use tag value as UDT parameter in nested UDT

Hi,

I would like to use a tag as value for a data type parameter.
I need to drive the “input” of the “AndonStopTimer” to be driven by the tag AndonStop:

Is it possible?

1 Like

I have the same question. I need to reference a tag in a UDT definition and use its value on another tag’s numeric property and all in the same UDT.
Here is the tag that I want to reference:
image

and here is where I need to use the reference value

I am not able to use a syntax like {[.]Cfg_EU} is there a way to use UDT parameters dynamically?

I also have a need for this (using 8.0.4). When I saw it in the search results I was really hoping there would be a solution posted also, but unfortunately not…even given the thread’s age.

I have same need. Using 8.1

No can do. If it was an option, it would need to be used with care, as I imagine this could add a lot of load onto the CPU.

In any case, if you guys are after it, you should add an idea to the ideas site
https://ideas.inductiveautomation.com/ignition-features-and-ideas

I was looking for a similar functionality and came up with something that works, but I’m not sure if this is very efficient. I needed a parameter in a UDT to refer to a tag value which inturn controlled tag paths in the UDT. I came up with using an expression tag in the UDT that refers to the tag value outside of the UDT and then in the UDT parameter used the {[.]tagname} which is referring to the expression tag. In the expression tag I referred to a tag within the same parent path and used {[.]…/tagname}. This did work, but I’m sure it is eating up processing power to do so and I have not tested response time on change. We did this to minimize the amount of editing of parameters we needed to do for UDTs. We just have one tag to edit vs the number of UDTs in a grouping.


1 Like

Just returning to this, this is actually possible now in v8 in a way. If you bind a UDT tag’s property to a UDT parameter, you can then write to the UDT’s parameter from, say, a tag change value script to set its value dynamically.

E.g. if the UDT parameter for the unit is called ‘EngUnit’, the tag path would be:

path/to/tag/parameters.EngUnit
2 Likes

@nminchin Can you please elaborate a bit on this?

perhaps an example of my use case may help inform your clarification?

I maintain my tag database such that the final OPC item paths for all UDT members can always be derived from the Ignition tag database/UDT folder structure itself (Line* is PLC, Tank* is UDT):

[tagProvider]Line3/Tank2/Level/Value - Ignition tag path
nsu=_URL;s=0:Line3!Tank2.Level.Value - actual OPC item path

So ideally I’d be able to create a new instance of Tank UDT named Tank_whatever, under Line_infinity parent folder, and assuming that
nsu=URL;s=0:Line_infinity!Tank_whatever.Level.Value
is a valid OPC path, I’d be done (no need to manually configure UDT parameter values).

Unfortunately this doesn’t appear to be possible , as it seems OPC path indirection can only use static UDT paramters :frowning_face::
{OPC Server}:{PLC}!{InstanceName}.Level.Value

I think I effectively need dynamic UDT Parameters (and thus dynamic OPC item paths).

can your described method accomplish this?

Perhaps I’m missing something obvious.

Would the OPC item path be constantly overwritten, albeit with the same data (performance bottleneck)?

You can write to UDT parameters and tag parameters using scripting, but how you achieve that is up to you. I imagine you’d need to use system.tag.getConfiguration to pull back the folder names and then apply those to the UDT parameters. It won’t be an automagic process.

per @nminchin 's comment above, it seems he is suggesting that UDT parameters can in fact be written to, albeit via through a bound tag property.

I’ve tried setting the bindings up (“Value” parameter <> Tag.Value property) and then modifying the tag’s bound “value” property (in the tag browser, not via script), but I get an error

Error writing to value.value: Bad_ReadOnly("The specified value is dynamic and cannot be written.")

Am I misinterpreting his comment?

You’re writing to a tag property, not to a UDT instance parameter. Some tag properties are indeed read-only. UDT instance parameters however are read/write.
E. G.
Path/to/UDTInstance/Parameters.Param1