Expression to access an address -Siemens-

Hi all,
I’m trying to access a dynamic address from a 1500 Siemens PLC. It should be something like
[PLCName]DB50,Real300*(2+n). Where n is a variable that actually comes from another tag. So:
[PLCName]DB50,Real(300*(2+{Tagxx})).

But I can’t get it working. Which type of tag should it be? An OPC Tag or an Expression tag? Can I access an address this way?
I’ve seen the Indirect Tag binding, but I’m not sure if this fits for that case.

PD: the type of data located in this address is a real. Which Data Type for the Tag should I select? A float or a Double?

Thanks a lot!

No, you cannot make an OPC Item Path depend on another tag like this. If it doesn’t change often, you can use a change script on the other tag to rewrite the OPC Item Path on the desired tag, but note that the tag restarts, with a noticeable delay.

Typically, users would create tags for all of the values and just pick the tag dynamically.

Thanks Pturmel!
Creating a tag for all the values it’s not the best approach, I think, because the auxiliary value can take up to 50 different values.
I’m trying to make a script to rewrite the OPC Item Path. I believe I can handle the delay.
But I’m not sure about how to do it, I haven’t used any Tag script yet. On value change event, I’ve tried:
[.]Tag_Name.tagPath = tag(‘ns=1;s=[PLC_Name]DB50,D’,currentValue)
where currentValue=300*(2+{Tagxx})
or it works just doing: [.]Tag_Name.tagPath = concat(‘ns=1;s=[PLC_Name]DB50,D’,currentValue) ?

You are mixing expression language with python. tag() and concat() are only usable in the expression language.

Assuming the reference tag and the dynamic tag are in the same folder, the reference tag’s value change event would look something like this:

system.tag.writeBlocking(['[.]dynamicTagName.OPCItemPath'], ['[PLC_Name]DB50,D%d' % currentValue.value])

Thanks @pturmel! This solved the problem.