TIA Portal access tag as string?

Manglemender

Member
Join Date
Jul 2007
Location
Lancashire
Posts
1,295
Hello all,

Can anyone tell me if it is possible to access a tag in TIA Portal by reading the tag name from a string variable?

I should add that I'm looking to do this in the PLC. I dare say it is possible with Scripting in an HMI.

Nick
 
Last edited:
Hello old friend,

The data I'm after resides in datablocks and will be reals. I'm helping out a PHd student in USA to access some data from one of our machines so i've generated a DB with 10 feedback entries and rather than hard code the sources, I thought that might be nice to have the sources selectable by name.

The only way I can think of doing it is build an array of potential tags with columns for type, DB, offset etc and then build a pointer from that data. It would be so much easier if there was a "Get_Tag_by_Name" function.

Nick
 
Try the function "GetSymbolName"

Close but not what I was looking for. I was wanting to to read a tag name as a string from one tag and use that tag name to read the value of the tag described by the string: e.g. Tag_1 = '"dbHMIData".rLinespeed' read tag_1 and return the value of "dbHMIData".rLinespeed.

You must be able to do something with a tagname as a string or what would be the point of the GetSymbolName function except to display it somewhere?

Nick
 
I don't know of any way to do that directly. You could create something along the lines of a 2D array. At startup read all the names you want to be able to access into col 1 of the array.

This would also give you a list of valid names to enter instead of being able to enter invalid items.

Col 1 - Name
Col 2 - Value or pointer to address
 
Close but not what I was looking for. I was wanting to to read a tag name as a string from one tag and use that tag name to read the value of the tag described by the string: e.g. Tag_1 = '"dbHMIData".rLinespeed' read tag_1 and return the value of "dbHMIData".rLinespeed.

You must be able to do something with a tagname as a string or what would be the point of the GetSymbolName function except to display it somewhere?

Nick

It's Siemens, what do you expect? ;)

You could use that for error messages, comms in general etc. But I don't believe they would let you parse if tag exists and then return its value. If there is no system function to convert the tag name to variant or so.
 
or what would be the point of the GetSymbolName function except to display it somewhere?


The point is to read it for alarming, I think, or possibly display on the HMI.


You can do indirect addressing of arrays easily. In SCL, you can use Peek/Poke to grab arbitrary addresses of non-optimized data (I/Q/M/non-optimized DB) (address based, though, not tag based). You can't, however, just grab an arbitrary tag by passing a tag name.



How is the PHD student accessing the data? I was assuming via scripting in a PC, but then they could probably just grab the tags they need there?
 
Do the tag names even exist in the PLC? Has the compiler replaced them with pointers (or equivalent) at each reference where they are read or written?


Is there a produce/consume framework in TIA? Could a PLC be both producer and consumer in such a dialog?
 
How is the PHD student accessing the data? I was assuming via scripting in a PC, but then they could probably just grab the tags they need there?

The Tags are already in the PLC (s7-1500) but they are all in optimised datablocks. The student is using the Kepware OPC server to access the ata so i have created a non-optimised block for this purpose. I can hard code tags to transfer easily but I thought it might be a neater solution if I could read a tag by name (string). In that way, next week, he wants to read different data, i would have to change any code, just update tag names.

i guess I'll stick with hard coded tags for now.

Nick

P.S. the system is programmed in TIA V13 and the CPU does not contain an OPC-UA server. Upgrading to V15 for OPC-UA would be a considerable undertaking because of the complex drive system associated.
 
Last edited:
It sounds as if the student is accessing your PLC by OPC DA. Hence the need for non-optimised DBs.

You can also access the data symbolically with OPC DA. I dont know Kepware, but with Simatic Net you can export the PLC symbols to the OPC Server, even if the OPC Server resides on another PC. I know that for example Deltalogics OPC server can import Siemens S7 symbols. Maybe Kepware can import Siemens S7 symbols ?

Another route would be to go for OPC UA, not on the PLC but on a PC. Essentially the same as above. You would need Simatic Net as the OPC UA server to do this. As far as I know there are no 3rd party vendors for OPC UA with Siemens S7-1500. A Simatic Softnet Lean license is inexpensive.
 

Similar Topics

Hi all Trying to remotely connect to a TIA Portal PLC. I can ping it without a problem but can't get my software to connect. I've opened port...
Replies
8
Views
352
Hi all, My customer has given me VPN access to their network so that I can connect to the S7-1500 PLC and unified HMI. Because I'm using VPN I...
Replies
4
Views
2,066
Hello, I have some data in Microsoft access database (with timestamps). I want to send this data to TIA portal. is it possible? Please help me...
Replies
11
Views
4,775
Hello all, It is the first project I am doing in TIA Portal V14 and I came across this strange thing. When I use slice access (.%X0) Step 7...
Replies
15
Views
10,567
Hi All, I have the following issue reading the status of an output (S7 1500 Fail Safe) The "TAG" parameter is not permitted. No read access is...
Replies
6
Views
4,034
Back
Top Bottom