Author Topic: TagAlias.txt and using tags  (Read 668 times)

Alpaslan

  • Newbie
  • *
  • Posts: 26
    • View Profile
TagAlias.txt and using tags
« on: May 01, 2021, 08:15:28 PM »
Hi,

In fact i used to know this however i have forgot.

I have a TagAlias.txt and i wrote tags in it.

Quote
sw_db_seperator,I0.0
sw_db_helezon1,10001
sw_db_helezon2,10002
sw_db_helezon3,10003
sw_db_helezon4,10004
sw_db_helezon5,10005
sw_db_helezon6,10006

when i use sw_db_helezon1 i am expecting it to be used 10001 as plc address. It is not. When i write 10001 control works however when write sw_db_helezon1 control doesn't work.

I couldn't find solution in forum.

How was we using tags?

Be happy.
One step at a time baby, One step at a time.

Alpaslan

  • Newbie
  • *
  • Posts: 26
    • View Profile
Re: TagAlias.txt and using tags
« Reply #1 on: May 02, 2021, 08:51:55 AM »
Hi,

I found below document in my notes. For anyone interested i wrote here. It is obviously from forum however i couldn't find original topic.
-----------------------
Many of the HMI software packages use a tag database to reference PLC addresses by a tag name/alias. This allows you to use an address in multiple places throughout the HMI, but change the actual PLC address in one location.

AdvancedHMI has both the capability of using a direct PLC address in properties such as PLCAddress-Value or creating a Tag Name database. The tag name database for AdvancedHMI is referred to as Application Settings. The data is stored in an XML file which allows you to edit the XML file and change addresses without the need of editing in Visual Studio and recompiling.

Here's how you go about using these Application Settings to do the equivalent of a Tag Database:

- Add a driver to the form
- Add a BasicLabel to the form
- In the Properties Window for the BasicLabel, scroll all the way to the top
- You will see Application Settings with a "+" sign next to it. Click the "+" sign
- Click in the (Property Binding) and you will get a button with 3 dots (ellipsis)
- Click on the ellipsis to open a new window of Application Settings for BasicLabel1
- In that Window look for PLCAddressValue, click in the area to get a drop down arrow
- Click (New...)
- Another window will open of New Application Setting
- For Defaultvalue enter your PLC Address (e.g. N7:0, 40001, MyTag, etc)
- For Name enter the Tag Name/Alias you would like to refer to this address as
- Click OK to close the 2 windows

You can now run your application that fetches its PLC address from an equivalent of a Tag Database.

These Application Settings are not limited PLC addresses. For example, let's say you have many forms each with a driver instance and you want them to all have the same IPAddress. Using the same proce-dure you can create an Application Setting for IPAddress and use that application setting for every driver instance.

In Visual Studio
- Right Click the AdvancedHMI project in Solution Explorer and select Properties
- Select the Settings tab
- You can now see all of your tags and edit the values

After Compiling
After you compile or run your application that uses Application Settings, you can use an editor such as XML Notepad to edit the data. This is done by browsing to where your executable resides (normally \AdvancedHMI\bin\Debug) and opening the file AdvancedHMI.exe.config

After editing and saving the file, the next time you run your application it will use the edited values.

A word of caution: recompiling your application will revert the AdvancedHMI.exe.config back to the val-ues defined in Visual Studio.
One step at a time baby, One step at a time.